MCP Catalogs
Homefastapi_mcp screenshot

fastapi_mcp

by tadata-org·11,863·Score 60

FastAPI-MCP exposes FastAPI endpoints as MCP tools with built-in authentication.

developer-toolsweb-scrapingai-llm
945
Forks
151
Open issues
6 mo ago
Last commit
2d ago
Indexed

Overview

FastAPI-MCP is a Python library that bridges FastAPI applications with the Model Context Protocol, allowing developers to expose existing API endpoints as MCP tools without extensive reconfiguration. The solution preserves request/response schemas, endpoint documentation from Swagger, and works with FastAPI's native authentication mechanisms. It offers flexible deployment options, allowing mounting directly to the FastAPI app or separate deployment.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:Convert existing REST APIs to MCP tools for AI agents
you:Securely expose internal API endpoints to language models
you:Create MCP servers from existing FastAPI services with minimal code changes
you:What authentication methods are supported?
you:Can I deploy the MCP server separately from my FastAPI app?

When to choose this

Choose FastAPI-MCP if you already use FastAPI and want to expose your existing endpoints as MCP tools with minimal configuration and leveraging your existing authentication.

When NOT to choose this

Avoid if you're not using FastAPI, as this solution is specifically designed for FastAPI applications and requires Python 3.10+.

Comparable tools

openapi-mcprest-api-mcphttp-mcp

Installation

Install with uv or pip:

uv add fastapi-mcp
pip install fastapi-mcp

Basic usage in FastAPI app:

from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

app = FastAPI()
mcp = FastApiMCP(app)
mcp.mount()

For Claude Desktop, add to config.json:

{
  "mcpServers": {
    "fastapi": {
      "command": "python",
      "args": ["-m", "fastapi_mcp"]
    }
  }
}

FAQ

What authentication methods are supported?
FastAPI-MCP leverages your existing FastAPI dependencies for authentication, using the same Dep() mechanisms you're already familiar with.
Can I deploy the MCP server separately from my FastAPI app?
Yes, FastAPI-MCP supports both mounting directly to your FastAPI app and separate deployment options for flexible infrastructure setup.

On Hacker News

Recent discussion from the developer community.

Compare fastapi_mcp with

GitHub →

Last updated · Auto-generated from public README + GitHub signals.