Semantic Rust tools for Codex, backed by rust-analyzer, Cargo, Clippy, rustfmt, and rustc.
This plugin exposes a local MCP server that gives Codex token-efficient Rust code intelligence without relying on text search alone. It starts rust-analyzer per Cargo project root for semantic LSP queries and shells out to Rust tooling for compiler diagnostics, linting, formatting checks, and error explanations.
rust-analyzerhover, definitions, references, document symbols, workspace symbols, diagnostics, and code actions.cargo checkwith JSON diagnostics.cargo clippywith JSON diagnostics.cargo fmt --all -- --check.rustc --explainfor compiler error codes.- Lightweight
--selftestfixture for smoke testing the MCP server.
- Python 3.11 or newer.
rust-analyzeronPATH.cargo,rustc, Clippy, and rustfmt onPATH.
Install the Rust toolchain with rustup if needed:
rustup component add rust-analyzer clippy rustfmtPlace this directory at:
%USERPROFILE%\.codex\plugins\rust-native
The plugin metadata is in .codex-plugin/plugin.json, and the MCP server command is in .mcp.json.
Run from the plugin root:
python scripts\rust_native_mcp.py --selftestExpected result: JSON output with "ok": true.
- LSP positions use 1-based
lineand 1-basedcharacterinputs. - Call
rust_lsp_diagnosticsbeforerust_lsp_code_actionswhen asking for quick fixes on a problematic range. rust_clippydoes not apply fixes; it only reports diagnostics.
MIT.