rust-sdk
The official Rust SDK for the Model Context Protocol
claude mcp add --transport stdio modelcontextprotocol-rust-sdk cargo run \ --env RUST_LOG="info"
How to use
The Rust RMCP SDK provides a native Rust implementation of the Model Context Protocol (RMCP) with asynchronous Tokio runtime. It exposes a core protocol crate and a macros crate to help you generate RMCP tool implementations. This server-side SDK is intended for building RMCP servers in Rust and interfacing with RMCP clients. To try it locally, you typically build and run the server binary from the repository or your project that uses the rmcp crate, and then connect clients that are built with the same RMCP protocol. The README demonstrates how a client can be started via a transport (e.g., standard I/O) and how to construct a service (ServerHandler) or ClientHandler to interact with the server. You can also leverage the generated prompts and resources capabilities to expose data and dynamic endpoints to clients. In practice, you would implement ServerHandler for your domain logic, start the RMCP service, and then send requests or notifications to manage resources, roots, and other MCP features supported by the SDK.
How to install
Prerequisites:
- Rust toolchain (installed via rustup) with stable toolchain available
- Git to clone the repository or access to the crate via crates.io
Steps:
- Install Rust:
- On macOS/Linux: curl https://sh.rustup.rs -sSf | sh
- Follow prompts to install the toolchain
- Clone the repository or create a Rust project and add the rmcp dependency:
- git clone https://github.com/modelcontextprotocol/rust-sdk.git
- cd rust-sdk
- Ensure you have the desired crate features enabled (e.g., server)
- Build and run the server:
- cargo build --release
- cargo run
- If integrating into your own project, add rmcp as a dependency and implement your ServerHandler accordingly, then run your binary with Tokio runtime.
Notes:
- The README examples show using the rmcp crate to create a client and server interactions, so you’ll typically either run the server from a binary or embed the library in your application and drive it from your main function.
Additional notes
Tips and considerations:
- If you enable logging, set RUST_LOG to capture info/debug output (e.g., RUST_LOG=info).
- Ensure that your ServerHandler implements the required MCP capabilities (e.g., resources, prompts) via get_info.
- The SDK uses Tokio for async runtime; ensure your environment supports asynchronous execution models.
- When testing, you can spin up a client transport (e.g., using stdio or a TCP transport) to interact with your server.
- If migrating from older versions, refer to the migration guide linked in the README for breaking changes and upgrade steps.
Related MCP Servers
goose
an open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
cunzhi
告别AI提前终止烦恼,助力AI更加持久
probe
AI-friendly semantic code search engine for large codebases. Combines ripgrep speed with tree-sitter AST parsing. Powers AI coding assistants with precise, context-aware code understanding.
mcp-center
A centralized platform for managing and connecting MCP servers. MCP Center provides a high-performance proxy service that enables seamless communication between MCP clients and multiple MCP servers.
backlog -rust
MCP server for Backlog, project management service.
perplexity-web-api
🔍 Perplexity AI MCP without API key