modelcontextprotocol/rust-sdk
The official Rust SDK for the Model Context Protocol
What it solves
MCP is a standard protocol that lets AI models interact with external tools, resources, and prompts. This SDK removes the low‑level plumbing so Rust developers can quickly build MCP servers and clients that connect AI assistants to real‑world capabilities, without reinventing protocol details.
How it works
It provides two core crates: rmcp (the protocol implementation) and rmcp-macros (procedural macros that auto‑generate tool and prompt handlers). Built on tokio for async runtime, it supports defining tools with #[tool] macros, resources and prompts via trait implementations, and includes multiple transports like stdio and HTTP. It handles capability negotiation, OAuth, pagination, notifications, and the latest 2026‑07‑28 spec while staying compatible with older versions.
Who it’s for
Rust developers building MCP‑compliant servers or clients, especially those creating AI‑powered applications that need to expose or consume tools, resources, and prompts in a standard way.
Highlights
- Official SDK from the MCP project, actively maintained.
- Supports the 2026‑07‑28 spec with backward compatibility.
- Procedural macros reduce boilerplate for tool and prompt definitions.
- Dual client/server roles with multiple transport options (stdio, HTTP, child process).
- Features include resource templates, subscriptions, long‑running tasks, response caching, and JSON Schema 2020‑12 generation.
Related
- Project
- Project
- Project
- Project
- Dispatch