FastAPI Docs MCP Server

FastAPI Docs MCP Server

Provides AI assistants with real-time access to FastAPI documentation, enabling search, browsing, code examples, and comparisons.

Category
Visit Server

README

<h1 align="center">🐍 FastAPI Docs MCP Server 🤖</h1>

<p align="center"> <em>Real-time FastAPI documentation access for AI assistants</em> </p> <p align="center"> <a href="https://github.com/jaredthivener/fastapi-docs-mcp/actions/workflows/test.yml" target="_blank"><img src="https://github.com/jaredthivener/fastapi-docs-mcp/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test"></a> <a href="https://github.com/jaredthivener/fastapi-docs-mcp/actions/workflows/codeql.yml" target="_blank"><img src="https://github.com/jaredthivener/fastapi-docs-mcp/actions/workflows/codeql.yml/badge.svg" alt="CodeQL"></a> <a href="https://github.com/jaredthivener/fastapi-docs-mcp/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a> <a href="https://github.com/jaredthivener/fastapi-docs-mcp" target="_blank"><img src="https://img.shields.io/badge/python-3.13%2B-blue.svg" alt="Python 3.13+"></a> </p>

<p align="center"> <img src="docs/BA35AD71-62DA-4C12-A605-21F9F48D72BA.PNG" alt="FastAPI Docs MCP Server hero" width="640"> </p>


An MCP (Model Context Protocol) server that provides real-time access to FastAPI documentation. Use it with Claude, GitHub Copilot, or any MCP-compatible client to instantly query FastAPI docs.

Features

  • Real-time documentation — Fetches directly from fastapi.tiangolo.com
  • Smart search — Find docs by keyword with common alias support
  • Full sitemap access — Browse all available documentation pages
  • Code examples — Get just the code, no prose
  • Compare approaches — Side-by-side comparisons of different patterns

Tools

Tool Description
get_fastapi_docs(path) Fetch any documentation page by path
search_fastapi_docs(query) Search docs by keyword (with alias support)
list_fastapi_pages() List all available documentation pages
get_fastapi_example(topic) Get just the code examples, no prose
compare_fastapi_approaches(topic) Compare different approaches side-by-side
get_fastapi_best_practices(topic) Get combined best practices from multiple pages

Examples

Once connected, ask your AI assistant:

  • "How do I set up CORS in FastAPI?"
  • "Show me the FastAPI security documentation"
  • "What are FastAPI dependencies?"
  • "List all FastAPI tutorial pages"
  • "Give me a code example for JWT authentication"
  • "Compare sync vs async in FastAPI"
  • "What are the best practices for testing in FastAPI?"

Installation

git clone https://github.com/jaredthivener/fastapi-docs-mcp.git
cd fastapi-docs-mcp
uv sync

Usage

With Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "fastapi-docs": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/fastapi-docs-mcp", "python", "main.py"]
    }
  }
}

With VS Code (GitHub Copilot)

Add to .vscode/mcp.json in your workspace:

{
  "servers": {
    "fastapi-docs": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/fastapi-docs-mcp", "python", "main.py"]
    }
  }
}

With Docker

Build the image locally:

docker build -t fastapi-docs-mcp .

Then use this MCP server config:

{
  "servers": {
    "fastapi-docs": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "fastapi-docs-mcp"
      ],
      "type": "stdio"
    }
  }
}

Standalone

uv run python main.py

Development

# Install dev dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Lint
uv run ruff check .

# Format
uv run ruff format .

# Type check
uv run mypy main.py

How It Works

The server fetches documentation directly from the official FastAPI website:

  1. Sitemap-based discovery — Uses sitemap.xml to find all available pages
  2. Real-time fetching — Retrieves current documentation on each request
  3. Smart extraction — Extracts readable content from HTML pages
  4. Keyword aliases — Maps common terms (e.g., "auth" → "security")

Content Limits

To keep responses fast and avoid overloading AI context windows, documentation content is truncated to a maximum length (currently 15,000 characters). If a page exceeds that limit, the response ends with a truncation notice and a link to the full page.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured