rmcp
The official async Rust SDK for building Model Context Protocol clients and servers
Repository Health
Technical Analysis
rmcp is the official Rust implementation of the Model Context Protocol (MCP), built on the tokio async runtime. It provides both client and server building blocks — tools, resources, prompts, sampling, roots, logging, completions, notifications, and subscriptions — plus a rmcp-macros procedural-macro crate for generating tool implementations from plain Rust functions with schemars-based JSON Schema generation for tool arguments.
The SDK supports multiple transports (stdio/child-process, streamable HTTP with standard headers and protocol-version negotiation) and both the legacy and newer MCP client lifecycle modes, along with OAuth support for authenticated servers and a task-manager abstraction for long-running tool invocations. As the reference Rust SDK for MCP, it is the crate most Rust-based MCP servers and clients build directly on top of.
What You Get
- Client and server implementations of the full MCP primitive set: tools, resources, prompts, sampling, roots, logging, completions, notifications, and subscriptions
- The
rmcp-macroscrate for generating tool implementations and their JSON Schema argument definitions from plain Rust functions viaschemars - Multiple transports: stdio/child-process (e.g. spawning
npx-based MCP servers) and streamable HTTP with protocol-version negotiation - Support for both legacy and current MCP client lifecycle modes
- A task-manager abstraction for long-running tool invocations, plus built-in OAuth support for authenticated MCP servers
Common Use Cases
- Building an MCP server in Rust that exposes tools, resources, or prompts to an MCP-compatible client (e.g. Claude Desktop or an agent framework)
- Building an MCP client in Rust that connects to existing MCP servers over stdio or streamable HTTP
- Spawning and communicating with an external MCP server process (e.g. an npm-distributed server) from a Rust application via
TokioChildProcess - Implementing an OAuth-protected MCP server that needs authenticated client connections
- Exposing long-running operations as MCP tools using the task-manager abstraction for progress reporting
Under The Hood
Architecture - The workspace splits into crates/rmcp (the core protocol implementation — handler, service, transport, and model modules) and crates/rmcp-macros (the procedural macro crate for tool generation), with examples/* and a conformance crate rounding out the workspace. service.rs and the service/ module implement the client/server session lifecycle; transport.rs abstracts over stdio and streamable-HTTP transports.
Tech Stack - Pure Rust (99%) on the tokio async runtime, using serde for message serialization and schemars to generate JSON Schema (2020-12) for tool argument definitions; Rust 2024 edition per the workspace Cargo.toml, with a pinned rust-toolchain.toml.
Code Quality - The crates/rmcp/tests directory has focused integration tests per behavior (client initialization, lifecycle modes, streamable-HTTP headers and protocol versioning, tool builder methods, progress subscribers), and a separate conformance crate checks the SDK against the MCP specification directly rather than relying on unit tests alone.
API Design - The client/server split is exposed through a small ServiceExt/serve() surface, and rmcp-macros lets server authors declare a tool as an annotated Rust function instead of hand-writing JSON Schema and dispatch code, keeping the common case (adding one tool) low-boilerplate while the lower-level handler/service/transport modules remain available for advanced use.
Used by 8 apps in this directory
agentgateway
AI Development · Developer Tools
An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
Jan
AI Assistants
Run LLMs 100% locally with full privacy, or connect to cloud AI — your machine, your data, your control.
Laminar
AI Development · Monitoring
Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.
mesh-llm
AI Development · AI Agents
Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.
openfootmanager
Game Development
A free and open source football management simulation game built with Rust and Tauri, inspired by Football Manager.
Silex
No Code Platforms · Design Tools
Free, open-source visual website builder that exports clean HTML/CSS — no lock-in, no subscription, host anywhere
Vibe Kanban
AI Agents · AI Code Assistants · Project Management
A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.