1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! # Model Context Protocol (MCP) Rust SDK
//!
//! This SDK provides a Rust implementation of the Model Context Protocol (MCP), a protocol designed
//! for communication between AI models and their runtime environments. The SDK supports both client
//! and server implementations via a stdio-based transport layer.
//!
//! Located at https://github.com/darinkishore/mcp_client_rust
//!
//! ## Features
//!
//! - Full implementation of MCP protocol specification
//! - Stdio transport layer
//! - Async/await support using Tokio
//! - Type-safe message handling
//! - Comprehensive error handling
//!
//! ## Example
//!
//! ```no_run
//! use std::sync::Arc;
//! use mcp_client_rs::client::Client;
//! use mcp_client_rs::transport::stdio::StdioTransport;
//! use tokio::io::{stdin, stdout};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a Stdio transport using standard input/output
//! let transport = StdioTransport::with_streams(stdin(), stdout())?;
//!
//! // Create the client with Arc-wrapped transport
//! let client = Client::new(Arc::new(transport));
//!
//! // Use the client...
//!
//! Ok(())
//! }
//! ```
//!
//! ## Usage
//! The client can be used to send requests and notifications to an MCP-compliant server.
//! See the [client](crate::client) module for details on initialization and tool usage.
/// Client module provides the MCP client implementation
/// Error types and handling for the SDK
/// Protocol-specific types and implementations
/// Server module provides the MCP server implementation
/// Transport layer implementations (stdio)
/// Common types used throughout the SDK
// Re-export commonly used types for convenience
pub use Error;
pub use ;
pub use *;
/// The latest supported protocol version of MCP
///
/// This version represents the most recent protocol specification that this SDK supports.
/// It is used during client-server handshake to ensure compatibility.
pub const LATEST_PROTOCOL_VERSION: &str = "2024-11-05";
/// List of all protocol versions supported by this SDK
///
/// This list is used during version negotiation to determine compatibility between
/// client and server. The versions are listed in order of preference, with the
/// most recent version first.
pub const SUPPORTED_PROTOCOL_VERSIONS: & = &;
/// JSON-RPC version used by the MCP protocol
///
/// MCP uses JSON-RPC 2.0 for its message format. This constant is used to ensure
/// all messages conform to the correct specification.
pub const JSONRPC_VERSION: &str = "2.0";
// Simple example function to demonstrate library usage in tests