Skip to main content
Glama
Cargo Doc MCP Server

Cargo Doc MCP Server

by spacemeowx2

cargo doc MCP Server

A MCP server for managing Rust documentation through cargo doc commands. This server provides tools to check, build, and search Rust documentation locally.

Features

Tools

  • 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 for

  • list_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 for

  • search_doc - Search within a crate's documentation

    • Parameters:

      • project_path: Path to the Rust project (must be absolute path)

      • crate_name: Name of the crate to search in

      • query: Search query (keyword or symbol)

      • limit (optional): Maximum number of results to return (default: 10)

Related MCP server: MCP Rust Docs Server

Requirements

  • Node.js 16 or later

  • Rust and Cargo installed

Installation

Install dependencies:

pnpm install

Build the server:

pnpm run build

For development with auto-rebuild:

pnpm run watch

Usage

Add the following configuration:

{
  "mcpServers": {
    "docs-rs-mcp": {
      "command": "/absolute/path/to/docs-rs-mcp/build/index.js"
    }
  }
}

Debugging

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.

Cache System

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.

License

MIT

Available Tools

3 tools
get_crate_docA

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.

Inputs: project_path (required), crate_name (required).

list_symbolsB

List all symbols in a crate. Use when implementing traits or exploring available types. Shows structs, enums, traits with their paths.

Inputs: project_path (required), crate_name (required).

search_docB

Search crate docs for specific features, error messages, or usage examples. Helps debug compilation issues or learn new APIs.

Inputs: project_path (required), crate_name (required), query (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: get_crate_doc retrieves main documentation pages, list_symbols enumerates all symbols in a crate, and search_doc performs targeted searches within documentation. There is no overlap in functionality, making it easy for an agent to select the appropriate tool based on the task.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (get_crate_doc, list_symbols, search_doc) with clear, descriptive verbs. There are no deviations in naming conventions, making the tool set predictable and easy to understand.

    Tool Count3/5

    With only 3 tools, the server feels somewhat thin for a documentation-focused domain, as it might lack operations like updating or managing documentation. However, the tools cover core use cases, so it's borderline but not severely mismatched.

    Completeness4/5

    The tools provide good coverage for basic documentation tasks: retrieving main docs, listing symbols, and searching. Minor gaps exist, such as no direct support for navigating between documentation sections or handling version-specific docs, but agents can likely work around these limitations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers