rust-analyzer
MCP server for rust-analyzer with cross-platform installers, comprehensive testing, and auto-configuration for VS Code, Claude Desktop, and Cursor
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:
-
Clone the repository git clone https://github.com/CireSnave/rust-analyzer-mcp-server.git cd rust-analyzer-mcp-server
-
Build the MCP server cargo build --release
-
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
shellfirm
Terminal guardrails for humans and AI agents — intercepts dangerous commands with context-aware challenges before the damage is done.
mcp-cli
mcpc is a CLI client for MCP. It supports persistent sessions, stdio/HTTP, OAuth 2.1, JSON output for code mode, proxy for AI sandboxes, and much more.
mcp-shell
Give hands to AI. MCP server to run shell commands securely, auditably, and on demand.
hackerone-graphql
MCP server for the HackerOne GraphQL API
terminal
A minimal, zero-dependency terminal MCP (Model Context Protocol) client built for coding agents like OpenAI Codex.
opensearch
OpenSearch 3.0 with MCP Server