What it does
FastAPI-MCP is a Python library that exposes your FastAPI endpoints as Model Context Protocol tools, enabling Claude to call them directly. Unlike tools that convert OpenAPI specs to MCP, this integrates natively with FastAPI using ASGI transport—no separate HTTP layer between MCP and your API. You add it to your existing FastAPI application (or deploy separately), and endpoints instantly become MCP tools while preserving their documentation and request/response schemas. Authentication is handled through FastAPI's dependency injection, so you secure MCP access using the same Depends() patterns as your web API.
Who it's for
Backend engineers and platform teams running FastAPI microservices who want to give Claude direct, authenticated access to internal APIs. Use this when you need Claude to query, update, or monitor data behind your FastAPI service.
Common use cases
- Expose a FastAPI microservice as MCP tools so Claude can query or modify backend data
- Add MCP capabilities to an existing FastAPI application without external infrastructure or manual OpenAPI conversion
- Secure Claude's access to FastAPI endpoints using your existing authentication logic
- Build Claude-integrated admin panels or monitoring dashboards on top of FastAPI services
Setup pitfalls
- This is a library for wrapping an existing FastAPI app, not a standalone MCP server—you need a functioning FastAPI application to integrate it with
- If deploying the MCP server separately from your original FastAPI app, ensure the ASGI interface and any shared dependencies are properly configured across both instances
- Authentication relies on FastAPI
Depends(); misconfigured dependency logic will silently allow or deny MCP access incorrectly - Requires Python 3.10 or higher