
A full spec async Rust implementation of the Model Context Protocol (MCP) with batteries
概览
The most advanced and complete implementation of the Model Context Protocol (MCP) specification. This Rust implementation goes beyond the standard specification to provide: - : Implements every feature from the latest MCP spec - : Comprehensive error system with recovery mechanisms - : Robust implementations of all transport types with detailed error tracking - : Leveraging Rust's type system for compile-time correctness - : Production-tested with Claude Desktop compatibility This library sets the standard for MCP implementations with its comprehensive feature set and robust error handling. : While this implementation provides the most complete coverage of the MCP specification, including features like sampling, roots, and completion that are not yet available in other implementations, it is still under active development. This is an implementation of the Model Context Protocol defined by Anthropic, with extensive modifications and improvements.
README
以下为原文 README 节选,完整内容请查看原文。
mcp-daemon
Overview
The most advanced and complete implementation of the Model Context Protocol (MCP) specification. This Rust implementation goes beyond the standard specification to provide:
- Full Specification Coverage: Implements every feature from the latest MCP spec
- Production-Grade Error Handling: Comprehensive error system with recovery mechanisms
- Advanced Transport Layer: Robust implementations of all transport types with detailed error tracking
- Type-Safe Architecture: Leveraging Rust’s type system for compile-time correctness
- Real-World Ready: Production-tested with Claude Desktop compatibility
This library sets the standard for MCP implementations with its comprehensive feature set and robust error handling.
Note: While this implementation provides the most complete coverage of the MCP specification, including features like sampling, roots, and completion that are not yet available in other implementations, it is still under active development.
Installation
Add this to your Cargo.toml:
[dependencies]
mcp_daemon = "0.2.1"
Overview
This is an implementation of the Model Context Protocol defined by Anthropic, with extensive modifications and improvements.
Repository
The mcp-daemon repository can be found at: https://github.com/entrepeneur4lyf/mcp-daemon
Features
Supported Transports
HTTP-Based Transports
- Server-Sent Events (SSE): Robust unidirectional server-to-client communication with automatic keep-alive
- WebSocket: Full-duplex communication with comprehensive error handling and connection management
Other Transports
- Standard IO (Stdio): For command-line and process-based communication
- In-Memory Channel: Efficient inter-process communication using Tokio channels
Transport Implementation Details
HTTP Transport Layer
The HTTP transport layer provides a unified interface for both SSE and WebSocket connections:
Server-Side Events (SSE)
- Efficient unidirectional communication from server to client
- Automatic keep-alive with configurable intervals (default: 15 seconds)
- Comprehensive event types support (data, named events, comments)
- JSON serialization for structured messages
- Built on
actix-web-labfor robust server implementation
WebSocket Transport
- Full-duplex communication with message broadcasting
- Header customization support for authentication and session management
- Robust error handling with specific error codes and messages
- Connection lifecycle management (open, close, reconnect)
- Built on
tokio-tungstenitefor async WebSocket support
Common Features
安装
npx -y @modelcontextprotocol/server-brave-search