by snowmead
MCP server for agents to explore rust docs, analyze source code, and build with confidence
# Add to your Claude Code skills
git clone https://github.com/snowmead/rust-docs-mcpRust is the language of AI
An MCP (Model Context Protocol) server that provides comprehensive access to Rust crate documentation, source code analysis, dependency trees, and module structure visualization. Built for agents to gain quality insights into Rust projects and build with confidence.
This is an entirely vibe coded project and was created as an experiment to see if LLMs can build a fully functional tool without human oversight.
The rise of AI agents has revolutionized software development, with new tools and libraries emerging at an unprecedented pace. However, this rapid evolution creates a critical challenge: agents cannot reliably build with tools they weren't trained on.
When an agent tries to use a new Rust crate:
No comments yet. Be the first to share your thoughts!
This leads to frustrated developers watching their agents fail repeatedly, guessing at APIs, and producing broken code.
This MCP server gives agents the tools they need to truly understand Rust crates:
With these capabilities, agents can build confidently with any Rust crate — even ones released yesterday.
cache_crate - Download and cache a crate from various sources. Set
source_type to one of: cratesio, github, or local
version (e.g., {crate_name: "serde", source_type: "cratesio", version: "1.0.215"})github_url and either branch OR tag (e.g., {crate_name: "my-crate", source_type: "github", github_url: "https://github.com/user/repo", tag: "v1.0.0"})path, optional version (e.g., {crate_name: "my-crate", source_type: "local", path: "~/projects/my-crate"})remove_crate - Remove cached crate versions to free disk spacelist_cached_crates - View all cached crates with versions and sizeslist_crate_versions - List cached versions for a specific crateget_crates_metadata - Batch metadata queries for multiple crateslist_crate_items - Browse all items in a crate with optional filteringsearch_items - Full search with complete documentation (may hit token
limits)search_items_preview - Lightweight search returning only IDs, names, and
typesget_item_details - Detailed information about specific items (signatures,
fields, etc.)get_item_docs - Extract just the documentation string for an itemget_item_source - View source code with configurable context linesget_dependencies - Analyze direct and transitive dependencies with filteringstructure - Generate hierarchical module tree using integrated cargo-modulessearch_items_fuzzy - Fuzzy search with typo tolerance and semantic
similarityBy default, crates are cached in ~/.rust-docs-mcp/cache/. You can customize
this location using:
# Command line option
rust-docs-mcp --cache-dir /custom/path/to/cache
# or set the environment variable
export RUST_DOCS_MCP_CACHE_DIR=/custom/path/to/cache
rust-docs-mcp
To access private repositories or increase GitHub API rate limits, set the
GITHUB_TOKEN environment variable:
export GITHUB_TOKEN=your_github_personal_access_token
Benefits of authentication:
source/ directorymetadata.jsonmembers/ directory:
members/{member-name}/docs.json - Rustdoc JSON documentationmembers/{member-name}/dependencies.json - Cargo dependency metadatamembers/{member-name}/metadata.json - Member-specific cache metadatadocs.json - Rustdoc JSON documentationdependencies.json - Cargo dependency metadatacurl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash
curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash
curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash -s -- --install-dir /usr/local/bin
cargo install rust-docs-mcp
Rust nightly toolchain (for Rustdoc JSON generation)
rustup toolchain install nightly
Runtime prefers nightly-2025-06-24 because it matches the rustdoc JSON
schema used by rustdoc-types, but it will fall back to nightly when that
toolchain produces the same JSON format version. You can override the choice
with:
export RUST_DOCS_MCP_TOOLCHAIN=nightly
Network access to download crates from crates.io
git clone https://github.com/snowmead/rust-docs-mcp
cd rust-docs-mcp/rust-docs-mcp
cargo build --release
./target/release/rust-docs-mcp install
rust-docs-mcp # Start MCP server
rust-docs-mcp install # Install to ~/.local/bin
rust-docs-mcp install --force # Force overwrite existing installation
rust-docs-mcp doctor # Verify system environment and dependencies
rust-docs-mcp doctor --json # Output diagnostic results in JSON format
rust-docs-mcp update # Update to latest version from GitHub
rust-docs-mcp --help # Show help
If you encounter issues during installation or runtime, run the doctor command to diagnose common problems:
rust-docs-mcp doctor
The doctor command checks:
For programmatic integration, use --json flag to get structured output.
Add the server to your MCP configuration:
{
"rust-docs": {
"command": "/path/to/rust-docs-mcp/target/release/rust-docs-mcp",
"transport": "stdio"
}
}