MCP.so
Sign In
Servers

FastAPI-MCP

@tadata-org

Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!

Overview

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

FAQ from FastAPI-MCP

How does FastAPI-MCP differ from other OpenAPI-to-MCP converters?

FastAPI-MCP is FastAPI-native—it is designed as a direct extension of FastAPI, not just a converter. It communicates via ASGI instead of making HTTP calls to your API, and it supports native FastAPI dependency injection for authentication.

What are the runtime dependencies for FastAPI-MCP?

FastAPI-MCP requires Python 3.10+ (recommended 3.12). The recommended package installer is uv, but pip also works. It depends on a running FastAPI application.

Where does the MCP server’s data live?

FastAPI-MCP does not store data itself; it exposes your existing FastAPI endpoints as MCP tools. All data and state remain within your FastAPI application and its backends.

What transport does FastAPI-MCP use?

It uses FastAPI’s ASGI interface directly for communication, eliminating the need for separate HTTP calls from the MCP server to your API.

Does FastAPI-MCP handle authentication?

Yes. It leverages your existing FastAPI Depends() for authentication and authorization, so MCP endpoints inherit the same security as your API endpoints.

Tags

More from Developer Tools