MCP 适配器
wesgine 的 MCP 适配器为每个 Cell 提供 MCP Server 连接与管理能力。
API 端点
GET /cells/{id}/mcp MCP Server 列表
POST /cells/{id}/mcp 注册/更新 MCP Server
DELETE /cells/{id}/mcp/{name} 删除 MCP Server
POST /cells/{id}/mcp/{name}/probe 探测连通性
POST /cells/{id}/mcp/{name}/connect 建立连接
POST /cells/{id}/mcp/{name}/disconnect 断开连接
POST /cells/{id}/mcp/{name}/call 调用工具
GET /cells/{id}/mcp/events SSE 事件流
Cell Handle
cell.MCPs() → MCPHandle
.List(ctx)
.Upsert(ctx, ServerConfig)
.Delete(ctx, name)
.Probe(ctx, name)
.Connect(ctx, name)
.Disconnect(ctx, name)
.Call(ctx, name, toolName, args)
传输协议
MCP Server 支持多种传输:
| Transport | 场景 |
|---|---|
stdio | 本地子进程 MCP Server |
sse | 远程 MCP Server(HTTP) |
CellSpec 声明
Channels 与 MCPs 没有运行时存储,CellSpec 就是唯一副本:
CellSpec{
MCPs: []mcp.ServerConfig{
{Name: "legal-mcp", Transport: "stdio", Command: []string{"/opt/mcp/server"}},
},
}
配额管理
MCP Server 数量受 CellQuotas.MaxMCPServers 限制:
- 配额在唯一增长点(append 路径)校验(INV-QUOTA-05)
- 覆盖已有名字
delta=0
动态管理
与 Plugin Runtime 不同,MCP 支持运行时动态连接/断开:
Connect建立连接后,MCP 暴露的 tools 出现在 Cell ToolRegistryDisconnect断开后 tools 消失- 无需重启 Cell
工具代理
MCP Server 的 tools 通过代理注册到 Cell:
- Agent 调用 MCP tool → 引擎转发 → MCP Server 处理 → 返回结果
- 治理链(Hardline/Sandbox/Zone)同样检查 MCP 代理工具
Per-Cell 隔离
Cell A 的 MCP tools 对 Cell B 的 Agent 物理不可见(AX-1 隔离)。
反模式
| 禁止 | 正确做法 |
|---|---|
| 跨 Cell 共享 MCP Server | Per-Cell 独立配置 |
| MCP tool 绕过治理链 | Hardline 检查 JSON 字段(INV-GOV-01) |
| 在 engine 级注册 MCP | per-Cell CellSpec 声明或 API 注册 |