Reference

Endpoints & protocol

The hub's HTTP surface, discovery, headers, and timings.

The hub exposes two surfaces: a display surface the paired phone uses (LAN, session-token gated), and an admin surface the MCP uses (localhost only, write-token gated). Widgets themselves never call these — the native app does.

Display surface (LAN, session token)

PathMethodPurpose
/widget/:idGETWidget HTML
/widget/:id/iconGETIcon PNG bytes (404 if not a png icon)
/api/data/:idGET / POSTThe widget’s JSON feed
/api/data/:id/streamGETSSE push channel
/activeGETActive widget + version
/widgetsGETList of widgets
/controlWSControl channel
/pairPOSTPairing handshake
/api/action/:widgetId/:actionIdPOSTInvoke an action
/api/pulsePOSTSide-effect-free UI echo
/api/capability/:name/requestPOSTRequest a Mac capability
/api/active/:idPOSTPhone switched the active widget
/api/widget/:id/versionsGETVersion history
/api/widget/:id/revert/:versionPOSTRevert to a version
/api/widget/:id/deletePOSTDelete a widget

Admin surface (127.0.0.1, write token — MCP only)

PathPurpose
/admin/publishPublish a widget
/admin/updateUpdate a widget
/admin/set-activeSet the active widget
/admin/listList all widgets
/admin/deleteDelete a widget
/admin/data/:idPush JSON data
/admin/data-endpoint/:idGet a widget’s data URL + token
/admin/pair-statusPairing status
/admin/set-iconSet/replace an icon
/admin/versions/:idVersion history
/admin/revertRevert a widget
/admin/register-actionRegister an action (debug)

Discovery (mDNS / Bonjour)

service type:   _perch._tcp
domain:         local.

Headers

Authorization: Bearer <token>      # tokens ride in headers, never URLs
X-Perch-Schema: <version>          # wire schema version

Timings

ConstantValue
Default data poll interval1500 ms
Pairing token TTL120 s