Running Your MCP Server with FastMCP v2.0
LocalAbout Running Your MCP Server with FastMCP v2.0
This guide shows developers with existing server code how to run an MCP server with FastMCP v2.0 and install it for Claude Desktop. It covers commands, dependencies, and environment configuration.
Key features
- 01Install FastMCP
- 02Run server code from the command line
- 03Install for Claude Desktop
- 04Declare package dependencies
- 05Pass environment variables or a .env file
Use cases
- 01Run an already-written MCP server
- 02Configure a server for Claude Desktop
- 03Set dependencies and credentials for a server
MCP support
The guide explains how to run an MCP server and install it in Claude Desktop; it does not specify the tools or resources exposed by the server itself.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMERunning Your MCP Server with FastMCP v2.0
This guide walks you through how to run your MCP server using FastMCP v2.0 and install it for use with Claude Desktop.
✅ Prerequisites
Assumes:
- Your environment is already set up
- Your server code (e.g.,
server.py) is complete and ready to run
🚀 Running the Server
1. Install FastMCP (if not already installed)
It's recommended to use uv:
uv pip install fastmcp
If you don’t have uv, you can install it via Homebrew (macOS):
brew install uv
Or use pip directly:
pip install fastmcp
2. Run Your Server
Using FastMCP’s run command:
fastmcp run server.py
If your script uses the standard entry point:
if __name__ == "__main__":
mcp.run()
Then you can also simply:
python server.py
🛠️ Installing Server for Claude Desktop
1. Install the Server
This command prepares your server for Claude Desktop integration:
fastmcp install server.py
2. Restart Claude Desktop
After installing, restart Claude Desktop to load your newly installed server.
🔧 Additional Tips
Specify Dependencies
Declare additional packages when instantiating FastMCP:
mcp = FastMCP("My Server", dependencies=["pandas", "numpy"])
Set Environment Variables
Pass env variables during installation:
fastmcp install server.py -e API_KEY=your_api_key
Use a .env File
Load environment configuration from a file:
fastmcp install server.py -f .env
✅ Example Claude Prompt
If you’ve defined a tool like add, you can talk to Claude like this:
"Please add 5 and 7."
Claude will then use the MCP server to calculate the result.
For more info, visit: https://github.com/jlowin/fastmcp
ℹ️ Reminder: If you want to use debugging tools like
mcp-inspector, you should use@modelcontextprotocol/[email protected]for best compatibility.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.