FastAPI MCP
StaleDescription
Library to expose FastAPI endpoints as Model Context Protocol tools with authentication support, enabling AI agents to call existing APIs directly
Key Features
- Native FastAPI extension — not just an OpenAPI-to-MCP converter
- Authentication built in using existing FastAPI Depends() dependencies
- Zero/minimal configuration — point at your FastAPI app and it works
- Preserves request/response schemas and endpoint documentation from Swagger
- ASGI transport for efficient direct communication without HTTP overhead
- Flexible deployment — mount to same app or deploy as separate MCP server
Use Cases
Tags
Categories
Quick Start
uv add fastapi-mcp (or pip install fastapi-mcp). In your FastAPI app: from fastapi import FastAPI; from fastapi_mcp import FastApiMCP; app = FastAPI(); mcp = FastApiMCP(app); mcp.mount(). Your MCP server is available at /mcp