skillfed

fastapi-mcp

Automatic MCP server generator for FastAPI applications - converts FastAPI endpoints to MCP tools for LLM integration

fastapi-mcp v0.4.0 17.5M downloads/30d#1,114 on PyPI11,983
Permissive 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) AGING released

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-mcp

uv

uv add fastapi-mcp

poetry

poetry add fastapi-mcp

Installing 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

Development Status :: 3 - AlphaFramework :: FastAPIIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python Modules

Tags

fastapi to mcp serverexpose fastapi endpoints as mcp toolsllm integration fastapimodel context protocol fastapifastapi mcp server generatorclaude api fastapi integrationopenapi to mcp converter
llm-integrationmcp-serverapi-bridge

More Python Modules packages