Model Context Protocol (MCP) server for rust-analyzer. Built with Rust standard library threads to provide fast AST navigation, hover, definitions, code actions, and compiler diagnostics for AI/LLM coding agents (Claude, Antigravity, Cursor, etc.).
The rust-analyzer MCP server defines 9 tools with reasonable schemas and descriptions, but falls short of production-grade quality in several dimensions. Most tools have basic descriptions (50-150 chars) and complete input schemas with proper typing, placing them solidly in the fair-to-good range. However, several tools lack depth in their descriptions, parameter documentation does not explain constraints or expected formats, and there is no visible output schema documentation, critical for LLMs planning downstream tool calls. Error handling patterns are absent from the visible code. The server includes both read-only and write operations, but lacks confirmation/dry-run patterns for destructive operations (format, set_workspace). Parameter descriptions are minimal and do not follow the 'actionable constraints' pattern (e.g., 'line must be 0-based, character position 0-based' is stated in the description but lacks examples or guidance on typical ranges).
Get available code actions for a range in a Rust file
Get code completion suggestions at a specific position
Go to definition of a symbol at a specific position
Get compiler diagnostics (errors, warnings, hints) for a Rust file
Format a Rust file using rust-analyzer
Get hover information for a symbol at a specific position in a Rust file
Find all references to a symbol at a specific position
Set the workspace root directory for rust-analyzer
No output schema documentation visible for any tool. LLMs cannot plan downstream tool calls or extract required fields without knowing what the tool returns. This violates the response-shaper pattern and forces agents to guess at return structures.
Destructive operations (format, set_workspace) lack confirmation/dry-run patterns. An agent could call set_workspace('/') and irreversibly change the working context. Agents make mistakes, destructive tools need a confirmation step.
Parameter descriptions are minimal and lack actionable constraints. E.g., 'Line number (0-based)' does not explain valid ranges, what happens if line > file length, or typical file sizes. Following the 'param-validation-rules' pattern, descriptions should state expected format, range, and allowed values.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 53 | 2026-07-28+ | v2 |
Get document symbols (functions, structs, etc.) for a Rust file
Tool descriptions do not explain WHEN to use each tool or dependencies between them. E.g., the difference between hover, definition, and code_actions is unclear from descriptions alone. LLMs need explicit guidance to select the right tool.
set_workspace description is vague ('Set the workspace root directory for rust-analyzer'). Does this affect all subsequent calls? Is it persistent? Can it fail? What are valid workspace paths? Description should clarify scope and state.
No error handling patterns documented. Tools should categorize errors as retryable, user-fixable, or fatal, and include recovery guidance. E.g., 'File not found. Ensure file_path is relative to workspace root and set_workspace() first if needed.'