JC

jbr/cargo-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

18 stars 10 forks 质量 70 趋势 36Apache-2.0

用于货物命令的 mcp 服务器

概览

一个模式背景协议(MCP)服务器,为Rust项目提供安全的货运业务. 这个MCP服务器暴露出以下的货运工具: - 在不产生可执行文件的情况下验证代码编译 - - 运行 Clippy 插件以获取代码建议 - - 执行工程测试 - 检查代码格式而不修改文件 - 构建工程(调试或放出模式) - 运行基准 - 添加对 Cargo.toml的依赖性 - 从 Cargo.toml 中删除依赖性 - 更新依赖性 - 删除货物过去产生的文物 - 运行二进制或实例 所有工具都支持通过货物-env参数和带有工具链参数的生锈工具链设置自定义环境变量.

概述(AI 翻译)

一个模式背景协议(MCP)服务器,为Rust项目提供安全的货运业务.

□ 特性

这个MCP服务器暴露出以下的货运工具:

  • ** 货物检查** - 在不产生可执行文件的情况下验证编码编译
  • ** cargo clippy ** - 运行 Clippy 插件以获取代码建议 -货物测试-执行项目测试
  • cargo fmt check - 在不修改文件的情况下检查代码格式
  • ** 货物 构建** - 构建工程( 调试或发布模式) -** 货物箱** - 运行基准
  • ** 货物加成** - 货物加成依赖性
  • ** 货物运走** - 从 Cargo.toml 中删除依赖性
  • ** 货物更新** - 更新依赖性
  • ** 货物清扫** - 拆除货物过去产生的文物
  • ** cargo run** - 运行二进制或示例

所有工具都支持通过 [[T0] 参数和生锈设置自定义环境变量 带有toolchain参数的工具链。

□ 安装

□ 用克洛德桌面

将此添加到您的 Claude 桌面 MCP 配置 :

可以选择,在参数中包括"env": {"CARGO_MCP_DEFAULT_TOOLCHAIN": {{toolchain}} }: [T3]是类似"夜"或"平稳"的东西.

□ 安全特性

本页由 AI 翻译,技术细节请以原文为准。

README

Cargo MCP Server

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)
  • cargo_bench - Run benchmarks
  • cargo_add - Add dependencies to Cargo.toml
  • cargo_remove - Remove dependencies from Cargo.toml
  • cargo_update - Update dependencies
  • cargo_clean - Remove artifacts that cargo has generated in the past
  • cargo_run - Run a binary or example

All tools support setting custom environment variables via the cargo_env parameter and rust toolchain with the toolchain parameter.

Installation

cargo install cargo-mcp

Usage with Claude Desktop

Add this to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "cargo-mcp": {
      "command": "/path/to/cargo-mcp/cargo-mcp",
      "args": ["serve"]
    }
  }
}

Optionally, include "env": {"CARGO_MCP_DEFAULT_TOOLCHAIN": {{toolchain}} } in the arguments where {{toolchain}} is something like “nightly” or “stable”

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

License

MIT or APACHE-2.0

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "cargo-mcp": { "command": "/path/to/cargo-mcp/cargo-mcp", "args": ["serve"] } } }