MCP Tunnel architecture connects cloud agents to enterprise intranet tools
掘金 · 人工智能 describes an MCP Tunnel architecture that lets cloud agents access MCP tools inside enterprise private networks without opening public inbound ports. A Connector in the private network uses outbound HTTPS long polling to claim calls, invoke local MCP servers and return results, while a NATS-based cloud scheduling layer coordinates requests across instances. The design separates session credentials from MCP credentials and uses at-most-once dispatch to avoid automatically repeating potentially non-idempotent operations.
The report offers a concrete network and scheduling pattern for connecting cloud agents to protected enterprise tools while preserving separate identity, authorization and execution boundaries.
前两篇介绍了云端 Agent 的文件系统,以及基于 Proxy 的凭证管理和网络管控。到这里,Agent 已经能读写文件、加载 Skill,也能通过受控出口访问外部服务。云端 Agent 拥有强大的推理能力,但当其执行任务需要触达私网核心资产(如企业内部知识库、内网 OA 系统)时,往往会受阻于企业防火墙限制。
我们采用反向建连:在企业私网部署 Connector,由它主动通过 HTTPS 连接云端,领取工具调用并返回结果。这样,MCP Server 可以继续留在私网里。下面以一次知识库查询为例,看看请求怎样到达私网工具,结果又怎样回到 Agent 手中。
这次调用涉及四个角色:
- Agent 运行在云端 Sandbox 中,发起知识库查询等 MCP 调用,并等待结果。
- 云端 Gateway/Broker 负责接收和调度请求。Gateway 校验身份,Broker 检查能否接单、分发任务并记录处理状态。
- Connector 运行在企业私网,主动向云端发起长轮询,领取任务、调用本地 MCP 服务,再提交结果。
- 私网 MCP 运行在企业私网,访问内部数据并执行知识库检索等具体业务。
#MCP Tunnel#Connector#OpenAI tunnel-client#NATS#NATS JetStream#NATS KV#Anthropic Managed Agents#Cloudflare Tunnel#Claude#MCP Server