Read-only MCP server for official Python docs: local index, no API keys, exact symbol lookup, version-aware retrieval.
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
claude mcp add python-docs -- uvx python-docs-mcp-server{
"mcpServers": {
"python-docs": {
"command": "uvx",
"args": ["python-docs-mcp-server"]
}
}
}Resumen de MCP Servers
# python-docs-mcp-server
<!-- mcp-name: io.github.ayhammouda/python-docs-mcp-server -->
**For AI coding agents writing Python, `python-docs-mcp-server` is the canonical Python stdlib oracle: exact symbols, exact sections, exact versions — offline, *always free, always MIT*, token-frugal.**
[](https://github.com/ayhammouda/python-docs-mcp-server/actions/workflows/ci.yml)
[](https://github.com/ayhammouda/python-docs-mcp-server/actions/workflows/security.yml)
[](https://github.com/ayhammouda/python-docs-mcp-server/actions/workflows/codeql.yml)
[](https://scorecard.dev/viewer/?uri=github.com/ayhammouda/python-docs-mcp-server)
[](https://glama.ai/mcp/servers/ayhammouda/python-docs-mcp-server)
[](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.ayhammouda%2Fpython-docs-mcp-server)
[](LICENSE)
[](https://www.python.org/)
[](#why-use-it)
[](https://docs.python.org/3/)
Built for the moment your agent needs `asyncio.TaskGroup` signatures, `pathlib.Path` semantics, or what changed in 3.12 — *not* a web fetch, *not* a hosted API, *not* a vector store hallucinating section anchors. Just an indexed slice of `docs.python.org`, returned by symbol or by query, scoped to the version you actually ship on.
## Why this exists
There is a difference between long context and usable context. Research like the
[*Lost in the Middle*](https://arxiv.org/abs/2307.03172) study (Liu et al., 2023)
found that models struggle to use relevant information buried in the middle of a
long input. Pasting an entire documentation page into the model invites that
failure. Returning the exact symbol, section, and version keeps the answer in a
short, high-signal context instead.
Generic docs retrieval is a rough fit for Python stdlib questions:
- `asyncio.TaskGroup` should resolve to the actual symbol, not a fuzzy page hit
- Python version matters (`3.12` and `3.13` do not always say the same thing)
- fetching a whole page burns tokens when one section answers the question
- the official docs are canonical, but they do not ship as an MCP server
This server indexes the official docs locally and exposes a small set of MCP
tools for lookup and section retrieval.
## Why use it
- no API keys to manage
- queries run against a local index, not a hosted docs API
- results come from the official Python docs
- the server is read-only at runtime
- fewer dependencies to review in strict environments
## What you get
- symbol lookup through Python `objects.inv`
- page and section retrieval with truncation and pagination
- a local SQLite + FTS5 index; no runtime web scraping
- results for each Python version you index
- six read-only MCP tools
## Quick example
**Prompt**
> What does `asyncio.TaskGroup` do in Python 3.13?
**Typical flow**
1. `search_docs("asyncio.TaskGroup", kind="symbol", version="3.13")`
2. Call `get_docs(...)` using the slug and anchor returned by the best hit
**Result**
The model gets the matching symbol and the relevant docs section, not a
full-page dump.
## 30-second demo
Ask your MCP client:
> In Python 3.13, how should I use `asyncio.TaskGroup` and what changed from older asyncio patterns?
If setup is working, the client should use `search_docs` for the exact symbol,
then `get_docs` for the matching section. Instead of generic web results or an
entire docs page, it gets official stdlib text for the requested Python version,
trimmed to the section that matters.
## Install
Run directly with `uvx`:
```bash
uvx python-docs-mcp-server --version
```
Or install it once with `pipx`:
```bash
pipx install python-docs-mcp-server
```
---
If `uv` is installed but the `uv` command is not on your `PATH`, reopen your
shell or use `python -m uv ...` as a fallback for local contributor commands.
## First run
Build the local documentation index:
```bash
uvx python-docs-mcp-server build-index --versions 3.10,3.11,3.12,3.13,3.14
```
If you installed the package persistently, you can drop the `uvx` prefix:
```bash
python-docs-mcp-server build-index --versions 3.10,3.11,3.12,3.13,3.14
```
The first build downloads Python's `objects.inv` files, clones CPython docs
sources, runs `sphinx-build -b json`, and writes an SQLite index to your local
cache. It can take several minutes.
## Configure your MCP client
### Claude Code
This repository includes a project-scoped `.mcp.json` for clients that support
checked-in MCP server configuration. It points at the published package:
```json
{
"mcpServers": {
"python-docs": {
"type": "stdio",
"command": "uvx",
"args": ["python-docs-mcp-server"]
}
}
}
```
Build the local documentation index with the first-run command above before
expecting docs queries to return corpus-backed results.
### Claude Desktop
Add this to your Claude Desktop configuration file:
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
**Linux:** `~/.config/Claude/claude_desktop_config.json`
**Windows:** `%APPDATA%\\Claude\\claude_desktop_config.json`
```json
{
"mcpServers": {
"python-docs": {
"command": "uvx",
"args": ["python-docs-mcp-server"]
}
}
}
```
Restart Claude Desktop after editing the config file.
### Cursor
Add this to your Cursor MCP settings (`.cursor/mcp.json` in your project or
global settings):
```json
{
"mcpServers": {
"python-docs": {
"command": "uvx",
"args": ["python-docs-mcp-server"]
}
}
}
```
### Codex
Add this to `.codex/config.toml`:
```toml
[mcp_servers.python-docs]
command = "uvx"
args = ["python-docs-mcp-server"]
```
## Quality checks
- CI runs `ruff`, `pyright`, and `pytest` on macOS and Linux for Python 3.12
and 3.13
- subprocess-based stdio and smoke tests cover the MCP protocol pipe
- packaging tests check the wheel contents and CLI entry points
- retrieval regression tests cover exact symbol hits, version behavior,
missing symbols, truncation, and local-version defaults
- manual MCP QA lives in
[`.github/INTEGRATION-TEST.md`](.github/INTEGRATION-TEST.md), with MCP
Inspector for local checks and Claude/Cursor for real-client checks
Contributor commands and validation steps live in
[`CONTRIBUTING.md`](CONTRIBUTING.md).
## Tools
The server currently exposes six MCP tools:
| Tool | Description |
|------|-------------|
| `search_docs` | Search Python stdlib docs by query. Supports symbol lookup (`asyncio.TaskGroup`), module search (`json`), and free-text search. Returns ranked hits with BM25 scoring and snippet excerpts. |
| `get_docs` | Retrieve a specific documentation page or section by slug and optional anchor. Returns markdown content with budget-enforced truncation and pagination. Retrieved results are cached on disk by Python docs version and request identity. |
| `lookup_package_docs` | Look up official PyPI package metadata and return package-declared documentation/homepage/source URLs. This is a controlled PyPI metadata lookup, not generic web search. |
| `list_versions` | List all indexed Python versions with metadata. |
| `detect_python_version` | Detect the user's local Python version and report whether that version has been indexed. |
| `compare_versions` | Diff a Python stdlib symbol between two indexed versions. Returns `change=added|removed|changed|unchanged` with optional `new_in`, `changed_in`, `deprecated_in`, `signature_delta` (advisory heuristic), `see_also_added/removed`, `section_diff`, and `note` deltas. Token-frugal — emits only changed fields, not full content. |
## Why not Context7 or generic docs retrieval?
Use this server when you want precise local Python docs retrieval rather than
broad web search:
- official Python docs, not scraped mirrors or summaries
- exact symbol resolution from `objects.inv`
- version-aware results for Python 3.10 through 3.14
- section retrieval instead of full-page dumps
- PyPI-declared docs, homepage, and source links through `lookup_package_docs`
- local read-only runtime with no API keys
Use Context7 or a generic docs fetcher for third-party libraries, arbitrary web
pages, or framework research. This server is not a universal docs search engine;
it is a focused stdlib retrieval tool for AI coding agents.
## Retrieved docs cache
`get_docs` responses are cached across MCP client/server restarts in the
platform cache directory:
```text
<platform cache dir>/mcp-python-docs/retrieved-docs-cache.sqlite3
```
The cache stores completed `get_docs` results for the resolved Python docs
version plus request identity (`slug`, optional `anchor`, `max_chars`, and
`start_index`). Cache misses use the normal local index retrieval path and then
write the result.
Cache entries are also scoped to a fingerprint of the local `index.db` file
(path, size, and modification timestamp). If you rebuild or replace the local
docs index, older entries are ignored automatically. Deleting
`retrieved-docs-cache.sqlite3` is safe; it removes cached retrieval results, not
the docs index.
## PyPI package docs lookup
`lookup_package_docs` queries the official PyPI JSON API documented at
`https://docs.pypi.org/api/json/` (`GET /Lo que la gente pregunta sobre python-docs-mcp-server
¿Qué es ayhammouda/python-docs-mcp-server?
+
ayhammouda/python-docs-mcp-server es mcp servers para el ecosistema de Claude AI. Read-only MCP server for official Python docs: local index, no API keys, exact symbol lookup, version-aware retrieval. Tiene 4 estrellas en GitHub y se actualizó por última vez 4d ago.
¿Cómo se instala python-docs-mcp-server?
+
Puedes instalar python-docs-mcp-server clonando el repositorio (https://github.com/ayhammouda/python-docs-mcp-server) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.
¿Es seguro usar ayhammouda/python-docs-mcp-server?
+
Nuestro agente de seguridad ha analizado ayhammouda/python-docs-mcp-server y le ha asignado un Trust Score de 95/100 (tier: Verified). Revisa el desglose completo de comprobaciones superadas y flags en esta página.
¿Quién mantiene ayhammouda/python-docs-mcp-server?
+
ayhammouda/python-docs-mcp-server es mantenido por ayhammouda. La última actividad registrada en GitHub es de 4d ago, con 14 issues abiertos.
¿Hay alternativas a python-docs-mcp-server?
+
Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.
Despliega python-docs-mcp-server en tu cloud
Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.
¿Mantienes este repo? Añade un badge a tu README
Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.
[](https://claudewave.com/repo/ayhammouda-python-docs-mcp-server)<a href="https://claudewave.com/repo/ayhammouda-python-docs-mcp-server"><img src="https://claudewave.com/api/badge/ayhammouda-python-docs-mcp-server" alt="Featured on ClaudeWave: ayhammouda/python-docs-mcp-server" width="320" height="64" /></a>Más MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。