What you are being handed
BunnyBridge exposes a small authenticated command API on the user’s phone. Through it you can run commands on the phone (within the Android app sandbox) — and, once the jump-host phase ships, on the user’s other machines via hosts they configured. It is the user’s phone and the user’s bridge: you are a guest operator, and access is lent, not owned.Know which tunnel you are using
Tunnel 1 — tailnet (API agents)
The bridge listens on the phone’s Tailscale address (for examplehttp://<phone-tailnet-ip>:8765). It is reachable only from inside the user’s tailnet. If you can make HTTP requests and have a route to the tailnet, this is your tunnel.
Tunnel 2 — public address (chatbot apps)
If you are a cloud chatbot, you cannot reach a tailnet address — do not try, and do not tell the user it should work. Your tunnel is the user’s public address: an https address (their hosted-relay address, or their own front-door machine’s address) where the/door2/ surface lives. You reach it through:
- Actions / OpenAPI: the app generates an actions schema pre-filled with the public address; the user adds it to your configuration along with the token. The schema is also served at
<public-address>/door2/openapi.json. - MCP: a remote MCP endpoint at
<public-address>/door2/mcp, with one tool,run_command(arguments:cmd, optionaltimeoutin seconds). - Relay mode: if you have no tool ability at all, use the copy-paste protocol in the last section of this page.
/door2/: POST /door2/run, GET /door2/health, GET /door2/status (a reduced status: version and your token’s name only). Send your token as the X-Token header, or as a Bearer token if your connector works that way. A Tunnel 2 token works only on the /door2/ surface — never on Tunnel 1 paths — and Tunnel 1 tokens never work here. Tunnel 2 is rate-limited: 30 calls per minute and at most 2 commands at once. A 429 means slow down, not retry harder.
Do not advise the user to “enable Tailscale Funnel on the phone.” Android has no Tailscale CLI and its Tailscale app has no Funnel feature; that instruction sends the user to a switch that does not exist. If the user’s Tunnel 2 address is unreachable, the front door (relay or their machine) is the problem — say that instead.
The connect block
The user hands you a connect block from the app: the URL for your tunnel, a token made for you, and a link to this page. Rules for the token: treat it as a password. Never print it in full, never save it in code, logs, or files. Send it only as theX-Token header (Tunnel 1 / direct API) or as configured in your actions/MCP setup (Tunnel 2). If you have no connect block, ask the user to open BunnyBridge → Tokens → create one for your tunnel and paste you the block. Tokens are shown once, so if a block is lost, the fix is a fresh token — never ask the user to “look up” the old value; it cannot be displayed again.
Read the diagnosis first
GET /health without a token is basic liveness. With your token it returns the full self-diagnosis — the same three lists the user sees on the Status screen. Check it before your first real command, and whenever something fails:
permissions_missing— Android permissions not yet granted (battery exemption, notifications…).software_missing— for example Tailscale not installed. Verdicts are layered: a live tailnet address counts as Tailscale being up even when the app check cannot see the app, and each item’s detail names which signal decided it. Termux, when found, is information, never a blocker.state_missing— for example Tailscale signed out or its VPN down, Tunnel 2 not set up, no hosts configured.
fix field: "agent" (resolvable through the API, or the app self-heals) or "user" with a short instruction. For a "user" fix, relay that one instruction exactly and wait. Never improvise around a system permission dialog or a Tailscale sign-in — those are the user’s taps.
One more endpoint worth knowing: GET /log (Tunnel 1 only) returns the app’s event log as plain text. When the user says something misbehaved, fetch /log?session=current first — it covers everything since their last “Start test session” marker, with diagnosis facts and stack traces. There is no log on Tunnel 2, by design.
Helping a new user set up
One step at a time, waiting for confirmation after each:- The user installs BunnyBridge and Tailscale.
- The user opens Tailscale and signs in with their own account, VPN on.
- The user opens BunnyBridge — it self-diagnoses, starts the bridge, and generates a first token automatically.
- The user creates a token for you under Tokens and pastes you the connect block. For Tunnel 2, the user also selects Your own front door in Chatbot Access (Status screen) and gives you the public address plus the generated actions schema or MCP endpoint.
- You call
GET /health, confirm the diagnosis is clear (or relay the one remaining user fix), run one harmless verification (echo ok), and show the user the result.
Failure meanings — do not guess
Working rules
- Start read-only. Look before changing anything.
- One command per call, and prefer one command that shows its work over a chain you can’t verify.
- Confirm with the user before anything destructive, irreversible, or visible to other people (deleting files, restarting services, sending messages). Their bridge, their call.
- Report outputs faithfully: quote exit codes and errors as returned; never summarise a failure as a success.
- If the user revokes your token or stops the bridge, stop. Access is lent, not owned.
What you cannot do
- Reach Tunnel 1 from the public internet — it doesn’t listen there. No route to the tailnet means Tunnel 2 or relay, or no connection.
- Grant yourself permissions, install software on the phone, or sign the user into Tailscale. Your job is to name the exact next tap.
- See the user’s other tokens, SSH keys, or stored secrets.
/statusshows names only, by design. - Manage tokens over HTTP. Creation, rotation, and revocation happen only in the app, by the owner.
Relay mode protocol
If you have no tool ability at all, emit exactly one command per reply in this fenced format and ask the user to paste it into the app’s Agent Inbox:Source: Leverine/Leverine-BunnyBridge@902c77c —
docs/site/BunnyBridge/for-agents.html.