MCPcopy Index your code
hub / github.com/denoland/clawpatrol

github.com/denoland/clawpatrol @v0.5.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.3 ↗ · + Follow
4,979 symbols 16,815 edges 419 files 2,353 documented · 47%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

clawpatrol

The security firewall for agents.

Claw Patrol sits between your agents and prod, parses their traffic at the wire, and gates each action against rules you write in HCL. For example, you can block destructive SQL, or pause kubectl delete pod until a human approves it before the request reaches Kubernetes.

For the full overview see clawpatrol.dev.

Install

curl -fsSL https://clawpatrol.dev/install.sh | sh

From source: make (requires Go and Node.js).

A rule

A real rule from our own production config:

rule "k8s-no-secrets" {
  endpoint  = k8s-prod
  condition = "k8s.resource == 'secrets'"
  verdict   = "deny"
  reason    = "Secret values must not leave the cluster via the agent"
}

Conditions are CEL expressions over wire-level facts the gateway extracts per protocol: SQL verbs and table names for Postgres / ClickHouse, resource / verb / namespace for Kubernetes, method / path / headers / body for HTTP. The full set of facts lives in the config reference.

Run

Three deployment shapes; pick whichever fits.

clawpatrol gateway config.hcl   # run the proxy itself
clawpatrol join <gateway-url>   # join a gateway
clawpatrol run claude           # wrap one agent's process tree

clawpatrol run opens a per-process tunnel on Linux (via netns) or macOS (via NetworkExtension); only the wrapped command's traffic goes through the gateway. clawpatrol join brings up a WireGuard tunnel that routes the whole host. clawpatrol gateway is the proxy: a single binary that loads your HCL config and accepts clients tunneling in via WireGuard or Tailscale.

Configure

clawpatrol.dev/docs/getting-started walks through a first config end-to-end. clawpatrol.dev/docs/config-reference is the auto-generated field reference. See gateway.example.hcl for an annotated starting template.

License

MIT. See LICENSE.md.

Extension points exported contracts — how you extend this code

OAuthFlowProvider (Interface)
OAuthFlowProvider is the optional interface a credential plugin's decoded body implements when it represents an OAuth-fl [6 …
internal/config/oauth.go
RequiresVIP (Interface)
RequiresVIP is the marker an endpoint plugin's body implements when its hostnames need DNS-VIP interception (because the [6 …
cmd/clawpatrol/dnsvip/dnsvip.go
DialUpstreamFunc (FuncType)
DialUpstreamFunc opens a tunnel plugin's transport connection — the socket the tunnel rides on to reach its endpoint (th
pluginsdk/tunneltransport.go
PageMeta (Interface)
(no doc)
site/docs-render.ts
Env (Interface)
(no doc)
site/worker/index.ts
SecretSlotsProvider (Interface)
SecretSlotsProvider is the optional interface a credential plugin's decoded body implements when the operator can connec [18 …
internal/config/secret_slot.go
Onboarder (Interface)
Onboarder mints a single-use auth artefact + tells the client which control-plane to register against. Implementations: [2 …
cmd/clawpatrol/onboard.go
Doc (Interface)
(no doc)
site/docs-render.ts

Core symbols most depended-on inside this repo

Error
called by 441
pluginsdk/conn.go
Close
called by 348
cmd/clawpatrol/daemon_linux.go
Add
called by 291
internal/config/runtime/runtime.go
Join
called by 267
internal/config/config.go
String
called by 226
pluginsdk/conn.go
Get
called by 205
internal/config/runtime/blobs.go
Close
called by 196
internal/config/runtime/tunnel.go
Set
called by 155
cmd/clawpatrol/oauth.go

Shape

Function 2,622
Method 1,658
Struct 571
Interface 87
TypeAlias 34
FuncType 7

Languages

Go93%
TypeScript7%

Modules by API surface

internal/config/extplugin/proto/plugin.pb.go663 symbols
internal/config/extplugin/proto/plugin_grpc.pb.go137 symbols
cmd/clawpatrol/web.go134 symbols
cmd/clawpatrol/main.go102 symbols
internal/config/extplugin/adapter.go76 symbols
internal/config/runtime/runtime.go73 symbols
internal/config/config.go67 symbols
internal/config/extplugin/manager.go55 symbols
cmd/clawpatrol/setup.go54 symbols
cmd/clawpatrol/oauth.go51 symbols
internal/config/plugins/endpoints/postgres.go47 symbols
cmd/clawpatrol/relay_linux.go47 symbols

For agents

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

⬇ download graph artifact