# Repository Briefing: modelcontextprotocol/rust-sdk
> Source: https://repoforai.com/repo/modelcontextprotocol/rust-sdk (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/modelcontextprotocol/rust-sdk
- **Official Docs / Website**: https://docs.rs/rmcp
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: Rust
- **License**: See repository
- **Engineering Health**: A (83/100 · Maintenance 35/35 · Adoption 22/25 · Releases 20/20 · License 6/20)
- **Latest Release**: rmcp-v3.12.0 (2026-11-26) — https://github.com/modelcontextprotocol/rust-sdk/releases
- **Review Snapshot**: 2026-11-29
- **Deployment / Stack Signals**: MCP
- **Momentum**: 4,188 ★ total (+3 24h / +38 7d) · 743 forks
- **Topics**: `rust`, `mcp`, `mcp-server`, `mcp-client`
- **When to Use**: Best for: Rust teams exposing existing business logic as MCP tools or URI-addressable resources, or embedding a client that must handle both legacy initialization and newer discovery. Skip if: You need a ready-to-run server rather than a library, or your application already uses another runtime and has no reason to add a Rust component.

## Overview
```text
### Architecture & Core Mechanics
RMCP splits the protocol and async service implementation (`crates/rmcp`) from procedural macros for tool wiring (`crates/rmcp-macros`). Tokio runs the async services, Serde handles serialization, and `schemars` generates JSON Schema 2020-12. Applications implement `ServerHandler` or `ClientHandler` and bind the handler to a transport; `crates/rmcp/src/handler/server.rs` and `crates/rmcp/src/handler/client.rs` are the corresponding extension points.

On the server, `ServiceExt::serve()` waits for peer input that establishes the protocol lifecycle before returning a handle to the background service. The application can then issue requests or notifications through that handle and await shutdown with `waiting()` or initiate it with `cancel()`. The same handler-and-transport model supports a local server over Tokio stdio and a client that launches a subprocess with `TokioChildProcess`.

### Key Capabilities & Differentiators
RMCP implements MCP `2026-07-28` while retaining the legacy `2025-11-25` lifecycle and compatibility with earlier versions. The new revision covers server discovery and negotiation, transport-neutral subscriptions, long-running tasks, response caching, multi-round-trip requests, and standard HTTP routing headers. Client `serve()` still sends `initialize` followed by `notifications/initialized`; in `Discover` mode, `server/discover` replaces that handshake and subsequent requests carry the protocol version, client information, and capabilities in `_meta`.

The `#[tool]`, `#[tool_router]`, and `#[tool_handler]` macros connect Rust methods to tool discovery and invocation. Generated schemas use field names, types, and field documentation, not docs on the enclosing type. Tool responses can carry mixed text, image, audio, and embedded resource blocks; structured results can be any JSON value under `2026-07-28`. Resources are read by URI, with templates for parameterized URIs and notifications for list changes or individual updates.

### Trade-offs & Limitations
Compared with hand-writing a narrow JSON-RPC adapter, RMCP takes on message typing, lifecycle handling, and tool schema generation, at the cost of adopting Tokio and the SDK's handler model. The tools-only macro shortcut minimizes wiring, but custom metadata or additional capabilities call for an explicit handler. Tool failures that callers should see belong in `CallToolResult::error`; `Err(McpError)` is for requests the server cannot route or process.

For mixed peer versions, choose the lifecycle deliberately: `Auto` can fall back when `server/discover` is unsupported, but a silent peer can add a 10-second wait before fallback. For stdio deployments, a server started without a client can wait at startup; `serve_with_ct()` supports startup cancellation, but Tokio's blocking stdin read can still delay runtime shutdown until input or EOF. Test both startup and shutdown with the actual client or process supervisor.

### Hardware & Deployment Guide
The workspace uses Rust edition 2024 and declares Rust 1.88 as its minimum. Add the published crate with `cargo add rmcp --features server` for a server integration. For a local smoke test, build the counter with `cargo build -p mcp-server-examples --example servers_counter_stdio`, then run `npx @modelcontextprotocol/inspector --cli ./target/debug/examples/servers_counter_stdio --method tools/list` so Inspector launches the process and sends protocol messages.

The stdio path does not require a network listener or a GPU for protocol handling; size the process and any child services around representative handler workloads, payloads, and concurrency. Use the migration guide when moving to 3.x. In `rmcp-v3.12.0`, `chrono` became optional behind a default-enabled feature, typed results were preserved for numeric cache TTLs, and `list_all_*` pagination gained a cap. The matching macro release fixed description extraction when other attributes follow doc comments.
```

## Key Capabilities
```text
- Crate split: `rmcp` implements the protocol and services; `rmcp-macros` generates tool routing and handler wiring.
- Lifecycle negotiation: `serve()` uses legacy initialization; `serve_with_lifecycle` adds explicit `Discover` and `Auto` modes.
- Tool contracts: `schemars` derives JSON Schema 2020-12 from Rust fields; MCP `2026-07-28` allows non-object output schemas and arbitrary JSON structured content.
- Resource access: Clients can list URI templates, read concrete URIs, and handle list-change and resource-update notifications.
- Local integration: Tokio stdio connects a server launched as a child process to an MCP client; `TokioChildProcess` supports this pattern on the client side.
- Release behavior: `rmcp-v3.12.0` bounds `list_all_*` pagination and gates `chrono` behind a default-enabled feature.
```

## Quick Start / Clone
```bash
cargo add rmcp --features server
```
