mcp-rust-sdk
Rust SDK for the Model Context Protocol (MCP)
claude mcp add --transport stdio derek-x-wang-mcp-rust-sdk cargo run --bin mcp_rust_sdk \ --env RUST_LOG="info"
How to use
The MCP Rust SDK provides a Rust-based implementation of the Model Context Protocol (MCP) with multiple transport options, including WebSocket and stdio, designed for asynchronous operation using Tokio. This package is a library rather than a standalone server, so you typically integrate its Client or Server abstractions into your application to enable MCP-compliant communication between models and runtimes. The SDK exposes transport layers, a typed error model, and helpers to serialize/deserialize MCP messages, making it easier to wire up a runtime that talks to MCP peers. Use the provided Client to act as an MCP client or the Server to build an MCP server component that can accept connections and process MCP requests via the chosen transport.
To get started, add the crate to your Cargo.toml, create a Tokio runtime, configure a transport (WebSocket or Stdio), and instantiate a Client or Server from the SDK. From there, you can connect, send requests (e.g., method calls or data exchanges defined by MCP), and handle responses with the library’s error types for robust handling. The documentation highlights how to construct and connect transports, perform requests, and run a server loop compatible with async/await, enabling smooth integration into Rust-based AI runtimes.
How to install
Prerequisites:
- Rust toolchain installed (Rustup, cargo)
- Optional: familiarity with Tokio and async/await patterns
-
Create a new Rust project (if starting fresh): cargo new my_mcp_app cd my_mcp_app
-
Add the MCP Rust SDK dependency to Cargo.toml: [dependencies] mcp_rust_sdk = "0.1.0"
-
Build the project to fetch dependencies: cargo build
-
(Optional) If you want to run examples or a quick test, you can add a small main.rs snippet shown in the Quick Start section of the README and adapt to your transport choice (WebSocket or Stdio).
-
Run or integrate:
- If you added a binary in src/main.rs, run with: cargo run
Prerequisites recap:
- Rust compiler and cargo installed
- Internet access to fetch crates.io dependencies
- Basic knowledge of async Rust and Tokio for proper integration
Additional notes
Notes:
- This SDK is marked as a work in progress and not intended for production use. Be prepared for API changes or breaking changes between versions.
- Supports multiple transport layers (WebSocket, stdio) and asynchronous operation via Tokio.
- If you plan to use stdio transport, ensure your process is wired correctly to read/write from standard streams.
- When configuring transports, consider network requirements, TLS for WebSocket (WSS), and proper error handling using the SDK's Error type.
- The npmPackage field is not applicable here since this is a Rust SDK library, not a Node.js package.
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