Skip to main content
Defined in shared/protocol.ts (protocol version 3). Transport: a WebSocket from the extension’s background process to ws://127.0.0.1:<port>. Chromium uses a service worker; Firefox uses background scripts. The first message must be hello; anything else, or a frame that is not a JSON object, closes the socket. Connections and requests that carry a web page’s Origin header are refused, so pages in the browser cannot reach the companion. Multiple extension profiles can connect to that port simultaneously. The companion assigns each connection a browserId and translates browser-native tab IDs into public IDs unique across all extension and developer browsers. The extension wire messages below use native tab IDs; MCP tools use public tab IDs. Sharing is checked by the extension that owns the tab.

Message shapes

Requests (companion → extension)

Events

instanceId is persistent per extension installation; browserSessionId changes when the browser restarts. Together they keep reconnects associated with the right profile without reusing a previous browser run’s public tab IDs. hello.browserEngine is optionally 'chromium' or 'firefox'; an omitted value uses the legacy Chromium default. The Firefox extension declares its engine explicitly.

ConnectionGraph

The companion sends changed snapshots only to profiles with tools.policy.graph: true. thisBrowserId identifies the receiving extension profile. Agents appear only after MCP initialization. sharedTabs counts shared tabs for an extension profile and open tabs for a developer context. Snapshots contain connection names, IDs and counts, without page URLs, titles, contents or sharing grants. The extension validates unique agent and browser IDs, nonnegative safe-integer tab counts, valid modes and a receiving browser with mode: 'extension'. When present, browserEngine must be 'chromium' or 'firefox'; it is optional so older graph snapshots remain valid without a protocol-version change. The dashboard uses it to choose the Chromium or Firefox logo for an unidentified browser. Node positions and canvas pan/zoom are local dashboard state and do not travel over the wire.

TabInfo

The companion adds browserId, browserName and browserEngine to its public tab records. They are not required in extension TabInfo messages. unsupportedReason(url, engine) marks browser-internal schemes, extension pages and the Chrome Web Store. For Firefox it also rejects protected Mozilla sites and non-HTTP(S) pages; about:blank remains available for preparing a tab. isNewTab(url) recognizes supported Chromium New Tab pages and Firefox about:newtab / about:home, which may be shared and navigated but not inspected.

HTTP routes on the same port