Skip to main content
Glama
jaredthivener

FastAPI Docs MCP Server


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

Related MCP server: DevDocs MCP Server

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

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaredthivener/fastapi-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server