Learning resourcesReviewed · Anthropic

Deploy MCP tunnels with Docker Compose

This Anthropic guide shows developers and platform operators how to use Docker Compose to run an MCP tunnel on their own host, so that MCP servers reachable from that host can be attached to a Managed Agent or the Messages API and called from Anthropic's side. Access is in research preview and certificates need ongoing maintenance. It covers provisioning through Workload Identity Federation or the Claude Console, routing to MCP servers, deployment verification and credential renewal.

Researched 14 Nov 2026

In short.

This Docker Compose guide shows developers and platform operators how to run an MCP tunnel on their own host, so that MCP servers reachable from that host can be attached to a Managed Agent or the Messages API and called from Anthropic's side. It requires research-preview access and ongoing host, credential and certificate management. It documents a proxy and cloudflared deployment, optional automated provisioning, a sample MCP server and maintenance procedures. The reference containers include several hardening measures, while the optional sample server uses a simpler configuration. Runtime behavior, security effectiveness, reliability and costs were not assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete selected page at [https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-compose.md]: the research-preview notice, prerequisites, optional sample, both installation paths, replication instructions, verification guidance, token rotation, certificate renewal and next-step links. Linked-page contents are excluded. All runtime behavior, security effectiveness, performance, availability and operational outcomes remain untested.

The overview

Identity

Deploy MCP tunnels with Docker Compose is an Anthropic deployment guide published at [https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-compose.md]. It teaches a reference configuration for running the tunnel stack on one Docker host and describes replicating that configuration across hosts. The tunnel lets MCP servers reachable from the host be attached to a Managed Agent or the Messages API and called from Anthropic's side.

The resource is documentation with configuration and code examples. MCP tunnels are identified as a research preview, with access available by request at [https://claude.com/form/mcp-tunnels].

Assessment

The guide is useful for teams that already operate Docker hosts and need concrete instructions for connecting reachable MCP servers to Anthropic. It covers installation and several operational details that can otherwise cause failures: required routing fields, cloudflared's forwarding target, token exports and certificate renewal.

It remains a reference deployment that operators must adapt to their security requirements. Its detailed commands support implementation planning, but they do not establish successful deployment, production readiness or measured security.

Users

The strongest fit is developers, infrastructure engineers and platform operators responsible for both MCP servers and their hosting environment. The work includes editing YAML, handling credentials, configuring network access and maintaining certificates.

Beginners receive a small example server and explicit commands, but the guide still assumes access to a Docker host and the Claude Console. The programmatic path additionally assumes familiarity with an OIDC identity provider and federation rules.

Capabilities

The configuration routes different tunnel subdomains to one or more upstream MCP servers. Programmatic provisioning can create a tunnel or attach to an existing one, obtain its token, generate certificates and register the certificate authority with Anthropic. A manual path performs provisioning through the Console and OpenSSL.

The guide also covers deploying replicas with shared tunnel credentials, rotating tunnel tokens and renewing server certificates. It states that the proxy detects certificate changes and reloads them without a restart. Availability improvement is described as a deployment option; failover behavior and capacity are not demonstrated.

Using it

Requirements

You need research-preview access, a host with Docker and Docker Compose, and at least one MCP server reachable from that host. The host needs outbound access to api.anthropic.com on TCP port 443 and the tunnel edge on TCP and UDP port 7844. Minimum Docker and Compose versions are not specified.

Programmatic setup requires a host identity from an OIDC provider, a federation rule ID, an organization ID and a matching identity token. A workspace ID is needed when using a rule scoped to a non-default workspace. Manual setup requires a Console-created tunnel and OpenSSL 1.1.1 or later.

The reference stack runs as UID 65532. Programmatic setup needs write access to its data directory, while the running proxy needs access to the generated certificate and key files.

Mechanism

cloudflared forwards incoming traffic to the MCP proxy at localhost:8080. It shares the proxy's network namespace so that this address reaches the proxy container. Both supplied Compose files pass the --url flag with [http://localhost:8080] as its value. For the manual flow, the guide states the flag is required because no ingress rules are pushed, and that without it cloudflared returns a 503 for every request.

The proxy receives a plain WebSocket connection with an inner TLS handshake inside the stream. Anthropic verifies that handshake against the registered certificate authority. The server certificate must cover the wildcard subdomain of the tunnel domain.

The required tunnel_domain setting lets the proxy remove the domain suffix and find the remaining subdomain in routes, a flat mapping to upstream URLs. The sample upstream uses HTTP, so that example does not configure TLS between the proxy and the MCP server.

Setup

For programmatic access, prepare the configuration and data directories, give UID 65532 access to data, and write the supplied Compose file. Set the federation identifiers and a freshly minted identity token, then run the setup service. Retrieve the generated tunnel domain, configure upstream routes, export the generated tunnel token and start the stack.

For manual access, obtain the domain and token from the Console, generate a certificate authority and server certificate, register the CA certificate, and write the proxy and Compose configurations before starting them.

The guide says to re-export TUNNEL_TOKEN in every fresh shell and after reboot because Compose reads it from the host environment without a default. Programmatic setup reuses tunnel and CA state stored in the data directory; an empty directory or changed tunnel ID can trigger a new CA registration, subject to a two-active-certificate limit.

Example

The optional Python example creates a FastMCP server listening on port 9000 with streamable HTTP transport. Its hello tool accepts a name, defaults to world and is written to return Hello, world! when called without an argument. The Compose service installs the mcp package and starts this server.

The proxy's echo route points to that service. The guide gives the routed address as [https://echo.<your-tunnel-domain>/mcp], where the tunnel domain has the form abcd1234.tunnel.anthropic.com. This is an illustrative address. The guide calls for verification through an MCP request from Anthropic's side; no such request was executed.

Assessment & evidence

Limitations

Research-preview access is a prerequisite. The page supplies no throughput measurements, latency results, availability guarantees or demonstrated recovery behavior. Replicating the configuration across hosts does not by itself establish those properties.

The setup, proxy and cloudflared definitions pin images by digest, run without root, use read-only filesystems, drop Linux capabilities and prevent privilege escalation. The optional Python sample has no equivalent hardening settings, uses a tagged image and installs an unpinned mcp package at startup.

The manual instructions make the server private key world-readable with chmod 644 to accommodate the container user, making host file-access controls relevant. Operators must monitor certificate expiry. Manual token rotation invalidates the old token immediately, and a host that restarts before receiving the replacement cannot reconnect.

Reasoning

Programmatic provisioning is the more suitable documented path when a host already has an appropriate OIDC identity: it handles token retrieval, certificate generation and CA registration. Its saved state also supports repeat setup without creating another tunnel.

Manual provisioning is the documented choice when that identity infrastructure is unavailable or for local development and testing. It requires more Console and certificate work. Both paths leave certificate-expiry monitoring and deployment security with the operator.

Alternatives

The guide offers two provisioning approaches: Workload Identity Federation with a setup component, or Console provisioning with manually generated certificates. It also permits using the sample server or routing to an existing MCP server.

For hosting, it documents a single-host deployment and replication across multiple hosts using the same tunnel token and certificates. It does not compare competing tunnel services or other deployment systems, so their relative suitability remains unassessed.

Evidence

The supporting source is the complete documentation page at [https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/deploy-compose.md]. It includes prerequisites, both provisioning paths, sample code, Compose configurations, verification instructions and maintenance procedures.

The page links to additional requirements, security guidance, API usage and troubleshooting documentation. Those linked contents are outside this assessment. No commands, deployment, MCP calls, token rotation or certificate renewal were executed; described behavior comes from the documentation.

Access & freshness

Costs

The page does not specify tunnel pricing, preview charges, API prices, free allowances or service limits tied to payment. These costs are unknown.

The deployment requires one or more hosts and ongoing operation. Hosting, network and maintenance costs depend on the chosen environment; the page provides no amounts or cost measurements.

Rights

The supplied page contains no explicit license or redistribution grant for its documentation, configuration examples, sample code or referenced container images. Their applicable reuse and redistribution terms are unknown from this evidence.

Freshness

The supplied page was captured on 14 November 2026 at 21:39:11 UTC. It labels MCP tunnels as a research preview but supplies no publication date, update date or named product release version. Subsequent changes and current access availability are unknown.

The main stack's image digests identify the exact images referenced by the guide, but do not establish whether newer images exist. The optional sample's tagged Python image and unpinned package installation provide less precise dependency reproducibility.

Actions

Start by obtaining preview access and confirming host connectivity and upstream MCP reachability. Choose the provisioning path that matches the host's identity capabilities, configure the required tunnel domain and routes, and review the supplied file permissions and container settings for your environment.

After deployment, perform the documented end-to-end MCP call from Anthropic's side. Establish certificate-expiry monitoring and renewal before relying on the connection. The programmatic renewal command supports a 720-hour threshold for scheduled renewal checks, and the guide states that the proxy reloads renewed certificates automatically.

Plan token rotation across every replica. For programmatic rotation, increment the persisted token-version argument and mint a fresh identity token. For manual rotation, promptly update each host's token and restart cloudflared because the old token becomes invalid immediately.

Evidence for this report

selected-page.txtselected · checked 2026-11-14