Official MCP Rust SDK
Official Rust SDK for Model Context Protocol clients and servers, published as the `rmcp` crate with tokio async runtime support, server and client features, tool macros, resources, prompts, sampling, roots, logging, completions, notifications, Streamable HTTP, child-process transports, and OAuth support.
Open the source and read safety notes before installing.
Safety notes
- The official Rust SDK is a protocol library; risk comes from the tools, resources, prompts, transports, auth flows, and long-running task behavior you implement with it.
- Validate tool parameters, enforce caller permissions, bound file and network access, and sanitize errors before returning MCP responses.
- Streamable HTTP servers, child-process transports, and OAuth flows need normal production controls: auth, TLS, request limits, lifecycle handling, logging policy, and abuse protection.
- Feature flags can pull in transport, HTTP, OAuth, schema, and process dependencies; review the enabled feature set before shipping.
Privacy notes
- Rust MCP services may expose tool arguments, tool results, resource contents, prompt templates, task state, authentication metadata, logs, traces, and subprocess output.
- Avoid returning secrets, private files, customer data, internal identifiers, privileged paths, or raw dependency/runtime errors to MCP clients.
- Document which MCP client, server process, transport, subprocess, model provider, and observability system can observe each request.
Prerequisites
- Rust toolchain and Cargo project compatible with the SDK crate version and edition requirements.
- Tokio async-runtime familiarity for client, server, transport, and handler integration.
- A selected feature set for server, client, macros, Streamable HTTP, child-process, OAuth, or schema generation support.
- Reviewed authorization, side-effect, and data-exposure boundaries for production MCP tools and resources.
Schema details
- Install type
- cli
- Troubleshooting
- No
- Scope
- Source repo
- Estimated setup
- 20 minutes
- Difficulty
- advanced
- Pricing
- free
- Disclosure
- editorial
- Application category
- DeveloperApplication
- Operating system
- Cross-platform
Full copyable content
cargo add rmcpAbout this resource
Overview
The official MCP Rust SDK is the Model Context Protocol project's Rust
implementation for building MCP clients and servers. The repository is published
around the rmcp crate and an rmcp-macros procedural macro crate, with tokio
async runtime support and docs.rs API documentation.
Rust developers are a high-intent segment for MCP infrastructure because they often care about typed protocol surfaces, async transport behavior, low-overhead services, and strict production boundaries.
Package Layout
| Crate | Best Fit |
|---|---|
rmcp |
Core MCP protocol implementation for clients, servers, handlers, transports, and models |
rmcp-macros |
Procedural macros for generating MCP tool implementations |
Quick Start
Install the core crate:
cargo add rmcp
Then enable the SDK features that match your deployment, such as server, client,
macros, Streamable HTTP, child-process transport, schema generation, or OAuth
support. The upstream crates/rmcp/Cargo.toml documents the feature list.
MCP Fit
Choose the official Rust SDK when an MCP integration needs Rust's type system, async execution, transport control, service embedding, or tight resource bounds. It is a strong fit for developer tools, local services, infrastructure agents, gateway processes, and systems that already use tokio-based Rust components.
The SDK provides protocol and transport primitives. It does not make unsafe tools safe by itself, so production use still requires clear authorization and data-exposure boundaries.
Core Capabilities
| Area | Rust SDK Coverage |
|---|---|
| Server APIs | Server handlers, tool registration, resources, prompts, notifications, and tasks |
| Client APIs | MCP client support and child-process transport examples |
| Tool macros | #[tool], #[tool_router], and related macro support through rmcp-macros |
| Transports | stdio/async I/O, child process, Streamable HTTP client and server features |
| Protocol features | Sampling, roots, logging, completions, notifications, subscriptions, and schema support |
| Auth | Optional OAuth and JWT-related feature support |
Use Cases
- Build a typed Rust MCP server around local services or infrastructure APIs.
- Implement a Rust MCP client or conformance test harness.
- Expose tools with procedural macro routing.
- Connect to child-process MCP servers from a Rust application.
- Run Streamable HTTP MCP client or server transports.
- Build low-overhead MCP services where resource bounds matter.
Source Review
Verified on 2026-06-18:
- The upstream README identifies RMCP as an official Rust Model Context Protocol SDK implementation with tokio async runtime support.
- The README lists
rmcpas the core protocol crate andrmcp-macrosas the procedural macro crate for tool implementations. - The workspace
Cargo.tomldeclares versionedrmcpandrmcp-macrosmembers, Apache-2.0 licensing, Rust 2024 edition, repository metadata, and MCP keywords. crates/rmcp/Cargo.tomldocuments the package name, docs.rs documentation URL, dependencies, default features, server/client features, Streamable HTTP features, OAuth-related features, schema support, and child-process transport support.- docs.rs resolves current API documentation for
rmcp.
Safety and Privacy
Rust helps with type safety and resource control, but MCP safety still depends on your handler design. Keep tool surfaces narrow, validate parameters, check permissions, and avoid returning raw internal errors or private data to clients.
For hosted or process-spawning deployments, review transport lifecycle, subprocess boundaries, authentication, logging, backpressure, cancellation, and task cleanup before production use.
Duplicate Check
Checked current content/mcp/, content/tools/, content/skills/, open pull
requests, and repository-wide content for modelcontextprotocol/rust-sdk,
official MCP Rust SDK, Model Context Protocol Rust SDK, rmcp crate, Rust MCP
server SDK, Rust MCP client SDK, tokio MCP Rust, and MCP tool macros Rust. Some
unrelated entries contain mcp inside product names, but no dedicated official
Rust SDK entry, exact source URL duplicate, target file, or open duplicate PR
was found.
Source citations
Add this badge to your README
How it compares
Official MCP Rust SDK side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Official MCP Rust SDK Official Rust SDK for Model Context Protocol clients and servers, published as the `rmcp` crate with tokio async runtime support, server and client features, tool macros, resources, prompts, sampling, roots, logging, completions, notifications, Streamable HTTP, child-process transports, and OAuth support. Open dossier | Official MCP Java SDK Official Java SDK for Model Context Protocol clients and servers, maintained in collaboration with Spring AI, with Java 17+ support, Maven artifacts, synchronous and asynchronous APIs, Reactive Streams, Project Reactor, JDK HttpClient, Servlet transport, JSON binding modules, and conformance tests. Open dossier | Official MCP Python SDK Official Python SDK for Model Context Protocol clients and servers, published as the `mcp` package on PyPI, with FastMCP server helpers, client support, tools, resources, prompts, stdio, SSE, Streamable HTTP, authentication, elicitation, sampling, logging, and standalone development tools. Open dossier | Official MCP Ruby SDK Official Ruby SDK for Model Context Protocol clients and servers, published as the `mcp` gem with JSON-RPC handling, tool, prompt, and resource registration, stdio and Streamable HTTP transports, Rack/Rails integration, roots, sampling, elicitation, logging, cancellation, pagination, and RubyGems metadata. Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Category | tools | tools | tools | tools |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | Model Context Protocol | Model Context Protocol | Model Context Protocol | Model Context Protocol |
| Added | 2026-06-18 | 2026-06-18 | 2026-06-18 | 2026-06-18 |
| Platforms | CLI | CLI | CLI | CLI |
| Source repo | — | — | — | — |
| Safety notes | ✓The official Rust SDK is a protocol library; risk comes from the tools, resources, prompts, transports, auth flows, and long-running task behavior you implement with it. Validate tool parameters, enforce caller permissions, bound file and network access, and sanitize errors before returning MCP responses. Streamable HTTP servers, child-process transports, and OAuth flows need normal production controls: auth, TLS, request limits, lifecycle handling, logging policy, and abuse protection. Feature flags can pull in transport, HTTP, OAuth, schema, and process dependencies; review the enabled feature set before shipping. | ✓The official Java SDK is a protocol library; production risk comes from your MCP tools, resources, prompts, transports, authorization hooks, and framework integration. Validate tool inputs, enforce caller permissions, bound side effects, and avoid returning raw Java exceptions or internal stack details to MCP clients. Servlet, Spring, and remote transport deployments need authentication, TLS, request limits, observability policy, cancellation behavior, and abuse protection. Spring AI MCP security and annotation support may simplify integration, but application owners still need to review authorization, tenant boundaries, and data retention. | ✓The official Python SDK is a protocol library; risk comes from the tools, resources, prompts, transports, auth flows, and server process you build with it. Validate all tool inputs, enforce caller permissions, bound file and network access, and sanitize errors before returning them to an MCP client. HTTP, SSE, and ASGI deployments need authentication, TLS, CORS review, host/path routing controls, request limits, logging policy, and abuse protection. The upstream README says v2 is alpha; production projects should stay on the stable v1 line unless they intentionally pin and test a pre-release. | ✓The official Ruby SDK is a protocol library; risk comes from your registered tools, resources, prompts, transports, session handling, and framework integration. Validate tool arguments, enforce caller permissions, bound file and network access, and sanitize exceptions before returning MCP responses. The upstream README warns that Streamable HTTP session and SSE state are in memory by default; multi-process Rack/Rails deployments need stateless mode or sticky sessions. Rails controller integrations that create servers per request should review user context, tool selection, and request-specific authorization carefully. |
| Privacy notes | ✓Rust MCP services may expose tool arguments, tool results, resource contents, prompt templates, task state, authentication metadata, logs, traces, and subprocess output. Avoid returning secrets, private files, customer data, internal identifiers, privileged paths, or raw dependency/runtime errors to MCP clients. Document which MCP client, server process, transport, subprocess, model provider, and observability system can observe each request. | ✓Java MCP clients and servers may expose tool arguments, tool results, resource contents, prompt templates, request metadata, correlation IDs, logs, traces, and authorization context. Avoid leaking secrets, customer data, private resources, internal identifiers, stack traces, privileged paths, or token values through schemas, responses, errors, or logs. Document which MCP client, server process, Java framework, model provider, transport, and observability system can observe each request. | ✓MCP Python servers may expose local files, application data, tool arguments, tool results, resource contents, prompt templates, authentication state, logs, traces, and errors. Do not leak secrets, customer data, private paths, internal identifiers, token values, or privileged resource contents through schemas, examples, responses, or logs. Document which MCP client, model provider, server process, transport, ASGI layer, and observability system can observe each request. | ✓Ruby MCP clients and servers may expose tool arguments, tool results, resource contents, prompt templates, request context, session IDs, logs, progress events, exceptions, and filesystem roots. Avoid leaking secrets, customer data, private files, internal identifiers, stack traces, privileged paths, or session contents through schemas, responses, errors, or logs. Document which MCP client, Ruby process, Rack/Rails layer, session store, model provider, transport, and logging system can observe each request. |
| Prerequisites |
|
|
|
|
| Install | | | | |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.