# Repository Briefing: openai/tunnel-client
> Source: https://repoforai.com/repo/openai/tunnel-client (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/openai/tunnel-client
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: Go
- **License**: Apache-2.0
- **Engineering Health**: A+ (94/100 · Maintenance 35/35 · Adoption 19/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v0.0.22 (2026-12-02) — https://github.com/openai/tunnel-client/releases
- **Review Snapshot**: 2026-12-02 (Note: v0.0.22 on 2026-12-02 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: Docker, Self-Hosted, MCP, CLI, API
- **Momentum**: 671 ★ total (+1 24h / +15 7d) · 148 forks
- **Topics**: `agentic`, `agentic-ai`, `agentic-workflow`, `chatgpt`, `cli`, `codex`, `golang`, `mcp`, `mcp-client`, `mcp-gateway`, `mcp-protocol`, `mcp-server`
- **When to Use**: Best for: Teams connecting localhost or private MCP tools to supported OpenAI products when inbound exposure is not approved and operators need readiness checks and diagnostics. Skip if: The entire request path must remain offline or self-hosted, or a secure direct MCP connection already meets the access requirements.

## Overview
```text
### Architecture & Core Mechanics
The repository delivers the customer-run part of Secure MCP Tunnel: a Go CLI and an embeddable SDK, not a general-purpose MCP server or the hosted control plane. ChatGPT, Codex, the Responses API, and AgentKit use the hosted `/v1/mcp/{tunnel_id}` MCP endpoint. The local runtime polls for queued requests, dispatches them to the private MCP server, and sends responses back through the runtime protocol. The two interfaces serve different callers; `/v1/tunnels` is the default runtime base path, not the application’s MCP endpoint.

The root package exposes `tunnelclient.New` and supports an in-memory MCP transport pair for colocated Go servers that should not bind a port or use stdio. The stack includes the MCP Go SDK, Cobra for the CLI, and OpenTelemetry and Prometheus dependencies for observability. The wire protocol, OpenAPI contract, and `X-Tunnel-Client-Capabilities` header give compatible runtime implementations a defined reference for the queue interface and optional features.

### Key Capabilities & Differentiators
The runtime connects to private Streamable HTTP and stdio targets, while the Go SDK can avoid both with an in-process transport. The embedded `server_info`, `echo`, and `uppercase` tools let operators validate the route without deploying another MCP server. `--embedded-stateless-mcp-stub` issues no MCP session ID even when a caller initializes; the compatibility stub retains stateful handling for legacy initialization and session requests. Neither demo mode establishes that an existing tool backend or OAuth flow is stateless.

Operators get `/healthz`, `/readyz`, `/metrics`, and `/ui`. W3C trace-context forwarding is off by default; `--mcp.forward-trace-context` enables it via `params._meta` on stdio and Streamable HTTP. Local span export is configured separately with `--tracing.enabled` and `--tracing.file`. The client can also preserve an MCP server’s request ID separately from the connector’s own identifier, which helps correlate forwarding failures with upstream logs.

### Trade-offs & Limitations
Compared with direct remote MCP, this design removes the need to publish the MCP server or create a new inbound firewall rule, but adds an OpenAI-hosted endpoint and queue to the request path. If callers already have approved access to a secured MCP endpoint, direct MCP has fewer moving parts. If both ends can join the same private network, a private link may be simpler. Neither comparison makes the hosted tunnel a fully self-hosted or offline option; Apache-2.0 applies to the client code, not to the hosted service.

Availability depends on the local MCP server, the runtime, and its control-plane connection. A running daemon does not prove polling or readiness is healthy. On macOS, a login-session service will not keep serving after logout, and sleep suspends its work. An HTTP backend needs its own supervision; after it restarts, MCP sessions may need reinitialization. Do not assume interrupted calls replay or that a stateless demo justifies running multiple instances against a sessionful target.

### Hardware & Deployment Guide
Start with `tunnel-client help quickstart`, obtain a tunnel ID and runtime API key, and run `doctor` with the intended profile. The supported macOS install path is `brew install openai/tools/tunnel-client`; use `brew services` for login-session supervision or choose the CLI’s managed runtime, not both for the same tunnel. Docker, Kubernetes, and VM deployment paths are covered, and the tree contains `Dockerfile` and `Dockerfile.runtime`. The source manifests specify Go 1.27 with toolchain `go1.27.4` and Node `22.23.3` for the container’s UI build stage.

Before shifting connector traffic, verify readiness rather than just process status, and keep runtime credentials separate from admin credentials. v0.0.21 adds regional control-plane endpoint selection through `--control-plane.residency`, `CONTROL_PLANE_RESIDENCY`, or YAML `control_plane.residency`, with support in the Go SDK, native runtime commands, and Tunnel MCP plugin. v0.0.20 adds the separate HTTPS OAuth-origin allowlist; v0.0.19 adds MCP request-ID propagation.
```

## Key Capabilities
```text
- Request flow: Applications use `/v1/mcp/{tunnel_id}`; the customer-run client polls for work and returns responses through the runtime protocol.
- Local transports: Connect over Streamable HTTP or stdio, or embed the Go SDK using an in-memory MCP transport pair.
- Readiness: Use `/healthz` and `/readyz` to distinguish process health from readiness, with `/metrics` and `/ui` for inspection.
- Tracing: `--mcp.forward-trace-context` opts in to forwarding W3C context in MCP `params._meta`; local JSONL span export is configured separately.
- OAuth boundary: v0.0.20 adds a separate allowlist for forwarding to discovered OAuth endpoints on other HTTPS origins.
- Request correlation: v0.0.19 preserves the MCP server’s `X-Request-Id` as `X-Tunnel-Mcp-Request-Id`, distinct from the connector’s request ID.
```

## Quick Start / Clone
```bash
brew install openai/tools/tunnel-client
```
