rust-docs-mcp
Rust documentation MCP server: an agent searches crate items, reads source code and inspects the dependency tree.
- 142 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The server downloads third-party crates and builds documentation from them, which means compiling downloaded code.
- `GITHUB_TOKEN`, when set, opens access to private repositories.
Install
- Works in
Manual install
curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bashThe first README command. Alternative: `cargo install rust-docs-mcp`. A Rust nightly toolchain is required.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The server downloads third-party crates and builds documentation from them, which means compiling downloaded code.
- `GITHUB_TOKEN`, when set, opens access to private repositories.
This is third-party code. Review the repository files before installing.
What it does
rust-docs-mcp downloads crates from crates.io, GitHub or a local folder, caches them and answers the agent from rustdoc documentation. The agent lists crate items, searches by pattern, kind and path, including fuzzy search tolerant of typos, and opens signatures, fields, methods and source code with a chosen number of context lines. The server also builds direct and transitive dependency trees and a module hierarchy through the integrated `cargo-modules`. After the first caching, a crate reads without a network. Long answers get the `search_items_preview` preview mode and truncation to stay within token limits.
Who it is for. Rust developers whose agent writes code for fresh crates and gets the API wrong because its training data is stale.
Good fit when
- The agent adds a crate released after its training and must see real signatures.
- A trait or type must be found by part of its name among thousands of crate items.
- Before a version bump, the agent inspects the dependency tree and module structure of the new version.
- Work goes on without a network: cached crates read offline.
Not a fit when
- The question is not about Rust: the server knows only rustdoc documentation and crate sources.
- No Rust nightly toolchain is installed: documentation cannot be generated without it.
- Foreign code must not be built locally: documentation is produced by compiling the downloaded crate.
Example request
Cache serde at an exact version, find types with Deserializer in the name and show the source of one of them.MCP
- Transport
- stdio
- Authentication
- not required
Environment variables
RUST_DOCS_MCP_CACHE_DIR- Crate cache folder instead of `~/.rust-docs-mcp/cache/`.
GITHUB_TOKENsecret- GitHub token for private repositories.
RUST_DOCS_MCP_TOOLCHAIN- Toolchain for documentation generation, for example `nightly`.
Limitations
The author warns that the project was written entirely by AI without human oversight, as an experiment. Generating rustdoc JSON needs a nightly toolchain, preferably `nightly-2026-05-22`; the fallback, plain `nightly`, works with the same JSON format. From crates.io only exact versions such as `9.3.1` are taken, and the server rejects partial `9` and `9.3`. Private GitHub repositories need `GITHUB_TOKEN`. Each feature-flag set is cached as its own variant, so the cache grows. `search_items` can hit the token limit, so start with `search_items_preview`.
How to disable. Remove the `rust-docs` block from the client's MCP configuration. The cache lives in `~/.rust-docs-mcp/cache/`: `remove_crate` or deleting the folder clears it.
FAQ
How do I install rust-docs-mcp?
The README's `install.sh` script installs the binary; the alternative is `cargo install rust-docs-mcp`. Then add the server to the client's MCP configuration and install a Rust nightly toolchain.
What if the server fails to start?
Run `rust-docs-mcp doctor`. It checks Rust toolchains, Git, access to crates.io and GitHub, cache folder permissions and rustdoc JSON generation; the `--json` flag returns structured output.
Where is the cache and how do I move it?
By default in `~/.rust-docs-mcp/cache/`. Set another location with the `--cache-dir` flag or the `RUST_DOCS_MCP_CACHE_DIR` variable.
Why does a crate not download at version 9?
crates.io accepts only an exact version, for example `9.3.1`. The error lists the available non-yanked releases: pick one and retry.
How do the search tools differ?
`search_items` searches by pattern and returns full documentation, `search_items_preview` returns only IDs, names and types, and `search_items_fuzzy` tolerates typos.
Discussion
No questions or reviews yet.
Related
MCP serversAn MCP server that answers an agent's questions from the documentation of one Rust crate at an exact version
rust-analyzer MCP: Rust code navigation for agents
r3bl-rust-analyzer-mcp-server
A Rust MCP server on standard threads: the agent gets hover info, go to definition, references, formatting and compiler diagnostics from rust-analyzer
Docs MCP Server
Grounded Docs MCP Server
A local MCP server that indexes docs from websites, GitHub, npm, PyPI and files and gives the agent version-aware search
A Rust binary for agents and the terminal that uses tree-sitter to find a symbol's definition, its calls and file dependencies
An MCP server and CLI for code research: search and understand your project and all of GitHub with fewer tokens
An MCP server that graphs repository dependencies, writes docs from the graph and answers agent questions via codebase-qna
README in short
The README explains why agents struggle with new crates and groups tools by task: cache, documentation queries, dependencies, structure, search. A separate table covers feature-flag selection and its effect on the cache. It ends with CLI commands for working without MCP.