mcp-sdk-rs

This Rust SDK provides a work-in-progress implementation of the Model Context Protocol (MCP) for AI model communication. It offers features like multiple transport layers, async support, type-safe message handling, and

6
0

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), facilitating 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:

[dependencies]
mcp_sdk_rs = "0.1.0"

Quick Start

The SDK provides client and server examples using WebSocket and stdio transports. The client example demonstrates creating a WebSocket transport, setting up message channels, initiating a session, and sending a request. The server example showcases creating a stdio transport and starting the server.

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Originally forked from https://github.com/Derek-X-Wang/mcp-rust-sdk.

Repository

JG
jgmartin

jgmartin/mcp-sdk-rs

Created

January 24, 2025

Updated

March 19, 2025

Language

Rust

Category

AI