FastAPI with FastMCP Agent

v1.0.0Coding Agentsstable

A modular application API interface based on FastMCP, integrating a demo of the MCP server, FastAPI interface and LLM Agent processing capabilities | 一个基于FastMCP的模块化应用,集成了MCP服务器、FastAPI接口和LLM Agent 处理能力的 demo

fastapi-with-fatmcp-agentmcpai-integration
Share:
10
Stars
0
Downloads
0
Weekly
0/5

What is FastAPI with FastMCP Agent?

FastAPI with FastMCP Agent is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to modular application api interface based on fastmcp, integrating a demo of the mcp server, fastapi interface and llm agent processing capabilities | 一个基于fastmcp的模块化应用,集成了mcp服务器、fastapi接口和llm agent 处理能力...

A modular application API interface based on FastMCP, integrating a demo of the MCP server, FastAPI interface and LLM Agent processing capabilities | 一个基于FastMCP的模块化应用,集成了MCP服务器、FastAPI接口和LLM Agent 处理能力的 demo

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A modular application API interface based on FastMCP, integr

Use Cases

Build modular applications combining FastAPI and MCP server capabilities.
Integrate LLM Agent processing with FastAPI interfaces.
ZhouhaoJiang

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedDec 4, 2025
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx fastapi-with-fatmcp-agent

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use FastAPI with FastMCP Agent

The FastAPI with FastMCP Agent project is a modular demo application that combines a FastMCP server, a FastAPI REST interface, and an LLM agent processing pipeline. It exposes MCP tools and resources via both the Model Context Protocol and a standard HTTP API, allowing you to call MCP tools directly, retrieve resources, or let an LLM agent autonomously orchestrate tool calls to handle natural language requests.

Prerequisites

  • Python 3.9 or higher installed
  • uv or pip package manager
  • An OpenAI API key (required for LLM agent mode)
  • Git for cloning the repository
  • Claude Desktop or another MCP client (optional, for MCP mode)
1

Clone the repository

Clone the project from GitHub and navigate to the project directory.

git clone https://github.com/ZhouhaoJiang/fastapi-with-fatmcp-agent.git
cd fastapi-with-fatmcp-agent
2

Install dependencies

Install the Python dependencies using uv (recommended) or pip in editable mode.

# With uv (recommended)
uv pip install -e .

# Or with pip
pip install -e .
3

Configure environment variables

Create a .env file in the project root and set your OpenAI API key. This is required for the LLM agent mode.

OPENAI_API_KEY=sk-your_openai_api_key_here
4

Start the MCP server

Run the application in MCP server mode to expose tools and resources to MCP clients like Claude Desktop.

python main.py --mode mcp
5

Start the API server (optional)

Run the FastAPI server to expose tools via HTTP REST endpoints. The API will be available at http://localhost:8080.

python main.py --mode api
6

Add the MCP server to Claude Desktop config

Register the FastMCP server in your Claude Desktop configuration for direct MCP access.

{
  "mcpServers": {
    "fastapi-fatmcp-agent": {
      "command": "python",
      "args": ["/absolute/path/to/fastapi-with-fatmcp-agent/main.py", "--mode", "mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-your_openai_api_key_here"
      }
    }
  }
}

FastAPI with FastMCP Agent Examples

Client configuration

Claude Desktop configuration for the FastAPI with FastMCP Agent MCP server.

{
  "mcpServers": {
    "fastapi-fatmcp-agent": {
      "command": "python",
      "args": ["/Users/yourname/fastapi-with-fatmcp-agent/main.py", "--mode", "mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-your_openai_api_key_here"
      }
    }
  }
}

Prompts to try

Example prompts for MCP mode and curl calls for API mode.

- "List all available MCP tools from the FastMCP server"
- "Call the [tool_name] tool with the following parameters"
- "Use the LLM agent to handle this request autonomously: summarize the latest news"
- "Check the health of the MCP server connection"
- "List all available resource URIs from the FastMCP server"

Troubleshooting FastAPI with FastMCP Agent

LLM agent mode returns API key error

Ensure OPENAI_API_KEY is set in your .env file or passed as an environment variable. The key must be valid and have available quota. Verify with: python -c "import os; print(os.getenv('OPENAI_API_KEY'))".

FastAPI server fails to start on port 8080

Check if port 8080 is already in use with lsof -i :8080. Kill the conflicting process or configure the API server to use a different port by modifying the uvicorn startup parameters in main.py.

MCP tools health check fails between API and MCP server

When running both modes, ensure the MCP server is started before the API server. The GET /api/tools/health endpoint checks connectivity between the two processes. Verify both are running with the correct --mode flag.

Frequently Asked Questions about FastAPI with FastMCP Agent

What is FastAPI with FastMCP Agent?

FastAPI with FastMCP Agent is a Model Context Protocol (MCP) server that modular application api interface based on fastmcp, integrating a demo of the mcp server, fastapi interface and llm agent processing capabilities | 一个基于fastmcp的模块化应用,集成了mcp服务器、fastapi接口和llm agent 处理能力的 demo It connects AI assistants to external tools and data sources through a standardized interface.

How do I install FastAPI with FastMCP Agent?

Follow the installation instructions on the FastAPI with FastMCP Agent GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with FastAPI with FastMCP Agent?

FastAPI with FastMCP Agent works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is FastAPI with FastMCP Agent free to use?

Yes, FastAPI with FastMCP Agent is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "fastapi-with-fatmcp-agent": { "command": "npx", "args": ["-y", "fastapi-with-fatmcp-agent"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use FastAPI with FastMCP Agent?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides