GitHub - tadata-org/fastapi_mcp: Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth! (original) (raw)

fastapi-to-mcp

FastAPI-MCP

Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!

PyPI version Python Versions FastAPI CI Coverage

fastapi-mcp-usage

Features

Hosted Solution

If you prefer a managed hosted solution check out tadata.com.

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:

from fastapi import FastAPI from fastapi_mcp import FastApiMCP

app = FastAPI()

mcp = FastApiMCP(app)

Mount the MCP server directly to your FastAPI app

mcp.mount()

That's it! Your auto-generated MCP server is now available at https://app.base.url/mcp.

Documentation, Examples and Advanced Usage

FastAPI-MCP provides comprehensive documentation. Additionaly, check out the examples directory for code samples demonstrating these features in action.

FastAPI-first Approach

FastAPI-MCP is designed as a native extension of FastAPI, not just a converter that generates MCP tools from your API. This approach offers several key advantages:

This design philosophy ensures minimum friction when adding MCP capabilities to your existing FastAPI services.

Development and Contributing

Thank you for considering contributing to FastAPI-MCP! We encourage the community to post Issues and create Pull Requests.

Before you get started, please see our Contribution Guide.

Community

Join MCParty Slack community to connect with other MCP enthusiasts, ask questions, and share your experiences with FastAPI-MCP.

Requirements

License

MIT License. Copyright (c) 2025 Tadata Inc.