feat(protocols): MCP tool adapter + Tauri commands + initialize bug fix
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

S6 MCP Protocol:
- Fix McpTransport::initialize() — store actual server capabilities instead
  of discarding them and storing empty ServerCapabilities::default()
- Add send_notification() method to McpTransport for JSON-RPC notifications
- Send notifications/initialized after MCP handshake (spec requirement)
- Add McpToolAdapter: bridges MCP server tools into the tool execution path
- Add McpServiceManager: lifecycle management for MCP server connections
- Add 4 Tauri commands: mcp_start_service, mcp_stop_service,
  mcp_list_services, mcp_call_tool
- Register zclaw-protocols dependency in desktop Cargo.toml

New files:
- crates/zclaw-protocols/src/mcp_tool_adapter.rs (153 lines)
- desktop/src-tauri/src/kernel_commands/mcp.rs (145 lines)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-03 22:07:35 +08:00
parent cc26797faf
commit 943afe3b6b
7 changed files with 352 additions and 4 deletions

View File

@@ -122,6 +122,7 @@ pub fn run() {
.manage(classroom_state)
.manage(classroom_chat_state)
.manage(classroom_gen_tasks)
.manage(kernel_commands::mcp::McpManagerState::default())
.invoke_handler(tauri::generate_handler![
// Internal ZCLAW Kernel commands (preferred)
kernel_commands::lifecycle::kernel_init,
@@ -323,7 +324,12 @@ pub fn run() {
classroom_commands::generate::classroom_list,
classroom_commands::chat::classroom_chat,
classroom_commands::chat::classroom_chat_history,
classroom_commands::export::classroom_export
classroom_commands::export::classroom_export,
// MCP (Model Context Protocol) lifecycle commands
kernel_commands::mcp::mcp_start_service,
kernel_commands::mcp::mcp_stop_service,
kernel_commands::mcp::mcp_list_services,
kernel_commands::mcp::mcp_call_tool,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");