modelcontextprotocol/rust-sdk

Description: The official Rust SDK for the Model Context Protocol

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 34 minutes ago
Added to GitGenius on July 16th, 2026
Created on February 18th, 2025
Open Issues & Pull Requests: 30 (-2)
GitHub issues: Enabled
Number of forks: 573
Total Stargazers: 3,676 (+0)
Total Subscribers: 32 (+0)

Issue Activity (beta)

Open issues: 20
New in 7 days: 9
Closed in 7 days: 14
Avg open age: 110 days
Stale 30+ days: 6
Stale 90+ days: 0

Recent activity

Opened in 7 days: 8
Closed in 7 days: 11
Comments in 7 days: 3
Events in 7 days: 11

Top labels

  • enhancement (51)
  • bug (47)
  • T-enhancement (45)
  • P2 (43)
  • T-transport (40)
  • T-bug (39)
  • 2026-07-28 (32)
  • P1 (30)

Repository Insights (GitGenius)

Median issue/PR response: 0.3 hours
Mean response time: 5.2 days
90th percentile: 7.2 days
Tracked items: 331

Most active contributors

Detailed Description

The rust-sdk repository is the official Rust implementation of the Model Context Protocol, a specification for enabling communication between AI models and external tools or data sources. Published as the rmcp crate on crates.io, it provides a complete SDK built on the tokio async runtime for both client and server implementations of the MCP protocol.

The repository is organized as a workspace containing two primary crates. The rmcp crate delivers the core protocol implementation, while rmcp-macros provides procedural macros that simplify building MCP servers by automatically generating tool implementations and handling protocol wiring. This macro-based approach significantly reduces boilerplate code when defining tools, prompts, and other server capabilities.

The SDK implements comprehensive support for the Model Context Protocol's major features. Tools allow servers to expose callable functions with JSON Schema parameter definitions that clients can discover and invoke. Resources enable servers to expose data like files or database records through URI-based access patterns, with support for both text and binary content. Prompts provide reusable message templates that servers expose to clients with typed arguments. The implementation includes client-side handlers for receiving notifications when resources change, allowing servers to push updates to clients.

The SDK supports multiple protocol lifecycle modes for client initialization. The legacy mode sends an initialize request followed by an initialized notification, while the newer Discover mode completes startup without the initialized notification and carries protocol version and capability information in subsequent requests. This flexibility accommodates both established and emerging MCP implementations.

Additional capabilities include completions for auto-completion suggestions during argument entry, notifications for progress updates and cancellation handling, and support for long-running tool invocations through task management. The SDK also provides deprecated but functional features including sampling, where servers request LLM completions from clients, roots for declaring workspace directories, and structured logging from servers to clients.

The repository demonstrates active maintenance with a migration guide for upgrading to version 1.x, indicating significant evolution and breaking changes in recent releases. The codebase includes extensive examples covering various server types such as calculator servers, prompt servers, sampling servers, and completion servers, along with corresponding client implementations. These examples serve as practical references for developers implementing MCP servers and clients.

The SDK's design emphasizes developer experience through its macro system, which automatically derives JSON schemas from Rust struct fields and handles protocol message routing. The ServerHandler and ClientHandler traits provide extension points for implementing protocol features, while the macros like #[tool], #[prompt], and #[tool_router] enable declarative definitions of server capabilities. Dependencies are kept minimal, relying on tokio for async runtime, serde for serialization, and schemars for JSON Schema generation.

The repository targets the full MCP specification version 2025-11-25, ensuring compatibility with the latest protocol standards. It provides both high-level abstractions through macros and lower-level control through trait implementations, allowing developers to choose between rapid development with macros or fine-grained control over protocol behavior. The inclusion of Chinese language documentation indicates international accessibility and adoption.

rust-sdk
by
modelcontextprotocolmodelcontextprotocol/rust-sdk

Repository Details

Fetching additional details & charts...