FastAPI-MCP
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Features
- Direct integration - Mount an MCP server directly to your FastAPI app
- Zero configuration required - just point it at your FastAPI app and it works
- Automatic discovery of all FastAPI endpoints and conversion to MCP tools
- Preserving schemas of your request models and response models
- Preserve documentation of all your endpoints, just as it is in Swagger
- Extend - Add custom MCP tools alongside the auto-generated ones
Installation
We recommend using uv, a fast Python package installer:
Alternatively, you can install with pip:
Basic Usage
The simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:
That's it! Your auto-generated MCP server is now available at https://app.base.url/mcp
.
Advanced Usage
FastAPI-MCP provides several ways to customize and control how your MCP server is created and configured. Here are some advanced usage patterns:
Examples
See the examples directory for complete examples.
Connecting to the MCP Server using SSE
Once your FastAPI app with MCP integration is running, you can connect to it with any MCP client supporting SSE, such as Cursor:
- Run your application.
- In Cursor -> Settings -> MCP, use the URL of your MCP server endpoint (e.g.,
http://localhost:8000/mcp
) as sse. - Cursor will discover all available tools and resources automatically.
Connecting to the MCP Server using mcp-proxy stdio
If your MCP client does not support SSE, for example Claude Desktop:
- Run your application.
- Install mcp-proxy, for example:
uv tool install mcp-proxy
. - Add in Claude Desktop MCP config file (
claude_desktop_config.json
):
On Windows:
On MacOS:
Find the path to mcp-proxy by running in Terminal: which mcp-proxy
.
- Claude Desktop will discover all available tools and resources automatically
Development and Contributing
Thank you for considering contributing to FastAPI-MCP open source projects! It’s people like you that make it a reality for users in our community.
Before you get started, please see CONTRIBUTING.md.
Community
Join MCParty Slack community to connect with other MCP enthusiasts, ask questions, and share your experiences with FastAPI-MCP.
Requirements
- Python 3.10+
- uv
License
MIT License. Copyright (c) 2024 Tadata Inc.
About
Developed and maintained by Tadata Inc.
This server cannot be installed
A zero-configuration tool that automatically exposes FastAPI endpoints as Model Context Protocol (MCP) tools, allowing LLM systems like Claude to interact with your API without additional coding.
- Installation
- Basic Usage
- Advanced Usage
- Examples
- Connecting to the MCP Server using SSE
- Connecting to the MCP Server using mcp-proxy stdio
- Development and Contributing
- Community
- Requirements
- License
- About