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.
cargo test
and cargo check
You can install Cursor Rust Tools directly from GitHub using Cargo:
cargo install --git https://github.com/terhechte/cursor-rust-tools
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.
If you've already configured your projects, you can run without the UI:
cursor-rust-tools --no-ui
The simplest way to configure the tool is through the UI that appears when you run cursor-rust-tools
.
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.
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.
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.
Verify settings: Check Cursor's MCP settings to confirm proper configuration.
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.
You can ask the AI to retrieve documentation for a specific crate or symbol:
Request type information for symbols in your code:
client
in src/main.rs?"process_data
function"Have the AI run and analyze cargo commands:
Request implementation details:
Display
for my CustomType
"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.
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.
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.
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": []
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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