Rust Docs MCP server

Integrates with Rust documentation from docs.rs, enabling search for crates, retrieval of documentation, type information, feature flags, versions, and source code for Rust projects.
Back to servers
Provider
laptou
Release date
Feb 27, 2025
Language
TypeScript
Stats
16 stars

This MCP server provides access to Rust documentation from docs.rs, enabling AI tools to search for documentation, type information, feature flags, version numbers, and symbol definitions/source code.

Installation

This server can be installed and run using either Bun or Node.js.

# Clone the repository
git clone https://github.com/yourusername/rust-docs-mcp-server.git
cd rust-docs-mcp-server

# Install dependencies
bun install

Building the Server

Before running the server, you need to build it:

# Build the server
bun run build

This creates a build directory containing the compiled JavaScript files.

Running the Server

You can run the server in development mode or use the built version:

# Run the development server
bun run dev

# Or run the built server
bun run start

Using the MCP Server

This server implements the Model Context Protocol and can be integrated with any MCP client. You'll need to configure your MCP client to connect to this server.

Available Tools

The server provides several tools for accessing Rust documentation:

  • search_crates: Search for crates on docs.rs
  • get_crate_documentation: Get documentation for a specific crate
  • get_type_info: Get type information for a specific item
  • get_feature_flags: Get feature flags for a crate
  • get_crate_versions: Get available versions for a crate
  • get_source_code: Get source code for a specific item
  • search_symbols: Search for symbols within a crate

Example Usage

To use the tools, your MCP client needs to make requests to the server with the appropriate parameters. Each tool expects specific inputs:

  • For searching crates:

    {
      "tool": "search_crates",
      "parameters": {
        "query": "serde"
      }
    }
    
  • For getting crate documentation:

    {
      "tool": "get_crate_documentation",
      "parameters": {
        "crate_name": "serde",
        "version": "1.0.152"
      }
    }
    
  • For retrieving type information:

    {
      "tool": "get_type_info",
      "parameters": {
        "crate_name": "serde",
        "version": "1.0.152",
        "path": "serde::Serialize"
      }
    }
    

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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