Live Bridge
The live bridge connects an external MCP client (ChatGPT, Claude, or a terminal tool) to a visitor's real browser session on your website. This lets the AI agent perform actions using the visitor's actual cookies, cart, and login state.
How it works
- A visitor opens the Hunch widget on your site. The widget calls
POST /bridge/live/initto create a bridge. - Hunch returns a claim code (e.g.,
HUNCH-K7M3XPQR) and a bridge token. - The claim code is shared with the workspace operator (shown in the widget or dashboard).
- An MCP client calls
bridge.live.claimwith the claim code to connect to the visitor's session. - The MCP client can now run tools in the visitor's browser via
bridge.live.run. - Commands are queued by Hunch, picked up by the widget on its next heartbeat (every 5 seconds), executed locally, and results posted back.
Available MCP tools
| Tool | Description |
|---|---|
bridge.live.claim | Claim a bridge using a claim code |
bridge.live.list_tools | List available tools in the visitor's browser session |
bridge.live.snapshot | Get the current page state (URL, title, text preview) |
bridge.live.run | Execute a tool in the visitor's browser |
bridge.live.release | Release the bridge and end the session |
Security
- Bridge tokens and claim codes are hashed before storage. Hunch never stores plaintext credentials.
- Claim codes expire after 10 minutes.
- Bridges expire after 30 minutes of inactivity. Heartbeats from the widget extend the TTL.
- Only workspace users with
sessions:manageorwebsites:managepermissions can claim bridges. - Individual tool executions can require operator approval via playbook rules.
When to use the live bridge
- Authenticated purchase flows: The visitor is logged in and has items in their cart. The AI agent needs to help them complete checkout.
- Multi-step workflows: Flows that require page navigation, form filling across multiple pages, or state that persists across interactions.
- Any action that requires the visitor's cookies or login state.
When NOT to use the live bridge
- Simple one-shot form submissions (contact forms, quote requests): Use
browser_publicmode instead. - Read-only questions: Use
site.askorsite.search. - When no visitor is present: The live bridge requires an active widget session.
Example flow
> bridge.live.claim({claim_code: "HUNCH-K7M3XPQR"})
✓ Bridge claimed · visitor on acme-store.com/products
> bridge.live.run({bridge_id: "blv_a8f2", tool_name: "add_to_cart", args: {product: "summer-dress", size: "M"}})
✓ Added to cart in visitor's browser
> bridge.live.run({bridge_id: "blv_a8f2", tool_name: "begin_checkout"})
✓ Checkout opened in visitor's browser
> bridge.live.release({bridge_id: "blv_a8f2"})
✓ Bridge released