
Rust Docs MCP Server
Gives AI coding assistants up-to-date, crate-specific Rust documentation via semantic search and LLM summarization.
Add to your client
Copy the config for your MCP client and paste it into its config file.
cargo build --releasePaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"rust-docs-mcp-server": {
"command": "rustdocs_mcp_server",
"args": [
"serde@^1.0"
],
"env": {
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY_HERE"
}
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- OpenAI API key set in the OPENAI_API_KEY environment variable
- Network access to download crate dependencies and reach the OpenAI API
- The rustdocs_mcp_server binary (download a pre-compiled release, or build from source with the Rust toolchain via `cargo build --release`)
About Rust Docs MCP Server
An MCP server that provides AI coding assistants with accurate, current documentation for a specific Rust crate. It runs over stdio, generates a single tool (query_rust_docs) backed by semantic search over crate docs plus LLM summarization, and a resource (crate://<crate_name>) reporting the crate it is configured for. Each server instance targets one crate; run multiple instances for multiple crates.
Tools & capabilities (1)
query_rust_docsQuery documentation for the specific Rust crate the server was started for, using semantic search and LLM summarization. Takes a required `question` string about the crate's API or usage and returns a text answer derived only from the relevant documentation context, prefixed with `From <crate_name> docs:`.
What this server can do
Rust Docs MCP Server provides tools for these capabilities — tap one to see every MCP server that does the same:
When to use it
- Giving AI coding assistants (Cursor, Cline, Roo Code, Claude Desktop, etc.) accurate, up-to-date context for a Rust crate before they write code
- Reducing incorrect or outdated API suggestions for fast-moving crates like serde, tokio, or reqwest
- Answering specific questions about a crate's API or usage grounded in its current documentation
- Running several instances concurrently so an assistant can consult docs for multiple crates in one session
Security notes
Requires an OpenAI API key supplied via the OPENAI_API_KEY environment variable; the key is used to call the OpenAI API for embedding generation and answer summarization. The server needs network access to download crate dependencies and reach the OpenAI API. First-run embedding generation incurs a small OpenAI cost (the README cites fractions of a US penny for most crates, up to $0.18 for a very large crate).
Rust Docs MCP Server FAQ
Do I need an OpenAI API key?
Yes. The server uses OpenAI's text-embedding-3-small model to generate embeddings and gpt-4o-mini-2024-07-18 to summarize answers. Provide the key via the OPENAI_API_KEY environment variable.
How much does it cost to run?
Only the first run for a given crate, version, and feature set incurs an OpenAI cost for generating embeddings — typically fractions of a US penny for most crates. The README notes that even a large crate like async-stripe (5000+ doc pages) cost about $0.18 USD during testing. Results are cached, so subsequent launches don't re-incur the cost.
Can one server handle multiple crates?
No — each server instance targets a single crate, specified by a Cargo Package ID (e.g. `serde@^1.0`). To cover several crates, configure multiple server instances, each with its own entry in your MCP client's mcpServers config.
How do I enable crate features needed for cargo doc?
Pass the -F or --features flag with a comma-separated list, e.g. `rustdocs_mcp_server "async-stripe@0.40" -F runtime-tokio-hyper-rustls`. The cache is keyed by feature set, so different feature combinations are cached separately.
Where is data cached?
In the XDG data directory, typically under ~/.local/share/rustdocs-mcp-server/<crate_name>/<version>/<features_hash>/embeddings.bin, serialized with bincode. If the cache is missing or corrupted it is regenerated automatically.
Alternatives to Rust Docs MCP Server
Compare all alternatives →Microsoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).
Up-to-date, version-specific library documentation injected into your coding agent.
LSP-powered coding agent toolkit: semantic symbol search, references and structural edits.
Compare Rust Docs MCP Server with: