Zero Labs
Industry News / AI

OpenAI Secure MCP Tunnel Architecture: Connect Private Tools Without Making Them Public

Source · Towards AI By Ethan Mark

From the publisher’s feed, collected in the ZeroLabs newsroom.

OpenAI Secure MCP Tunnel ArchitectureA production guide to connecting private MCP servers to ChatGPT, Codex, or the Responses API while keeping the real boundary, authorization, and operating evidence inside your network.Your most valuable tool is often the one that should never accept an inbound internet connection.Your team has an internal MCP server that can look up an order, search a private codebase, or prepare a financial report. Someone asks for it in ChatGPT or Codex. The fast answer is to put an HTTPS endpoint in front of it.That answer is fast because it deletes the hard part: deciding exactly who may reach the tool, which actions are allowed, and how you will know what happened. A private MCP server becomes a public service with a particularly persuasive caller.OpenAI Secure MCP Tunnel offers a different starting point. A small client runs inside the network that already reaches the MCP server. It makes an outbound HTTPS connection, polls for work, forwards an MCP request locally, and sends the response back through that same path. The private server does not need an inbound public listener.That is useful, but it is not a magic security wrapper. A tunnel changes network reachability. It does not decide whether a user may read payroll data, whether an agent may send an email, or whether an overly broad tool should exist. This guide shows how to make that distinction concrete before you connect a valuable private tool to an AI surface.The question to ask before setupDo not begin with “How do I expose my MCP server?” Begin with: what is the narrowest private capability this AI workflow actually needs?That wording creates a better design. A developer assistant may need a read-only search_release_notes tool. It probably does not need a general shell. A support assistant may need get_order_status. It should not receive a database connection that can run arbitrary queries. The tunnel should carry a deliberately small set of tools, not make an old internal API suddenly available to a model.Private network access is not the same as least privilege. Keep the server private, then make every capability small enough to explain and test.The official guide describes the tunnel as an outbound-only connection between a customer-run tunnel-client and an OpenAI-hosted endpoint. It can serve supported OpenAI products while the MCP server remains private. It also makes an important product boundary clear: tunnel mode is for private connections and developer-mode testing, not public plugin distribution. A public plugin still needs a stable public HTTPS endpoint.Draw the actual request pathA single sketch prevents several costly assumptions. For each tool, trace this path:the user and the OpenAI product surface;the OpenAI-hosted tunnel endpoint;the host or pod running tunnel-client;the private MCP server;the downstream system the tool can read or change; andthe audit event you will retain after the call.Mark the identity at every hop. The tunnel client authenticates to the tunnel control plane. Your MCP server may authenticate the client locally. The downstream service must still decide what the represented user, workload, or service is allowed to do. Do not let one successful connection stand in for all three checks.The safe visual model is a specific outbound work lane, not a hole through the firewall.Choose the deployment shape that keeps trust localRun the client in the same trust boundary that can already reach the private server. OpenAI documents three common patterns: a Kubernetes sidecar next to the server, a separate deployment that reaches a private Service, or a VM/system service. The right answer depends on how tightly you want the tunnel lifecycle coupled to the tool.Sidecar for a single-purpose toolA sidecar is a strong default when one MCP server owns one narrow job. The server can listen on loopback, while the client forwards only to that local address. This minimizes routing surprises and makes start, stop, and deployment versioning move together.# Conceptual topology, not a copy-paste manifestprivate-mcp-pod ├── mcp-server listens on 127.0.0.1:8080/mcp └── tunnel-client reaches only localhost:8080 and api.openai.com:443network policy ingress: none from public internet egress: OpenAI control plane + required internal dependencies onlyA separate deployment is better when several tools share an approved private service or when operations wants an independent client lifecycle. In that case, resist the temptation to grant the client broad service-mesh access. Allow it to reach the one service and port it needs. Record the DNS name, port, protocol, and owner as part of the tunnel profile.For a VM, use a non-root service account, a secret store or protected environment file, a supervisor, and restrictive local firewall rules. “It only runs on our internal VM” is not an authorization policy.Build capability boundaries before the tunnel goes liveStart with a tool inventory. For every tool, write a one-line effect statement: “Returns release names for repositories the caller can view,” or “Creates a draft expense report but never submits it.” If you cannot write that sentence, the tool is too broad for an agent integration.Then place controls where they can actually decide the effect:Tool schema: use typed, bounded arguments. Prefer an order ID to arbitrary SQL; prefer a repository allowlist to a filesystem path.MCP executor: verify the request context, validate input, enforce allowlists, and apply an operation budget.Downstream API: make its own authorization decision. A tunnel connection is never a replacement for application authorization.Approval layer: require a fresh, exact approval for meaningful writes. Bind the approval to the tool, resource, parameters, actor, and a short expiry.Audit sink: record a privacy-aware receipt before and after the effect, including request ID, tool, policy decision, and result class.Read-only is a good default, but do not stop there. A read tool can disclose secrets or enable dangerous inference. Use resource scoping, output filtering, and a disclosure policy for sensitive fields.Use approvals as an action contract, not a pop-upThe Responses API supports MCP tools and can require approval for tool calls. That is valuable when a model proposes an action, but an approval UI is only as good as the thing it approves. A human who sees “Approve CRM update?” cannot judge a request that also changes ownership, sends an email, and exports contacts.Instead, create a concise action preview from the exact structured arguments. Show the object, intended mutation, scope, and irreversible consequences. On the server, verify that the approved payload still matches the payload you execute. Reject changed parameters and expired approvals.approval_claim = { "tool": "create_refund_draft", "order_id": "ord_4821", "amount_cents": 2400, "actor": "user_123", "expires_at": "short-lived timestamp", "request_hash": "hash of canonical arguments"}if not valid_signature(approval_claim) or expired(approval_claim): deny("approval is missing or stale")if approval_claim.request_hash != hash(canonical(tool_arguments)): deny("approved action differs from requested action")execute_draft_only(tool_arguments)This pattern also makes incident review easier. You can answer whether the model proposed an action, whether a person or policy approved it, and whether the executor ran the same action.Make health meaningfulA green process is not proof that a private tool is usable. The official tunnel documentation exposes local health, readiness, metrics, and admin surfaces. Use them, but give each signal a different job.Liveness: the client process can run. Restart only when it is genuinely dead.Readiness: the client is connected and can reach its configured private MCP server. Remove it from service when it cannot accept work.Functional canary: a low-risk tool call reaches the private service and receives a valid, non-sensitive response.Policy canary: an intentionally forbidden request is rejected at the expected boundary and creates an audit event.Do not use a busy condition as a reason to repeatedly restart a healthy client. A bounded queue, back-pressure response, and visible saturation metric are kinder to both the tool and its users. Current public issue reports also show why this distinction matters: a tunnel and local server can be healthy while a longer AI workflow stops progressing elsewhere. Your evidence needs to separate transport health, local tool health, and product-orchestrator progress.Keep secrets and data out of the wrong logsThe tunnel client needs credentials to operate, and the MCP server may handle data the AI product should not receive by default. Treat both as a design problem, not a logging preference. Load tunnel credentials from a secret manager or protected runtime file, rotate them with a rehearsed procedure, and never put a key in a profile committed to source control. Give the client identity only the tunnel permission it requires.For telemetry, record references rather than raw sensitive values whenever you can. A receipt can contain a request ID, tool name, policy version, caller class, decision, duration, result class, and a keyed hash of canonical arguments. That is usually enough to trace a failure without copying customer content into a dashboard. If debugging needs payload capture, make it short-lived, access-controlled, redacted, and explicitly approved.Also consider the tool result as a data boundary. An internal search tool should return the smallest answer that satisfies the request, not the entire document that happened to match. Enforce maximum result sizes, field allowlists, and safe error messages on the server. The model should never need to see a stack trace, connection string, or a secret-bearing upstream response in order to tell the user that a request failed.Test the failure paths people skipA successful demo proves that one request worked once. Production confidence comes from purposeful failures. Create a small test suite before you give the tunnel a valuable tool.Attempt to reach the MCP server from an untrusted network. It should fail because there is no public listener.Start the client with an invalid or rotated credential. It should fail closed and emit a useful operator signal without exposing the secret.Point the client at a wrong local address. Readiness should fail while liveness remains understandable.Call an allowlisted read tool with an out-of-scope resource. The executor or downstream service should deny it.Submit a write request without approval, with an expired approval, and with altered parameters. All three should be denied.Stop the client during a queued request. Confirm that callers see a bounded, retryable failure rather than an invented success.Flood the low-risk canary. Confirm that rate limits and queue bounds protect the real tool.Save the expected decision, event name, and correlation ID for every test. A future incident should be diagnosable without reproducing it against production data.Evidence is what turns “the tunnel is secure” into a claim an operator can verify.A practical rollout sequenceStart with a single read-only capability and a small user group. Keep the actual MCP server loopback-only or private-network-only. Run tunnel-client doctor --profile --explain before connecting a product surface, then confirm readiness and run both functional and policy canaries.Next, observe the request mix. Are prompts producing surprising arguments? Are users retrying because tool responses are too vague? Are outputs including too much data? Fix the schema and executor before adding more tools.Add writes one effect at a time. Make the first write reversible or draft-only. Require approval. Add an idempotency key so retries do not duplicate a real-world action. Finally, document an operator stop procedure: revoke the tunnel credential or stop the client, disable the connected app, and preserve the relevant audit window.Useful mental model: Secure MCP Tunnel reduces exposure by keeping ingress private. Your server, policies, and downstream systems still own the decision to do work. Treat the tunnel as a narrow delivery lane — not as the guard at every destination.What to measure after launchTrack completed calls by tool, denial rate by policy, approval abandonment, readiness time, upstream timeouts, queue depth, and p95 local execution time. Pair that with sampled, redacted evidence of tool arguments and response classes. The goal is not maximal logging; it is enough evidence to distinguish a bad prompt, an authorization denial, a tunnel issue, an overloaded tool, and a broken downstream dependency.Review tool inventory monthly. The tool that starts as “read a deployment status” often grows into a broad internal gateway. Split it before it becomes impossible to approve or reason about. Private connectivity stays valuable only when the capability behind it stays deliberately small.ConclusionOpenAI Secure MCP Tunnel gives teams a better answer than putting a sensitive MCP server on the public internet. But the most important work happens on the private side: choose a narrow capability, keep the local listener constrained, authorize the real effect, bind approvals to exact requests, and test the denial paths.When those pieces are in place, ChatGPT, Codex, and API workflows can use private tools without turning your network boundary into an afterthought.FAQDoes OpenAI Secure MCP Tunnel make my MCP server public?No. The documented design has tunnel-client initiate outbound HTTPS and forward work to the configured private server. You should still verify that the server itself has no unintended public listener.Is a secure tunnel enough to authorize a sensitive action?No. The tunnel handles private connectivity. The MCP executor and downstream system must enforce identity, permissions, resource scope, and approvals for the actual action.Should every MCP tool require human approval?Not necessarily. Low-risk, narrow reads may be automatic. Use approvals for consequential writes, broad data access, and actions whose target or effect a person should inspect. Keep approvals bound to exact parameters.Can I use a private tunnel for a public ChatGPT plugin?No. OpenAI’s documentation distinguishes private tunnel use from public plugin distribution, which requires a stable publicly reachable HTTPS MCP endpoint.Where should tunnel-client run?Run it inside the network boundary that can already reach the private MCP server: commonly as a Kubernetes sidecar, a limited separate deployment, or a locked-down VM service.What is the first production test to automate?Automate a harmless functional canary and a deliberate denied-action canary. Together they prove that the private path works and that a meaningful boundary still refuses work.SourcesOpenAI: Secure MCP Tunnel guideOpenAI: MCP servers and the Responses APIOpenAI Developers: Making private MCP servers reachable without making them publicOpenAI tunnel-client repositoryOpenAI Secure MCP Tunnel Architecture: Connect Private Tools Without Making Them Public was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.