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
//! MCP (Model Context Protocol) Support
//!
//! Provides integration with MCP servers for extending A3S Code with external tools.
//!
//! ## Overview
//!
//! MCP is an open protocol for connecting AI assistants to external tools and data sources.
//! This module implements:
//!
//! - **Protocol types**: JSON-RPC messages, tool definitions, resources
//! - **Transport layer**: stdio (local processes), HTTP+SSE (remote servers)
//! - **Client**: High-level API for MCP server communication
//! - **Manager**: Lifecycle management for multiple MCP servers
//! - **Tools integration**: Automatic registration of MCP tools to ToolRegistry
//!
//! ## Usage
//!
//! ```rust,ignore
//! use a3s_code::mcp::{McpManager, McpServerConfig, McpTransportConfig};
//!
//! // Create manager
//! let manager = McpManager::new();
//!
//! // Register server
//! let config = McpServerConfig {
//! name: "github".to_string(),
//! transport: McpTransportConfig::Stdio {
//! command: "npx".to_string(),
//! args: vec!["-y".to_string(), "@modelcontextprotocol/server-github".to_string()],
//! },
//! enabled: true,
//! env: [("GITHUB_TOKEN".to_string(), "...".to_string())].into(),
//! oauth: None,
//! };
//! manager.register_server(config).await;
//!
//! // Connect
//! manager.connect("github").await?;
//!
//! // Get tools
//! let tools = manager.get_all_tools().await;
//! // tools: [("mcp__github__create_issue", McpTool { ... }), ...]
//!
//! // Call tool
//! let result = manager.call_tool("mcp__github__create_issue", Some(json!({
//! "title": "Bug report",
//! "body": "Description..."
//! }))).await?;
//! ```
//!
//! ## Tool Naming Convention
//!
//! MCP tools are registered with the prefix `mcp__<server>__<tool>`:
//!
//! | Full Name | Server | Tool |
//! |-----------|--------|------|
//! | `mcp__github__create_issue` | github | create_issue |
//! | `mcp__postgres__query` | postgres | query |
pub use McpClient;
pub use ;
pub use ;
pub use ;