# rust-sdk [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/modelcontextprotocol/rust-sdk  
**GitHub Stars:** 4118  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/rust-sdk

## Description
The official Rust SDK for the Model Context Protocol

## Claude Desktop Quick Installation
No confirmed install details yet, so no config is published. Follow the setup steps in the repository above.

## Documentation

## What rust-sdk MCP server does

rust-sdk is a Rust SDK for implementing Model Context Protocol clients and servers; it is not a standalone MCP server with a fixed set of agent-facing tools. The core `rmcp` crate provides the protocol implementation, while `rmcp-macros` supplies procedural macros for generating tool implementations.

The SDK targets the stable `2026-07-28` MCP specification and remains compatible with the `2025-11-25` release and earlier versions. Its protocol coverage includes tools, resources, prompts, sampling, elicitation, roots, logging, completions, notifications, subscriptions, long-running tasks, response caching, multi-round-trip requests, pagination, capability negotiation, and JSON Schema 2020-12 support.

## How it works

Applications create a client or server service and attach it to a transport. Client code can use `ServiceExt` and `TokioChildProcess` to launch another MCP process, while server code can connect a service to Tokio's standard input and output streams. After startup, the service processes protocol messages asynchronously in the background.

The client lifecycle can use the legacy initialize flow, explicit discovery, or an automatic mode that probes discovery and falls back to a legacy protocol version. Server startup waits for peer input that establishes the protocol lifecycle. Once a service is running, application code can issue requests, send notifications, wait for shutdown, or cancel the service.

For tools, the `#[tool]`, `#[tool_router]`, and `#[tool_handler]` macros generate the surrounding wiring. Rust parameter types can derive deserialization and JSON Schema traits so the SDK produces tool input and output schemas from their fields. A tool client discovers available functions with `list_tools` and invokes them with `call_tool`.

## Setup and configuration

Add the published crate with Cargo:

```sh
cargo add rmcp --features server
```

For development against the repository's main branch, Cargo can use the Git source instead:

```sh
cargo add rmcp --features server --git https://github.com/modelcontextprotocol/rust-sdk --branch main
```

Basic dependencies include Tokio and Serde. JSON Schema generation uses Schemars with the 2020-12 schema version. Server applications can construct a service with `ServerHandler` or a tool router, connect it to a transport, and call `waiting()` after startup to keep the service running.

## Tools and capabilities

- Build MCP clients and servers in Rust.
- Expose typed callable tools with procedural macros.
- Generate tool schemas from Rust parameter types.
- Use Tokio-based asynchronous services.
- Support stdio and child-process communication patterns.
- Negotiate protocol versions and capabilities.

## Limitations and notes

The SDK requires an asynchronous Tokio environment for the documented usage patterns. A stdio server normally runs as a child process launched by an MCP client; starting it directly in a terminal can leave protocol startup waiting for client messages. Tokio's standard-input reader may also delay runtime shutdown while waiting for input or EOF, even when cancellation is requested.

The repository includes examples that can be built with Cargo and launched through the MCP Inspector CLI. Applications that need custom server metadata or multiple capabilities should use an explicit `ServerHandler` and `#[tool_handler]` implementation rather than relying only on the tools-only shortcut.

_Full upstream README: https://allmcps.com/mcp/rust-sdk/readme_

