CrateDocs MCP

CrateDocs MCP

MCP server for Rust crate documentation lookup and search

9
Stars
2
Forks
9
Watchers
0
Issues
CrateDocs MCP is an MCP (Model Context Protocol) server designed to provide AI models with access to Rust crate documentation. It enables lookup of crate-level and item-level documentation, as well as efficient searching of Rust crates on crates.io. The system supports various server modes, offers multiple output formats, and includes features for both developers and large language models.

Key Features

Lookup Rust crate documentation
Search for crates on crates.io with keywords
Retrieve item-specific documentation within a crate
Support for multiple output formats (markdown, text, JSON)
HTTP/SSE and STDIN/STDOUT server modes
Command-line testing of documentation tools
Customizable search limits and filtering
Summarization with token limits
Output saving to files
Contextual tools for LLM integration

Use Cases

Providing LLMs with contextual Rust documentation during code generation
Automating crate and item documentation lookup for developer tools
Building AI assistants that support Rust programming queries
Integrating with IDEs for on-demand Rust documentation retrieval
Augmenting code review bots with contextual documentation awareness
Supporting documentation search in chat-based programming assistants
Generating summarized Rust crate documentation for quick reference
Scripting automated crate searches and metadata retrieval
Custom documentation retrieval workflows for Rust projects
Enhancing developer platforms with seamless Rust doc lookups

README

CrateDocs MCP

This 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.

Features

  • Lookup crate documentation: Get general documentation for a Rust crate
  • Search crates: Search for crates on crates.io based on keywords
  • Lookup item documentation: Get documentation for a specific item (e.g., struct, function, trait) within a crate

Installation

bash
git clone https://github.com/promptexecution/cratedocs-mcp.git
cd cratedocs-mcp
cargo build --release
cargo install --path .

Running the Server

There are multiple ways to run the documentation server:

Using the Unified CLI

The unified command-line interface provides subcommands for all server modes:

bash
# Run in STDIN/STDOUT mode
cargo run --bin cratedocs stdio

# Run in HTTP/SSE mode (default address: 127.0.0.1:8080)
cargo run --bin cratedocs http

# Run in HTTP/SSE mode with custom address
cargo run --bin cratedocs http --address 0.0.0.0:3000

# Enable debug logging
cargo run --bin cratedocs http --debug

Directly Testing Documentation Tools

You can directly test the documentation tools from the command line without starting a server:

bash
# Get help for the test command
cargo run --bin cratedocs test --tool help

# Enumerate crate items (step by step)
cargo run --bin cratedocs test --tool list_crate_items --crate-name serde --version 1.0.0 --item-type struct
cargo run --bin cratedocs test --tool list_crate_items --crate-name tokio --version 1.28.0 --visibility pub --module tokio::sync

# 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

# Look up documentation for a specific version
cargo run --bin cratedocs test --tool lookup_item --crate-name serde --item-path Serialize --version 1.0.147

# Look up a trait in a crate (e.g., the Serialize trait in serde) & a specific version
cargo run --bin cratedocs test --tool lookup_item --crate-name serde --item-path serde::Serialize --version 1.0.160

# 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
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio --format text

# Save output to a file
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio --output tokio-docs.md

# Summarize output by stripping LICENSE and VERSION sections, limits to xxxxx tokens (uses huggingface tokenizer)
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio --tldr --max_tokens 48000



By default, the HTTP server will listen on http://127.0.0.1:8080/sse.

Available Tools

The server provides the following tools:

1. lookup_crate

Retrieves documentation for a specified Rust crate.

Parameters:

  • crate_name (required): The name of the crate to look up
  • version (optional): The version of the crate (defaults to latest)

Example:

json
{
  "name": "lookup_crate",
  "arguments": {
    "crate_name": "tokio",
    "version": "1.28.0"
  }
}

2. search_crates

Searches for Rust crates on crates.io.

Parameters:

  • query (required): The search query
  • limit (optional): Maximum number of results to return (defaults to 10, max 100)

Example:

json
{
  "name": "search_crates",
  "arguments": {
    "query": "async runtime",
    "limit": 5
  }
}

3. lookup_item

Retrieves documentation for a specific item in a crate.

Parameters:

  • crate_name (required): The name of the crate
  • item_path (required): Path to the item (e.g., 'std::vec::Vec')
  • version (optional): The version of the crate (defaults to latest)

Example:

json
{
  "name": "lookup_item",
  "arguments": {
    "crate_name": "serde",
    "item_path": "serde::Deserialize",
    "version": "1.0.160"
  }
}

Implementation Notes

  • The server includes a caching mechanism to prevent redundant API calls for the same documentation
  • It interfaces with docs.rs for crate documentation and crates.io for search functionality
  • Results are returned as plain text/HTML content that can be parsed and presented by the client

MCP Protocol Integration

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.

Vscode MCP, RooCode local example

bash
# compile & install cratedocs in ~/.cargo/bin
cargo install --path . 

in mcp_settings.json

json
{
  "mcpServers":{
    "rust-crate-local": {
      "command": "cratedocs",
      "args": [
        "stdio"
      ],
    }    
  }
}

VScode MCP, RooCode hosted example

json
// Roo Code, use bunx or npx, sessionId= 
{
  "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"
      ]
    }
  }
}

4. list_crate_items

Enumerates all items in a specified Rust crate and version, optionally filtering by item type, visibility, or module path. Useful for exploring crate structure, generating concise listings for LLMs, or programmatically analyzing crate APIs.

Parameters:

  • crate_name (required): The name of the crate
  • version (required): The version of the crate
  • item_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:

json
{
  "name": "list_crate_items",
  "arguments": {
    "crate_name": "serde",
    "version": "1.0.0",
    "item_type": "struct"
  }
}

Example Output (stub):

Stub: list_crate_items for crate: serde, version: 1.0.0, filters: Some(ItemListFilters { item_type: Some("struct"), visibility: None, module: None })

When implemented, the output will be a structured list of items matching the filters.

License

MIT License

Star History

Star History Chart

Repository Owner

PromptExecution
PromptExecution

Organization

Repository Details

Language Rust
Default Branch main
Size 96 KB
Contributors 3
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Rust
99.56%
Just
0.44%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • MCP Language Server

    MCP Language Server

    Bridge codebase navigation tools to AI models using MCP-enabled language servers.

    MCP Language Server implements the Model Context Protocol, allowing MCP-enabled clients, such as LLMs, to interact with language servers for codebase navigation. It exposes standard language server features—like go to definition, references, rename, and diagnostics—over MCP for seamless integration with AI tooling. The server supports multiple languages by serving as a proxy to underlying language servers, including gopls, rust-analyzer, and pyright.

    • 1,256
    • MCP
    • isaacphi/mcp-language-server
  • godoc-mcp-server

    godoc-mcp-server

    Provides Go package documentation from pkg.go.dev to LLMs as an MCP server.

    godoc-mcp-server enables searching Golang packages and obtains their documentation from pkg.go.dev, serving the information to language models via the Model Context Protocol. Communication occurs over standard input/output, supporting efficient retrieval of package information, including support for subpackages and usage instructions. The tool includes local caching and features tailored to LLM integration scenarios.

    • 32
    • MCP
    • yikakia/godoc-mcp-server
  • Raindrop.io MCP Server

    Raindrop.io MCP Server

    Enable LLMs to manage and search Raindrop.io bookmarks via the Model Context Protocol.

    Raindrop.io MCP Server is an integration that allows large language models to interact with Raindrop.io bookmarks using the Model Context Protocol. It provides tools to create and search bookmarks, including filtering by tags, and is designed for interoperability with environments like Claude for Desktop. Installation can be done via Smithery or manually, and configuration is managed through environment variables. The project is open source and optimized for secure, tokenized access to Raindrop.io.

    • 63
    • MCP
    • hiromitsusasaki/raindrop-io-mcp-server
  • RAG Documentation MCP Server

    RAG Documentation MCP Server

    Vector-based documentation search and context augmentation for AI assistants

    RAG Documentation MCP Server provides vector-based search and retrieval tools for documentation, enabling large language models to reference relevant context in their responses. It supports managing multiple documentation sources, semantic search, and real-time context delivery. Documentation can be indexed, searched, and managed with queueing and processing features, making it highly suitable for AI-driven assistants. Integration with Claude Desktop and support for Qdrant vector databases is also available.

    • 238
    • MCP
    • hannesrudolph/mcp-ragdocs
  • solscan-mcp

    solscan-mcp

    A Rust-based MCP server for querying Solscan Pro API on Solana blockchain data.

    solscan-mcp provides a Model Context Protocol (MCP) server that interfaces with the Solscan Pro API to deliver blockchain data from the Solana network. Built in Rust, it allows querying of token information, account activities, and transactions, and is designed for easy integration with language models. The tool supports context-driven investigations by leveraging AI to analyze and report on blockchain wallet behaviors using customized context inputs.

    • 32
    • MCP
    • wowinter13/solscan-mcp
  • godoc-mcp

    godoc-mcp

    Token-efficient Go documentation server for LLMs using Model Context Protocol.

    godoc-mcp is a Model Context Protocol (MCP) server that provides efficient, structured access to Go package documentation for large language models. It enables LLMs to understand Go projects without reading entire source files by supplying essential documentation and source code at varying levels of granularity. The tool supports project navigation, automatic module setup, caching, and works offline for both standard and third-party Go packages.

    • 88
    • MCP
    • mrjoshuak/godoc-mcp
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results