MCP server for Cargo workspace operations: check, build, test, clippy, fmt, tree, doc, and clean — callable directly from Copilot Chat with structured JSON output.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Instead of typing cargo commands into a terminal and squinting at the text
output, Copilot calls Cargo as a set of structured tools — getting precise
diagnostics with exact file paths and line numbers it can act on directly,
streaming progress while builds run, and one-click application of Clippy and
rustc fix suggestions.
Install, reload, run /cargo-mcp:setup once per repo. That's it.
Platforms: Pre-built binaries ship for Windows x64 and arm64.
Linux/macOS users should
build from source.
What you get
Precise diagnostics — JSON-shaped errors with exact file paths and line
numbers, instead of best-effort parsing of compiler text.
Streaming build progress — long builds report live status in the chat
panel; a one-line summary collapses into history when finished.
Reviewable fix suggestions — machine-applicable Clippy and rustc
suggestions appear in a checkbox dialog you can accept selectively.
Automatic retry on Windows file-in-use errors — transient antivirus or
file-indexer collisions in target\ no longer derail multi-step tasks.
Toolchain transparency — the cargo_diagnostic tool reports exactly
which cargo and rustc will be invoked, and why.
Zero MCP config — the extension bundles the server and registers it
with VS Code automatically. No mcp.json to edit.
Screenshots
Note: The images below are placeholders shipped with the initial
release; real screenshots will replace them in a follow-up.
Streaming build progress in the chat panel.
Clippy suggestions in a reviewable checkbox dialog.
Precise diagnostics with exact file paths and line numbers.
Quick start
Install this extension.
Reload VS Code so the MCP server registers and slash commands appear.
Open Copilot Chat in Agent mode and run:
/cargo-mcp:setup
This adds a short instruction block to your repository's
.github/copilot-instructions.md (or equivalent) telling Copilot to prefer
the MCP tools over running cargo in a terminal. Commit the change and
Copilot will use the tools for every future session in that repository.
Why the setup step? Tool descriptions are only visible to Copilot
after it has decided how to carry out a task. A repository instruction
file is loaded before that decision, so it reliably intercepts the choice
before Copilot reaches for a terminal.
rustup — optional but strongly recommended if
your repo uses rust-toolchain.toml. Without rustup, the toolchain file
has no effect on any cargo invocation (this is a property of cargo itself,
not specific to this extension).
cargo clippy and cargo fmt components installed if you want
cargo_clippy / cargo_fmt
Settings
Setting
Default
Description
cargo-mcp.elicitationMode
always-skip
How to handle machine-applicable fix suggestions: prompt, always-accept, or always-skip.
cargo-mcp.retry.onBusy
true
Retry idempotent cargo invocations (check, build, test, clippy, fmt, doc, tree, clean, metadata) when they fail with a transient Windows file-locking error ((os error 32)sharing violation, (os error 5)access denied, being used by another process). These usually clear themselves within a fraction of a second once an antivirus, file indexer, or stray process releases the handle.
cargo-mcp.retry.delayMs
500
Delay between retry attempts, in milliseconds.
cargo-mcp.retry.maxAttempts
3
Maximum total attempts (initial try + retries).
cargo-mcp.binaryPath
(bundled)
Override the path to the cargo-mcp binary. Intended for development against a locally-built server.
Commands
cargo-mcp: Open Copilot setup chat — opens Copilot Chat with the setup
prompt pre-filled.
cargo-mcp: Copy bundled server binary path — copies the bundled
cargo-mcp binary path to the clipboard.
cargo-mcp: Show bundled server version — displays the bundled server
version.