Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.63 KB

File metadata and controls

56 lines (36 loc) · 1.63 KB

Rust Native

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.

Features

  • rust-analyzer hover, definitions, references, document symbols, workspace symbols, diagnostics, and code actions.
  • cargo check with JSON diagnostics.
  • cargo clippy with JSON diagnostics.
  • cargo fmt --all -- --check.
  • rustc --explain for compiler error codes.
  • Lightweight --selftest fixture for smoke testing the MCP server.

Requirements

  • Python 3.11 or newer.
  • rust-analyzer on PATH.
  • cargo, rustc, Clippy, and rustfmt on PATH.

Install the Rust toolchain with rustup if needed:

rustup component add rust-analyzer clippy rustfmt

Installation

Place 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.

Smoke Test

Run from the plugin root:

python scripts\rust_native_mcp.py --selftest

Expected result: JSON output with "ok": true.

Tooling Notes

  • LSP positions use 1-based line and 1-based character inputs.
  • Call rust_lsp_diagnostics before rust_lsp_code_actions when asking for quick fixes on a problematic range.
  • rust_clippy does not apply fixes; it only reports diagnostics.

License

MIT.