MCP Rust SDK

Active
GitHub Rust NOASSERTION

Description

Official Rust SDK for the Model Context Protocol, providing type-safe async MCP clients and servers with first-class Tokio integration.

Key Features

  • Official Rust crate published on crates.io alongside the MCP specification
  • Tokio-native async runtime with full async/await APIs for client, server, and transport
  • Strongly-typed request, response, and notification builders with serde integration
  • Transport abstraction supporting stdio, TCP, WebSocket, and Streamable HTTP
  • Macro-driven tool and resource definition for declarative server authoring
  • Used as the implementation reference for production MCP runtimes in Rust

Use Cases

💡 Building high-throughput MCP servers in Rust that handle thousands of concurrent tool calls
💡 Embedding MCP clients inside systems software such as CLIs, daemons, and game engines
💡 Authoring wasm-compatible MCP servers that run in browser or edge environments
💡 Adding typed tool definitions to existing Rust services without runtime overhead
💡 Bridging non-async codebases to MCP via the sync client wrapper

Quick Start

# Cargo.toml
[dependencies]
mcp-sdk = "0.4"
tokio = { version = "1", features = ["full"] }

# main.rs
use mcp_sdk::{Server, tool};
#[tool]
async fn add(a: i64, b: i64) -> i64 { a + b }
#[tokio::main]
async fn main() { Server::new().tool(add).serve_stdio().await.unwrap(); }

Related Projects