lspmux-cc
Share a single rust-analyzer instance across Neovim, Claude Code, and Codex in the same Rust workspace. Built on lspmux by p2502.
How It Works
lspmux multiplexes multiple LSP client connections through a Unix socket to one rust-analyzer process. lspmux-cc adds an MCP server that exposes rust-analyzer capabilities as agent-callable tools, plus a Claude Code plugin for transparent LSP routing.
graph LR
NV[Neovim] -- lspmux client --> S
CC[Claude Code] -- lspmux client --> S
CC -. stdio .-> MCP[lspmux-cc-mcp<br/>14 MCP tools]
MCP -- lspmux client --> S
S((Unix socket)) --> LS[lspmux server<br/>spawned on demand by MCP]
LS --> RA[rust-analyzer]
Install
Prerequisites
- macOS or Linux
- Rust toolchain (cargo)
- curl, jq
Core Setup
git clone <repo-url> && cd lspmux-cc
cargo install --path mcp-server
./setup core
./setup core installs lspmux, validates rust-analyzer is on PATH (or RUST_ANALYZER_PATH), and writes the config. The lspmux daemon is spawned on demand by the MCP server — no launchd/systemd service is installed. Users upgrading from a pre-M5 install should run ./setup migrate to remove the legacy unit. See docs/migration-m5.md.
For Nix users: nix build builds everything from the flake.
Verify
./setup doctor
MCP Tools
All tools are read-only: they return data and never modify your files. The edits from rust_code_actions and rust_rename are returned for you (or the agent) to apply.
| Tool | Description | Parameters |
|---|
rust_diagnostics | Compiler errors and warnings for a file | file_path |
rust_hover | Type signature and docs at a position | file_path, line, character |
rust_goto_definition | Jump to where a symbol is defined | file_path, line, character |
rust_goto_implementation | Implementations of a trait or trait method | file_path, line, character |
rust_find_references | All references to a symbol | file_path, line, character |
rust_workspace_symbol | Search symbols by name across the workspace | query |
rust_document_symbols | A file's hierarchical symbol tree | file_path |
rust_code_actions | Quick fixes / refactors for a range, with their edits (unapplied) | file_path, start_line, start_character, end_line, end_character |
rust_rename | The workspace edit to rename a symbol (unapplied) | file_path, line, character, new_name |
rust_call_hierarchy_incoming | Callers of the symbol at a position | file_path, line, character |
rust_call_hierarchy_outgoing | Functions called by the symbol at a position | file_path, line, character |
rust_expand_macro | Expand the macro invocation at a position | file_path, line, character |
rust_server_status | Server health, readiness, and workspace info | (none) |
rust_workspace_registry | All rust-analyzer instances the daemon is hosting | (none) |
Coordinates: line and character inputs are zero-based (first line = 0). Output locations are one-based. Subtract 1 from output values before passing them as input to another tool.
All file paths must be absolute.
Host Integrations
Claude Code
./setup core
./setup sandbox claude-code
claude plugin add-marketplace /absolute/path/to/lspmux-cc
claude plugin disable rust-analyzer-lsp --scope user
claude plugin install lspmux-rust-cc --scope user
./setup core starts the shared service outside the sandbox. Claude Code's macOS seatbelt sandbox blocks Unix socket connect() by default, so ./setup sandbox claude-code adds the socket path to allowUnixSockets in ~/.claude/settings.json. Without this, both MCP and LSP connections fail silently.
The plugin registers both an LSP server (for Claude's native Rust support) and an MCP server (for agent tool access). See docs/hosts/claude-code.md for the full connection story, troubleshooting, and subagent behavior.
Codex
./setup host codex
Prints environment variables and launch command. See docs/hosts/codex.md.
Generic MCP
./setup host generic-mcp
Works with any MCP-capable host. See docs/hosts/generic-mcp.md.
Configuration