explaingit

tadata-org/fastapi_mcp

11,862PythonAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

A Python library that automatically exposes all your existing FastAPI endpoints as MCP tools so AI assistants like Claude or Cursor can discover and call your API during a conversation, with no rebuilding required.

Mindmap

mindmap
  root((fastapi_mcp))
    What it does
      FastAPI to MCP tools
      Auto endpoint discovery
      Auth reuse
    Tech stack
      Python
      FastAPI
      MCP protocol
    Use cases
      Claude tool integration
      Cursor AI integration
      Reuse existing API
    Deployment
      Mounted on app
      Separate process
    Audience
      Python developers
      AI tool builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Expose an existing FastAPI backend to Claude or Cursor as callable tools without rewriting any endpoint logic

USE CASE 2

Reuse your existing FastAPI authentication dependencies for the AI tool interface without creating a separate auth layer

USE CASE 3

Mount the MCP server directly onto your FastAPI app so it runs as part of your existing service with no extra infrastructure

USE CASE 4

Run the MCP server as a separate process if your infrastructure requires it to be isolated from the main app

Tech stack

PythonFastAPIMCP

Getting it running

Difficulty · easy Time to first run · 30min

Requires Python 3.10 or later, Python 3.12 is recommended.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

FastAPI-MCP is a Python library that takes an existing FastAPI web application and automatically exposes all of its API endpoints as tools that AI assistants can call. FastAPI is a popular Python framework for building web APIs. MCP, the Model Context Protocol, is a standard that lets AI tools like Claude or Cursor discover and invoke external capabilities during a conversation. The idea is that if you already have a working FastAPI backend, you should not need to rebuild anything to make it usable by an AI assistant. You add this library, call two functions, and your entire API becomes available to AI tools at a new URL. The library reads your existing FastAPI route definitions, including their documentation and data schemas, and uses that information to describe each endpoint to the AI in the format MCP requires. The README highlights that this is built as a native FastAPI extension rather than a generic converter. That distinction matters for authentication: instead of creating a separate authentication layer for the MCP interface, you can reuse the same FastAPI dependency functions you already wrote for your regular API. The library also communicates with your FastAPI app directly through its internal interface rather than making HTTP calls to it, which the README notes is more efficient. Deployment is flexible. You can mount the MCP server onto the same application so it runs as part of your existing service, or you can run it as a separate process if your infrastructure requires that. Installation is through pip or the uv package manager. Python 3.10 or later is required, with 3.12 recommended. The project is open-source under the MIT license and is maintained by Tadata, which also offers a managed hosted version of the same functionality for teams that prefer not to self-host.

Copy-paste prompts

Prompt 1
Add FastAPI-MCP to my FastAPI app and expose all my endpoints as tools that Claude can call during a conversation
Prompt 2
How do I reuse my existing FastAPI OAuth2 dependency for authentication in the FastAPI-MCP interface?
Prompt 3
Set up FastAPI-MCP as a standalone process separate from my FastAPI app and connect it to Cursor
Prompt 4
Show me the two functions I need to call to turn a FastAPI app into an MCP server with FastAPI-MCP
Prompt 5
How do I add FastAPI-MCP to a FastAPI app that already has JWT authentication without breaking existing routes?
Open on GitHub → Explain another repo

← tadata-org on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.