Get the FREE Ultimate OpenClaw Setup Guide →

rmcp

BEST Rust SDK for MCP (Model Context Protocol)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio 4t145-rmcp npx -y @modelcontextprotocol/server-everything

How to use

RMCP (Rust Model Context Protocol) provides a Rust SDK implementation with async support built on tokio for building servers and clients that communicate via the MCP specification. The README demonstrates a quick-start flow where a client can be served by a transport that reads and writes JSON-RPC messages. In practice, you would either embed RMCP as a library in your Rust project and construct a transport (for example, from stdin/stdout or a network stream) and then create a service to handle your RPC tools, or you can leverage a pre-built server package (as shown by the server-everything example) to quickly wrap a set of tools and endpoints. The toolkit supports building transports, declaring tools with macros, and serving them together with a standard API for requests and notifications. Tools can be declared using macros to expose operations and descriptions, and the framework includes support for awaiting shutdown, cancellation, and dynamic composition of multiple services.

To use the capabilities, you typically:

  • Build a transport that satisfies IntoTransport (common options include a pair of AsyncRead/AsyncWrite streams or a tuple of sink/stream). This is what your client or server will use to exchange ClientJsonRpcMessage and ServerJsonRpcMessage.
  • Create a service (e.g., via a ServerHandler or ClientHandler) that encapsulates your business logic or exposes tool boxes via the provided macros. The examples in the README illustrate a calculator toolbox with both asynchronous and synchronous tool functions.
  • Serve the transport with the service and interact with the server by sending requests (e.g., list_roots) or notifications (e.g., notify_cancelled) through the JSON-RPC channel. You can also wait for service shutdown or cancel the service if needed.

How to install

Prerequisites:

  • Rust and Cargo installed (rustup default toolchain is fine).
  • A Rust toolchain with the required nightly features if using advanced macros or schemars support.

Installation steps:

  1. Install Rust from https://rust-lang.org unless you already have it: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

  2. Create a new project or open your existing RMCP project and add the RMCP dependency with the server feature: [dependencies] rmcp = { version = "0.1", features = ["server"] }

  3. Build the project: cargo build --release

  4. Run the server (example): cargo run --bin your_server_binary

  5. If you want to experiment with a pre-packaged Node-based server using npx (as shown in the README), ensure Node.js is installed and you can launch: npx -y @modelcontextprotocol/server-everything

Note: The README demonstrates a Node.js-based quick-start client/server example. For a native Rust server, follow the cargo-based build/run workflow and use the RMCP APIs to create transports and services.

Additional notes

Tips and considerations:

  • The RMCP crate emphasizes type-safe MCP data models and uses tokio for asynchronous runtimes. Ensure your environment supports async IO models used in transports.
  • When declaring tools via macros (toolbox, tool), ensure your return types implement IntoCallToolResult so responses serialize correctly.
  • If you plan to compose multiple services, you can convert them into a dynamic type using into_dyn for uniform handling.
  • The README references a toolbox-based design for exposing server tools; explore examples in the repository for concrete patterns.
  • If you encounter transport interoperability issues, review how IntoTransport is implemented for common types (e.g., (stdin, stdout), TCP streams, or async I/O pairs).

Related MCP Servers

Sponsor this space

Reach thousands of developers