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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! # Alou - 智能自动化工作流系统
//!
//! 一个基于Rust和Model Context Protocol (MCP)的智能自动化工作流系统,集成了DeepSeek API,
//! 提供强大的上下文感知和工具调用能力。
//!
//! 这个库提供了完整的MCP协议实现,支持AI模型与其运行环境之间的通信。
//! 支持客户端和服务器实现,通过stdio传输层进行通信。
//!
//! 项目地址: https://github.com/your-username/alou-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.
/// Agent module provides the intelligent agent implementation
/// Client module provides the MCP client implementation
/// Connection pool for managing multiple MCP connections
/// Error types and handling for the SDK
/// Protocol-specific types and implementations
/// Prompt registry for managing MCP prompts
/// System prompts and templates
/// Server module provides the MCP server implementation
/// Transport layer implementations (stdio)
/// Common types used throughout the SDK
/// Workspace context for managing project directories
// Authentication and database modules
/// Data models for users and sessions
/// Database connection and management
/// Authentication logic (JWT, OAuth, middleware)
/// API endpoints
// 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