Files
Aleksander Dygoń fef3dfecfd Let admins use the NEAR wallet of a joined server, and resume a pause that NEAR did not apply (#21024)
* Let a NEAR wallet pause that NEAR did not apply be turned off again

A failed freeze kept the wallet paused on this computer while NEAR Intents
did not freeze it. Each unfreeze then got wallet_already_unfrozen from
generate-intent and failed, so the Payments switch stayed off.

Unfreeze now takes wallet_already_unfrozen as done and clears the pause.
Freeze takes wallet_already_frozen as done. Both codes are in the public
Agent API OpenAPI document for /v1/generate-intent.

* Serve the NEAR wallet to admins of a joined server

Add the optional near-wallet-v1 capability: admin routes for each wallet
action, a signing-page route and a signature route, and the
near-wallet-changed event. A member's owner action runs on the host with
member signing: the host does not open its own browser, and the route
answers when the signing page is ready. The member opens the page, and
the desktop client forwards the openbot://near-signature link to the
server that asked for it. A page URL from the host opens only when it is
the signing page of this app's signing origin.

* Show the NEAR wallet of a joined server on the desktop and the web client

The desktop client and the web client show the Crypto tab of a joined
server to its owner and admins when the server has near-wallet-v1. The
chat payment card also works for that server.

The signing page takes a web return: after the passkey step it opens
/near/signed on the OpenBot site, which hands the result to the open
/app tab through a BroadcastChannel. The /app tab sends it to the host.
A web owner action opens a blank tab in the click, so the browser does
not block the signing page.

* Test the near-wallet-v1 routes through the Team API and document them

The routes E2E checks the capability and admin gates, that an owner
action runs with member signing and answers when the signing page is
ready, the web return page, the nonce check, the deposit error text and
the agent list. The integrations doc and PRIVACY.md describe the joined
server wallet and its signing path.

* Stop a NEAR status read loop and early owner-action answers

A remote client reads the status on each near-wallet-changed event, and
that read refreshes the wallet on the host, which emits again. The host
now sends the event only when the status changed.

An owner action answered at once when the status still had an old error
from before the action. It now waits until that error is cleared.

The desktop keeps one host wallet API for each server, and the web
client keeps its signature channel open while a signature waits.

* Share one host event subscription per server for the NEAR wallet

Each wallet store of a joined server added its own agent:event IPC
listener: the Vault panel and each chat view. They now share one
subscription per server, which stops when the last view leaves.

* Answer a remote NEAR wallet setup when its steps end with no signature

The create route waited for a signing page or an error, because create
runs its steps in the background. When the steps ended at once with no
signature, such as when a device-only passkey must be kept or replaced,
the client waited 60 seconds. The route now uses createAndWait, which
forks the steps in the wallet scope and waits for them, and still answers
as soon as a signing page is ready.

* Tie a remote NEAR owner action to its own signing session

Review fixes:
- The owner-action route answers when the signing page of this request
  opens (NearMemberSigning.opened) or when the action ends. A signing or
  an error of another action no longer answers it.
- A status read refreshes the host wallet at most once each 30 s, so an
  event-driven read does not start another refresh. The web client reads
  the status once per event for all its views.
- A forwarded desktop signature stays pending until the server answers,
  so a failed send can be tried again.
- The web client sends the receipt to /near/signed only after the host
  accepts the signature. The page waits up to 20 s for it.
- A failure to open the signing page on the client is logged; the action
  still shows the host status with its Open signing page button.
- The host watcher starts from the current server list, and the payment
  card store resets when its server changes.

* Name the release notes file after the branch

* Call the local NEAR wallet with the local server id

The nearWallet endpoints take an optional server, and the preload sends a
call with no server to the selected server. The local wallet store and
the local payment card called with no server, so with a joined server
selected they read and changed that server's wallet. Each adapter now
binds its server id, and the local one passes LOCAL_SERVER_ID.

* Keep the /near/signed page parts local to their files

knip:check found NearSignedView and NearSignReturn exported but not used
elsewhere.

* Name NearMemberSigning in the integrations doc
2026-12-01 23:05:52 +01:00

81 KiB
Raw Permalink Blame History

Integrations and sign-in

This guide tells you how a sign-in reaches OpenBot, how a joined server signs in through the computer of its user, and how to add a provider, an application or a connector. Each section has a working example with real file paths.

How a sign-in reaches OpenBot

The computer that runs OpenBot keeps every grant. On a joined server, this is the host, not the computer of the user who signs in. A sign-in uses one of these kinds:

Kind Example On this computer On a joined server
Loopback callback URL MCP servers (McpOAuth), Codex browser sign-in, a page that an agent's CLI prints The page sends the browser to http://127.0.0.1:<port>/.... The MCP listener uses port 28417 and takes the paths /mcp-auth and /callback (mcp-oauth-redirect-server.ts). A sign-in on this computer registers /callback first: New Relic accepts a loopback page only on a common path such as /callback (#13216). A client that never finished a sign-in at /mcp-auth registers again. A sign-in that another computer opens (relay or live view) keeps /mcp-auth, because clients older than 0.70.0 take only that path. A server that refuses one path at registration gets the other. The callback relay (sign-in-relay-v1). MCP on an older host: the host's live view (mcp-sign-in-v1).
Device code Codex (codex-device), Grok, Cline, Kimi, Muse, the GitHub connector The user types a short code on the provider's page. Nothing comes back to OpenBot. The host starts it and the client shows the code (providers-v1 to providers-v5; Kimi providers-v8 only). Muse: the relay opens its device page with no callback. GitHub: connectors-v1.
Pasted code Claude on Linux (cli / paste), Cursor (cli / link) The page shows a code, and the user pastes it into OpenBot. The host starts it and the client takes the code (providers-v3 to providers-v5).
CLI-owned browser login Claude (auth login), Codex, Gemini (acp-authenticate) The provider's CLI opens the browser and takes its own callback. The relay (provider/start): the host captures the page, and the client sends the callback query to the CLI's listener on the host. Grok, Cursor and Cline: a code kind. Mistral: the host takes the page from Vibe (acp-delegated) and the client shows it as a link (providers-v8 with mistral-code-sign-in-v1).
Deep link Slack, Discord (openbot://slack-workspace, openbot://discord-guild), MCP fallback (openbot://mcp-auth) A hosted page ends in an openbot:// link, which reaches only the computer that opened it. Slack and Discord: connectors-v1. The client sends the sealed grant on to the host that started the install. The browser client gets the grant from a return page of its own origin (web-messaging-install.ts).
Terminal Pi OpenBot opens the CLI in a terminal on the host (provider-terminal-login.ts). Sign in on the host.
Key or local session API keys, 1Password, Bitwarden, Proton Pass The user types a key or gives a CLI session. Proton Pass also signs in on Proton's web page. Keys go to the host over the encrypted channel. Vault approval stays on the host. A Bitwarden session key works only on the computer that made it; a joined server gets an API key and the master password. Proton Pass: password-managers-v1; the client opens the host's sign-in page.

The sign-in kinds of providers are in ProviderSignIn and ProviderCodeSignIn in provider-drivers.ts. The kinds of applications are the auth kinds of a catalog entry: link, key and local.

How an MCP sign-in renews and ends

McpOAuth (mcp-oauth-provider.ts) renews a token before a thread start or a test, with no browser. The renewal calls refreshAuthorization of the SDK, not auth(), so it never registers a new client. The answer of the token endpoint sets what stays:

Answer Tokens Client registration Sign-in app, discovery Row
New token set Replaced Kept Kept Signed in
invalid_grant Dropped Kept Kept Sign-in needed (lostAt)
invalid_client, unauthorized_client Dropped Dropped Kept Sign-in needed (lostAt)
No network, a server error, a timeout Kept Kept Kept No change

A dropped token is not handed to an agent: accessToken answers null. The IPC McpSignInState.needsSignIn tells the panel to show the sign-in badge and the Sign in button with no test. The frozen mcp-sign-in-v1 wire keeps only mcpServerId and signedIn.

Sign-out and removal delete the local tokens first. Then OpenBot sends one best-effort RFC 7009 request per token, refresh token first, to the revocation_endpoint of the authorization server. The request goes through secureOAuthFetch, with the client authentication of the registration and a 5-second limit. A failure is logged with the origin and the status only, and is not shown.

secureOAuthFetch limits each OAuth request: the body is at most 1 MiB, and the answer must come in 20 seconds. The outer deadlines stay. A request to the MCP URL itself is MCP traffic, because the probe uses the same fetch for the transport, so it has no size or time limit. When the host of the MCP URL resolves only to public addresses, each OAuth host (metadata, authorization server, token, registration and revocation endpoints) must also resolve only to public addresses, or the request fails with error.backend.mcpOAuthPrivateEndpoint before it connects. A failed lookup also stops the request. A LAN or localhost MCP URL has no such check. The check does not pin the address, so DNS can change between the check and the connection; this residual risk is accepted. Run bun run test:mcp-oauth to check the sign-in paths against a local authorization server.

More than one account of one MCP server

An app on a fixed address that signs in with a browser, such as Notion, can have more than one account. Each account is one http row on the same address. The row name is the account name, and a message tags the account with @<row name>.

Part Rule
Address The first account keeps the listing URL and name, so a released client still finds it. Add account adds #account-<id> to the URL (mcp-accounts.ts). A row from before accounts has no fragment and keeps its sign-in.
Sign-in McpOAuth keeps one record for each address with its fragment (mcpOAuthAccountKey). Discovery, registration, tokens and revocation use the address without the fragment, so the fragment never leaves the computer.
Provider McpGateway.endpoint removes the fragment. The proxy target keeps it, so a token refresh reads the sign-in of that account, and the proxy removes it before each request. The proxy route is a digest of the row id and its URL, so each account has its own route.
Own sign-in A new row on an address that another row signs in with gets its own #account-<id>, so it never takes the sign-in of the other row. The MCP server form and the Marketplace install add it to the draft before the first test or sign-in (withOwnMcpAccount). McpGateway.accountConfig applies the same rule at each save and before the agent tool save_mcp_server tests a server, so a plain address from an older client also gets its own account. An edit keeps the account of the row unless the row moves to an address that another row uses. Rows that already share an address keep their shared sign-in. To split them, edit one row and add #account-<name> to its address.
Catalog isPluginAppConfig gives each row with an account fragment to the catalog app, whatever its name. A row with no fragment needs the catalog name, so it has no Rename. Disconnect removes all accounts of the app.
Joined server The client offers Add account only when the host sends mcp-accounts-v1. An older host keys sign-ins by the address without the fragment, so two accounts would share one sign-in.

Run bun scripts/mcp-oauth-store-e2e.ts to check that two accounts keep separate sign-ins, and bun run test:mcp-own-sign-in to check that a new row on a used address gets its own account.

Members and the MCP servers of a joined server

A host with mcp-member-access-v1 lets a member, not only an owner or admin, use the routes of mcp-servers-v1, mcp-sign-in-v1, mcp-sign-in-app-v1 and the MCP start of sign-in-relay-v1. The host checks each request in mcp-member-access.ts.

Part Rule
Client The host lets a member in only when the client also sends the capability. A released client stays admin-only. serverCanManageMcp decides what the desktop and web clients offer, and canManageMcpServers what the phone offers.
Read and add A member reads the list, tests a server, and adds a server, a stdio command too. On each row where the member's level is below manage, the host replaces each env and header value that is not empty with MASKED_MCP_SECRET (••••••••). The keys and names stay.
Masked values A test of a saved row where the member's level is below manage uses the stored row on the host, not the sent config, so the test has the real values and a changed command or address cannot get them. When a save or a test of a saved row sends MASKED_MCP_SECRET for a key that the row has, the host keeps the stored value. A member below manage cannot save the row (403), so a mask never replaces a stored value.
Change A member changes, turns on or off, or removes only a server that the member added. Any other row gets 403 error.team.mcpServerNotYours. Owners and admins change every row.
Owners McpServerOwnersStore keeps the member ID of each row that a joined server added, in openbot-mcp-server-owners-v1.json. A row with no entry, such as one added on the host, counts as an admin's. A damaged file reads as empty.
Sign-in A sign-in belongs to an address with its account fragment (mcpOAuthAccountKey), not to a row. A member starts, cancels or signs out a sign-in, or changes a sign-in app, only when each row with that sign-in is the member's. A new member row on the address of another person gets its own account, so the member signs it in. Each server keeps one sign-in, which every agent of the host uses.
Providers Provider sign-ins, account starts and agent links on the relay stay with owners and admins.

Run bun run test:mcp-member-access to check these rules on a real host.

Who gets each MCP server

A host with mcp-access-v1 keeps one entry for each MCP server in mcp-access-store.ts, a preference file with no migration.

Part Rule
Agents agents: null gives the server to each agent, also to a new one. A list gives it only to those agents. AgentService applies the list when it gives the enabled servers to a provider session.
New member server When a member adds a server through the Team API, the host first saves it off, then writes an entry with agents set to the agents where that member has manage at that time (McpAccessStore.limitNewServer), then turns it on when the member asked for that. So the server never starts in an agent that the member cannot manage, and a later agent does not get it. An owner or admin can widen the list. A server that an owner or admin adds keeps agents: null.
Earlier member server One time, at the first start on this version, the host limits each server that a member added before the rule above (TeamApiServer.limitEarlierMemberMcpServers, McpAccessStore.limitMemberServers). It reads the person who added the server from openbot-mcp-server-owners-v1.json. When that person is still a member (not an owner or admin) and the entry is missing or has agents: null, it sets agents to the agents where that member has manage now and keeps the other fields of the entry. It skips a server of a removed member, an entry that has a list, and all servers while the roles file is closed. It never deletes a server, an owner record or an entry, and never widens an entry. It runs after the agent roster loads and before the providers start. It then writes memberServersLimited: true to openbot-mcp-access-v1.json, so a later admin choice of agents: null stays. When it fails, the host logs a warning, starts as usual and tries again at the next start.
Members everyone and each role have a level: none hides the server and refuses it, use gives the rights on a server of another person, manage gives the rights of the person who added it. A member gets the highest level. An owner, an admin and the person who added the server always manage.
none The host leaves the server out of the list and out of the sign-in states, and it refuses a change, a test, a sign-in and a sign-in status for the server. The host also refuses the member each saved row (new or moved), test, sign-in status and sign-in state on that address, with any account fragment, the member's own rows included.
Routes POST /v1/mcp-access reads and POST /v1/mcp-access/set replaces one entry (route-mcp-access.ts). Only an owner or admin reads the entries and sets them; a member reads mine and cannot change the agents of a server, also of a server that the member added.
Revision The snapshot has a revision, and a replace names the one that the client read. Each replace adds 1. When another admin saved first, the host answers 409 error.team.mcpAccessStale and changes nothing; the client reads again.
Sessions A replace that changes the agents of a server gives each agent a new provider session. A replace of the levels only does not.
Client The Marketplace page of a connected app or custom server shows the Agents and Roles sections when serverCanAdminister(server, "mcp-access-v1") is true.
Damaged file Each server is closed to agents and members until an owner or admin saves its access.
Not covered Access for each tool. The built-in entries (Computer Use, the GitHub connector) have no MCP row, so each agent gets them, also after a damaged file. The MCP management tools of an agent do not apply the agent list, and a server that an agent adds for a member keeps agents: null.

Run bun run test:mcp-member-access to check the routes and the levels through the Team API.

How many MCP servers a host keeps

A computer keeps up to 100 MCP servers (INPUT_LIMITS.mcpServers). Disabled rows count too. The released codecs of mcp-servers-v1 and mcp-sign-in-v1 read at most 32 rows in one list, and they are frozen. The protocol 9 capability mcp-many-servers-v1 (mcp-many-servers-v1.ts) lets a list hold 100 rows when both peers send it. The rows and the requests keep their frozen shapes.

Peer Rule
Client with the capability Reads lists of up to 100 rows.
Client without it Works while the host has 32 rows or fewer. When a route would answer with more, or a save would add the 33rd row, the host refuses it with 409 error.team.mcpServerListNeedsUpdate before it changes anything (requireMcpListFits in route-mcp.ts).
Transfer file An export can hold up to 100 rows. An app before this change refuses the Settings section of a file with more than 32.

How an agent reaches a signed-in MCP server

An agent never gets an OAuth token. McpGateway.endpoint gives a provider a route of McpOAuthProxy (mcp-oauth-proxy.ts) for each http row that has a sign-in on this computer, or a sign-in that the server ended, and no Authorization header that the user typed. The GitHub row keeps its own proxy. Other rows, stdio rows and the Test probe are not changed.

Part Rule
Address http://127.0.0.1:<port>/mcp/<route>/<agent>. The route is a digest of the row id and its URL, so a changed URL is a new route. The agent segment is a digest of the agent id (mcpOAuthProxyAgentKey). /mcp/<route> with no agent segment stays valid: Codex sessions from before the segment hold it.
Bearer An HMAC of the route and the agent segment with the proxy secret. A bearer opens one route for one agent only. It is compared with timingSafeEqual and registered for redaction.
Identity The clientInfo of each initialize becomes { name: "openbot", title: "<agent name> (OpenBot)", version, websiteUrl }; the name is read at each initialize, so a rename shows in the next session. With no known agent the title is OpenBot. User-Agent is OpenBot/<version> unless the row sets one. A body that is not JSON, is a batch, or is larger than 64 KiB goes through unchanged.
Refused with 403 A Host that is not 127.0.0.1:<port> or localhost:<port>, an unknown path, a wrong bearer.
Upstream The row's URL and its headers, with the current token. The provider's Authorization and cookies are not sent. Only same-origin 307 and 308 redirects are followed, at most 3.
Server answers 401 One McpOAuth.refreshAccessToken, then one retry with the new token.
No sign-in Each request gets JSON-RPC error -32001, notifications get 202, GET and DELETE get 405. The proxy never answers 401, so the provider does not start its own sign-in.
Server not reached 502 with JSON-RPC error -32603.

Each request reads its target from the enabled rows and the stored sign-in. Removing, turning off, editing or signing out of a row refuses its route at once; there is no list of routes to keep current. A proxy that cannot start drops the row from the hand-off with error.backend.mcpOAuthProxyUnavailable. The raw token is never the fallback.

The port and the secret are kept encrypted in openbot-mcp-oauth-proxy-v1.json. Codex keeps the MCP configuration of a resumed thread, so the same address must work after a restart. When the saved port is in use, the proxy takes a new port and a new secret, so the old bearers stop working. The Codex tool manifest records the proxy address and the proxied rows; a change replaces the Codex session at its next turn. A computer with no proxied row keeps its manifest.

Run bun run test:mcp-oauth to check these paths against a local authorization server and a local MCP server.

Remote sign-in: the callback relay

The user is connected to a joined server, for example a cloud server. The host starts the sign-in, but the sign-in page opens in the browser of the user's own computer. The user's browser keeps their passwords, passkeys and sessions. After the user signs in, the page sends the browser back to a loopback address. The user's OpenBot takes that callback and sends it to the host. The host finishes the sign-in and keeps the grant.

The optional Team API capability sign-in-relay-v1 carries the relay. The frozen contract is sign-in-relay-v1.ts. It has three start routes, and provider-account-relay-v1 and -v2 add one more each. They share status, complete and cancel:

Start route What it signs in How the host delivers the callback
mcp/start A URL MCP server, from the Marketplace It gives the code to McpOAuth (owned flow).
provider/start The CLI of a provider in SIGN_IN_RELAY_PROVIDERS: Codex, Claude, Gemini (antigravity) and Muse It replays the query to the CLI's own loopback listener on the host. A Muse device page has no callback: the client only opens it.
provider/v2/start The CLI of a provider in PROVIDER_SIGN_IN_RELAY_V2_PROVIDERS: Devin. The separate capability provider-sign-in-relay-v2 adds this route (provider-sign-in-relay-v2.ts). Only a Linux host advertises it, with v1: on macOS the CLI runs /usr/bin/open by its absolute path, and on Windows OpenBot has no open command that the CLI uses, so OpenBot cannot take the page there. provider-sign-in-relays.ts gives a client the route that takes a provider As for provider/start.
link/start A sign-in page that an agent of the host printed in its conversation It replays the query to the loopback address of that page.
provider-account/start An account after the first of Codex or Claude (PROVIDER_ACCOUNT_RELAY_PROVIDERS), new or signed out. The separate capability provider-account-relay-v1 adds this route (provider-account-relay-v1.ts) It replays the query to the loopback listener of the account's CLI on the host, as for provider/start.
provider-account/v2/start An account after the first of Codex, Claude or Gemini (PROVIDER_ACCOUNT_RELAY_V2_PROVIDERS), new or signed out. The separate capability provider-account-relay-v2 adds this route (provider-account-relay-v2.ts). A host advertises it with v1, and a client uses the newest one that the host advertises As for provider-account/start.
mcp/start-deep-link As mcp/start. The separate capability sign-in-relay-deep-link-v1 adds this route (sign-in-relay-deep-link-v1.ts). A desktop client sends it only while its operating system opens openbot:// in OpenBot. After two sign-ins of the same address got no grant back on 127.0.0.1 and on localhost, the host registers openbot://mcp-auth: TradingView's firewall blocks a page that returns to a loopback name (#9209) The client takes the callback from openbot://mcp-auth by state and sends it with complete; the host gives the code to McpOAuth.

Sequence

User's computer (client)                        Host (joined server)
------------------------                        --------------------
POST mcp/start {config}  ---------------------> McpHostSignIns.startRelay: start the sign-in,
                                                open no tab, keep the page address
                         <--------------------- {flowId, expiresAt}
POST status {flowId}     ---------------------> SignInRelayHost.status
                         <--------------------- {authorizeUrl, callback {port, path, state}, result}
Read port, path and state from authorizeUrl
(refuse a page with no state)
Listen on that port (or use the own
MCP listener on 28417 /mcp-auth, by state)
Show the page's host name; the user clicks
"Open sign-in page" (https only)
        ... the user signs in ...
Browser -> http://127.0.0.1:<port><path>?code&state
POST complete {flowId, query} ----------------> check state, give code to McpOAuth
                         <--------------------- {result: null} -> read status until result

Parts

Part File
Frozen wire contract packages/contracts/src/team-protocol/sign-in-relay-v1.ts
Host flows (single use, expiry, member, state) src/main/sign-in-relay-host.ts
Host route (requireAdmin on every route) src/main/team-api/route-sign-in-relay.ts
Host sign-in with no tab ("relay" mode) src/main/host-sign-in-pages.ts, src/main/mcp-host-sign-ins.ts
Client flow (listen, open, complete, paste) src/main/sign-in-relay-client.ts
Loopback listener checks (Host, method, path) src/main/loopback-callback-server.ts
Desktop IPC (servers:mcp:sign-in-relay, servers:mcp:open-sign-in-relay, servers:mcp:complete-sign-in-relay) src/main/ipc/mcp-server-handlers.ts
Paste dialog McpSignInRelayDialog in packages/ui/src/features/settings/McpSignInPage.tsx
Browser client (paste only) src/renderer/src/features/web-client/web-server-settings.ts
Marketplace src/renderer/src/features/settings/marketplace-controller.ts, web-marketplace.ts
Provider page capture on the host (BROWSER command, ACP link) src/backend/agent/browser-capture.ts, src/main/provider-host-sign-ins.ts
Provider Connect on a joined server src/main/ipc/provider-admin-handlers.ts, web-provider-relay.ts
Agent links (agent:open-message-link, agent:paste-message-link, agent:cancel-message-link) src/main/message-link-relay.ts, web-message-link-relay.ts

How the client takes the callback

The client tries these, in this order:

  1. Its own MCP listener. The callback names port 28417 and path /mcp-auth, and the client's own MCP grant listener has that port. The listener gives a state that no local sign-in started to SignInRelayClient.deliver. The openbot://mcp-auth link does the same.
  2. The exact port. The client binds 127.0.0.1:<port> for the time of the sign-in with listenLoopbackExact. It never takes another port, because the page sends the browser to the host's port.
  3. A pasted address. The port is busy, the callback is not a loopback address, or the client is the browser client. The dialog asks the user to paste the address that the browser shows at the end. The client takes only the query and sends it with complete.

A page with no callback, such as the Muse device page, has nothing to take. The client opens it and reads status until the CLI on the host ends the sign-in.

A host without sign-in-relay-v1 falls back to the live view of mcp-sign-in-v1: the host opens the page in its own private tab, and the user signs in through the live view. A host with neither capability answers that the sign-in must be done on the host.

Rules

  • Only an owner or admin can use a relay route. requireAdmin runs on every route. With mcp-member-access-v1, a member also uses mcp/start, status, complete and cancel, under the rules of Members and the MCP servers of a joined server.
  • flowId is 128 random bits. A flow completes once, only for the member who started it, and ends after SIGN_IN_RELAY_TTL_MS (10 minutes). An unknown flow, an expired flow and the flow of another member get the same 404.
  • The client sends only the query of the callback. The host checks state against the page address that its own sign-in made. A client can never choose a host port, host name or path.
  • The host names a callback only for http: on 127.0.0.1, localhost or [::1], with a port.
  • The host chooses the page. The client therefore:
    • opens only an https: page. The desktop app opens it as soon as the sign-in waits, and the dialog shows the page's host name, with "Open sign-in page" to open it again. The browser client opens it only on that click, because a browser blocks a page that no click opened;
    • reads the callback port and path from the page's redirect_uri, not from the host's callback;
    • refuses a page with no state, so its listener hands on only the callback of this sign-in.
  • The client listener refuses a request whose Host header is not a loopback name, a method that is not GET or HEAD, and any other path. Its page is a fixed catalog message.
  • The code is a secret. The host calls registerSecretValue on it before delivery. No log line, analytics event or diagnostic export contains the code, the state or the query.
  • The code travels only on the encrypted Team channel. The account Worker never sees it.
  • Replay delivery sends one GET to the loopback address of the host's own page. It follows no redirect, keeps only the status code and drops the body.
  • link/start accepts only an https page with a state and a loopback redirect_uri (relayableSignInLink), and only when an agent message of agentId from the last hour holds that exact address as a whole link (agentPrintedLink). Any other link gets 404, so a client cannot make the host send a query to a port of its choice. The replay sends only what a click on that link on the host would send.
  • An agent link opens at once, because the user clicked it. The desktop app opens it only when the page that the host names is the link that the user clicked; any other page ends the sign-in unopened. The browser client opens the link on the click, as before, because a browser blocks a page that no click opened; it accepts a pasted address only when the host names that same page.
  • When the desktop app cannot bind the port, and always in the browser client, openMessageLink returns the page, and the conversation shows McpSignInRelayDialog with the paste field. pasteMessageLink ends when the sign-in ends; cancelMessageLink cancels it on the host.

Security checklist for a new relay kind

  • The host builds the full callback address from its own record. The client sends only a query.
  • The host checks state before it delivers. The client refuses a page with no state.
  • The client opens only an https: page, and the dialog shows its host name.
  • One flow completes once, for one member, before its deadline.
  • The code is registered with registerSecretValue and never logged.
  • The route uses requireAdmin, and its codec is in an optional capability (not in bootstrap).
  • Single use, the other member, expiry and a state mismatch are checked. See Test a sign-in through a joined server.

Add a provider

A provider is a coding agent CLI, such as Codex, Claude or Gemini. Read Providers first. The descriptor row and the driver are the start; the type checker then names most of the other places.

  1. Descriptor. Add the id to AGENT_PROVIDERS and a row to AGENT_PROVIDER_DESCRIPTOR_TABLE in packages/contracts/src/agent-providers.ts: displayName, cliName, authKind, signInMessage, localCodeSignIn, skillFolders and the other fields. The table uses satisfies Record<AgentProviderId, ...>, so a missing row does not compile. Do not add to AGENT_IDS_RESERVED_AT_RELEASE: it is frozen.
  2. Driver. Add a row to BUILT_IN_PROVIDER_DRIVERS in src/backend/provider-drivers.ts. Choose the sign-in:
  3. Backend. resolve<X>Cli in src/backend/cli.ts, the state paths in src/backend/process-confinement.ts, providerLabel in src/backend/agent/thread-items.ts and src/backend/agent/provider-diagnostics.ts.
  4. Managed runtime (when OpenBot installs the CLI): native-runtime.lock.json, scripts/agent-runtime-lock.ts, and src/main/provider-runtime-descriptors.ts, provider-runtime-releases.ts and provider-runtime-manager.ts.
  5. Contracts and preload. The AgentAuthState arm in ipc-agent-status.ts, then src/preload/agent-decoding.ts. A managed runtime also needs its line in decodeProviderRuntimeSnapshot (ipc-provider-admin.ts, with decodeLaterRuntime) and in src/preload/provider-runtime.ts.
  6. Renderer. SetupProviderPicker.tsx, ProviderSettingsSection.tsx, app-defaults.ts, and the preview mock-provider-runtimes.ts.
  7. Logo. The ProviderLogoVariant union and its SVG in packages/brand/src/ProviderLogo.tsx, and the color in packages/brand/src/tokens.css.
  8. Team API. No edit. Team API v8 and providers-v8 carry any provider id (see "Protocol compatibility" in Providers). The host status row names the provider, and the code sign-in, key and runtime routes take its id. The clients (desktop, web and iPhone) read the rest from the descriptor: Connect from a device localCodeSignIn, Download from MANAGED_RUNTIME_PROVIDERS and INSTALLER_PROVIDERS, and the key from KEY_ONLY_PROVIDERS. A peer below v8 does not see the provider (provider-visibility.ts), and a client that does not know it shows it disabled with "Update OpenBot to use {name}". Do not edit the frozen lists of a released capability. A paste or link code sign-in, or the sign-in relay, on a joined server needs a new capability.
  9. Text and docs. Error keys in error/provider.ts and onboarding text in all languages (docs/i18n.md). A section in Providers, and a changelog.d/<branch>.md file.

Worked example: Codex browser sign-in. The driver row uses signIn: { kind: "browser" }. CodexLoginFlow.startBrowser in codex-login.ts asks the Codex app-server for account/login/start, gets authUrl, and opens it with openExternal. The Codex CLI takes the loopback callback by itself. For another computer, the row also has codeSignIn: { kind: "codex-device" }: the host starts a device code, and the client shows it.

On a joined server with sign-in-relay-v1, Connect uses provider/start. The host runs the same startBrowser in "relay" mode, so openPage keeps authUrl and opens no tab. The client opens the page in its own browser and listens on the port of the page's redirect_uri (1455 in current Codex releases). The host replays the callback query to the Codex listener on that port.

To relay a new provider, add it to SIGN_IN_RELAY_PROVIDERS before the capability ships, and give the host its page:

  • A CLI that honors BROWSER: run it with captureBrowser from browser-capture.ts. Claude does this.
  • An ACP agent that prints its link: the acp-authenticate capture. Gemini does this.
  • A CLI that returns the page address, such as the Codex app-server: give it to openPage.

A CLI that opens its own browser and honors no BROWSER cannot be relayed. Give it a code sign-in.

Add an application

An application is an MCP server that the Marketplace installs, with optional skills. The source is one folder per plugin in marketplace/plugin-catalog/.

  1. Add marketplace/plugin-catalog/plugins/<slug>/plugin.json, and add the slug to order in catalog.json. The fields are slug, name, tagline, description, category, creatorName, iconUrl, version, prompts, apps, skills ([] for now) and the policy URLs. The types are in scripts/build-plugin-catalog.ts.

  2. Each app has a server: http with a url, or stdio with a command and args. Its auth names how the user connects:

    • link: a browser sign-in. OpenBot is the OAuth client (McpOAuth in mcp-oauth-provider.ts): discovery, dynamic registration or a client metadata document, PKCE and refresh. The tokens stay in encrypted storage. No bridge program.
    • key: one or two fields that go into a header (http) or an env value (stdio).
    • local: steps that the user does on the computer that runs the server.

    A stdio app that drives Apple apps through AppleScript lists them in macAutomation (calendar, contacts, mail, notes, reminders, messages, safari). On a Mac that runs the server, the listing page can then ask macOS for each app at install (mac-automation.ts). The mobile copy leaves the field out.

  3. Never put a secret in the catalog. The user types it in the connect dialog.

  4. Build and check the generated files:

    bun run marketplace:build:plugins
    bun run marketplace:build:plugins -- --check
    

    The build writes src/renderer/src/features/settings/marketplace-plugin-catalog.ts, apps/auth-api/src/lib/plugin-catalog.generated.ts, apps/mobile/src/features/marketplace/model/plugin-catalog.generated.ts and resources/plugin-catalog/. Do not edit them by hand. The mobile copy states its own types and leaves out the vendor icon addresses: the phone loads icons from /plugins/icon/<slug>?app=<id>.

  5. For an http server, run bun run test:mcp-catalog (mcp-catalog-smoke.ts). It connects to the live servers with no account and writes .openbot-build/mcp-catalog-smoke/report.json. It needs the network, so it is a manual run and not a CI gate.

The smoke checks an http server with no auth or with a link flow. It skips stdio servers and servers with only key or local flows: they need the user's key or computer. Add or keep an entry only when the smoke passes for it:

auth The server must
None Answer initialize with no credential.
link Refuse initialize with a 401 and a Bearer challenge. Publish protected-resource metadata that names an authorization server. That server's metadata lists a registration_endpoint or sets client_id_metadata_document_supported, and lists S256 in code_challenge_methods_supported and the code response type. Its endpoints use https and public addresses.

A link server with neither fails: each user would have to register a sign-in app first. Use a key flow for it, or leave it out. The smoke reads metadata only. It never registers a client and never sends a credential.

A server with no registration_endpoint that sets client_id_metadata_document_supported gets OpenBot's client metadata document (CIMD, SEP-991) as the client_id: https://openbot.run/oauth/mcp-client.json, which apps/auth-api serves (mcp-client[.]json.ts). Its redirect_uris holds only http://127.0.0.1:28417/mcp-auth: ElevenLabs refuses a document that also lists a custom scheme such as openbot://mcp-auth (#5748). A server that offers registration keeps it. ElevenLabs accepts only the document. When port 28417 is in use, the loopback address has another port, and a server that compares ports refuses it.

A server that registers only the clients it approved, and that approved OpenBot's own app, gets a built-in client (BUILT_IN_MCP_CLIENTS in mcp-oauth-provider.ts), chosen by the MCP server address and the issuer that discovery finds. Both must match: any server can name an issuer in its metadata, and the token goes to the server that asked for it. Meta Ads (https://www.facebook.com/ads) is one: its registration endpoint answers "Dynamic registration is not available for this client", and it refuses every http redirect, loopback too. Its client is the OpenBot Meta app 1479376854168579, with no secret. Its redirect is https://openbot.run/oauth/mcp-callback (mcp-callback.ts), which answers 302 to http://127.0.0.1:28417/mcp-auth with the query unchanged. So the grant still arrives at the MCP listener of the computer where the browser runs, and a joined server uses the callback relay as before. The relay always names port 28417: when another program holds that port, the sign-in cannot finish. A sign-in app that the admin saves replaces the built-in client, but it keeps the built-in client's redirect: Meta refuses the loopback address for every app (#13663). The "Sign-in app" section shows that redirect as its callback URL. The Meta app must list the relay address in "Valid OAuth Redirect URIs", and a user who has no role on the app can sign in only after Meta's App Review puts the app in Live mode. bun run test:mcp-sign-in-https-relay checks the Meta page, the relay, and that another server that names Meta's issuer does not get the app.

A server that does not register OpenBot by itself needs a sign-in app: an OAuth app that the admin registers with the provider. The user enters its client ID in the "Sign-in app" section of the MCP server (McpSignInAppSection.tsx). The callback URL is http://127.0.0.1:28417/mcp-auth. On a joined server, the host keeps the app (mcp-sign-in-app-v1).

Worked example: Linear (marketplace/plugin-catalog/plugins/linear/plugin.json):

"apps": [
  {
    "id": "app-linear-mcp",
    "name": "Linear",
    "description": "Issue search, triage, status updates, and issue creation, over Linear's MCP server with browser sign-in.",
    "iconUrl": "https://linear.app/favicon.ico",
    "server": {
      "name": "linear",
      "transport": "http",
      "url": "https://mcp.linear.app/mcp",
      "auth": [{ "id": "linear-oauth", "kind": "link", "label": "Sign in" }]
    }
  }
],

On this computer, Connect opens Linear's page in the browser and the grant comes back on port 28417. On a joined server with sign-in-relay-v1, the Marketplace installs the app on the host, and the page opens in this computer's browser through the relay.

Add a connector

A connector links OpenBot to an outside account for all agents. Each one has a main-process service, an IPC contract, a renderer controller and a panel. Marketplace › Apps, the chat suggestion card and the browser client read one list, so a connector shows the same state on each of them.

Connector Service Sign-in Contract
GitHub github-connector-service.ts, github-device-flow.ts Device flow of a GitHub App with only the public client ID ipc-github-connector.ts; joined server: connectors-v1 GitHub routes
Slack src/backend/messaging/slack/ Hosted OAuth in the account Worker, which ends in openbot://slack-workspace with a sealed grant slack-workspace-grant.ts, ipc-messaging.ts
Discord src/backend/messaging/discord/ The same, with openbot://discord-guild discord-guild-grant.ts, ipc-messaging.ts
Telegram src/backend/messaging/telegram/ A one-use link code in a t.me link. No OAuth telegram-app.ts, ipc-messaging.ts
1Password onepassword-connector-service.ts The user's op session creates a read-only service account, or the user pastes a token ipc-onepassword-connector.ts; joined server: onepassword-connector-v1 (token only)
Bitwarden bitwarden-connector-service.ts A bw session key, kept in memory only; a joined server signs in with an API key and the master password ipc-bitwarden-connector.ts; joined server: bitwarden-connector-v1
Proton Pass proton-pass-driver.ts A web sign-in in a temporary pass-cli session makes an agent access key, or the user pastes one ipc-password-managers.ts; joined server: password-managers-v1

To add a connector:

  1. Add the IPC contract in packages/contracts/src/ipc-<name>-connector.ts, the handlers in src/main/ipc/<name>-connector-handlers.ts (read src/main/ipc/AGENTS.md), the preload decoders and the preview mock.
  2. Add the service in src/main/<name>-connector-service.ts. Keep its secret in encrypted storage, and call registerSecretValue on every token before the first log line.
  3. Prefer a device code: it works on any computer and through any joined server. A deep link (openbot://...) reaches only the computer that opened the page. Add its kind to deep-link-router.ts, and keep a grant out of the renderer.
  4. Add the id to CONNECTOR_IDS and its entry to CONNECTORS in connectors.ts. server is the capability that lets a joined server run it, or null when only the user's own computer can, as for a vault app. connector-access.ts reads it; no surface has its own gate.
  5. Add its name, tagline, Marketplace category and mark to CONNECTOR_LISTINGS in connector-catalog.tsx, its panel to ConnectorDetail and ConnectorDetailPanel, and its row state to connectorSummary.
  6. Add a controller (ConnectorController in connector-controller.ts), with createConnectorActions for its actions, and create it in createConnectorSet in connector-registry.ts. connect is the one-click Connect of a Marketplace card; leave it out when the panel must ask for input first. watch follows a state that changes with no event from main. The type checker names each place that still misses the new id.
  7. Add the text keys in all languages and a changelog.d/<branch>.md file. Update PRIVACY.md when the connector sends new data out.

connectors-context.tsx makes two registries on the desktop: one for the server on screen (Marketplace and chat cards) and one for the server whose settings are open. The browser client makes one in WebWorkspace.tsx. A registry gives each connector its access: available with its controller, local-only, hidden, unsupported (such as GitHub with no GitHub App), or loading before the first read.

On a joined server, the optional capability connectors-v1 (connectors-v1.ts, host route route-connectors.ts) carries GitHub, Slack, Discord and Telegram:

  • GitHub: the host runs the device flow. The client shows userCode and opens verificationUri. The host sees the sign-in by itself.
  • Slack and Discord: the host answers the install page and a nonce, and opens nothing. The client opens the page. The install ends in an openbot:// link on the client, with a grant that is sealed to a one-use key of the host. RelayedMessagingInstalls (relayed-messaging-installs.ts) sends the grant with messagingComplete only to the server whose install this computer opened, and only once. The client cannot open the grant.
  • Telegram: the client opens the t.me link. There is no callback.
  • No route carries a token. The overview drops the bot token.

A new connector on a joined server needs new routes in a new capability, because connectors-v1 is frozen once it ships.

The optional capability discord-access-v1 (discord-access-v1.ts, host route route-discord-access.ts) reads and sets which Discord roles can use OpenBot in each Discord server of the host, and lists the server's roles through Signal (listRoles). The host keeps the list in projection_messaging_allowed_roles. An empty list lets everyone. With a list, MessagingService ignores a mention from a member who has none of the roles, before it reacts or posts. Signal passes the author's role IDs with each mention; a mention from an older Signal has none, so a server with a list ignores it.

The optional capability whatsapp-connector-v1 (whatsapp-connector-v1.ts, host route route-whatsapp-connector.ts) carries the host's WhatsApp numbers. The host runs the WhatsApp session and keeps its keys. A link answers the QR code text or the pairing code that the host's session got, and the client shows it and reads linkState while it waits. The other routes read the numbers, the allowed contacts and groups, and the pairing requests, and set them, and add the WhatsApp Orchestrator on the host's default model. The client uses the same WhatsApp page through hostWhatsAppPort (whatsapp-connector.ts). No route carries a stored key; the QR code text holds the one-use secret of its link.

The optional capability whatsapp-working-message-v1 (whatsapp-working-message-v1.ts, host route route-whatsapp-working-message.ts) reads and sets, for each WhatsApp number, whether OpenBot posts “Working on it…” while the agent works. The setting is on by default and is kept with the number's connection values, so it needs no migration. With the setting off, MessagingService posts no “Waiting” and no “Working on it…” line and edits no progress into one: the reaction shows that OpenBot read the message, and the answer is the only post. A request that is given to a teammate or stopped, or that ends without an answer, posts no line and leaves only its reaction. An error still posts its line (“Too many requests are waiting”, “OpenBot could not finish this request”), so the person knows that it did not succeed. A reply of stop still stops the request; in a group, the person replies to their own request, because there is no status post to reply to. The released whatsapp-connector-v1 overview cannot carry the value, so a client reads this list and merges it (withWhatsAppWorkingMessages). A client hides the switch while the host does not have the capability. Only protocol 9 peers get it.

The optional capability whatsapp-status-reactions-v1 (whatsapp-status-reactions-v1.ts, host route route-whatsapp-status-reactions.ts) reads and sets, for each WhatsApp number, whether OpenBot puts status reactions on a message: 👀 when it arrives, then ✅, ❌ or 🫡 when the request ends. The setting is on by default and is kept with the number's connection values, so it needs no migration. MessagingService reads it at each reaction, so with the setting off a WhatsApp message gets no reaction, and the posts do not change. A removal still goes out, so a request that started before the setting went off loses its 👀 at its end. In a quiet chat of a personal number, a failed or stopped request then shows nothing to the other person. With both this setting and “Working on it…” off, only the answer shows that OpenBot read the message. A client reads this list and merges it into the released overview (withWhatsAppStatusReactions), and hides the switch while the host does not have the capability. Only protocol 9 peers get it.

Each allowed contact and group has a mode: “Can give work” (reply, the default) or “Read only” (read), in the mode column of projection_messaging_allowed_senders (migration 69). A message from a read-only chat gets the save sender decision (whatsapp-senders.ts): OpenBot saves it, with its author and files, for messaging_history, and starts no turn, also for a mention or a reply to an OpenBot post. WhatsAppSession refuses each send to a read-only chat (place_read_only) right before the socket sends it, so a reply, a reaction, a “Working on it…” line, a deletion, a messaging_post and a send that waited in the chat queue when the mode changed all stay out of the chat. messaging_list_places marks the place with readOnly, and messaging_post tells the agent to answer in its own conversation. An older release refuses a database at version 69, so a downgrade cannot make a read-only chat answer again. The optional capability whatsapp-read-only-v1 (whatsapp-read-only-v1.ts, host route route-whatsapp-read-only.ts) lists the read-only sender ids of each number and sets the mode of one sender; owners and admins only. A client merges the list into the released overview (withWhatsAppReadOnly), and shows the mode only while the host has the capability. Only protocol 10 peers get it.

The phone uses the same routes in Marketplace › Apps › WhatsApp (apps/mobile/src/features/servers/components/whatsapp-connector-page.tsx). It links only with a pairing code, because the WhatsApp app on the same phone cannot scan a QR code on its own screen. The link page reads linkState every second while it waits, and cancels the link when the person leaves the page before linked. The phone adds the WhatsApp Orchestrator with no model choice, so the host uses its default provider and model. A host older than this capability shows no WhatsApp row.

The optional capability onepassword-connector-v1 (onepassword-connector-v1.ts, host route route-onepassword-connector.ts) carries 1Password. A server often has no screen for the 1Password app, so an owner or admin pastes a service account token in Marketplace › Apps › 1Password. The token goes to the host once, in connect. The host checks it with 1Password and keeps it in its own encrypted store. No answer carries it. Status and disconnect act on that host only. A host older than this capability hides 1Password.

Bitwarden on a joined server

The optional capability bitwarden-connector-v1 (bitwarden-connector-v1.ts, host route route-bitwarden-connector.ts) carries Bitwarden and self-hosted Vaultwarden. A session key unlocks only the CLI data of the computer that made it, so the host signs in with its own bw. An owner or admin enters the server address, the personal API key and the master password in Marketplace › Apps › Bitwarden. They go to the host once, in connect; no answer carries them. connect answers connecting at once, because the first sign-in can download bw and sync the vault for longer than the 15-second request limit. The client reads status every 2 seconds until the state changes. The host stores the record only after it unlocks the vault and finds the folder Shared with OpenBot, and unlocks again from it after a restart. The host must reach the server address over HTTPS; the instance firewall of several instances on one host blocks private addresses. A host older than this capability hides Bitwarden.

The phone uses the same routes in Marketplace › Apps › Bitwarden (apps/mobile/src/features/servers/components/bitwarden-connector-page.tsx). It reads status every 3 seconds while the page shows, as for the other connectors, and keeps no copy of the API key or the master password. For a host older than this capability, the phone shows Bitwarden as "Desktop app only", with no action.

Password managers on a joined server

The password-manager engine (password-managers-service.ts) keeps one driver for each manager (driver.ts). A driver owns the sign-in, the stored access, the CLI and the logins of its manager. The engine owns the list, the checks that every manager shares, and the login sources of password-vault-router.ts. Proton Pass is its only driver: 1Password and Bitwarden keep their own services, panels and capabilities, and the router reads their logins directly. A new manager needs a driver, an id in PASSWORD_MANAGER_IDS and a Marketplace descriptor; no new IPC group or route.

The optional capability password-managers-v1 (password-managers-v1.ts, host route route-password-managers.ts, protocol 9) carries list, connect, cancel and disconnect for every manager of the host. All routes are for an owner or admin. An access key or an extra password goes to the host once, in connect; no answer carries it. The host refuses a manager that it does not know and a method that the manager's status does not list.

Proton Pass has two methods. With browser, the host runs pass-cli login in a temporary session and reports Proton's sign-in page in signInUrl. The client opens that page on its own computer only when it is an https: page on account.proton.me (password-managers-handlers.ts); the renderer never names a URL. When the account has an extra password, the status step is extra-password, and the client sends it with connect. The CLI reads it from a FIFO (a named pipe on Windows), never from an argument or a file on disk. The host then finds or makes the vault Shared with OpenBot, makes an agent access key that reads only that vault and ends after one year, and signs the temporary session out. With key, the user pastes an agent access key that they made. The host keeps only the access key, in openbot-protonpass-connector-v1.json, and the CLI session in <userData>/provider-state/protonpass-host. It installs the pass-cli release that proton-pass-cli-installer.ts pins, with a SHA-256 per target, into <userData>/provider-state/protonpass-cli. Disconnect removes the record and the session; the agent access key stays on the Proton account until it ends or the user removes it there.

NEAR Intents wallet

The Crypto tab of the Vault connects one NEAR Intents agent account (Agent API, SDK @near-intents-agent-api/sdk) for agent payments. Main owns it: near-wallet-service.ts and near-wallet-store.ts. The renderer, the backend and the agent processes never get the partner key, the grant token or a signature.

  • Owner. A passkey. OpenBot does not support an EVM wallet owner. Each owner action (register, create, grant, budget, freeze, unfreeze, auto-pay, a vote on a payment) opens /near/sign of the account service in the system browser (near-wallet-signing.ts). The request is in the URL fragment, which no server gets. The page returns the signature with openbot://near-signature?nonce=…&data=…; a development build uses a loopback listener. Main takes only the result of the one waiting nonce (32 random bytes, used once) and checks its shape and the passkey key type.

  • Paused state. Pause marks the wallet paused on the host first, so payments stop at once, then signs agent_freeze. When NEAR answers wallet_already_frozen or wallet_already_unfrozen at generate-intent, OpenBot takes the action as done. So a pause that NEAR did not apply can be turned off again.

  • Joined servers (near-wallet-v1). The owner and admins of a server manage its wallet from the desktop client and the web client. The host runs the wallet and keeps its file and grant; a client gets only the status. Routes are in route-near-wallet.ts. A member's owner action runs with NearMemberSigning: the host does not open its own browser, and the route answers when the signing page is ready (or after 60 s). The client then asks signing-page and opens it in its own browser:

    • Desktop client: returnTo: "app". The page returns openbot://near-signature, and relayed-near-signatures.ts sends it to the server that gave that nonce.
    • Web client: returnTo: "web". The page opens /near/signed on the OpenBot site, which gives the result to the open /app tab through a BroadcastChannel (openbot:near-signature). That tab sends it to the host with the signature route. A web owner action opens a blank tab in the click, so that the browser does not block the page.

    A client opens a page from the host only when it is /near/sign of its signing origin. The host takes a signature only for its one waiting nonce, as on this computer. A vote on a payment from a remote chat card still starts on the host; the card's "Open signing page" button opens the page on the client. Mobile has no wallet screen.

  • Grant. OpenBot holds an agent grant for 30 days. Payments use it; Renew signs a new one.

  • Payments. An agent calls request_near_payment (attention-registry.ts). All agents can ask, also agents made later, until the owner chooses a list on the wallet page; a wallet stored with a list keeps it. A new wallet's daily budget is $25. A request from a Slack, Discord or Telegram chat is refused. A payment that no rule allows waits for the owner on the chat card. A rule of "Pay without asking" allows a recipient for a domain up to a daily USD limit; the first rule turns off owner_approval with one signature. The Agent API keeps the daily budget of all payments.

  • No double payment. A payment is stored with its idempotency key before it is sent. A lost answer is uncertain: OpenBot sends it again with the same key, also after a restart, for one hour.

  • Test. bun run test:near-wallet-e2e runs the service against a fake Agent API on 127.0.0.1 with a real P-256 passkey owner key. The real Agent API has no test network; do not run payments against it without the owner's consent.

Add a Team API capability

A new remote feature is a new optional capability. Do not change a shipped capability: released Team API adapters stay while a release in the support window speaks them (see Team API compatibility). Worked example: sign-in-relay-v1, which follows mcp-sign-in-app-v1.

  1. Frozen codec. Add packages/contracts/src/team-protocol/<name>-v1.ts. Build each route with the helpers of admin-wire.ts (adminRoute, fields, string(max), nullable). Export the capability name, the routes and the codec map. Write the contract in the PR: what each route does and who can use it.
  2. Package export. Add "./team-protocol/<name>-v1" to packages/contracts/package.json.
  3. Codecs. Spread the codec map into CODECS in optional-routes.ts.
  4. Capability list. Add the capability at the end of TEAM_CAPABILITY_REGISTRY in current.ts, with the V10 placement. Every capability list comes from this table. Protocols 7 to 9 read a limited number of capabilities and their lists are full, so only a protocol 10 peer sends or gets a new capability.
  5. Host route. Add src/main/team-api/route-<name>.ts. Return "unmatched" for other paths, refuse with 400 when the capability is off, and call requireAdmin for admin routes. Register it in TeamApiServer.#handle in team-api-server.ts, and advertise the capability in #protocolSupport only when its dependency is present. Add the dependency type to team-api/dependencies.ts, and create it in application-services.ts, which passes it through host-service.ts.
  6. Client gate. Add the capability to the explicit list in serverSupportsCapability (server-capabilities.ts), so an older host that never sent it is not given the benefit of the doubt. In main, gate with remoteServers.supportsCapability(serverId, CAPABILITY).
  7. Browser client. Add the requests to team-admin-requests.ts, and gate them on the host's capabilities in the web client.
  8. Bootstrap. Make sure that the capability is not in bootstrap.
  9. Text. Error messages use sourceText(key) with keys in all languages of @openbot/i18n.

Test a sign-in through a joined server

  1. Two clients: bun run dev:test-client starts the services, the app and a second client with its own profile (see README.md: Commands). Join the app from the second client as an admin. Add a URL MCP server with OAuth on the host, and press Sign in on the client. The page must open in the client's browser, and the host must show the server as signed in.
  2. Paste fallback: hold port 28417 on the client with another program, and sign in again. The dialog asks for the address. Paste the address from the browser. The host must sign in.
  3. Browser client: open /app and sign in to the same server. The dialog shows "Open sign-in page" and the paste field.
  4. Check the logs of both computers. They must not contain code=, the code or the state.

Use bun run dev:automation for snapshots and screenshots. Do not drive another worktree's app.

What cannot be relayed

Flow Why
A sign-in that returns to a public https: address of the provider The provider finishes it by itself. The host only waits. Nothing comes back to a loopback port.
A sign-in that opens an app on the host, such as Pi, which opens Terminal The step happens on the host's screen. There is no page address to open somewhere else.
A vault that approves in its desktop app, such as 1Password or Bitwarden The approval is in the vault app on the host. A relay cannot approve for it. 1Password on a joined server uses a service account token (onepassword-connector-v1); Bitwarden uses an API key and the master password (bitwarden-connector-v1). Proton Pass signs in on the host and the client opens Proton's page (password-managers-v1).
The Slack development return address (returnUrl) Development builds only. It returns to http://127.0.0.1:<port>/... on the host, and the relay does not carry it. Use the hosted install.
An agent link for a member who is not an admin The relay routes are admin only. The link opens as it is, and its callback cannot reach the host.
An agent link in a command, tool output or commentary The host relays only a link that the text of an agent message holds.
A CLI that opens its own browser and honors no BROWSER The host never gets the page address. Grok, Cursor and Cline use a code kind.
The iPhone app It does not take relayed sign-ins. It keeps its current behavior.

The browser extension on X

The extension (apps/browser-extension) sends a post from X to the user's X agent (X_AGENT_LISTING_ID in packages/contracts/src/browser-extension-x.ts, a Marketplace Agent in marketplace/production-catalog). On desktop and web, the user adds this agent with the X app of the Marketplace (MarketplaceXAppPage in packages/ui/src/features/marketplace), not from the Agents tab. Its setup has two steps, as a chat app has: get the extension (X_EXTENSION_URL), then add the agent through the usual Marketplace install. X_EXTENSION_URL is the Chrome Web Store page of the extension (ID eggdpikcggoicfcfdpdihfkinajchpfj, also in BROWSER_EXTENSION_IDS of apps/auth-api/wrangler.jsonc). The X app shows on this computer, and on a joined server only for an admin that can install agents (agent-install-v1), as Discord and the other chat apps do. There are three parts:

  • Content script (src/x-content.ts, built as one IIFE file, x-content.js). It finds the parts of an X page with CSS selectors only. When a reply mentions @OpenBot_ and the server answers ready, it sets data-openbot-x on the reply button, and CSS gives the button the OpenBot look and motion. A click (or Cmd/Ctrl+Enter) is stopped in the capture phase. The script reads the post, the posts above it and the author's next posts (no replies by other people), gives them to the worker, and clicks the button again with data-openbot-x-pass, so X posts the reply at once. Each part has selectors for the earlier X web app (data-testid) and for the X web app of November 2026, which has no test ids: its text box is a textarea, so the script reads its value. That app shows no <time datetime>, so the time comes from the status ID in the post link (an X ID holds its creation time). In the reply dialog the post has no link; the script then takes the ID from in_reply_to in the page address when the address has one.
  • Worker (src/background.ts). It answers the selectors, and keeps each post in a queue (src/x-outbox.ts, chrome.storage.local) until the server has it. Each post keeps one clientMessageId, and the host answers a repeated id with the first receipt for a day, so a retry makes no second thread. A failed send waits 30 s, then longer, up to 30 minutes (chrome.alarms wakes the worker). A browser start (onStartup, or onInstalled for an extension that Chrome loads again) and a side panel that has connected send every waiting post at once. Each failure says whether it may have reached the server (XSendResult.reached): a post that no attempt can have sent waits up to 7 days, and one that an attempt may have sent is tried only for 23 hours after that attempt. Nothing of OpenBot shows on X for a post that waits; a post that arrives after a failed attempt, or that is dropped, gets a browser notification. The worker cannot load a language, so it keeps the texts that the last status answer brought. The side panel shows the posts that wait, with "Send now". The selectors come from the account service (X_PAGE_RULES_ROUTE, at most once an hour, by hash) and stay in chrome.storage.local. A copy whose hash does not match is dropped. The content script tries the served selectors first, then the built-in ones (X_PAGE_RULES_DEFAULT).
  • One connection at a time. The account service gives a sign-in one logical session per server (startSession in apps/auth-api/src/server/remote-control-plane.ts), and the server keeps one connection per session, so a second connection of the same sign-in takes the session of the first. Each open side panel holds a port (PANEL_PORT) to the worker. While a panel is open, the worker passes status and send to it (src/x-agent.ts with the panel's connection), closes the offscreen page, and does not open a second panel. With no panel, the offscreen page (offscreen.html, src/offscreen.tsx) makes the connection. Chrome gives an offscreen page chrome.runtime only, so it reads and writes storage through the worker, which takes these requests only from that page. It closes after 10 minutes with no work. Two panels in two windows still take the session from each other.

The E2E (scripts/browser-extension-e2e.ts, step 7) uses a local copy of an X post page whose reply button has a test id that only the served selectors know, then a local page in the markup of the new X web app that only the new selectors find.

Agents on the member's Chrome (host side)

A member can share tabs of the member's own Chrome with the agents of a server, through the OpenBot Chrome extension (client-browser-v1, packages/contracts/src/team-protocol/client-browser-v1.ts). The extension is a remote client, so no new data channel is necessary:

  • Presence. The extension sends POST /v1/client-browser/presence ({ sharing, tabs }, at most 50 tabs) when sharing starts or changes, and every 30 s. ClientBrowserHub (src/main/client-browser-hub.ts) keeps it per member and logical session. It ends at sharing: false, when the last event connection of the session closes (team-api-server.ts), or after 75 s with no presence. The newest session of a member that started to share gets the commands.
  • Commands. The hub sends each command as the client-browser-command event to the event connections of that session that read the capability, and to no other member. The extension answers with POST /v1/client-browser/result. The hub accepts the answer only from the same member and session, waits at most 120 s (the person's approval included), and stops waiting when the tool call is cancelled. A command that the contract decoder refuses never leaves the host, because the client closes its event stream on a malformed event.
  • Tools (src/backend/agent/client-browser-tools.ts). A shared tab has the id chrome:<member key>:<Chrome key>:<tab id>; the member key is a short hash of the member id, and the Chrome key a short hash of the session that shares the tab, so a command reaches only the Chrome that listed the tab (else not-found). Only a turn with a message from a session that shares Chrome tabs reaches a Chrome: the Team API request context sets fromChrome from the hub, the routes pass it to sendMessage and startTask, and the agent service keeps those delivery ids in memory (the newest 200; a message that waits through a host restart counts as an app message). Such a turn gets a note in its prompt to work in that Chrome, and list_tabs adds the shared tabs of each Chrome of the one person who requested it (#turnRequesters). open with browser: "chrome" opens a tab in that person's newest shared Chrome. A message from the OpenBot app or the web app, a routine run, or a message from another agent reaches no Chrome, and the agent instructions do not mention Chrome. On a Chrome tab, only snapshot, screenshot, navigate, click, type, press, scroll, wait_for and close_tab run; each other tool (Vault, secrets, takeover, uploads, evaluate, run_script) gets a refusal, and so do a role target and nth.

The extension side

The extension (apps/browser-extension) shares the user's open web tabs while the user is signed in and the "Share browser tabs" switch in Settings is on. The switch is stored in openbot.client-browser.sharing-enabled.v1; only a stored false turns sharing off, so sharing stays on after an update until the user turns it off. While it is off, the presence has no tabs, a command gets not-shared, and the offscreen page closes when it is idle. A tab that an agent works in joins the Chrome tab group "OpenBot" of its window.

  • Worker (src/client-browser-worker.ts). Only the worker can use chrome.debugger, so it owns the group, the approvals and the commands. openbot.client-browser.sharing.v1 keeps only the ID of the OpenBot group, and the worker ignores an { off: true } that an older version stored. The worker answers the presence (the open web tabs, the active tab first, at most 50), and tells the page with the connection when a tab opens, closes or changes. A command groups its tab on attach, unless the tab is in another group.
  • Connection (src/client-browser-link.ts). The page that holds the server connection (the side panel, else the offscreen page) sends the presence when it changes (at most once in 5 s, and an unchanged presence only every 30 s) and at once after a reconnection. It passes each client-browser-command event to the worker and posts the worker's answer to /v1/client-browser/result. While sharing is on, the offscreen page does not close when it is idle, and the worker opens it when the last panel closes or the browser starts.
  • Commands (src/client-browser-executor.ts). CDP 1.3 on any open web tab: it attaches on demand, puts the tab into the OpenBot group of its window, and detaches after 30 s with no command. Page scripts run in one isolated world per tab, made again after a navigation. snapshot keeps a map from each ref to its element in that world, where page scripts cannot change it. A command gets not-found for a closed tab. A page dialog (alert, confirm, prompt, beforeunload, also from a frame) stops the tab. The executor never answers it: each command on that tab except close_tab then fails at once, also a navigate, which would close the dialog for the person. The text first tells the agent to ask the person to answer it in Chrome, says whether it opened while the command ran, then gives the tab title and the dialog type and text (at most 500 characters). The tab stays attached until the dialog closes or the top frame navigates. The host redacts the failure text before the agent gets it. scripts/browser-extension-dialog-e2e.ts checks this in Chromium. The X agent's chat of each post is kept for its notification (openbot.x-chats.v1, the newest 20), and becomes the chat to open only when the user clicks that notification.
  • Approvals. Before a command, the worker checks the site (origin) of the tab or address. A site that is not in openbot.client-browser.sites.v1 gets a card in the side panel (Allow once / Always for this site / Deny), or a notification when no panel is open. The card waits 100 s, then the command fails with timeout. A command also has a deadline 10 s before the host gives up on it (120 s from its arrival): after the deadline it does not act, so the agent is never told "timeout" for an action that then runs. These ask every time, also on an allowed site, and have no "Always": typing into a password field, a field with autocomplete="cc-*", or a field inside a frame or a closed shadow root, which the extension cannot see into (card and login fields are often there); fields in an open shadow root are checked as usual; a download; and a click, key, navigate or open on an address whose path has oauth or authorize and that has a client_id parameter. chrome.debugger cannot stop downloads (Page.setDownloadBehavior is a browser-level command that an extension may not send), so the worker uses chrome.downloads.onDeterminingFilename: for 30 s after an agent acts on a site, Chrome holds each new download from that site (by referrer or address) until the person answers. Allow once lets it go on; Deny or no answer cancels it. A download link asks before the click. A download that the person starts on such a site in those 30 s asks too. A browser that Playwright drives skips the listener, so this check runs in a Chrome that Playwright only connects to.

While an agent works in a tab, the executor draws an overlay in the page (pageOverlay): a glow around the page with " is using this tab", and a cursor that glides to each click or field (350 ms) with a ripple on the click. It is a shadow root on <html> with pointer-events: none, so snapshots (which read document.body) and clicks do not see it, and it is hidden while the agent takes a screenshot. Styles go through the CSSOM and motion through the Web Animations API, which a page's CSP and Trusted Types allow. It is removed when the debugger detaches, and fades out by itself 36 s after the last command, also when Chrome's Cancel bar detached the debugger first.

The extension E2E (scripts/browser-extension-e2e.ts, step 6b) shares a local page and lets the agent click its button through the card.

Chrome Web Store permission notes (for the store listing):

Permission Justification
debugger When the user shares tabs, the user's own agents read and use the user's open tabs (page text, screenshots, clicks and typing), after the user allows each site. Chrome shows its debugging bar while it is attached.
tabs Lists the address and title of the user's open tabs for the user's agents, and opens or closes a tab when an agent asks.
tabGroups Puts the tabs that an agent works in into the "OpenBot" tab group, so the user sees them.
downloads Holds a download that starts on a site where the user's agent works until the user allows it in the side panel, and cancels it when the user denies it. The extension does not read, open or list the user's files.

The Team API E2E (scripts/team-api-routes-e2e.ts, "A member's shared Chrome tabs") checks the capability, presence, delivery to one session, foreign and late answers, denial, timeout, refusals, and the end of a presence.