Get the FREE Ultimate OpenClaw Setup Guide →

language -rs

A Model Context Protocol (MCP) server that bridges rust-analyzer language server functionality for AI assistants

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio emillindfors-language-server-mcp-rs /path/to/language-server-mcp/target/release/language-server-mcp /path/to/your/rust/workspace

How to use

This MCP server exposes rust-analyzer functionality over the MCP interface, allowing editors and tools that speak MCP to query Rust analysis data and perform common IDE-like actions through a standardized protocol. It leverages the underlying rust-analyzer LSP capability wrapped by the MCP layer, enabling operations such as diagnostics, hover information, code completions, go-to-definition, references search, and formatting via the defined MCP tools. You can integrate it with editors or CLI tools that support MCP to get language features for Rust projects without needing a native LSP setup in each environment.

To use it, configure your MCP client (e.g., Claude Desktop or Claude Code CLI) to launch the server executable that you built from this repository and pass the path to your Rust workspace. Once registered, you can issue MCP actions like hover, completions, diagnostics, and other tool calls by referencing the appropriate tool name (e.g., hover, completion, diagnostics, goto_definition, find_references, format_document, etc.) with the required file_path, line, and column parameters as documented in the available Tools section of the repository. You can also expand macro results or request inlay hints depending on the client’s support for the expanded toolset.

For CLI-based workflows, you can interact with the server by sending JSON-RPC requests corresponding to the available tools, such as requesting diagnostics for a file or asking for type information at a given position, and then applying the results to your Rust project exploration and editing tasks.

How to install

Prerequisites

  • Install Rust toolchain (via rustup): https://rust-lang.org/tools/install
  • Ensure you have cargo available in your PATH
  • Optional: rustup component add rust-analyzer to enable the rust-analyzer backend locally

Install and build

  1. Install rust-analyzer (if not already present): rustup component add rust-analyzer

  2. Clone or download this MCP server repository and navigate to it: git clone <repository-url> && cd language-server-mcp-rs

  3. Build the MCP server in release mode: cargo build --release

  4. The compiled server will be available at: /path/to/language-server-mcp/target/release/language-server-mcp

  5. Configure your MCP client (Claude Desktop or Claude Code CLI) to point to the built executable and the path to your Rust workspace as shown in the README configuration examples.

Additional notes

Notes and tips:

  • Replace the placeholder paths in the mcp_config with the actual paths on your system: the location of the language-server-mcp binary and the path to your Rust workspace.
  • Ensure rust-analyzer is installed and available in your PATH for full LSP-based capabilities.
  • When using Claude Desktop, restart the application after updating the MCP configuration.
  • You can customize or extend the MCP tools in this project by updating src/tools.rs and related handlers; this enables additional LSP-like interactions beyond the default set.
  • If you encounter connection issues, verify that the executable has execute permissions and that the Rust workspace path is correct and accessible from the environment running the MCP server.

Related MCP Servers

Sponsor this space

Reach thousands of developers