What is FastAPI-MCP?
FastAPI-MCP is a Python library that exposes your FastAPI endpoints as Model Context Protocol (MCP) tools, with built-in authentication support. It is built by Tadata and targets developers who want to add MCP capabilities to existing FastAPI services with minimal friction.
How to use FastAPI-MCP?
Install with uv add fastapi-mcp or pip install fastapi-mcp. Then, in your FastAPI application, import FastApiMCP, instantiate it with your app, and call .mount() to expose the MCP server at /mcp. No further configuration is required for basic use.
Key features of FastAPI-MCP
- Authentication built in using existing FastAPI dependencies
- FastAPI-native: not just an OpenAPI-to-MCP converter
- Zero or minimal configuration required
- Preserves request and response model schemas
- Preserves endpoint documentation as in Swagger
- Flexible deployment: mount to same app or deploy separately
- Uses ASGI transport for efficient communication
Use cases of FastAPI-MCP
- Add MCP tool access to an existing FastAPI API without rewriting code
- Secure MCP endpoints using familiar FastAPI
Depends() for authentication and authorization
- Deploy MCP capabilities on the same infrastructure as your FastAPI app
- Enable AI assistants to interact with your API through the Model Context Protocol
Comments