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 限制:


动态管理

与 Plugin Runtime 不同,MCP 支持运行时动态连接/断开:


工具代理

MCP Server 的 tools 通过代理注册到 Cell:


Per-Cell 隔离

Cell A 的 MCP tools 对 Cell B 的 Agent 物理不可见(AX-1 隔离)。


反模式

禁止正确做法
跨 Cell 共享 MCP ServerPer-Cell 独立配置
MCP tool 绕过治理链Hardline 检查 JSON 字段(INV-GOV-01)
在 engine 级注册 MCPper-Cell CellSpec 声明或 API 注册