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
//! MCP (Model Context Protocol) support for AGNT5
//!
//! This module provides MCP client functionality for connecting to external
//! MCP servers and using their tools within AGNT5 agents.
//!
//! # Overview
//!
//! The Model Context Protocol (MCP) is a standard for AI agents to interact with
//! external tools and services. This module provides:
//!
//! - **MCPClient**: Connect to external MCP servers (Smithery, Composio, Wikipedia, etc.)
//! - **Transport abstraction**: Support for stdio (subprocess) and SSE (HTTP) transports
//! - **Tool discovery**: List and call tools from connected servers
//!
//! # Example
//!
//! ```rust,ignore
//! use agnt5_sdk_core::mcp::{McpClient, ServerConfig, StdioConfig, SseConfig};
//!
//! // Create client
//! let mut client = McpClient::new("research-client");
//!
//! // Add servers
//! client.add_stdio_server("wikipedia", "npx", vec!["-y".into(), "wikipedia-mcp".into()]);
//! client.add_sse_server_with_api_key("agnt5", "http://localhost:34183/v1/mcp/sse", "your-api-key");
//!
//! // Connect
//! client.connect().await?;
//!
//! // List tools from all servers
//! let tools = client.list_tools().await?;
//!
//! // Call a tool
//! let result = client.call_tool("wikipedia", "search", serde_json::json!({"query": "Rust"})).await?;
//!
//! // Disconnect when done
//! client.disconnect().await?;
//! ```
//!
//! # Transports
//!
//! ## Stdio Transport
//!
//! For local subprocess communication with MCP servers:
//!
//! ```rust,ignore
//! let config = StdioConfig::new("npx", vec!["-y".into(), "wikipedia-mcp".into()])
//! .with_env("DEBUG", "true")
//! .with_cwd("/tmp");
//! ```
//!
//! ## SSE Transport
//!
//! For HTTP-based MCP servers (including AGNT5 Gateway):
//!
//! ```rust,ignore
//! let config = SseConfig::new("https://smithery.ai/weather-mcp")
//! .with_header("Authorization", "Bearer token")
//! .with_api_key("your-api-key");
//! ```
// Re-export main types
pub use ;
pub use ;
pub use ;
pub use ;