MCPcopy
hub / github.com/cloudflare/cloudflared

github.com/cloudflare/cloudflared @2026.6.1 sqlite

repository ↗ · DeepWiki ↗ · release 2026.6.1 ↗
4,561 symbols 16,452 edges 389 files 1,215 documented · 27%
README

Cloudflare Tunnel client

Contains the command-line client for Cloudflare Tunnel, a tunneling daemon that proxies traffic from the Cloudflare network to your origins. This daemon sits between Cloudflare network and your origin (e.g. a webserver). Cloudflare attracts client requests and sends them to you via this daemon, without requiring you to poke holes on your firewall --- your origin can remain as closed as possible. Extensive documentation can be found in the Cloudflare Tunnel section of the Cloudflare Docs. All usages related with proxying to your origins are available under cloudflared tunnel help.

You can also use cloudflared to access Tunnel origins (that are protected with cloudflared tunnel) for TCP traffic at Layer 4 (i.e., not HTTP/websocket), which is relevant for use cases such as SSH, RDP, etc. Such usages are available under cloudflared access help.

You can instead use WARP client to access private origins behind Tunnels for Layer 4 traffic without requiring cloudflared access commands on the client side.

Before you get started

Before you use Cloudflare Tunnel, you'll need to complete a few steps in the Cloudflare dashboard: you need to add a website to your Cloudflare account. Note that today it is possible to use Tunnel without a website (e.g. for private routing), but for legacy reasons this requirement is still necessary: 1. Add a website to Cloudflare 2. Change your domain nameservers to Cloudflare

Installing cloudflared

Downloads are available as standalone binaries, a Docker image, and Debian, RPM, and Homebrew packages. You can also find releases here on the cloudflared GitHub repository.

User documentation for Cloudflare Tunnel can be found at https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/

Creating Tunnels and routing traffic

Once installed, you can authenticate cloudflared into your Cloudflare account and begin creating Tunnels to serve traffic to your origins.

TryCloudflare

Want to test Cloudflare Tunnel before adding a website to Cloudflare? You can do so with TryCloudflare using the documentation available here.

Deprecated versions

Cloudflare currently supports versions of cloudflared that are within one year of the most recent release. Breaking changes unrelated to feature availability may be introduced that will impact versions released more than one year ago. You can read more about upgrading cloudflared in our developer documentation.

For example, as of January 2023 Cloudflare will support cloudflared version 2023.1.1 to cloudflared 2022.1.1.

Development

Requirements

Build

To build cloudflared locally run make cloudflared

Test

To locally run the tests run make test

Linting

To format the code and keep a good code quality use make fmt and make lint

Mocks

After changes on interfaces you might need to regenerate the mocks, so run make mocks

Git Hooks

To avoid CI errors, you can install pre-push hooks that run linting and tests before each push:

make install-hooks

This will configure git to use the hooks in .githooks/ that run make fmt-check lint test before each push.

Extension points exported contracts — how you extend this code

DatagramSessionHandler (Interface)
DatagramSessionHandler is a service that can serve datagrams for a connection and handle sessions from incoming connecti [19 …
connection/quic_datagram_v2.go
TunnelConnection (Interface)
TunnelConnection represents the connection to the edge. The Serve method is provided to allow clients to handle any erro [19 …
connection/connection.go
OriginService (Interface)
OriginService is something a tunnel can proxy traffic to. [9 implementers]
ingress/origin_service.go
ICMPRouterServer (Interface)
ICMPRouterServer is a parent interface over-top of ICMPRouter that allows for the operation of the proxy origin listener [19 …
ingress/origin_icmp_proxy.go
ConnectionHandler (Interface)
ConnectionHandler is the Serve method to handle connections from a local TCP listener of the standard library (net.Liste [19 …
socks/connection_handler.go
FunnelID (Interface)
FunnelID represents a key type that can be used by FunnelTracker [7 implementers]
packet/funnel.go
DatagramConn (Interface)
DatagramConn is the bridge that multiplexes writes and reads of datagrams for UDP sessions and ICMP packets to a connect [5 …
quic/v3/muxer.go
Authenticator (Interface)
Authenticator is the connection passed in as a reader/writer to support different authentication types [5 implementers]
socks/authenticator.go

Core symbols most depended-on inside this repo

Equal
called by 713
packet/funnel.go
Errorf
called by 449
tunnelrpc/utils.go
String
called by 305
cfapi/hostname.go
Err
called by 223
tunnelrpc/proto/tunnelrpc.capnp.go
Close
called by 223
packet/funnel.go
Context
called by 141
quic/v3/muxer.go
Struct
called by 135
tunnelrpc/proto/tunnelrpc.capnp.go
Set
called by 122
tunnelrpc/proto/tunnelrpc.capnp.go

Shape

Method 2,052
Function 1,695
Struct 638
Interface 97
TypeAlias 42
Class 26
FuncType 11

Languages

Go95%
Python5%

Modules by API surface

tunnelrpc/proto/tunnelrpc.capnp.go846 symbols
proxy/proxy_test.go72 symbols
tunnelrpc/proto/quic_metadata_protocol.capnp.go70 symbols
quic/v3/muxer_test.go63 symbols
ingress/origin_service.go55 symbols
connection/connection.go46 symbols
mocks/mock_resolvers.go40 symbols
prechecks/probes_test.go39 symbols
cmd/cloudflared/tunnel/subcommands.go38 symbols
ingress/config.go34 symbols
supervisor/tunnel.go33 symbols
ingress/icmp_windows.go33 symbols

Dependencies from manifests, versioned

github.com/BurntSushi/tomlv1.2.0 · 1×
github.com/beorn7/perksv1.0.1 · 1×
github.com/bytedance/sonicv1.12.0 · 1×
github.com/cespare/xxhash/v2v2.3.0 · 1×
github.com/cloudflare/backoffv0.0.0-2024092001513 · 1×
github.com/coreos/go-oidc/v3v3.17.0 · 1×
github.com/coreos/go-systemd/v22v22.5.0 · 1×
github.com/cpuguy83/go-md2man/v2v2.0.0 · 1×
github.com/davecgh/go-spewv1.1.2-0.20180830191 · 1×
github.com/ebitengine/puregov0.10.0 · 1×
github.com/facebookgo/ensurev0.0.0-2016012719340 · 1×
github.com/facebookgo/freeportv0.0.0-2015061218290 · 1×

For agents

$ claude mcp add cloudflared \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact