Running Your MCP Server with FastMCP v2.0

by GanonUchiha

302 downloads
Not rated
GitHub

About

This guide explains how to run a custom MCP server using FastMCP v2.0 and install it for use with Claude Desktop. It is intended for developers who already have a server script (e.g., server.py) ready.

Details

Author
GanonUchiha
Downloads
302
Categories
Other

- Provides fastmcp run and fastmcp install commands
- Supports specifying additional Python dependencies
- Allows passing environment variables during installation
- Supports loading environment variables from a .env file

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Running Your MCP Server with FastMCP v2.0
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install FastMCP, run the server with fastmcp run server.py (or python server.py if using the standard entry point), then install it for Claude Desktop with fastmcp install server.py and restart Claude Desktop.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "running your mcp server with fastmcp v2.0": {
            "My-FastMCP-Example": {
                "command": "uv",
                "args": [
                    "pip",
                    "install",
                    "fastmcp"
                ]
            }
        }
    }
}

McpServers

{
    "My-FastMCP-Example": {
        "command": "uv",
        "args": [
            "pip",
            "install",
            "fastmcp"
        ]
    }
}

Running 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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.