
FastAPI-MCP
Turns the endpoints of a FastAPI app into MCP tools that AI assistants can call, with auth.
- Stars
- 12k
- Forks
- 967
- Licence
- MIT
- Language
- Python
- Last update
- 12 months ago
- Type
- Library
What it is
FastAPI-MCP is a Python library that adds a Model Context Protocol (MCP) server to an existing FastAPI application, so AI tools such as Claude or Cursor can call your API endpoints as tools. It reuses your FastAPI routes, request and response schemas, and docs, and it can secure MCP access with your existing FastAPI dependencies.
- Expose an existing FastAPI endpoint set to an MCP client such as Claude or Cursor
- Protect MCP tool access with FastAPI Depends()-based authentication
- Mount the MCP server inside the same app or deploy it separately
Great for
- Python developers who already have a FastAPI app and want AI assistants to use it
- Teams that want to reuse existing FastAPI authentication for MCP endpoints
- Developers who prefer minimal configuration and do not want to write MCP tools by hand
Not ideal for
- Non-Python projects, since the README describes only a Python/FastAPI library
- People who need a managed service without running code; the README points to a hosted option at tadata.com but this entry does not evaluate it
- Anyone without an existing FastAPI app, since the library is an extension of FastAPI rather than a standalone tool
How to get it
- 1
Install with a package manager
You'll need: Python 3.10+ (3.12 recommended) · uv or pip
Install with uv
uv add fastapi-mcpInstall with pip
pip install fastapi-mcp - 2
Run it
- Install fastapi-mcp with uv or pip
- Create a FastAPI app and wrap it with FastApiMCP(app)
- Call mcp.mount() to add the MCP server
- Connect an MCP client to the /mcp path on your app's base URL
- 3
Get the most out of it
- Use FastAPI Depends() to secure MCP endpoints with your existing auth
- Deploy the MCP server separately from the original app if needed (see the advanced deploy docs linked in the README)
- Check the examples directory for code samples
- Join the MCParty Slack community to ask questions
Downloads
Strengths
- Uses existing FastAPI dependencies for authentication and authorization
- Preserves request/response schemas and endpoint documentation from the FastAPI app
- Minimal setup: point it at a FastAPI app and mount it
Trade-offs
- Only useful if you already run or plan to run a FastAPI application
- README is truncated and does not detail every configuration option; the full documentation is on the homepage
- Latest release is v0.4.0 and the README does not state a stability guarantee
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| fastapi_mcp (this) | 12k | Library | intermediate | 12 months ago | Python developers who already have a FastAPI app and want AI assistants to use it |
| mcp-use | 10.8k | Library | intermediate | 6 days ago | TypeScript developers who want to build MCP servers |
| codebase-memory-mcp | 48k | Dev tool | intermediate | 4 days ago | Developers who use an MCP-capable AI coding agent on a large codebase |
| agents | 42.1k | Dev tool | beginner | 4 days ago | Developers who already use one of the listed AI coding tools and want ready-made specialist agents |
| mcp-for-beginners | 17.6k | Learning resource | beginner | 4 days ago | Developers new to MCP who want guided lessons |
| unity-mcp | 15.6k | App | intermediate | 6 days ago | Unity developers who want to prototype scenes by describing them in plain language |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.