Rust MCP Server

Rust MCP Server

rust-mcp-server•bylh

A Model Context Protocol server that exposes Rust development tools such as syntax checking, linting, formatting, testing and building to AI assistants and IDEs.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Provides a cargo_check tool for validating Rust code syntax and type checking, with workspace-wide checking.
  • •Provides a cargo_clippy tool for linting Rust code, with support for automatic fixes.
  • •Provides a rustfmt tool for formatting Rust code and checking formatting without applying changes.
  • •Provides cargo_test and cargo_build tools for running Rust tests and building projects in debug or release mode.

BEST FOR

  • •Checking Rust code for errors through natural language requests to an AI assistant.
  • •Linting and formatting a Rust project from within an AI-assisted development workflow.
  • •Running tests and building a Rust project in release mode via an assistant.

ABOUT RUST-MCP-SERVER

Rust MCP Server is cataloged as an MCP server attributed to lh. A Model Context Protocol server that exposes Rust development tools such as syntax checking, linting, formatting, testing and building to AI assistants and IDEs. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Rust MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How does the server communicate with MCP clients?

It communicates via JSON-RPC over stdin/stdout following the MCP protocol.

What format do the tools return results in?

Tools return standardized JSON responses including success, exit code, stdout, stderr and the command.

Can the server limit work to a specific project path?

Yes, the server can be run with a project path option to target a specific Rust project.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 0cd0f2b4c27d · 采集于 2026-11-13 10:55:09 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Rust MCP Server

A Model Context Protocol (MCP) server that provides essential Rust development tools for AI assistants and IDEs. This server enables real-time syntax checking, linting, formatting, testing, and building of Rust projects through the standardized MCP interface.

Features

Available Tools

  1. cargo_check - Syntax and type validation

    • Validates Rust code syntax and type checking
    • Supports workspace-wide checking
    • Provides detailed error messages and suggestions
  2. cargo_clippy - Code linting

    • Catches common mistakes and suggests improvements
    • Supports automatic fixes where possible
    • Configurable lint levels and rules
  3. rustfmt - Code formatting

    • Formats Rust code according to style guidelines
    • Can check formatting without applying changes
    • Supports individual file or project-wide formatting
  4. cargo_test - Test execution

    • Runs Rust tests with detailed output
    • Supports specific test patterns and packages
    • Configurable output capture for debugging
  5. cargo_build - Project building

    • Builds Rust projects in debug or release mode
    • Supports workspace builds
    • Provides build status and error details

Installation

Prerequisites

  • Rust toolchain (rustc, cargo, clippy, rustfmt)
  • Tokio async runtime support

Build from source

git clone https://github.com/lh/rust-mcp-server
cd rust-mcp-server
cargo build --release

Claude Code Integration

Quick Install

# Clone and build the server
git clone https://github.com/lh/rust-mcp-server
cd rust-mcp-server
cargo build --release

# Add to Claude Code (adjust the project path as needed)
claude mcp add rust-tools -s user -- $(pwd)/target/release/rust-mcp-server --project-path ~/Code

# Verify installation
claude mcp list | grep rust-tools

Alternative Installation Methods

Using absolute path:

claude mcp add rust-tools -s user -- /path/to/rust-mcp-server/target/release/rust-mcp-server --project-path /path/to/your/rust/projects

Project-specific installation:

# Navigate to your Rust project
cd /path/to/your/rust/project

# Add the server with current directory as project path
claude mcp add rust-tools -s project -- /path/to/rust-mcp-server/target/release/rust-mcp-server --project-path .

Verify Connection

After installation, restart Claude Code and check the server status:

/mcp

You should see rust-tools: connected in the list.

Usage

Command Line

# Run in current directory
./target/release/rust-mcp-server

# Specify project path
./target/release/rust-mcp-server --project-path /path/to/rust/project

Using with Claude Code

Once installed, you can use natural language to invoke Rust tools:

  • "Check this Rust code for errors" → runs cargo check
  • "Lint my Rust project" → runs cargo clippy
  • "Format this Rust file" → runs rustfmt
  • "Run the tests" → runs cargo test
  • "Build the project in release mode" → runs cargo build --release

MCP Integration

The server communicates via JSON-RPC over stdin/stdout following the MCP protocol:

Initialize

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {}
}

List Available Tools

{
  "jsonrpc": "2.0", 
  "id": 2,
  "method": "tools/list"
}

Execute Tool

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "cargo_check",
    "arguments": {
      "workspace": true
    }
  }
}

Tool Parameters

cargo_check

{
  "target": "",        // Optional specific target
  "workspace": false   // Check all workspace packages
}

cargo_clippy

{
  "fix": false,        // Auto-apply fixes
  "workspace": false,  // Run on all packages
  "deny": []          // Lint levels to deny
}

rustfmt

{
  "file": "",         // Specific file to format
  "check": false      // Check without applying
}

cargo_test

{
  "test_name": "",    // Specific test pattern
  "package": "",      // Specific package
  "workspace": false, // Test all packages
  "nocapture": false  // Don't capture output
}

cargo_build

{
  "release": false,   // Build in release mode
  "workspace": false  // Build all packages
}

Output Format

All tools return standardized JSON responses:

{
  "success": true,
  "exit_code": 0,
  "stdout": "compilation output...",
  "stderr": "warnings and errors...",
  "command": "cargo check"
}

Integration Examples

Claude Code Integration

This server is designed to work seamlessly with AI assistants like Claude Code, providing real-time feedback during code development:

  1. Syntax Validation: Automatically check code as it's written
  2. Lint Suggestions: Get improvement suggestions and apply fixes
  3. Code Formatting: Ensure consistent code style
  4. Test Execution: Validate changes don't break existing functionality
  5. Build Verification: Confirm project compiles successfully

VS Code Extension

Can be integrated with VS Code through MCP to provide enhanced Rust development experience alongside existing language servers.

Error Handling

The server provides detailed error information for:

  • Invalid tool names
  • Missing required parameters
  • Compilation errors
  • Process execution failures
  • File system errors

Troubleshooting

Server Not Connecting

If you see connection errors in Claude Code:

  1. Ensure the binary is built:

    cd /path/to/rust-mcp-server
    cargo build --release
    ls -la target/release/rust-mcp-server  # Should exist and be executable
    
  2. Check the -- separator:

    # ✅ Correct
    claude mcp add rust-tools -- /path/to/rust-mcp-server/target/release/rust-mcp-server
    
    # ❌ Incorrect (missing --)
    claude mcp add rust-tools /path/to/rust-mcp-server/target/release/rust-mcp-server
    
  3. Test the server manually:

    cd /path/to/rust-mcp-server
    python3 test_server.py
    
  4. Check logs: Look for error messages when running claude --mcp-debug

Common Issues

  • "cargo: command not found": Ensure Rust is installed and in your PATH
  • "failed to find cargo.toml": Make sure --project-path points to a Rust project
  • Server disconnects immediately: Check that the binary path is absolute, not relative
  • Server connects but no tools available: This was a bug in v0.1.0 where the server included "error": null in successful responses, violating JSON-RPC 2.0 spec. Fixed in v0.1.1.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License

Changelog

v0.1.1 (fix/json-rpc-error-field)

  • Fixed JSON-RPC 2.0 compliance issue where error: null was incorrectly included in successful responses
  • This fix resolves connection issues with Claude Code where the server would connect but tools wouldn't be available
  • Added #[serde(skip_serializing_if = "Option::is_none")] to the error field in McpResponse

v0.1.0

  • Initial release
  • Core MCP server implementation
  • Support for cargo check, clippy, rustfmt, test, and build
  • JSON-RPC communication over stdin/stdout
  • Configurable project path
  • Comprehensive error handling

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Rust MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/rust-mcp-server)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools