rust-analyzer MCP: Rust code navigation for agents

r3bl-rust-analyzer-mcp-server

A Rust MCP server on standard threads: the agent gets hover info, go to definition, references, formatting and compiler diagnostics from rust-analyzer

  • 486 ★ on the repository
  • Last commit
  • Apache-2.0
MCP server

Extended access

Why this level

  • The server starts rust-analyzer in your project, and format and code_actions can change files
  • The tools read the workspace source, which enters the agent's context
All reasons and checks

r3bl-org/r3bl-open-core

Install

Manual install

cargo install r3bl-rust-analyzer-mcp-server

Installs the rust-analyzer-mcp-server binary into ~/.cargo/bin. rust-analyzer is required: rustup component add rust-analyzer.

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The server starts rust-analyzer in your project, and format and code_actions can change files
  • The tools read the workspace source, which enters the agent's context

This is third-party code. Review the repository files before installing.

What it does

The server links an agent to rust-analyzer over LSP 3.17 and offers ten tools. rust_analyzer_hover shows documentation and type signatures, rust_analyzer_definition and rust_analyzer_references find a definition and all references, rust_analyzer_symbols builds a file's symbol hierarchy and rust_analyzer_completion suggests completions. rust_analyzer_format calls rustfmt, and rust_analyzer_code_actions gives quick fixes and refactors. Compiler diagnostics come from two tools: rust_analyzer_diagnostics for a file and rust_analyzer_workspace_diagnostics for the whole workspace. rust_analyzer_set_workspace switches the project root on the fly. Line and character numbers in arguments start at zero. The authors built the server on standard library threads with no Tokio: three threads (the main loop, a stdout reader and a background stderr drainer) guard against deadlock on large diagnostics. The binary is called rust-analyzer-mcp-server and installs with cargo install.

Who it is for. For Rust developers using Claude Code, OpenCode or Antigravity who want to give an agent the same code understanding an editor has.

Good fit when

  • An agent renames or moves a function and needs every reference to it across the workspace
  • You need an expression's type or its documentation without reading a dependency's source
  • After an edit the agent should check compiler errors for a file or the whole project before cargo build
  • You want the quick fixes and refactors that rust-analyzer offers
  • You switch between several project roots and want to change them without restarting the server

Not a fit when

  • The project is not written in Rust: the server works only with rust-analyzer
  • You need a server for another language or a generic LSP bridge: this one does not serve them
  • The machine has no rust-analyzer: install it with rustup component add rust-analyzer
  • You want the r3bl_tui library itself or the edi and giti apps: they sit in the same repository but are separate products

Example request

Find every reference to the parse_config function in the workspace through rust-analyzer and show the compiler errors for src/main.rs

MCP

Transport
stdio
Authentication
not required

Limitations

  • An installed rust-analyzer reachable from the shell is required. Node.js and npx are needed only for integration tests with the MCP inspector.
  • Line and character numbers count from zero per the LSP specification.
  • The verified clients in the description are Google Antigravity, OpenCode and Claude Code. Other clients use the standard stdio setup.
  • The server is part of the large r3bl-open-core repository: its own README sits in the server folder.
  • The license is Apache-2.0.

How to disable. Run claude mcp remove rust-analyzer and remove the binary with cargo uninstall r3bl-rust-analyzer-mcp-server.

FAQ

How do I connect rust-analyzer MCP to Claude Code?

Run cargo install r3bl-rust-analyzer-mcp-server and then claude mcp add rust-analyzer -- rust-analyzer-mcp-server. For OpenCode and Antigravity, add a server with the command rust-analyzer-mcp-server to mcp_config.json.

Which launch parameters does the server have?

--workspace sets the workspace root, --log-level picks a level from off to trace and --log-file sends the log to a file instead of stderr. Logging is off by default.

Why is the server built without an async runtime?

According to the authors, other servers had CPU spins on exit, deadlocks on large diagnostics and lock contention. They chose standard library threads and sync_channel(1) channels.

What else sits in the r3bl-open-core repository?

The r3bl_tui library for text interfaces, the r3bl-cmdr apps (edi, giti, rc, env-source), build utilities and an .agents/skills folder with workflows for developers of the project itself. Only the server matters to agent users.

How do I check that the server responds?

Run npx @modelcontextprotocol/inspector --cli rust-analyzer-mcp-server --method tools/list: the command prints the list of ten tools.

Discussion

No questions or reviews yet.

Needs a VPN

An MCP server that answers an agent's questions from the documentation of one Rust crate at an exact version

MCP serverExtended access300Repository stars
Official

An MCP server and CLI for code research: search and understand your project and all of GitHub with fewer tokens

MCP serverExtended access956Repository stars

A Rust binary for agents and the terminal that uses tree-sitter to find a symbol's definition, its calls and file dependencies

MCP serverMinimal access357Repository stars

A bridge from an LSP language server to the agent: definitions, references, diagnostics, hover and symbol rename

MCP serverExtended access1.6KRepository stars

CodeGraph (Rust)

codegraph-rust

A Rust code graph for agents: four MCP tools show what an edit will touch, how the architecture fits together and where the fragile spots are

MCP serverExtended access908Repository stars
Official

A local code graph with version history: an MCP server that tells the agent who calls a function and what an edit breaks

MCP serverExtended access506Repository stars

README in short

The repository's main README is about the r3bl_tui library and terminal apps, while the MCP server appears in the crate table and in the section on working with agents. The server's own README explains the motivation (stability without Tokio), installation with cargo, configuration examples for Antigravity, OpenCode and Claude Code, command-line parameters and the list of ten tools with arguments. It ends with how to run the tests and a link to an article on the architecture.

README badge

Report a problem

Foxx AIrust-analyzer MCP: Rust code navigation for agents
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.