Get the FREE Ultimate OpenClaw Setup Guide →

rust-docs

MCP server for agents to explore rust docs, analyze source code, and build with confidence

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio snowmead-rust-docs-mcp rust-docs-mcp

How to use

The rust-docs-mcp server provides comprehensive access to Rust crate documentation, source analysis, dependency trees, and module structure visualization. It enables agents to explore crate internals, fetch complete rustdoc documentation, and perform offline caching for reliable usage. Core capabilities include documentation search and item inspection (signatures, fields, methods, and docs), access to source code with contextual lines, and detailed dependency trees. It also supports workspace analysis for Cargo workspaces and generates a hierarchical module structure via cargo-modules integration. Use the server to cache crates from crates.io or GitHub, query items by pattern or path, and inspect either individual crates or entire workspaces to equip AI agents with precise, offline knowledge about Rust projects.

How to install

Prerequisites:

  • Rust toolchain (recommended stable for most users; nightly is needed if you plan to generate Rustdoc JSON during build).
  • Internet access to fetch crates from crates.io and GitHub during initial caching.

Installation steps (one of the following):

Option A: Quick install (recommended)

  • Run the installer script directly to install the binary:
curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash

Option B: Custom install directory

curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash -s -- --install-dir /usr/local/bin

Option C: Build from source

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

Option D: Cargo install (if you have cargo available)

cargo install rust-docs-mcp

CLI usage examples:

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

Troubleshooting:

  • Run the doctor command to diagnose common problems:
rust-docs-mcp doctor
  • Ensure Rust toolchain is installed (and nightly if you are generating Rustdoc JSON during builds).
  • Verify network access for initial crate caching and any GitHub authentication you may require.

Additional notes

Environment considerations and tips:

  • Cache directory: Crates are cached under the default path (e.g., ~/.rust-docs-mcp/cache/). You can customize it via the --cache-dir option or the RUST_DOCS_MCP_CACHE_DIR environment variable.
  • GitHub authentication: If you need higher rate limits or access to private repositories, set the GITHUB_TOKEN environment variable. This helps when caching private crates or performing bulk metadata queries.
  • Crate metadata and workspace handling: Single crates store docs.json and dependencies.json at the top level, while workspace crates place per-member data under members/{member-name}/ with docs.json, dependencies.json, and metadata.json. This affects how you navigate and cache large workspaces.
  • Rustdoc generation requirements: Building from source may require the nightly toolchain for Rustdoc JSON generation. Use rustup toolchain install nightly if you plan to generate documentation from source.

Related MCP Servers

Sponsor this space

Reach thousands of developers