Skip to content

FastAPI-MCP: install, tools and limits

Better Design

Direct answer

FastAPI-MCP turns the endpoints of an existing FastAPI app into MCP tools, and keeps their request and response schemas and docs. It runs over Streamable HTTP through mount_http() or SSE through mount_sse(), needs no sign-in unless you add your FastAPI auth, and turns each FastAPI endpoint you expose into a tool named after its operation_id.

A hand-drawn terminal that connects a coding agent to FastAPI-MCP, with the server's name and tool count written beside it.

What FastAPI-MCP does

FastAPI-MCP turns the endpoints of an existing FastAPI app into MCP tools, and keeps their request and response schemas and docs. It is a Python library, not a hosted server, and it mounts the MCP server on the same app or a separate one and can reuse your FastAPI auth dependencies.

Tadata Inc. maintains it. The latest release on PyPI is fastapi-mcp 0.4.0, published July 28, 2025. It is licensed under MIT.

How a coding agent uses FastAPI-MCP

The agent asks, FastAPI-MCP acts, and the result comes back into the session.

A hand-drawn three-step flow from the coding agent to FastAPI-MCP and back: Expose our orders API to the agent, Turns each FastAPI endpoint into a tool, Tools the agent calls against the real API.
  1. The agent asks: Expose our orders API to the agent
  2. FastAPI-MCP acts: Turns each FastAPI endpoint into a tool
  3. The result comes back: Tools the agent calls against the real API

Install FastAPI-MCP in the library

the library
uv add fastapi-mcp
# or:
pip install fastapi-mcp

Install FastAPI-MCP in a minimal app

a minimal app
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

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

Install FastAPI-MCP in Cursor

Cursor mcp.json
{
  "mcpServers": {
    "fastapi-mcp": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

Install FastAPI-MCP in a stdio client through mcp-remote

a stdio client through mcp-remote
{
  "mcpServers": {
    "fastapi-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8000/mcp",
        "8080"
      ]
    }
  }
}

What FastAPI-MCP covers

FastAPI-MCP's own documentation lists these, read on November 12, 2026.

  • FastApiMCP(app) wraps an existing FastAPI app
  • mount_http() / mount_sse() mount the server (mount() is deprecated)
  • Tool names come from route operation_id
  • Endpoint filtering: include_operations, exclude_operations, include_tags, exclude_tags
  • AuthConfig for OAuth, with setup_proxies and fake dynamic client registration
  • ASGI transport, or a custom httpx.AsyncClient for a remote base URL
  • setup_server() to re-register endpoints added after creation

Settings worth knowing in FastAPI-MCP

include_operations / exclude_operations / include_tags / exclude_tags
What it changes

Choose which endpoints become tools.

Server

FastAPI-MCP

describe_all_responses and describe_full_response_schema
What it changes

Add every response and the full response schema to tool descriptions.

Server

FastAPI-MCP

name and description
What it changes

Set the server metadata.

Server

FastAPI-MCP

http_client
What it changes

Injects a custom httpx.AsyncClient with its own base URL and timeout.

Server

FastAPI-MCP

mount_http(router, mount_path=...)
What it changes

Mounts the server on a separate app or path; the default path is /mcp.

Server

FastAPI-MCP

Sign-in, limits and caveats for FastAPI-MCP

Sign-in: Your FastAPI Depends() dependencies, token passthrough through the Authorization header, or a full OAuth 2 flow through AuthConfig (MCP spec 2025-03-26).

Limits and price: FastAPI-MCP is open source under MIT and free to use. Its documentation states no usage limit. It needs Python 3.10 or newer, and 3.12 is recommended.

  • The README still shows mcp.mount(), which 0.4.0 deprecates and which defaults to SSE; use mount_http().
  • Endpoints added after the server is created are not tools until you call setup_server().
  • The default HTTP timeout is 5 seconds; inject an httpx client for slow endpoints.
  • Only FastAPI endpoints can be tools.
  • FastAPI-MCP 0.4.0 declares mcp>=1.12.0 on PyPI, and the MCP Python SDK was at 2.3.0 on 12 November 2026, so a fresh install takes the newest SDK major version.

Use FastAPI-MCP for interface work

It exposes your own backend API to a coding agent, so the agent can call real endpoints while it builds the UI on top.

Steal this workflow

Run this guide in your own assistant. The prompt carries the guide link and the workflow summary, so the assistant can adapt it to your project.

Read the guide "FastAPI-MCP: install, tools and limits" at https://better-design.com/blog/fastapi-mcp and help me apply it to my project.

FastAPI-MCP turns the endpoints of an existing FastAPI app into MCP tools, and keeps their request and response schemas and docs. It runs over Streamable HTTP through mount_http() or SSE through mount_sse(), needs no sign-in unless you add your FastAPI auth, and turns each FastAPI endpoint you expose into a tool named after its operation_id.

Start by asking what I am building and which tools I use. Then walk me through the workflow step by step, adapted to my answers.

Claude and ChatGPT open with the prompt filled in. Gemini copies the prompt to your clipboard first, so paste it when the app opens.

Questions

What does FastAPI-MCP do?

FastAPI-MCP turns the endpoints of an existing FastAPI app into MCP tools, and keeps their request and response schemas and docs. It is a Python library, not a hosted server, and it mounts the MCP server on the same app or a separate one and can reuse your FastAPI auth dependencies.

Does FastAPI-MCP need an API key or sign-in?

Your FastAPI Depends() dependencies, token passthrough through the Authorization header, or a full OAuth 2 flow through AuthConfig (MCP spec 2025-03-26).

Is FastAPI-MCP free?

FastAPI-MCP is open source under MIT and free to use. Its documentation states no usage limit. It needs Python 3.10 or newer, and 3.12 is recommended.

Which coding agents can use FastAPI-MCP?

Its documentation shows a setup for Cursor. Any client that speaks MCP over Streamable HTTP through mount_http() or SSE through mount_sse() can connect.

Where these FastAPI-MCP facts come from

Each fact on this page comes from FastAPI-MCP's own repository, documentation or package registry, read on November 12, 2026.

Add design rules next to it

FastAPI-MCP gives the agent its capabilities. It does not tell the agent what a good screen looks like. Better Design adds that part: a design system, interface principles and review rules that the agent calls while it builds.