thzxx
22a33ae241
feat: 实现 MCP (Model Context Protocol) 完整功能
主进程:
- 新增 mcp-manager.ts: JSON-RPC 2.0 over stdio 通信
- 服务器生命周期管理 (spawn/initialize/handshake/stop)
- tools/list 动态工具发现
- tools/call 工具执行 (30 秒超时)
- 消息分帧 (newline-delimited JSON)
- 优雅清理 (pending 请求超时 + SIGTERM)
IPC 通道 (7 个):
- mcp:startServer / mcp:stopServer / mcp:stopAll
- mcp:callTool / mcp:getTools / mcp:getStatuses / mcp:refreshTools
渲染端:
- mcp-client.ts 完整重写: 配置管理 + 服务器生命周期 + 工具定义获取 + 工具执行
- tool-registry.ts: MCP 工具路由 (mcp_ 前缀识别 → executeMCPTool)
- settings-modal.ts: MCP 服务器管理 UI (添加/启用/禁用/删除/状态显示)
- main.ts: 启动时自动启动已启用的 MCP 服务器
数据流:
settings.mcp_servers → startAllMCPServers → initialize → tools/list → getMCPToolDefinitions → Agent Loop → mcp_ 工具调用 → callTool → JSON-RPC → MCP Server
2026-04-18 10:14:33 +08:00
..
2026-04-18 10:00:14 +08:00
2026-04-17 12:35:42 +08:00
2026-04-18 10:08:01 +08:00
2026-04-07 01:33:51 +08:00
2026-04-18 09:22:25 +08:00
2026-04-18 10:14:33 +08:00
2026-04-17 10:33:44 +08:00
2026-04-18 09:22:25 +08:00
2026-04-18 09:25:40 +08:00
2026-04-18 10:14:33 +08:00
2026-04-16 09:27:05 +08:00
2026-04-16 09:27:05 +08:00