The canonical Python stdlib oracle for AI coding agents — exact symbols, exact sections, exact versions, offline, always free, always MIT, token-frugal.
pip install python-docs-mcp-server==0.4.1 Copy PIP instructions
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.
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.
There is a difference between long context and usable context. Research like the Lost in the Middle 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:
This server indexes the official docs locally and exposes a small set of MCP tools for lookup and section retrieval.
What does asyncio.TaskGroup do in Python 3.13?
The model gets the matching symbol and the relevant docs section, not a full-page dump.
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.
uvx python-docs-mcp-server --version Or install it once with pipx:
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.
For kind="auto" with an explicit version, a nonempty search with spare result slots may append one exact inventory target when the prompt contains one known qualified identifier in that version. Original hits, snippets, scores, order and notes are preserved. Full results, ambiguous identifiers, other kinds and versionless queries are unchanged; the existing empty-result fallback is unchanged. Canonical locations are deduplicated, including inventory aliases.
The append is admitted only when the complete proposed response serialized by Pydantic's compact model_dump_json() is at most 8000 UTF-8 bytes. This is not a global search cap: oversized original responses remain unchanged. It is separate from get_docs(max_chars=8000), which limits content characters.
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:
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.
The source-pinned documentation targets include Python 3.10–3.15. To index 3.15 alongside 3.14, explicitly run:
This is documentation coverage, not a claim that the server runs on Python 3.15 or that a named MCP client was tested with it. Queries remain offline and read-only after a successful build. Until it is indexed, consult the official 3.15 docs directly.
The 3.15 target is CPython tag v3.15.0, commit d220409a13b77de7a6c30abe16ea90db01528edc, with Sphinx 8.2.3. See integration checks for explicit-version and comparison examples.
This repository includes a project-scoped .mcp.json for clients that support checked-in MCP server configuration. It points at the published package:
{ "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.
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
{ "mcpServers": { "python-docs": { "command": "uvx", "args": ["python-docs-mcp-server"] } } } Restart Claude Desktop after editing the config file.
Add this to your Cursor MCP settings (.cursor/mcp.json in your project or global settings):
The server currently exposes seven MCP tools:
For search_docs with kind="auto" and an explicit indexed version, the original lookup and full-text search run first. If both return no hits, the server looks for dotted Python identifiers in the prompt. Exactly one distinct identifier registered in that version enables a symbol-lookup fallback; repeated mentions count once and unknown identifiers do not count. Multiple known identifiers leave the result empty. A result note identifies fallback matches, which are symbol documentation, not an answer to the complete prompt. Explicit kinds, searches without a version, nonempty results, and result budgets are unchanged.
Use this server when you want precise local Python docs retrieval rather than broad web search:
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.
get_docs responses are cached across MCP client/server restarts in the platform cache directory:
/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.
lookup_package_docs queries the official PyPI JSON API documented at https://docs.pypi.org/api/json/ (GET /pypi/ /json) and returns only sources declared in that package's PyPI metadata: the PyPI project URL, docs_url, home_page, and allowlisted project_urls labels such as Documentation, Homepage, Source, and Repository.
The tool makes the trust boundary explicit with trust_boundary="pypi-declared-metadata". It does not crawl pages, perform web search, or silently fall back to unofficial community mirrors.
uvx python-docs-mcp-server doctor This checks the runtime Python version, SQLite FTS5, cache/index paths, the index format, disk space, and the venv/ensurepip support needed by build-index. If it reports FAIL: Index format, run the build-index command it prints; it lists the versions your index already holds (or every supported version, if it cannot read them). If it says your index is newer than this release, upgrade python-docs-mcp-server instead.
uvx python-docs-mcp-server validate-corpus Troubleshooting FTS5 unavailable The index needs SQLite's FTS5 extension. The python.org installers, uv python install, and the Pythons from Linux distributions, Homebrew and conda all include it. If doctor reports FAIL: SQLite FTS5, your Python was built against a SQLite without FTS5. Install one that has it:
uv python install Or install Python from python.org.
If doctor says build venv support is unavailable, install the venv package for the same Python minor version that runs the server:
sudo apt install python3.12-venv Adjust 3.12 to match the version shown by doctor. Without this package, build-index cannot create the disposable Sphinx environment it uses to build JSON documentation content.
Earlier development snapshots of this project used the PyPI name mcp-server-python-docs. The published PyPI project is python-docs-mcp-server. If your MCP client config still references the old name via uvx, you will see a Package not found error, because uvx resolves projects by PyPI name.
"args": ["python-docs-mcp-server"] The wheel still installs a legacy mcp-server-python-docs console script for users who already have the package installed and invoke the binary by name on $PATH. That script is an alias and will be removed in a future release.
If uvx python-docs-mcp-server runs an old version:
uvx --reinstall python-docs-mcp-server Or clear the uv cache:
uv cache clean python-docs-mcp-server Claude Desktop on Windows (MSIX) The MSIX-packaged version of Claude Desktop on Windows may have restricted PATH access. If uvx is not found, specify the full path in your config:
{ "mcpServers": { "python-docs": { "command": "C:\\Users\\YOU\\.local\\bin\\uvx.exe", "args": ["python-docs-mcp-server"] } } } Replace YOU with your Windows username. Find the exact path with where uvx.
After running build-index, restart your MCP client so it picks up the new database file. The server opens the index read-only on startup and does not reload it while running.
On Windows, close the MCP client before rebuilding if the index file is locked.
Tested on macOS and Linux. Windows should work, but it is not verified on every release.
The server requires Python 3.12+ to run. Source-pinned documentation targets cover Python 3.10 through 3.15; Python 3.15 is opt-in. The versions available for queries depend on the documentation versions selected when building the index.
All 2 files in this release have provenance metadata.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




