Get the FREE Ultimate OpenClaw Setup Guide →

rust-analyzer

MCP server for rust-analyzer with cross-platform installers, comprehensive testing, and auto-configuration for VS Code, Claude Desktop, and Cursor

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ciresnave-rust-analyzer-mcp-server rust-analyzer-mcp-server

How to use

This MCP server exposes Rust language analysis capabilities by integrating rust-analyzer into the MCP framework. It provides commands to diagnose code, inspect types and documentation, navigate to symbol definitions, locate references, and offer intelligent code completions, as well as a workspace-wide analysis feature. You can run the server binary directly and use the MCP tools to query a Rust project or file. Typical usage involves starting the server and issuing tool requests such as get_diagnostics for a Rust file, get_hover_info for symbol details, goto_definition to jump to a symbol's origin, find_references to locate all usages, get_completions for code suggestions, and analyze_workspace to scan the entire project.

To interact with the tools, call the corresponding MCP endpoints with the required parameters (e.g., file_path, line, character). The analyze_workspace tool can be used with no parameters to analyze the workspace. This setup is suitable for AI assistants, code editors, or other MCP clients that rely on robust Rust analysis provided by rust-analyzer.

How to install

Prerequisites:

  • Rust toolchain (Rust/Cargo) installed and available in PATH
  • rust-analyzer installed and accessible in PATH (optional, as the server builds from source)

Install from source:

  1. Clone the repository git clone https://github.com/CireSnave/rust-analyzer-mcp-server.git cd rust-analyzer-mcp-server

  2. Build the MCP server cargo build --release

  3. Run the server ./target/release/rust-analyzer-mcp-server

Manual verification:

  • Ensure the binary is executable and prints a version/help message when invoked with --help
  • Start the server and test MCP tool calls from your MCP client or example script

Additional notes

Notes and tips:

  • Ensure Rust and, if used, rust-analyzer are properly installed and in PATH for a smooth setup.
  • The server binary name may vary by OS (e.g., rust-analyzer-mcp-server.exe on Windows).
  • If you encounter path or permission issues, verify that the install/build directory is included in your system PATH.
  • The available tools map directly to typical language-server-like capabilities provided by rust-analyzer (diagnostics, hover, goto definition, references, completions, and workspace analysis).
  • When analyzing large workspaces, be mindful of memory usage and provide appropriate workspace paths to the analyze_workspace tool.

Related MCP Servers

Sponsor this space

Reach thousands of developers