cargo doc mcp
A server for managing Rust documentation that enables users to check, build, and search Rust documentation locally through cargo doc commands.
A server for managing Rust documentation that enables users to check, build, and search Rust documentation locally through cargo doc commands.
A MCP server for managing Rust documentation through cargo doc commands. This server provides tools to check, build, and search Rust documentation locally.
get_crate_doc
- Get crate's main documentation page for understanding overall concepts and usage
Parameters:
project_path
: Path to the Rust project (must be absolute path)crate_name
: Name of the crate to get documentation forlist_symbols
- List all symbols (structs, enums, traits, etc.) in a crate's documentation
Parameters:
project_path
: Path to the Rust project (must be absolute path)crate_name
: Name of the crate to list symbols forsearch_doc
- Search within a crate's documentation
project_path
: Path to the Rust project (must be absolute path)crate_name
: Name of the crate to search inquery
: Search query (keyword or symbol)limit
(optional): Maximum number of results to return (default: 10)Install dependencies:
pnpm install
Build the server:
pnpm run build
For development with auto-rebuild:
pnpm run watch
Add the following configuration:
{
"mcpServers": {
"docs-rs-mcp": {
"command": "/absolute/path/to/docs-rs-mcp/build/index.js"
}
}
}
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector:
pnpm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
The server maintains a cache of built documentation paths to improve performance. Cache entries expire after 24 hours to ensure documentation stays up-to-date.
MIT
[
{
"description": "Get crate's main documentation page. Useful for unresolved imports (e.g. use get_crate_doc when seeing 'unresolved import tokio::sync') or understanding crate features.",
"inputSchema": {
"properties": {
"crate_name": {
"description": "Name of the crate to get documentation for",
"type": "string"
},
"project_path": {
"description": "Path to the Rust project (must be absolute path)",
"type": "string"
}
},
"required": [
"project_path",
"crate_name"
],
"type": "object"
},
"name": "get_crate_doc"
},
{
"description": "List all symbols in a crate. Use when implementing traits or exploring available types. Shows structs, enums, traits with their paths.",
"inputSchema": {
"properties": {
"crate_name": {
"description": "Name of the crate to list symbols for",
"type": "string"
},
"project_path": {
"description": "Path to the Rust project (must be absolute path)",
"type": "string"
}
},
"required": [
"project_path",
"crate_name"
],
"type": "object"
},
"name": "list_symbols"
},
{
"description": "Search crate docs for specific features, error messages, or usage examples. Helps debug compilation issues or learn new APIs.",
"inputSchema": {
"properties": {
"crate_name": {
"description": "Name of the crate to search in",
"type": "string"
},
"project_path": {
"description": "Path to the Rust project (must be absolute path)",
"type": "string"
},
"query": {
"description": "Search query (keyword or symbol)",
"type": "string"
}
},
"required": [
"project_path",
"crate_name",
"query"
],
"type": "object"
},
"name": "search_doc"
}
]