fastapi_mcp
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!
fastapi_mcp is an MCP server library that exposes existing FastAPI endpoints as Model Context Protocol tools with built-in authentication support. It provides a FastAPI-native approach to MCP integration, allowing developers to mount an auto-generated MCP server directly to their FastAPI applications or deploy it separately. The library uses ASGI transport for efficient direct communication, preserves request/response schemas and endpoint documentation, and requires minimal configuration to get started. Developers can secure their MCP tools using familiar FastAPI dependency injection patterns.
Key Features
Use Cases
- 01Exposing existing FastAPI REST APIs as MCP tools for AI agent consumption
- 02Adding AI assistant capabilities to backend services without rewriting endpoints
- 03Securing MCP tool access using existing FastAPI authentication middleware
- 04Building AI-powered workflows that interact with internal FastAPI microservices
- 05Prototyping MCP integrations rapidly on top of existing API infrastructure
- 06Creating authenticated AI agent interfaces for production FastAPI applications
Related MCP Servers
View moremarkitdown
Python tool for converting files and office documents to Markdown.
firecrawl
The context API to search, scrape, and interact with the web at scale. 🔥
prompts.chat
f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.
langflow
Langflow is a powerful tool for building and deploying AI-powered agents and workflows.
fastapi_mcp — FAQ
What is fastapi_mcp?+
fastapi_mcp is a Python library that transforms FastAPI application endpoints into Model Context Protocol (MCP) tools, allowing AI agents to interact with your existing API. It integrates natively with FastAPI using ASGI transport and supports authentication through FastAPI's dependency system.
How do I install fastapi_mcp?+
Install fastapi_mcp using uv with 'uv add fastapi-mcp' or pip with 'pip install fastapi-mcp'. Then import FastApiMCP in your FastAPI application, instantiate it with your app, and call mount() to expose the MCP server.
Which AI clients work with fastapi_mcp?+
fastapi_mcp works with any MCP-compatible client, including Claude Desktop, and can be integrated into AI agent workflows that support the Model Context Protocol. The MCP server endpoint is exposed at /mcp on your FastAPI application.
Does fastapi_mcp require API keys or special configuration?+
No API keys are needed for the library itself, though you can implement authentication for your MCP endpoints using FastAPI's existing dependency injection. Minimal configuration is required—just instantiate FastApiMCP with your app and mount it.
Is fastapi_mcp free to use?+
Yes, fastapi_mcp is open source and released under the MIT License, making it free for both personal and commercial use. Tadata also offers a hosted managed solution at tadata.com for those who prefer not to self-host.
What are the prerequisites for using fastapi_mcp?+
You need Python 3.10 or higher (Python 3.12 recommended) and an existing FastAPI application. The library integrates with your current FastAPI setup without requiring separate infrastructure or HTTP servers.
How do I install fastapi_mcp?+
Open the source repository on GitHub and follow its README. fastapi_mcp is a mcp server — MCP Agents Market links you directly to the official repo.
Is fastapi_mcp free?+
fastapi_mcp is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.