FastAPI with FastMCP 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
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
Maintainer
Works with
Installation
Manual Installation
npx fastapi-with-fatmcp-agentConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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)
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-agentInstall 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 .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_hereStart 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 mcpStart 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 apiAdd 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.
FastAPI with FastMCP Agent Alternatives — Similar Coding Agents Servers
Looking for alternatives to FastAPI with FastMCP Agent? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
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.
Set Up FastAPI with FastMCP Agent in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.