Rust crates for building MCP clients and servers with Tokio. Implements the MCP specification with tools, resources, prompts, and pluggable transports.
Overview
Rust SDK (RMCP) is the official Rust implementation for the Model Context Protocol. It lets developers expose MCP servers that offer tools, resources, and prompts to AI assistants, or build clients that connect to those servers.
The core rmcp crate provides the protocol implementation on the Tokio async runtime. A companion rmcp-macros crate supplies procedural macros for generating tool and prompt handlers. The SDK tracks the stable MCP specification while remaining compatible with earlier protocol releases, including newer features such as server discovery, transport-neutral subscriptions, long-running tasks, response caching, multi-round-trip requests, and standard HTTP routing headers.
Servers can define callable tools with JSON Schema parameters, publish readable resources by URI, and offer reusable prompt templates. Clients can discover capabilities, invoke tools, read resources, and handle notifications. Optional feature flags enable server-only or client-only builds, macro helpers, JSON Schema generation, OAuth authentication, elicitation, and skills served from a directory tree.
Transport is pluggable: common setups pair stdio on both sides or streamable HTTP between client and server. Types implementing the Transport trait—or sinks, streams, or async read/write pairs—can be adapted automatically. HTTP transports can use rustls or platform-native TLS backends.
Key features
- MCP client and server on Tokio
- Tool, resource, and prompt macros
- Streamable HTTP and stdio transports
- OAuth and enterprise auth options
- Protocol version negotiation
- Tasks, caching, and subscriptions
- Elicitation for user input
- JSON Schema 2020-12 for tools
Use cases
- Building MCP servers in Rust
- Connecting Rust apps to MCP tools
- Stdio servers launched by MCP clients
- HTTP MCP endpoints behind TLS
- Custom transports via trait impls