Rust Analyzer Tools MCP server

Integrates with Rust Analyzer to provide type information, documentation, references, implementations, and Cargo commands for Rust development projects
Back to servers
Setup instructions
Provider
Benedikt Terhechte
Release date
Apr 08, 2025
Language
Rust
Stats
73 stars

Cursor Rust Tools provides a Model Context Protocol (MCP) server that enhances AI interactions with Rust code by giving LLMs access to Rust Analyzer, crate documentation, and Cargo commands. This allows AI assistants to work more effectively with Rust codebases by accessing type information and up-to-date documentation.

Features

  • Access documentation for crates or specific symbols
  • Retrieve type information and descriptions for symbols
  • Get references to symbols across your codebase
  • View implementations of symbols
  • Find types by name in your project
  • Run and view results from cargo test and cargo check

Installation

You can install Cursor Rust Tools directly from GitHub using Cargo:

cargo install --git https://github.com/terhechte/cursor-rust-tools

Running the Server

With UI (Recommended)

To run with the graphical user interface:

cursor-rust-tools

The UI allows you to add projects, install the required MCP configuration, and monitor server activity.

Without UI

If you've already configured your projects, you can run without the UI:

cursor-rust-tools --no-ui

Configuration

Using the UI

The simplest way to configure the tool is through the UI that appears when you run cursor-rust-tools.

Manual Configuration

Alternatively, you can manually create a configuration file at ~/.cursor-rust-tools:

[[projects]]
root = "/Users/username/Developer/Rust/example1"
ignore_crates = []

[[projects]]
root = "/Users/username/Developer/Rust/example2"
ignore_crates = ["large_crate_to_ignore"]

The ignore_crates parameter lets you specify crate dependencies that should not be indexed for documentation, which can be useful for very large dependencies.

Setting Up Cursor to Use the Tools

  1. Add the MCP configuration file: Add a mcp.json file to your project's .cursor directory. The UI has a button to do this for you, or the CLI will show the contents when running without UI.

  2. Enable in Cursor: After saving the file, Cursor will detect the new MCP server and prompt you to enable it via a dialog in the bottom right corner.

  3. Verify settings: Check Cursor's MCP settings to confirm proper configuration.

  4. Use in Agent Mode: Make sure "Agent Mode" is selected in your current chat. You can then ask the AI to use one of the new tools, such as the cargo_check tool.

Usage Examples

Accessing Crate Documentation

You can ask the AI to retrieve documentation for a specific crate or symbol:

  • "Show me the documentation for tokio::spawn"
  • "What does serde_json::from_str do?"

Getting Type Information

Request type information for symbols in your code:

  • "What is the type of variable client in src/main.rs?"
  • "Show me the hover information for the process_data function"

Running Cargo Commands

Have the AI run and analyze cargo commands:

  • "Run cargo check and tell me if there are any errors"
  • "Execute cargo test and summarize the results"

Finding Implementations

Request implementation details:

  • "Show me the implementation of the trait Display for my CustomType"
  • "Find all references to the handle_request function in my project"

The tools integrate directly with Cursor's AI assistant, allowing it to provide more accurate and up-to-date information when helping with Rust development.

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 "cursor-rust-tools" '{"command":"cursor-rust-tools","args":[]}'

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": {
        "cursor-rust-tools": {
            "command": "cursor-rust-tools",
            "args": []
        }
    }
}

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": {
        "cursor-rust-tools": {
            "command": "cursor-rust-tools",
            "args": []
        }
    }
}

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