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
//! Client implementation for the MCP SDK.
//!
//! This crate provides the client-side implementation for the Model Context
//! Protocol. It includes a fluent client API, server discovery, and connection
//! management.
//!
//! # Overview
//!
//! The MCP client allows AI applications to:
//!
//! - Connect to MCP servers via various transports
//! - Discover and invoke tools
//! - Read resources
//! - Get prompts
//! - Track long-running tasks
//!
//! # Example
//!
//! ```no_run
//! use mcpkit_client::{Client, ClientBuilder};
//! use mcpkit_transport::SpawnedTransport;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), mcpkit_core::error::McpError> {
//! // Spawn an MCP server as a subprocess and connect via stdio
//! let transport = SpawnedTransport::spawn("my-mcp-server", &[] as &[&str]).await?;
//!
//! let client = ClientBuilder::new()
//! .name("my-client")
//! .version("1.0.0")
//! .build(transport)
//! .await?;
//!
//! // List available tools
//! let tools = client.list_tools().await?;
//! for tool in &tools {
//! println!("Tool: {}", tool.name);
//! }
//!
//! // Call a tool
//! let result = client.call_tool("add", serde_json::json!({
//! "a": 1,
//! "b": 2
//! })).await?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Client Handler
//!
//! For handling server-initiated requests (sampling, elicitation), implement
//! the [`ClientHandler`] trait:
//!
//! ```rust
//! use mcpkit_client::ClientHandler;
//! use mcpkit_core::types::{CreateMessageRequest, CreateMessageResult};
//! use mcpkit_core::error::McpError;
//!
//! struct MyHandler;
//!
//! impl ClientHandler for MyHandler {
//! // Override default methods as needed
//! }
//! ```
// Re-export commonly used types
pub use ClientBuilder;
pub use Client;
pub use ;
pub use ClientHandler;
pub use ;
/// Prelude module for convenient imports.