MCP 零信任边界
MCP 安全网关架构,对工具调用进行认证,将执行路由到隔离沙箱,清洗响应,并向 AI 智能体返回干净结果。
完整 FlowZap 代码
Agent { # AI Agent
n1: circle label:"Start"
n2: rectangle label:"Request tool invocation"
n3: rectangle label:"Receive clean response"
n4: circle label:"Done"
n1.handle(right) -> n2.handle(left)
n2.handle(bottom) -> MCPGateway.n5.handle(top) [label="Tool call + OBO token"]
n3.handle(right) -> n4.handle(left)
}
MCPGateway { # MCP Security Gateway
n5: rectangle label:"Authenticate + check registry"
n6: rectangle label:"Route to sandbox"
n7: rectangle label:"Receive sandbox result"
n8: rectangle label:"Forward clean response"
n5.handle(right) -> n6.handle(left)
n6.handle(bottom) -> ToolSandbox.n9.handle(top) [label="Sandbox request"]
n7.handle(right) -> n8.handle(left)
n8.handle(top) -> Agent.n3.handle(bottom) [label="Sanitized response"]
}
ToolSandbox { # Tool Sandbox
n9: rectangle label:"Execute in isolated container"
n10: rectangle label:"Validate response"
n11: rectangle label:"Strip injection payloads"
n12: rectangle label:"Return clean result"
n9.handle(right) -> n10.handle(left)
n10.handle(right) -> n11.handle(left)
n11.handle(right) -> n12.handle(left)
n12.handle(top) -> MCPGateway.n7.handle(bottom) [label="Clean result"]
}
相关模板
AI原生单智能体架构
单智能体AI架构,其中一个智能体处理所有事务:解析请求、推理、通过MCP调用工具、生成响应。这是原型和简单自动化的默认架构——易于调试,但很快达到上下文窗口限制且难以并行化。适合快速交付的MVP和独立开发者。
Claw Code Harness 架构
Claw Code harness 架构图,展示用户循环、Python 编排层、Rust 运行时以及 LLM 提供商、文件系统和 MCP 服务器等外部系统。