claude-mcp-rs

jakvbs/claude-mcp-rs

3.2

If you are the rightful owner of claude-mcp-rs and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

claude-mcp-rs is a high-performance Rust implementation of a Model Context Protocol (MCP) server designed to wrap the Claude CLI for AI-assisted coding tasks.

claude-mcp-rs

CI License: MIT Rust Version MCP Compatible

A high-performance Rust implementation of an MCP (Model Context Protocol) server that wraps the Claude CLI for AI-assisted coding tasks.

Features

  • MCP Protocol Support: Implements the official Model Context Protocol using the Rust SDK
  • Claude CLI Integration: Wraps the Claude CLI to enable AI-assisted coding through MCP
  • Session Management: Supports multi-turn conversations via session IDs
  • Configurable: CLI arguments and timeout configurable via JSON config file
  • Async Runtime: Built on Tokio for efficient async I/O

Prerequisites

  • Rust 1.70+ (uses 2021 edition)
  • Claude CLI installed and configured
  • Claude Code or another MCP client

Installation

Option 1: Build from Source

git clone https://github.com/jakvbs/claude-mcp-rs.git
cd claude-mcp-rs
cargo build --release

Then add to your Claude Code MCP configuration:

claude mcp add claude-rs -s user --transport stdio -- /path/to/claude-mcp-rs

Option 2: Download from Releases

Download the appropriate binary for your platform from the releases page.

Building

# Debug build
cargo build

# Release build
cargo build --release

Running

The server communicates via stdio transport:

cargo run

Or after building:

./target/release/claude-mcp-rs

Tool Usage

The server provides a single claude tool with a minimal parameter surface. Most Claude CLI flags are configured globally via the config file.

Required Parameters

ParameterTypeDescription
PROMPTstringTask instruction for Claude

Optional Parameters

ParameterTypeDescription
SESSION_IDstringResume a previously started Claude CLI session. Use the exact SESSION_ID value returned from an earlier call. If omitted, a new session is created. Do not send an empty string value: when starting a new session, omit the SESSION_ID field entirely instead of passing \"\".

Response Structure

{
  "success": true,
  "SESSION_ID": "uuid-string",
  "message": "Claude's response text",
  "error": null,
  "warnings": null
}

Configuration

The server loads configuration from claude-mcp.config.json in the current working directory, or from a path specified via the CLAUDE_MCP_CONFIG_PATH environment variable.

Example configuration:

{
  "additional_args": [
    "--dangerously-skip-permissions"
  ],
  "timeout_secs": 600
}

Configuration Options

OptionTypeDefaultDescription
additional_argsstring[][]Extra CLI arguments passed to every Claude invocation
timeout_secsnumber600Maximum runtime per execution (clamped to 3600 max)

The additional_args are appended after core flags (--print, --output-format stream-json) and before any --resume or prompt arguments.

Testing

# Run all tests
cargo test

# Run specific test suite
cargo test --test integration_tests

Test coverage:

  • Unit tests: Core functionality
  • Integration tests: End-to-end scenarios
  • Server tests: MCP protocol implementation

Architecture

Claude Code (MCP Client)
    |
stdio transport
    |
MCP Server (main.rs) -> server::claude() tool
    |
claude::run() -> spawns `claude` subprocess
    |
Parses JSON-streamed output line-by-line
    |
Returns ClaudeResult with session_id, agent_messages

See for detailed architecture documentation.

Related Projects

Contributing

Contributions are welcome! See for guidelines.

License

MIT License - See for details.