Model Context Protocol (MCP) Rust SDK
⚠️ Warning: This SDK is currently a work in progress and is not ready for production use.
A Rust implementation of the Model Context Protocol (MCP), designed for seamless communication between AI models and their runtime environments.
Features
- 🚀 Full implementation of MCP protocol specification
- 🔄 Multiple transport layers (WebSocket, stdio)
- ⚡ Async/await support using Tokio
- 🛡️ Type-safe message handling
- 🔍 Comprehensive error handling
- 📦 Zero-copy serialization/deserialization
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
Quick Start
Client Example
use ;
async
Server Example
use ;
async
Transport Layers
The SDK supports multiple transport layers:
WebSocket Transport
- Ideal for network-based communication
- Supports both secure (WSS) and standard (WS) connections
- Built-in reconnection handling
stdio Transport
- Perfect for local process communication
- Lightweight and efficient
- Great for command-line tools and local development
Error Handling
The SDK provides comprehensive error handling through the Error
type:
use Error;
match result
License
This project is licensed under the MIT License - see the LICENSE file for details.