FastAPI Docs MCP Server
Provides AI assistants with real-time access to FastAPI documentation, enabling search, browsing, code examples, and comparisons.
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:
- Sitemap-based discovery — Uses
sitemap.xmlto find all available pages - Real-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.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。