cloudflared
$ cloudflared Official High Riskcloudflared connects local servers to Cloudflare Tunnel (tunnel), inspects tunnel state (tunnel list --output json), and authenticates non-browser clients against Cloudflare Access (access token). Quick tunnels (--url) run as long-lived foreground daemons.
brew install cloudflared Required local daemon/client for Cloudflare Tunnel routing and Access tokens (cloudflared access token); no MCP replacement exists.
Agent-Readiness Checklist
Local Probe EvidenceCaptured --help excerpt
NAME:
cloudflared - Cloudflare's command-line tool and agent
USAGE:
cloudflared [global options] [command] [command options]
VERSION:
2025.6.1 (built 2025-06-17T09:42:18Z)
DESCRIPTION:
cloudflared connects your machine or user identity to Cloudflare's global network.
You can use it to authenticate a session to reach an API behind Access, route web traffic to this machine,
and configure access control.
See https://developers.cloudflare.com/cloudflare-one/connections/connect-apps for more in-depth documentation.
COMMANDS:
update Update the agent if a new version exists
version Print the version
proxy-dns Run a DNS over HTTPS proxy server.
tail Stream logs from a remote cloudflared
service Manages the cloudflared launch agent
help, h Shows a list of commands or help for one command
Access:
access, forward access <subcommand>
Tunnel:
tunnel Use Cloudflare Tunnel to expose private services to the Internet or to Cloudflare connected private users.
GLOBAL OPTIONS:
--output value Output format for the logs (default, json) (default: "default") [$TUNNEL_MANAGEMENT_OUTPUT, $TUNNEL_LOG_OUTPUT]
--credentials-file value, --cred-file value Filepath at which to read/write the tunnel credentials [$TUNNEL_CRED_FILE]
--region value Cloudflare Edge region to connect to. Omit or set to empty to connect to the global region. [$TUNNEL_REGION]
--edge-ip-version value Cloudflare Edge IP address version to connect with. {4, 6, auto} (default: "4") [$TUNNEL_EDGE_IP_VERSION]
--edge-bind-address value Bind to IP address for outgoing connections to Cloudflare Edge. [$TUNNEL_EDGE_BIND_ADDRESS]
--label value Use this option to give a meaningful label to a specific connector. When a tunnel starts up, a connector id unique to the tunnel is generated. This is a uuid. To make it easier to identify a connector, we will use the hostname of the machine the tunnel is running on along with the connector ID. This option exists if one wants to have more control over what their individual connectors are called.
--post-quantum, --pq When given creates an experimental post-quantum secure tunnel (default: false) [$TUNNEL_POST_QUANTUM]
--management-diagnostics Enables the in-depth diagnostic routes to be made availab FCRS-1.0 6-Dimension Breakdown
Supports --output json on tunnel list/info, --no-autoupdate, and scriptable access token, though tunnel run is a long-lived daemon.
- Supports
--output jsonon management commands andaccess token
Exposing local services over public trycloudflare.com URLs bypasses local firewalls; stores cert.pem and tunnel tokens under ~/.cloudflared/.
- Publicly exposes localhost ports; stores
~/.cloudflared/cert.pem
Single static Go binary available via brew, Linux apt/rpm repos, Docker, and GitHub Releases.
- Single static Go binary across macOS, Linux, Windows
Essential for webhook testing, local preview sharing, and authenticating scripts behind Cloudflare Access.
- Zero-cost quick tunnels and Cloudflare Access CLI token helpers
Official Cloudflare project (cloudflare/cloudflared) under Apache-2.0.
- Official
cloudflare/cloudflaredrepository
Comprehensive Cloudflare Zero Trust documentation and --help reference.
- Official docs at developers.cloudflare.com
Security, Auth & Guardrails
Stores origin certs (cert.pem) and tunnel credential JSON files under ~/.cloudflared/; Access tokens are cached locally per origin.
Free, Apache-2.0 open-source Go binary; Cloudflare Zero Trust Free plan covers basic tunnels.
# cloudflared Agent Rules - Never run `cloudflared tunnel --url` unattended without user approval—it exposes localhost services to the public internet. - Pass `--no-autoupdate` in CI/agent runs and terminate background tunnel processes explicitly when finished.
Agent-Ready Command Recipes
Safe Read-Only Queries
cloudflared tunnel list --output json
Queries Cloudflare API for active tunnels and emits structured JSON (--output json).
cloudflared access token -app=https://internal.example.com
Prints the Access JWT token so shell scripts can pass cf-access-token cleanly.
Controlled Writes & Previews
cloudflared tunnel --url http://localhost:3000 --no-autoupdate
Exposes local port 3000 on a public trycloudflare.com URL until terminated.
Strengths for Agents
- + Management subcommands support
--output jsoncleanly. - + Single static Go binary requiring no Cloudflare account for quick
--urltunnels.
Caveats & Pitfalls
- ! Exposing
localhostvia quick tunnels creates immediate external internet reachability. - ! Tunnel runtime commands block indefinitely as foreground daemons.