FastAPI MCP automatically converts existing FastAPI endpoints into MCP tools with zero manual work. Add one line of code, and every endpoint becomes available to AI agents through the Model Context Protocol — complete with type validation and authentication.
FastAPI MCP is the simplest way to make existing APIs accessible to AI agents. Already have a FastAPI app? Adding MCP support is literally one line of code. Every endpoint automatically becomes an MCP tool that any AI agent can call.
mcp = FastApiMCP(app)mcp.mount()from fastapi import FastAPI
from fastapi_mcp import FastApiMCP
app = FastAPI()
@app.get("/users/{user_id}")
def get_user(user_id: int):
return {"id": user_id, "name": "Alice"}
mcp = FastApiMCP(app)
mcp.mount()
After adding FastAPI MCP:
User: "Create an order for 5 widgets"
Agent → POST /orders(product="widget", quantity=5)
Returns: {"order_id": "ORD-456", "product": "widget", "qty": 5}
AI agents that work well with FastAPI MCP.
Official Anthropic-maintained collection of 20+ MCP server implementations for filesystem, GitHub, Slack, databases, and more.
The fast, Pythonic way to build MCP servers — like FastAPI but for the Model Context Protocol.
Secure cloud sandboxes for AI agents to execute code — isolated environments with built-in safety.