rusty-mcp-scaffold

Sokoliem/rusty-mcp-scaffold

3.2

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

Rusty MCP Scaffold is a minimal Rust-based Model Context Protocol (MCP) server scaffold designed for quick integration with Claude Desktop.

Tools
3
Resources
0
Prompts
0

Rusty MCP Scaffold

A minimal Rust-based Model Context Protocol (MCP) server scaffold for quickly bootstrapping MCP servers that integrate with Claude Desktop.

Features

This scaffold provides a working MCP server implementation with:

  • šŸ¦€ Pure Rust Implementation using the rmcp crate
  • šŸ”§ Example Tools: Echo, Calculator, and Stats tools for reference
  • šŸ“ Comprehensive Logging: File and console logging with configurable levels
  • šŸš€ Easy Setup: Pre-configured for Claude Desktop integration
  • šŸ“¦ Minimal Dependencies: Only essential crates included

Quick Start

  1. Clone the repository

    git clone https://github.com/Sokoliem/rusty-mcp-scaffold.git
    cd rusty-mcp-scaffold
    
  2. Build the server

    cargo build --release
    
  3. Configure Claude Desktop

    Add to your claude_desktop_config.json:

    "rusty-server": {
      "command": "C:\\path\\to\\rusty-mcp-scaffold\\target\\release\\rusty-server.exe",
      "args": [],
      "env": {
        "RUST_LOG": "debug",
        "RUST_BACKTRACE": "1"
      }
    }
    
  4. Restart Claude Desktop and your server should be available!

Project Structure

rusty-mcp-scaffold/
ā”œā”€ā”€ Cargo.toml          # Project dependencies
ā”œā”€ā”€ build.rs            # Build script for compile-time info
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ main.rs         # Server entry point and logging setup
│   └── server.rs       # MCP server implementation and tools
ā”œā”€ā”€ logs/               # Generated log files (gitignored)
└── target/             # Build artifacts (gitignored)

Available Tools

1. Echo Tool

Echoes back any message sent to it.

Parameters:
- message (string): The message to echo back

2. Calculator Tool

Performs basic arithmetic operations.

Parameters:
- operation (string): "add", "subtract", "multiply", or "divide"
- a (number): First number
- b (number): Second number

3. Get Stats Tool

Returns server statistics including request count.

Parameters: None

Extending the Server

To add new tools:

  1. Add a new method to the RustyServer implementation in src/server.rs:

    #[tool(description = "Your tool description")]
    async fn your_tool_name(
        &self,
        #[tool(param)]
        #[schemars(description = "Parameter description")]
        param_name: String,
    ) -> Result<CallToolResult, McpError> {
        // Your implementation
        Ok(CallToolResult::success(vec![Content::text("Result")]))
    }
    
  2. Rebuild the server:

    cargo build --release
    
  3. Restart Claude Desktop to use the new tool

Logging

Logs are written to:

  • Console: stderr output for immediate feedback
  • Files: logs/rusty_server_YYYYMMDD_HHMMSS.log for detailed debugging

Configure logging verbosity with the RUST_LOG environment variable:

  • error: Only errors
  • warn: Warnings and errors
  • info: General information
  • debug: Debug information
  • trace: Very detailed trace information

Development

Prerequisites

  • Rust 1.70+ (install from rustup.rs)
  • Windows, macOS, or Linux

Testing Standalone

# Run with default logging
cargo run

# Run with trace logging
RUST_LOG=trace cargo run

# Run the release build
./target/release/rusty-server

Building for Distribution

# Build optimized binary
cargo build --release

# Binary will be at target/release/rusty-server (or .exe on Windows)

Troubleshooting

  1. Server doesn't appear in Claude Desktop

    • Ensure Claude Desktop is fully restarted
    • Check the path in your config is correct
    • Look for errors in the log files
  2. Tools not working

    • Check logs/ directory for error messages
    • Verify the server is running with test_server.bat (Windows)
    • Ensure RUST_LOG is set for debugging
  3. Build failures

    • Update Rust: rustup update
    • Clean build: cargo clean && cargo build --release

Dependencies

  • rmcp: MCP protocol implementation
  • tokio: Async runtime
  • tracing: Structured logging
  • serde/serde_json: JSON serialization
  • schemars: JSON schema generation

License

MIT License - feel free to use this scaffold for your own MCP servers!

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Resources