docs.rs MCP server

Provides access to Rust crate documentation from docs.rs by fetching and parsing rustdoc JSON data with caching support for exploring modules, structs, enums, traits, and functions.
Back to servers
Setup instructions
Provider
Marius Modlich
Release date
Jun 17, 2025
Language
Python
Stats
5 stars

The MCP Rust Docs Server provides access to Rust crate documentation from docs.rs using the rustdoc JSON API. It implements the Model Context Protocol (MCP) to make Rust documentation easily accessible to language models and tools that support the MCP standard.

Installation

Using Pre-built Executables

Download the latest release for your platform from the Releases page:

Linux

# For Ubuntu, Debian, Fedora, etc.
wget https://github.com/vexxvakan/mcp-docsrs/releases/latest/download/mcp-docsrs-linux-x64
chmod +x mcp-docsrs-linux-x64

macOS

# For Apple Silicon Macs
wget https://github.com/vexxvakan/mcp-docsrs/releases/latest/download/mcp-docsrs-darwin-arm64
chmod +x mcp-docsrs-darwin-arm64

Windows

Download mcp-docsrs-windows-x64.exe directly from the releases page.

Using Docker

# Pull the latest image
docker pull ghcr.io/vexxvakan/mcp-docsrs:latest

# Run the server
docker run --rm -i ghcr.io/vexxvakan/mcp-docsrs:latest

Using Bun

bun install
bun run build:bytecode  # or bun run build:all for all platforms

Running the Server

Using Executable

# Show help
./mcp-docsrs --help

# Run with default settings
./mcp-docsrs

# Run with custom configuration
./mcp-docsrs --cache-ttl 7200000 --max-cache-size 200

Using npm or Bun

# Production mode
npm start
# or
bun start

# Development mode with hot reload
npm run dev
# or
bun run dev

Available Tools

lookup_crate_docs

Fetches comprehensive documentation for an entire Rust crate.

Parameters:

Parameter Type Required Description
crateName string Name of the Rust crate
version string Specific version or semver range (e.g., "1.0.0", "~4")
target string Target platform (e.g., "i686-pc-windows-msvc")
formatVersion string Rustdoc JSON format version

Example:

{
  "tool": "lookup_crate_docs",
  "arguments": {
    "crateName": "serde",
    "version": "latest"
  }
}

lookup_item_docs

Fetches documentation for a specific item within a crate.

Parameters:

Parameter Type Required Description
crateName string Name of the Rust crate
itemPath string Path to the item (e.g., "struct.MyStruct", "fn.my_function")
version string Specific version or semver range
target string Target platform

Example:

{
  "tool": "lookup_item_docs",
  "arguments": {
    "crateName": "tokio",
    "itemPath": "runtime.Runtime"
  }
}

search_crates

Search for Rust crates on crates.io with fuzzy/partial name matching.

Parameters:

Parameter Type Required Description
query string Search query for crate names (supports partial matches)
limit number Maximum number of results to return (default: 10)

Example:

{
  "tool": "search_crates",
  "arguments": {
    "query": "serde",
    "limit": 5
  }
}

Cache Resources

The server provides resources for querying and inspecting the cache database:

cache://stats

Returns cache statistics including total entries, size, and oldest entry.

cache://entries?limit={limit}&offset={offset}

Lists cached entries with metadata. Supports pagination.

cache://query?sql={sql}

Execute SQL queries on the cache database (SELECT queries only for safety).

cache://config

Returns the current server configuration including all runtime parameters.

Configuration

Configure the server using environment variables or command-line arguments:

Variable CLI Flag Default Description
CACHE_TTL --cache-ttl 3600000 Cache time-to-live in milliseconds
MAX_CACHE_SIZE --max-cache-size 100 Maximum number of cached entries
REQUEST_TIMEOUT --request-timeout 30000 HTTP request timeout in milliseconds
DB_PATH --db-path :memory: Path to SQLite database file

Example:

# Environment variables
CACHE_TTL=7200000 MAX_CACHE_SIZE=200 npm start

# Command-line arguments (executable)
./mcp-docsrs --cache-ttl 7200000 --max-cache-size 200

# Use persistent database to cache documentation between sessions
./mcp-docsrs --db-path ~/.mcp-docsrs

MCP Integration

Add to your MCP configuration file:

{
  "mcpServers": {
    "rust-docs": {
      "command": "/path/to/mcp-docsrs"
    }
  }
}

Or using Docker:

{
  "mcpServers": {
    "rust-docs": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "ghcr.io/vexxvakan/mcp-docsrs:latest"]
    }
  }
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "rust-docs" '{"command":"/path/to/mcp-docsrs"}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "rust-docs": {
            "command": "/path/to/mcp-docsrs"
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "rust-docs": {
            "command": "/path/to/mcp-docsrs"
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later