rust-cargo-docs-rag-mcp is an MCP (Model Context Protocol) server that provides tools for Rust crate documentation lookup. It allows LLMs to look up documentation for Rust crates they are unfamiliar with. This README focuses on how to build, version, release, and install the project using two common paths: 1. pkgx (build/install locally from source) 2. Docker image (published to GitHub Container R
Add this skill
npx mdskills install promptexecution/cratedocs-mcpComprehensive MCP server for Rust crate documentation with excellent multi-deployment support
rust-cargo-docs-rag-mcp is an MCP (Model Context Protocol) server that provides tools for Rust crate documentation lookup. It allows LLMs to look up documentation for Rust crates they are unfamiliar with.
This README focuses on how to build, version, release, and install the project using two common paths:
git clone https://github.com/promptexecution/rust-cargo-docs-rag-mcp.git
cd rust-cargo-docs-rag-mcp
cargo build --release
cargo install --path .
# Or install the pkgx-managed binary and check its version
just install-pkgx
The repository includes a mini pkgx pantry so you can build and run the CLI through pkgx without touching your global toolchain:
git clone https://github.com/promptexecution/rust-cargo-docs-rag-mcp.git
cd rust-cargo-docs-rag-mcp
export PKGX_PANTRY_PATH=$PWD/pkgx
export PKGX_PANTRY_DIR=$PWD/pkgx # pkgx^2 compatibility
pkgx cratedocs version
pkgx will download the tagged source tarball, compile cratedocs with the required Rust toolchain, and cache the result for subsequent runs. Once you're ready to upstream this package to the central pkgx pantry, copy pkgx/projects/github.com/promptexecution/rust-cargo-docs-rag-mcp/package.yml into a new PR there.
This repository is wired to Cocogitto via cog.toml. Typical flow to create a release:
Install Cocogitto (once)
cargo install cocogitto
Bump the version / create the tag from main (on your machine):
git checkout main
git pull origin main
cog bump patch
# or `cog bump minor` / `cog bump major`
cog bump runs the pre_bump_hooks/post_bump_hooks defined in cog.toml.vX.Y.Z.Push commit + tag to GitHub:
git push --follow-tags origin main
When the tag is pushed, the Release & Publish (GHCR) workflow will run:
Repository requirements:
main is the branch you want cog to operate from (cog.toml has branch_whitelist = ["main"] by default).Prebuilt images are published to GitHub Container Registry (GHCR) on release tags.
Pull the image (replace OWNER with the GH org or username that owns the repo; tags look like v0.3.1):
docker pull ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest
# or a specific version:
docker pull ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:v0.3.1
Run the container in HTTP mode (default):
docker run --rm -p 8080:8080 ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest
Run in stdio mode:
docker run --rm -e CRATEDOCS_MODE=stdio -i ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest
You can also build and run the server in an Alpine-based container. Prebuilt images are automatically published to GHCR via .github/workflows/docker.yml:
docker pull ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest
To build locally (useful before pushing to another registry):
# Build the image (adjust the tag to match your registry)
docker build -t promptexecution/rust-cargo-docs-rag-mcp .
# Run HTTP/SSE mode on port 8080
docker run --rm -p 8080:8080 promptexecution/rust-cargo-docs-rag-mcp
Configuration is controlled through environment variables:
CRATEDOCS_MODE (default http): switch to stdio to expose the stdio MCP serverCRATEDOCS_ADDRESS (default 0.0.0.0:8080): bind the HTTP server to a specific interface/portCRATEDOCS_DEBUG (default false): set to true to enable verbose logging in HTTP modeAll additional arguments appended to docker run ... -- are forwarded to the underlying cratedocs process.
CRATEDOCS_MODE (default: http) — set to stdio to run the stdio MCP serverCRATEDOCS_ADDRESS (default: 0.0.0.0:8080) — bind address for HTTP modeCRATEDOCS_DEBUG (default: false) — set to true to enable debug loggingYou can also pass custom arguments directly to the cratedocs binary:
docker run --rm -p 3000:3000 ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest \
http --address 0.0.0.0:3000 --debug
pkgx is a universal package manager that can build and run this project without requiring a system-wide Rust installation:
# Install using pkgx (automatically handles Rust dependencies)
pkgx install
# Or build directly with pkgx
pkgx +rust +cargo cargo build --release
# Run without installing
pkgx +rust +cargo cargo run --bin cratedocs -- stdio
The project includes a package.yml file for pkgx integration, making it easy to build and test across different environments.
git clone https://github.com/promptexecution/rust-cargo-docs-rag-mcp.git
cd rust-cargo-docs-rag-mcp
cargo build --release
cargo install --path .
After installation, you can run:
# STDIN/STDOUT mode
cratedocs stdio
# HTTP/SSE mode
cratedocs http --address 127.0.0.1:8080
# With debug logging
cratedocs http --address 127.0.0.1:8080 --debug
The server provides the following tools via the MCP protocol:
lookup_crateRetrieves documentation for a specified Rust crate.
Parameters:
crate_name (required): The name of the crate to look upversion (optional): The version of the crate (defaults to latest)Example:
{
"name": "lookup_crate",
"arguments": {
"crate_name": "tokio",
"version": "1.28.0"
}
}
search_cratesSearches for Rust crates on crates.io.
Parameters:
query (required): The search querylimit (optional): Maximum number of results to return (defaults to 10, max 100)Example:
{
"name": "search_crates",
"arguments": {
"query": "async runtime",
"limit": 5
}
}
lookup_itemRetrieves documentation for a specific item in a crate.
Parameters:
crate_name (required): The name of the crateitem_path (required): Path to the item (e.g., 'std::vec::Vec')version (optional): The version of the crate (defaults to latest)Example:
{
"name": "lookup_item",
"arguments": {
"crate_name": "serde",
"item_path": "serde::Deserialize",
"version": "1.0.160"
}
}
list_crate_itemsEnumerates all items in a specified Rust crate and version, optionally filtering by item type, visibility, or module path.
Parameters:
crate_name (required): The name of the crateversion (required): The version of the crateitem_type (optional): Filter by item type (struct, enum, trait, fn, macro, mod)visibility (optional): Filter by visibility (pub, private)module (optional): Filter by module path (e.g., serde::de)Example:
{
"name": "list_crate_items",
"arguments": {
"crate_name": "serde",
"version": "1.0.0",
"item_type": "struct"
}
}
You can directly test the documentation tools from the command line without starting a server:
# Get help for the test command
cargo run --bin cratedocs test --tool help
# Enumerate crate items
cargo run --bin cratedocs test --tool list_crate_items --crate-name serde --version 1.0.0 --item-type struct
# Look up crate documentation
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio
# Look up item documentation
cargo run --bin cratedocs test --tool lookup_item --crate-name tokio --item-path sync::mpsc::Sender
# Search for crates
cargo run --bin cratedocs test --tool search_crates --query logger --limit 5
# Output in different formats (markdown, text, json)
cargo run --bin cratedocs test --tool search_crates --query logger --format json
# Summarize output (strip LICENSE and VERSION sections, limit tokens)
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio --tldr --max_tokens 48000
This server implements the Model Context Protocol (MCP) which allows it to be easily integrated with LLM clients that support the protocol. For more information about MCP, visit the MCP repository.
# compile & install cratedocs in ~/.cargo/bin
cargo install --path .
in mcp_settings.json:
{
"mcpServers":{
"rust-crate-local": {
"command": "cratedocs",
"args": [
"stdio"
]
}
}
}
{
"mcpServers":{
"rust-crate-docs": {
"command": "bunx",
"args": [
"-y",
"mcp-remote@latest",
"http://127.0.0.1:3000/sse?sessionId=",
"--allow-http",
"--transport sse-only",
"--debug"
]
}
}
}
You can use the Docker image directly in your MCP configuration:
{
"mcpServers": {
"rust-crate-docs-docker": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest",
"stdio"
]
}
}
}
Or if you want to run the HTTP/SSE server in Docker and connect via mcp-remote:
# Start the HTTP server in Docker
docker run --rm -p 8080:8080 ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:latest
Then in mcp_settings.json:
{
"mcpServers": {
"rust-crate-docs-docker-http": {
"command": "bunx",
"args": [
"-y",
"mcp-remote@latest",
"http://localhost:8080/sse",
"--allow-http",
"--transport", "sse-only"
]
}
}
}
If you have pkgx installed, you can run the server without a system-wide Rust installation:
{
"mcpServers": {
"rust-crate-docs-pkgx": {
"command": "pkgx",
"args": [
"+rust",
"+cargo",
"cargo",
"run",
"--manifest-path",
"/path/to/rust-cargo-docs-rag-mcp/Cargo.toml",
"--bin",
"cratedocs",
"--",
"stdio"
]
}
}
}
Or use pkgx to install and run directly:
# Clone and install with pkgx
git clone https://github.com/promptexecution/rust-cargo-docs-rag-mcp.git
cd rust-cargo-docs-rag-mcp
pkgx +rust +cargo cargo install --path .
Then reference it normally in mcp_settings.json:
{
"mcpServers": {
"rust-crate-docs": {
"command": "cratedocs",
"args": ["stdio"]
}
}
}
For detailed versioning and release instructions (including the Cocogitto workflow), see the Release / Versioning workflow (maintainers) section above.
This repository includes a cog.toml profile wired to scripts/set-version.sh so Cocogitto can bump the crate version and regenerate the changelog automatically.
Typical release flow:
cargo install cocogitto (once)cog bump minor (or patch/major) – this updates Cargo.toml, Cargo.lock, and CHANGELOG.mdSee CHANGELOG.md for the latest published versions.
MIT License
This fork builds on the original d6e/cratedocs-mcp work by:
stdio and HTTP/SSE launch modeslist_crate_items tool surfaceIf you decide to keep these changes upstream, could you please add a short linkback to promptexecution/rust-cargo-docs-rag-mcp in your README? That attribution helps other developers understand where this MCP-focused variant originated and makes it easier for them to follow improvements across both projects.
Install via CLI
npx mdskills install promptexecution/cratedocs-mcpRust Cargo Docs RAG MCP is a free, open-source AI agent skill. rust-cargo-docs-rag-mcp is an MCP (Model Context Protocol) server that provides tools for Rust crate documentation lookup. It allows LLMs to look up documentation for Rust crates they are unfamiliar with. This README focuses on how to build, version, release, and install the project using two common paths: 1. pkgx (build/install locally from source) 2. Docker image (published to GitHub Container R
Install Rust Cargo Docs RAG MCP with a single command:
npx mdskills install promptexecution/cratedocs-mcpThis downloads the skill files into your project and your AI agent picks them up automatically.
Rust Cargo Docs RAG MCP works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Gemini Cli, Amp, Roo Code, Goose. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.