1. Start the tunnel in the background
ssh -n -T -o ServerAliveInterval=30 -R 80:localhost:3000 stable@proxy.tunnl.gg output=json > tunnel.jsonl 2>&1 &
-n -T: no input and no terminal, so it runs in the background without stoppingstable@: the same URL every time for this machine's SSH key, so a webhook registered once keeps workingoutput=json: one JSON object per line instead of the banner, QR code and request table
2. Read the URL
The first line describes the tunnel. Wait for it, then take the URL:
until grep -q '"event":"tunnel"' tunnel.jsonl 2>/dev/null; do sleep 1; done
head -1 tunnel.jsonl | jq -r .url
Without jq:
sed -n 's/.*"url":"\([^"]*\)".*/\1/p' tunnel.jsonl | head -1
The line looks like this:
{
"event": "tunnel",
"url": "https://brave-fox-7c41e09b.tunnl.gg",
"subdomain": "brave-fox-7c41e09b",
"stable": true,
"idle_timeout_seconds": 7200,
"max_lifetime_seconds": 86400
}
3. Watch requests
Every request through the tunnel adds a line, so the agent can check that a webhook arrived and what the app answered:
grep '"event":"request"' tunnel.jsonl | tail -5
{
"event": "request",
"time": "2026-10-09T08:14:03Z",
"method": "POST",
"path": "/webhooks/stripe",
"status": 200,
"bytes": 2,
"duration_ms": 41,
"visitor": "54.187.174.169"
}
A failed request carries a detail saying why, like your app not answering. from_tunnl: true marks requests tunnl answered itself, such as rate limits. Lines with "event":"notice" are messages from tunnl, like a warning before a time limit and a summary when tunnl closes the tunnel.
4. Stop it
kill %1 # or: pkill -f 'stable@proxy.tunnl.gg'
Tell your agent how
Paste this into your project's AGENTS.md or CLAUDE.md, so the agent uses tunnl.gg whenever it needs a public URL:
## Public URLs for local servers
To give a local server a public HTTPS URL (webhooks, OAuth callbacks, testing on a phone),
use tunnl.gg. Nothing to install: it's one SSH command.
1. Start it in the background, with the app's port:
`ssh -n -T -o ServerAliveInterval=30 -R 80:localhost:PORT stable@proxy.tunnl.gg output=json > /tmp/tunnl.jsonl 2>&1 &`
2. Wait for the URL: `until grep -q '"event":"tunnel"' /tmp/tunnl.jsonl; do sleep 1; done; head -1 /tmp/tunnl.jsonl`
The `url` field is the public URL. It stays the same on every run.
3. Each request adds a line with `"event":"request"` (method, path, status, duration_ms).
4. Stop it with `pkill -f 'stable@proxy.tunnl.gg'` when done.
Docs: https://tunnl.gg/guides/ai-coding-agents.md
Inspect and replay requests over MCP
output=json shows each request's method, path and status. To read full headers and bodies, or replay a request after fixing a handler, connect the agent to the request inspector's MCP server at https://app.tunnl.gg/mcp. In Claude Code:
claude mcp add --transport http tunnl https://app.tunnl.gg/mcp
Then run /mcp to sign in. It works with tunnels connected to your free account as pro@proxy.tunnl.gg.
Things to know
- Same URL every run. With
stable@, the URL comes from the SSH key, so the agent can register it with Stripe, GitHub or an OAuth provider once. Withoutstable@, every run gets a new random URL. - One tunnel per key. Starting a second
stable@tunnel with the same key replaces the first. For two apps at once, use a second key: see Stable URLs. - The warning page is for browsers only. Webhooks,
curland other non-browser clients reach your app directly. If the agent tests with a headless browser, send thetunnl-skip-browser-warningheader: see the docs. - Time limits. Free tunnels close after 2 hours without traffic or 24 hours at most; the
tunnelline says so in seconds. Run it again for the same URL, or keep it running. Pro tunnels have no time limits. - Daily transfer. Free tunnels may transfer 5 GB a day per IP (10 GB on Pro). Past that, requests get HTTP 429 until 00:00 UTC, and a
noticeline says so. - It's public. Anyone with the URL can reach the app while the tunnel is open. Verify webhook signatures, and don't tunnel anything with real data.
- Stable URLs need a registered key. The machine's SSH key must be registered to a free account: run
ssh -t link@proxy.tunnl.ggonce yourself and open the link it prints. No SSH key on the machine? Runssh-keygen -t ed25519first. Or dropstable@for a random URL, which needs no account.
The full list of JSON fields is in the README on GitHub.