FastAPI-MCP

by @tadata-org

Fast API MCP Server

FastAPI-MCP exposes existing FastAPI endpoints as MCP tools while retaining schemas, endpoint documentation, and dependency-based authentication. It is a native extension for developers adding agent access to a FastAPI service.

Developer Tools12,023pythonMIT

Server facts

FastAPI-MCP

GitHub stars

12,023

Last commit

Nov 24, 2025

Runtime

python

License

MIT

Tech

Runtime
pythonPython
Transports
stdio
Remote access
No

Activity

GitHub stars
12,023
Last commit
Data as of

Tags

  • Api Integration
  • Asgi
  • Authentication
  • Fastapi
  • Python

Overview

FastAPI-MCP turns a FastAPI application's endpoints into tools that MCP clients can use. Its approach is tied directly to FastAPI rather than treating the service only as an OpenAPI document to convert. The README emphasizes retaining request and response schemas, preserving endpoint documentation, and reusing familiar dependency-based authentication and authorization. This is useful when a team already has an API and wants assistants to reach those capabilities without separately defining a parallel tool interface. The actual available tools depend on the application's endpoints; the supplied input does not name a fixed catalog of built-in tools.

The basic integration creates a FastApiMCP instance around an existing FastAPI app and mounts the MCP server on that app. The example makes the MCP route available beneath /mcp at the application's own base URL, not at a shared public endpoint. Communication with the API uses its ASGI interface directly, avoiding an extra HTTP call from the MCP layer to the FastAPI application. Deployment can share the original app's infrastructure or run separately, with advanced details linked from the README. Installation uses uv or pip, and the requirements list Python 3.10 or later, recommending 3.12. This is primarily an application integration package rather than a standalone server with a universal launch command or predefined environment settings.

Install & configure

Requirements

  • Python 3.10 or later, with 3.12 recommended
  • uv for this installation method
  • A FastAPI application
Documented launch / install command
uv add fastapi-mcp

This command adds the dependency, not a runnable standalone MCP server. Instantiate FastApiMCP(app) and call mcp.mount() in your app. The README gives an application-specific /mcp URL but does not state a public endpoint or exact MCP wire transport. ASGI describes its internal API communication. pip install fastapi-mcp is also documented.

Use cases

  • Add MCP access to an existing FastAPI application.
  • Reuse FastAPI dependency-based authentication for assistant-facing tools.
  • Expose API capabilities while retaining request and response schemas.
  • Mount MCP within the API deployment or arrange a separate deployment.

Strengths

  • Reuses native FastAPI dependencies for authentication and authorization.
  • Preserves endpoint schemas and documentation.
  • Uses direct ASGI communication rather than extra internal HTTP requests.
  • Supports shared-app or separate deployment.

Limitations

  • Requires a FastAPI application and Python 3.10 or later.
  • Tool names and capabilities are application-specific rather than a fixed catalog.
  • The README's install command does not launch an application server.

FastAPI-MCP setup notes

  • FastAPI-MCP records stdio only; confirm a network transport upstream before planning remote access.

Frequently asked questions

The README describes exposing existing FastAPI endpoints with minimal configuration while retaining their schemas and documentation.

Related MCP servers