The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Rust SDK
The official Rust SDK for the Model Context Protocol
Install
git clone https://github.com/modelcontextprotocol/rust-sdkInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →RMCP
An official Rust Model Context Protocol SDK implementation with tokio async runtime.
Migrating to 3.x? See the migration guide for breaking changes and upgrade instructions.
This repository contains the following crates:
- rmcp: The core crate providing the RMCP protocol implementation - see rmcp
- rmcp-macros: A procedural macro crate for generating RMCP tool implementations - see rmcp-macros
This SDK implements the stable MCP 2026-07-28 specification while
remaining fully compatible with the 2025-11-25 release and earlier
versions. Features introduced in 2026-07-28 — server discovery & negotiation,
transport-neutral subscriptions, long-running tasks, response caching,
multi-round-trip requests, and standard HTTP routing headers — are documented
below. For the full MCP specification, see
modelcontextprotocol.io.
Table of Contents
- Usage
- Tools
- Resources
- Prompts
- Sampling
- Elicitation
- Roots
- Logging
- Completions
- Notifications
- Subscriptions
- Multi-Round-Trip Requests
- Tasks
- Caching
- Standard HTTP Headers
- Stateless Streamable HTTP
- Transports
- Pagination
- Capability & Protocol Version Negotiation
- JSON Schema 2020-12
- Examples
- OAuth Support
- Related Resources
- Related Projects
- Development
Usage
Import the crate
Add the latest published version with cargo:
cargo add rmcp --features server
Or use the dev channel:
cargo add rmcp --features server --git https://github.com/modelcontextprotocol/rust-sdk --branch main
Third Dependencies
Basic dependencies:
Build a Client
Start a client
use rmcp::{ServiceExt, transport::{TokioChildProcess, ConfigureCommandExt}};
use tokio::process::Command;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ().serve(TokioChildProcess::new(Command::new("npx").configure(|cmd| {
cmd.arg("-y").arg("@modelcontextprotocol/server-everything");
}))?).await?;
Ok(())
}
Client lifecycle modes
serve() uses the legacy MCP lifecycle: the client sends initialize, receives
the negotiated server information, and then sends notifications/initialized.
Use ClientServiceExt::serve_with_lifecycle to
select another lifecycle explicitly:
use rmcp::{ClientLifecycleMode, ClientServiceExt, ProtocolVersion, model::ClientConfig};
Similar plugs
Reverse engineer anything with agents, from app behavior down to native binaries.
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)