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
//! # MCP Core Library
//!
//! `mcp-core` provides the foundational types, traits, and implementations for the
//! Model Context Protocol (MCP). This crate is the core building block for MCP
//! clients and debugging tools.
//!
//! ## Features
//!
//! - **Complete MCP Message Types**: All JSON-RPC message structures defined by the MCP specification
//! - **Transport Abstraction**: Unified interface for stdio, HTTP+SSE, and HTTP streaming transports
//! - **Type-Safe Configuration**: Compile-time validated configuration for all transport types
//! - **Comprehensive Error Handling**: Structured error types for all failure modes
//! - **Async-First Design**: Built on tokio for high-performance async I/O
//! - **High-Level Client**: Ready-to-use MCP client with protocol handling
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use mcp_probe_core::{
//! client::{McpClient, ClientConfig},
//! transport::TransportConfig,
//! messages::Implementation,
//! };
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Configure a stdio transport
//! let config = TransportConfig::stdio("python", &["server.py"]);
//!
//! // Create and connect client
//! let mut client = McpClient::with_defaults(config).await?;
//!
//! let client_info = Implementation {
//! name: "mcp-probe".to_string(),
//! version: "0.1.0".to_string(),
//! metadata: std::collections::HashMap::new(),
//! };
//!
//! let server_info = client.connect(client_info).await?;
//! println!("Connected to: {}", server_info.implementation.name);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Architecture
//!
//! The library is organized into several key modules:
//!
//! - [`error`]: Comprehensive error types for all MCP operations
//! - [`messages`]: Complete MCP message type definitions
//! - [`transport`]: Transport abstraction and implementations
//! - [`client`]: High-level MCP client interface
//!
//! ## Transport Support
//!
//! This crate supports all three MCP transport mechanisms:
//!
//! - **stdio**: Local process communication (enabled by default)
//! - **http-sse**: HTTP + Server-Sent Events (enabled by default)
//! - **http-stream**: Full-duplex HTTP streaming (enabled by default)
//!
//! Transport support can be controlled via feature flags.
// Re-export commonly used types for convenience
pub use ;
pub use ;
pub use ;
pub use ;
/// Current version of the mcp-core library
pub const VERSION: &str = env!;
/// Current MCP protocol version supported by this library
pub const PROTOCOL_VERSION: &str = "2024-11-05";