Get the FREE Ultimate OpenClaw Setup Guide →

cursor-rust-tools

A MCP server to allow the LLM in Cursor to access Rust Analyzer, Crate Docs and Cargo Commands.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio terhechte-cursor-rust-tools cargo install --git https://github.com/terhechte/cursor-rust-tools

How to use

Cursor Rust Tools provides MCP endpoints that let your LLM query Rust type information, crate docs, and cargo command outputs directly from your codebase. The server spins up an index layer using Rust Analyzer for LSP-like capabilities to retrieve hover information, symbol references, and implementations, and it also builds local HTML documentation via cargo docs to expose up-to-date crate documentation in Markdown. Use the included UI to add projects and generate the mcp.json configuration, then enable the MCP server in Cursor. Once configured, you can request tools such as cargo_check, cargo_test, and crate/documentation queries to surface accurate Rust information during conversations. The UI helps you manage multiple projects and inspect activity, which makes it easier to keep your toolchain aligned with your codebase.

How to install

Prerequisites:

  • Rust toolchain (cargo) installed
  • Git installed
  • Access to the internet to fetch the repository

Installation steps:

  1. Ensure Rust is installed on your system. If not, install it from https://rust-lang.org or using rustup.

  2. Install Cursor Rust Tools from the Git repository:

cargo install --git https://github.com/terhechte/cursor-rust-tools
  1. Run the tool with the UI to set up projects and generate the MCP configuration:
cursor-rust-tools
  1. If you prefer running without the UI, you can still generate the mcp.json and add your projects manually by creating a mcp.json in your project directory and pointing Cursor to the MCP server.

  2. For Cursor integration, ensure your project contains a mcp.json (cursor-rust-tools UI can create it) and enable the MCP server in Cursor under MCP settings.

Additional notes

Notes and tips:

  • The server uses cargo docs to generate crate documentation locally and caches it in the project root as .docs-cache. This improves response times for doc queries but may require disk space for large projects.
  • You can control which crates are indexed by adjusting ignore_crates in your project configuration.
  • If you encounter build or index errors, ensure your Rust toolchain is up to date and that the project paths referenced in mcp.json are accessible.
  • The MCP endpoints expose tools like cargo_check and cargo_test, which can help the LLM verify type information and compile status before presenting results.
  • When using Cursor, you may want to set up Cursor rules to prefer using these tools for relevant queries to improve accuracy.

Related MCP Servers

Sponsor this space

Reach thousands of developers