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
//! # Hanzo MCP - Unified Model Context Protocol
//!
//! This crate provides a unified interface to the Hanzo MCP ecosystem:
//!
//! - **Core types and traits** (`hanzo-mcp-core`) - Shared abstractions
//! - **Client** (`hanzo-mcp-client`) - Connect to MCP servers
//! - **Server** (`hanzo-mcp-server`) - Build MCP servers with tools
//!
//! ## Features
//!
//! - `client` (default) - Include the MCP client
//! - `server` - Include the MCP server implementation
//! - `full` - Include everything
//!
//! ## Quick Start
//!
//! ### Using the unified McpClient (recommended)
//!
//! ```rust,ignore
//! use hanzo_mcp::{McpClient, McpClientConfig, McpServerConfig, McpServerSource};
//!
//! let config = McpClientConfig {
//! servers: vec![
//! McpServerConfig {
//! name: "example".to_string(),
//! source: McpServerSource::Http {
//! url: "http://localhost:3333/mcp".to_string(),
//! timeout_secs: Some(30),
//! headers: None,
//! },
//! ..Default::default()
//! },
//! ],
//! max_concurrent_calls: Some(5),
//! ..Default::default()
//! };
//!
//! let mut client = McpClient::new(config);
//! client.initialize().await?;
//!
//! let tools = client.list_tools().await;
//! let result = client.call_tool("tool_name", serde_json::json!({})).await?;
//! ```
//!
//! ### Using low-level mcp_methods
//!
//! ```rust,ignore
//! use hanzo_mcp::mcp_methods;
//!
//! // List tools from an MCP server
//! let tools = mcp_methods::list_tools_via_http("http://localhost:3333", None).await?;
//!
//! // Execute a tool
//! let result = mcp_methods::run_tool_via_http(
//! "http://localhost:3333".to_string(),
//! "tool_name".to_string(),
//! params,
//! ).await?;
//! ```
//!
//! ### Building a Server
//!
//! Enable the `server` feature and use `hanzo_mcp::server`:
//!
//! ```rust,ignore
//! use hanzo_mcp::server::{Config, MCPServer};
//!
//! let server = MCPServer::new(Config::default(), 3333)?;
//! server.run().await?;
//! ```
// Re-export core types - these are always available
pub use *;
/// MCP client functionality
///
/// Connect to external MCP servers and execute tools.
/// MCP server functionality (requires `server` feature)
// Convenience re-exports for common usage patterns
pub use mcp_methods;
pub use McpClient;
pub use McpResourceInfo;