fastapi_mcp is a free, open source api development & testing project written in Python and released under MIT. It has 12,008 GitHub stars, 967 forks and 169 open issues, and was last pushed 10 months ago. On this registry it ranks #17 of 103 tracked projects in API Development & Testing, with 5 head-to-head comparisons available.

What is fastapi_mcp?

FastAPI-MCP is an MIT-licensed Python library from Tadata that exposes the endpoints of an existing FastAPI application as Model Context Protocol (MCP) tools, so MCP clients such as Claude and Cursor can call a team's own API, and it is built for Python backend developers who already run FastAPI services and want agent access without hand-writing a separate MCP server.

What it is

FastAPI-MCP is a native extension of the FastAPI framework that mounts an MCP server onto an existing FastAPI app. Rather than generating MCP tools from an OpenAPI document, it reads the live application, keeps the schemas of the request and response models, and carries the endpoint documentation across as it appears in Swagger. The library installs from PyPI as fastapi-mcp, requires Python 3.10 or newer, and recommends Python 3.12 alongside uv as the installer.

The concrete problem it solves is the gap between an HTTP API that already exists and an MCP client that needs callable tools. The specific thing it replaces is the generic OpenAPI-to-MCP converter, and the hand-written MCP server that would otherwise be produced from one. Because the mapping is taken from the running FastAPI app instead of a static specification, authentication written with FastAPI's own Depends() applies to the MCP endpoints unchanged, and communication happens over FastAPI's ASGI interface rather than through HTTP calls from the MCP server back into the API.

Key capabilities

  • Authentication and authorization are built in and reuse existing FastAPI dependencies through Depends(), so the MCP endpoints inherit the same security model as the rest of the app.
  • A FastAPI-first design that is explicitly not just another OpenAPI to MCP converter, reading the application directly rather than a generated specification.
  • Zero or minimal configuration: FastApiMCP(app) followed by mcp.mount() produces a working MCP server.
  • Request model and response model schemas are preserved, so tool inputs and outputs match the API definitions.
  • Endpoint documentation is preserved as it appears in Swagger.
  • Flexible deployment allows the MCP server to be mounted on the same app or deployed separately from the original FastAPI application.
  • ASGI transport lets the MCP server talk to the FastAPI app through its ASGI interface, removing the need for HTTP calls between the two.
  • The generated MCP server is reachable at the /mcp path of the application's base URL.

Who uses it and how

  • FastAPI teams adding MCP capability to services that already carry their own authentication, using the existing Depends() dependencies rather than a second credential system.
  • Teams that want one process rather than two, since the FastAPI app does not need to run separately from the MCP server, with separate deployment available where that suits the infrastructure.
  • Projects that want a managed alternative, since Tadata offers a hosted solution at tadata.com for those who prefer not to operate the MCP layer themselves.
  • Contributors and MCP enthusiasts who follow the project through the MCParty Slack community, the issues tracker, and the contribution guide, in a repository that reports 12,008 stars, 967 forks, and 169 open issues.
  • MCP client users working in Claude and Cursor, named among the project's topics alongside modelcontextprotocol and mcp-server.

Getting started

Install the package with uv add fastapi-mcp, or with pip install fastapi-mcp, then create the server with FastApiMCP(app) and call mcp.mount() to publish it at /mcp. Python 3.10 or newer is required, with 3.12 recommended.

How it compares

No list of paid products that this project replaces is provided, and the facts name no directly comparable tools, so it stands alone in this registry. The two deployment choices it documents are self-hosting inside an existing FastAPI application and the managed hosted solution at tadata.com, both under the same MIT licence for the library itself.

When to use it — and when not to

The library assumes a Python 3.10 or newer service built on FastAPI, so teams on other languages or frameworks get nothing from it. A self-hoster keeps operating the FastAPI application itself, and should note the 169 open issues on the repository as a signal of outstanding work. Adoption suits teams already invested in FastAPI and its dependency injection for auth, and not projects that need an MCP server decoupled from an existing Python API.

project readme (upstream, from github) — read inline

fastapi-to-mcp

Built by Tadata

FastAPI-MCP

tadata-org%2Ffastapi_mcp | Trendshift

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

PyPI version Python Versions FastAPI CI Coverage

fastapi-mcp-usage

Features

  • Authentication built in, using your existing FastAPI dependencies!

  • FastAPI-native: Not just another OpenAPI -> MCP converter

  • Zero/Minimal configuration required - just point it at your FastAPI app and it works

  • Preserving schemas of your request models and response models

  • Preserve documentation of all your endpoints, just as it is in Swagger

  • Flexible deployment - Mount your MCP server to the same app, or deploy separately

  • ASGI transport - Uses FastAPI's ASGI interface directly for efficient communication

Hosted Solution

If you prefer a managed hosted solution check out tadata.com.

Installation

We recommend using uv, a fast Python package installer:

uv add fastapi-mcp

Alternatively, you can install with pip:

pip install fastapi-mcp

Basic Usage

The simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:

from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

app = FastAPI()

mcp = FastApiMCP(app)

# Mount the MCP server directly to your FastAPI app
mcp.mount()

That's it! Your auto-generated MCP server is now available at https://app.base.url/mcp.

Documentation, Examples and Advanced Usage

FastAPI-MCP provides comprehensive documentation. Additionaly, check out the examples directory for code samples demonstrating these features in action.

FastAPI-first Approach

FastAPI-MCP is designed as a native extension of FastAPI, not just a converter that generates MCP tools from your API. This approach offers several key advantages:

  • Native dependencies: Secure your MCP endpoints using familiar FastAPI Depends() for authentication and authorization

  • ASGI transport: Communicates directly with your FastAPI app using its ASGI interface, eliminating the need for HTTP calls from the MCP to your API

  • Unified infrastructure: Your FastAPI app doesn't need to run separately from the MCP server (though separate deployment is also supported)

This design philosophy ensures minimum friction when adding MCP capabilities to your existing FastAPI services.

Development and Contributing

Thank you for considering contributing to FastAPI-MCP! We encourage the community to post Issues and create Pull Requests.

Before you get started, please see our Contribution Guide.

Community

Join MCParty Slack community to connect with other MCP enthusiasts, ask questions, and share your experiences with FastAPI-MCP.

Requirements

  • Python 3.10+ (Recommended 3.12)
  • uv

License

MIT License. Copyright (c) 2025 Tadata Inc.

Frequently asked questions

Is fastapi_mcp free to use?

fastapi_mcp is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does fastapi_mcp do?

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

What is fastapi_mcp written in?

fastapi_mcp is primarily written in Python. Its source is publicly available at https://github.com/tadata-org/fastapi_mcp, and it has 12,008 GitHub stars.