Provides tools for Rust development by exposing Cargo operations, including code compilation checks, linting with Clippy, test execution, formatting verification, and project building in debug or release mode.
Cargo MCP Server
Caution
This repository is written by AI as an experiment. Although I (jbr) review every line, the code quality is not necessarily identical to what I would have written. Caveat usor.
A Model Context Protocol (MCP) server that provides safe access to Cargo operations for Rust projects.
Features
This MCP server exposes the following Cargo tools:
- cargo_check - Verify code compiles without producing executables
- cargo_clippy - Run the Clippy linter for code suggestions
- cargo_test - Execute project tests
- cargo_fmt_check - Check code formatting without modifying files
- cargo_build - Build the project (debug or release mode)
Installation
Usage with Claude Desktop
Add this to your Claude Desktop MCP configuration:
Tool Usage
cargo_check
Verify that your Rust code compiles:
cargo_clippy
Get linting suggestions:
cargo_test
Run tests:
cargo_fmt_check
Check formatting:
cargo_build
Build the project:
Safety Features
- Only whitelisted Cargo commands are available
- Path validation ensures the target is a valid Rust project (has Cargo.toml)
- No arbitrary command execution
- All commands run in the specified project directory
Development
To test the server manually:
Then send MCP requests via stdin. Example initialization:
License
MIT
Related MCP Servers
- MIT License
- -securityAlicense-qualityMarineTraffic MCP ServerLast updated -1TypeScriptMIT License
- PythonMIT License
- TypeScriptApache 2.0