fastapi-mcp
Automatic MCP server generator for FastAPI applications - converts FastAPI endpoints to MCP tools for LLM integration
What it is and what it does
FastAPI-MCP bridges FastAPI applications and the Model Context Protocol, allowing LLMs like Claude to call your API endpoints as tools. Instead of converting OpenAPI specs to MCP in isolation, it integrates directly with FastAPI's runtime, using the ASGI interface to communicate efficiently and reusing FastAPI's dependency injection for authentication and authorization.
The package requires minimal setup—instantiate FastApiMCP with your app and call mount() to expose endpoints as MCP tools at /mcp. It preserves endpoint documentation, request/response schemas, and FastAPI dependencies, so your existing security and validation logic applies to MCP calls without duplication. You can mount the server on the same app or deploy separately.
Use it for:
- Enable Claude or other LLMs to invoke your FastAPI endpoints as tools without writing separate MCP server code.
- Add LLM-native tool access to existing FastAPI services while reusing authentication and validation logic.
- Prototype AI agent integrations by exposing internal APIs as MCP tools with zero additional configuration.
- Preserve OpenAPI documentation and schemas when exposing endpoints to LLMs, ensuring consistency across interfaces.
- Deploy an MCP server alongside or separately from your FastAPI app for flexible AI orchestration architectures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically exposes FastAPI endpoints as Model Context Protocol (MCP) tools for LLM integration, with built-in authentication support using FastAPI's dependency system.
Yes, if you have a FastAPI application and want to expose endpoints to LLMs. The low install friction, permissive license, and native FastAPI integration make it straightforward to add. However, note the aging maintenance status (last release 382 days ago)—evaluate whether the current feature set and stability meet your timeline, and monitor the repository for updates before committing to production use.
Install
fastapi-mcp on PyPI
pip
pip install fastapi-mcpuv
uv add fastapi-mcppoetry
poetry add fastapi-mcpInstalling fastapi-mcp
Before you install
Low friction installation with a pure-Python wheel. The package depends on 10 runtime libraries including fastapi, uvicorn, and pydantic, all widely-used and stable. Maintenance status is aging—last release was 382 days ago, though the repository remains active with recent commits and substantial community interest (11983 stars).
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for both commercial and open-source projects. No copyleft or attribution requirements beyond preserving the license notice.
Quickstart
pip install fastapi-mcp
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP
app = FastAPI()
mcp = FastApiMCP(app)
mcp.mount()
# MCP server now available at /mcp
Requires Python 3.10 or later (3.12 recommended). FastAPI application must already exist to wrap.
Verify before relying
- Whether the ASGI transport optimization provides measurable latency benefits over HTTP in typical deployments.
- How schema preservation handles complex Pydantic v2 features and custom validators.
- Whether separate deployment mode (mentioned in docs) is production-ready given the aging maintenance status.
Package facts
| License | MIT License Copyright (c) 2024 Tadata Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 10 — fastapi, httpx, mcp, pydantic-settings, pydantic, requests, rich, tomli, typer, uvicorn |
| Maintenance | aging — 382 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 17,508,920/month — #1,114 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fastapi_mcp-0.4.0-py3-none-any.whl
Keywords: ai, api, claude, conversion, fastapi, llm, mcp, modelcontextprotocol, openapi, tools
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
mcpoExposes MCP (Model Context Protocol) servers as…
unclear · top 15,000 on PyPI
arcade-serveArcade Serve provides FastAPI and Model Context…
permissive · top 15,000 on PyPI
mcp-server-gitExposes Git repository operations as tools for…
permissive · top 15,000 on PyPI
mcp-typesProvides the wire types and protocol message…
permissive · top 5,000 on PyPI
wikipedia-mcpExposes Wikipedia search, article retrieval,…
permissive · top 15,000 on PyPI
django-mcp-serverExposes Django models and custom logic as Model…
permissive · top 15,000 on PyPI
cli-mcp-serverProvides a secure Model Context Protocol (MCP)…
unclear · top 15,000 on PyPI
scalar-fastapiServes interactive, browser-based API…
permissive · top 5,000 on PyPI
astro-airflow-mcpProvides AI assistants with programmatic access…
unclear · top 15,000 on PyPI