Documentation Index
Fetch the complete documentation index at: https://docs.useswarm.co/llms.txt
Use this file to discover all available pages before exploring further.
Persistent Tunnels
Swarm can reuse the same public tunnel hostname for local tests instead of creating a new temporary URL on every run. Persistent tunnels are useful when your app depends on callback URLs, redirect URLs, or OAuth flows that break when the public tunnel URL changes.Persistent tunnels are provisioned automatically after
swarm login or useswarm-mcp login when your Swarm workspace has the feature enabled. If provisioning is unavailable, local tests keep using Cloudflare Quick Tunnels automatically.How it works
When persistent tunneling is enabled, Swarm assigns one stable hostname to your user and organization:- Starts Swarm’s local proxy in front of your app.
- Opens a Cloudflare named tunnel to that proxy.
- Reuses your stable hostname for the test URL.
- Runs Swarm’s cloud agents against that hostname.
- Closes the local tunnel process when the test is done.
CLI usage
Log in normally:Manual retry or revoke
Retry provisioning:MCP usage
The MCP package uses the same persistent tunnel flow.dev_test automatically uses the persistent hostname when testing localhost.
OAuth and localhost callbacks
OAuth providers often receive localhost callback URLs during development:redirect_uri, callbackURL, redirectTo, and returnTo to your stable tunnel hostname before the provider receives the request:
Split frontend/backend apps
Persistent tunnels still support split frontend/backend setups:| Path | Destination |
|---|---|
/api/* | Backend |
/auth/* | Backend |
/graphql | Backend |
/trpc/* | Backend |
| Everything else | Frontend |
--backend-paths for custom backend prefixes.
One active session
Only one active test session can use a persistent tunnel at a time. If a second local test starts while the first still holds the tunnel, Swarm returns a clear conflict message. If a client crashes, Swarm automatically treats the lease as stale after missed heartbeats and lets the next run recover.Troubleshooting
Login says persistent tunnel was not provisioned
Your test can still run. Swarm falls back to temporary Cloudflare Quick Tunnels. Try again later:A second test says the tunnel is already in use
Wait for the first run to finish, calldev_close in your MCP host, or revoke and re-provision:
OAuth redirects still fail
Check which callback URL your provider receives inredirect_uri or sends back in Location. Localhost callback values are rewritten automatically. HTTPS provider allowlists still need to include the stable tunnel callback if the provider does not allow localhost redirect URIs.
Operator setup
Self-hosted or internal deployments need Cloudflare credentials on the Swarm API before users can provision persistent tunnels. See the repository operator runbook atdocs/persistent-tunnels.md.
