FastAPI Docs MCP Server
This MCP server gives AI assistants real-time access to official FastAPI documentation through six documentation tools.
Fetch any FastAPI documentation page by path (e.g.,
tutorial/first-steps).Search the docs by keyword, with common alias support like
auth→ security pages.List all available FastAPI doc pages, categorized by section.
Get code examples only, without prose, for a topic.
Compare FastAPI approaches side-by-side (e.g., sync vs async, auth methods).
Combine best-practice content from all matching doc pages for a topic.
Use it with Claude, GitHub Copilot, or any MCP-compatible client, running via
uvor Docker.Content is fetched live from
fastapi.tiangolo.comand truncated at 15,000 characters per page with a link to the full page.
Provides real-time access to FastAPI documentation, including tools for fetching pages by path, searching with alias support, listing all available pages, extracting code examples, comparing approaches, and retrieving best practices.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@FastAPI Docs MCP Server How do I set up CORS in FastAPI?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| Fetch any documentation page by path |
| Search docs by keyword (with alias support) |
| List all available documentation pages |
| Get just the code examples, no prose |
| Compare different approaches side-by-side |
| 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 syncUsage
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", "fastapi-docs-mcp"]
}
}
}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", "fastapi-docs-mcp"]
}
}
}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 fastapi-docs-mcpDevelopment
# 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 src/fastapi_docs_mcpHow It Works
The server fetches documentation directly from the official FastAPI website:
Sitemap-based discovery — Uses
sitemap.xmlto find all available pagesReal-time fetching — Retrieves current documentation on each request
Smart extraction — Extracts readable content from HTML pages
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.
Changelog
See CHANGELOG.md.
License
MIT
Available Tools
6 toolscompare_fastapi_approachesARead-only
Compare FastAPI approaches side-by-side (e.g. sync vs async, auth methods).
Inputs: topic (required).
get_fastapi_best_practicesARead-only
Combine best-practice content from all doc pages matching a topic.
Inputs: topic (required).
get_fastapi_docsARead-only
Fetch FastAPI documentation content for a page by its path.
Inputs: path (required).
get_fastapi_exampleARead-only
Get code examples (no prose) for a FastAPI topic.
Inputs: topic (required).
list_fastapi_pagesARead-only
List all available FastAPI doc pages, categorized by section.
Inputs: no named parameters.
search_fastapi_docsARead-only
Search the docs by keyword and return the best-matching page.
Common aliases are supported (e.g. "auth" finds security pages).
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct task: comparing approaches, best practices, fetching docs, examples, listing pages, and searching. No overlap in functionality.
All names use snake_case and follow a verb_fastapi_noun pattern. Minor variation in verbs like 'compare' vs 'get' but overall consistent.
Six tools is well-scoped for a documentation server, covering essential operations without being excessive or insufficient.
The surface covers common documentation needs (browse, search, fetch, examples, comparisons). Minor gap: no explicit tool for random page or offline caching, but core workflows are complete.
Maintenance
Related MCP Connectors
Access and search Branch's official API documentation directly within any AI agent or client.
@latest documentation and code examples to 9000+ libraries for LLMs and AI code editors in a singl…
Tailor Platform for AI assistants: search, list and read the platform documentation.
Versioned documentation registry and semantic search for AI tools and coding assistants.
Related MCP Servers
- AlicenseBqualityDmaintenanceConverts FastAPI application OpenAPI documentation into MCP tools for AI assistants to efficiently query API information. Reduces token consumption by enabling on-demand, structured API queries instead of loading complete OpenAPI specifications.2MIT
- FlicenseAqualityDmaintenanceProvides AI models with direct access to documentation for over 600 technologies from DevDocs.io, including popular languages, frameworks, and tools. It enables comprehensive searching, content retrieval, and offline access via an intelligent local caching system.122-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to fetch, index, and perform semantic RAG-based searches on API documentation from various sources. It provides tools for hybrid search and collection management, allowing users to access up-to-date documentation from projects like Gemini and FastMCP.-
- FlicenseAqualityDmaintenanceProvides Large Language Models with real-time access to the latest documentation for Python libraries like Langchain, LlamaIndex, and OpenAI, enabling accurate and up-to-date code suggestions.1-