Rust MCP SDK

v1.0.0Developer Toolsstable

A high-performance, asynchronous toolkit for building MCP servers and clients in Rust.

crates-iomcp-clientmcp-servermcp-toolsmodel-context-protocol
Share:
176
Stars
0
Downloads
0
Weekly
0/5

What is Rust MCP SDK?

Rust MCP SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to high-performance, asynchronous toolkit for building mcp servers and clients in rust.

A high-performance, asynchronous toolkit for building MCP servers and clients in Rust.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A high-performance, asynchronous toolkit for building MCP se

Use Cases

Build high-performance MCP servers and clients in Rust.
Develop asynchronous MCP implementations with Rust.
rust-mcp-stack

Maintainer

LicenseMIT
Languagerust
Versionv1.0.0
UpdatedMay 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx rust-mcp-sdk

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Rust MCP SDK

The Rust MCP SDK (`rust-mcp-sdk`) is a high-performance, asynchronous toolkit for building both MCP servers and MCP clients in Rust. It provides type-safe schema objects via `rust-mcp-schema`, procedural macros via `rust-mcp-macros` for defining tools with minimal boilerplate, and multiple transport implementations including stdio, Streamable HTTP, and SSE. The SDK supports OAuth authentication with remote providers, MCP Tasks, message streaming, and built-in observability via the `McpObserver` trait, making it a production-ready foundation for developers who want to build or integrate MCP tooling using Rust's performance and safety guarantees.

Prerequisites

  • Rust toolchain (stable, 1.75 or later recommended) installed via rustup
  • Cargo package manager (included with the Rust toolchain)
  • Familiarity with async Rust and Tokio runtime concepts
  • An MCP-compatible client for testing (Claude Desktop, MCP Inspector, or a custom client)
1

Create a new Rust project

Initialize a new Rust binary project that will become your MCP server or client.

cargo new my-mcp-server
cd my-mcp-server
2

Add rust-mcp-sdk to your Cargo.toml

Add the SDK as a dependency. Use feature flags to include only the components you need — server, client, macros, and/or specific transports.

[dependencies]
rust-mcp-sdk = { version = "0.9.0", default-features = false, features = ["server", "macros", "stdio"] }
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
3

Define a tool using the mcp_tool macro

Use the `#[mcp_tool]` procedural macro to define a typed tool struct. The macro automatically generates the JSON Schema and tool registration boilerplate.

use rust_mcp_sdk::macros;
use serde::{Deserialize, Serialize};

#[macros::mcp_tool(name = "say_hello", description = "Returns a greeting message")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct SayHelloTool {
    pub name: String,
}
4

Implement the ServerHandler trait

Implement the `ServerHandler` or `ServerHandlerCore` trait to handle incoming MCP requests such as listing tools and executing tool calls.

use rust_mcp_sdk::{ServerHandler, schema::*};
use async_trait::async_trait;

struct HelloHandler;

#[async_trait]
impl ServerHandler for HelloHandler {
    async fn handle_list_tools_request(
        &self,
        _request: ListToolsRequest,
        _runtime: &dyn McpServerRuntime,
    ) -> Result<ListToolsResult, RpcError> {
        Ok(ListToolsResult {
            tools: vec![SayHelloTool::tool()],
            meta: None,
            next_cursor: None,
        })
    }
}
5

Launch the MCP server with stdio transport

Wire up the handler to the stdio transport and start the async runtime. This is the standard setup for use with Claude Desktop.

use rust_mcp_sdk::{McpServer, StdioTransport};

#[tokio::main]
async fn main() {
    let transport = StdioTransport::new();
    let server = McpServer::new(HelloHandler, transport);
    server.run().await.unwrap();
}
6

Build and register with your MCP client

Build the release binary and register it in your Claude Desktop config. Point the command to the compiled binary.

cargo build --release
# Then add to claude_desktop_config.json:
{
  "mcpServers": {
    "my-mcp-server": {
      "command": "/path/to/my-mcp-server/target/release/my-mcp-server",
      "args": []
    }
  }
}

Rust MCP SDK Examples

Client configuration

Claude Desktop config for a compiled Rust MCP server binary. After building with `cargo build --release`, point the command to the binary path.

{
  "mcpServers": {
    "my-rust-mcp-server": {
      "command": "/home/user/my-mcp-server/target/release/my-mcp-server",
      "args": []
    }
  }
}

Prompts to try

Example prompts for testing a Rust MCP server built with the SDK. These depend on the tools your server implements.

- "List all tools available from my Rust MCP server"
- "Call the say_hello tool with name 'World'"
- "What tools does this server expose and what parameters do they accept?"
- "Run the my-tool tool with the following arguments: ..."

Troubleshooting Rust MCP SDK

Compilation errors related to async traits

Ensure `async-trait = "0.1"` is in your dependencies and you have `use async_trait::async_trait;` imported. The `ServerHandler` and `ClientHandler` traits require the `#[async_trait]` attribute on implementations.

Macro errors with #[mcp_tool] attribute

The `macros` feature must be enabled in your Cargo.toml: `rust-mcp-sdk = { version = "0.9.0", features = ["macros"] }`. Also ensure the struct derives `Serialize`, `Deserialize`, and `macros::JsonSchema`.

MCP client does not receive tool list

Verify your `handle_list_tools_request` implementation returns the tools correctly and the server is using stdio transport for Claude Desktop. Check that the binary path in the config is correct and the binary has execute permissions.

Frequently Asked Questions about Rust MCP SDK

What is Rust MCP SDK?

Rust MCP SDK is a Model Context Protocol (MCP) server that high-performance, asynchronous toolkit for building mcp servers and clients in rust. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Rust MCP SDK?

Follow the installation instructions on the Rust MCP SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Rust MCP SDK?

Rust MCP SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Rust MCP SDK free to use?

Yes, Rust MCP SDK is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "rust-mcp-sdk": { "command": "npx", "args": ["-y", "rust-mcp-sdk"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Rust MCP SDK?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides