MCP

Agents use OpenBelt through its MCP server at <workspace origin>/mcp (https://acme.<your domain>:8445/mcp from bun run dev, http://acme.localhost:1337/mcp on one machine), over Streamable HTTP. Protocol revisions from 2025-03-26 to 2026-07-28 work; pi and Claude Code connect as they are.

Every MCP request needs Authorization: Bearer <token>: an access token the agent got by signing in (OAuth, below), or an API token you made. Either belongs to one person in one workspace (People and groups), and only that workspace accepts it. The agent's writes are that person's (author is their email), and whoami says who it is; nothing else tells the two apart.

An agent sees two tools. search({ query }) finds the operations for a task, each with its input schema, and the workspace's apps and connections that match; search({ query: "" }) lists every operation you may use. call({ tool, args }) runs one: call({ tool: "deploy_app", args: { app, files } }). Every operation these pages name (deploy_app, check_app, app_info…) is run this way, with the arguments they show as args. The harness composes calls, in its own code mode if it has one; OpenBelt runs no second sandbox for it.

Directory endpoint (/mcp/directory)

Plugin and connector directories that disallow generic search + call dispatchers can connect to <origin>/mcp/directory instead of /mcp. It uses the same OAuth flow and permissions, lists a curated set of discrete first-party OpenBelt tools (whoami, docs, starter_list, starter_add, app_list, app_info, app_files, app_logs, deploy_app, promote_app, check_app, collection_list, collection_add, collection_update, collection_delete, call_function) with explicit title, readOnlyHint, destructiveHint and openWorldHint annotations, and refuses calls outside that set. On the base host, OPENBELT_OPENAI_APPS_CHALLENGE serves /.well-known/openai-apps-challenge as text/plain when set.

Workspace management uses the same sign-in. search offers the operations that person may use: admins get workspace administration, members get their own connection settings and tokens. Each call checks the current role, so after a promotion or demotion, search again; a remembered admin operation cannot preserve access. Personal credentials and app consents always belong to the person signed in, including when that person is an admin. The openbelt CLI lists every operation as a command of its own.

Which to use

Signing in (OAuth)

An MCP client that does OAuth needs only the address:

claude mcp add --transport http openbelt https://acme.<your domain>/mcp   # then /mcp, and sign in

Its first request gets a 401 whose WWW-Authenticate names <workspace origin>/.well-known/oauth-protected-resource/mcp (RFC 9728), which names the workspace host as the authorization server (/.well-known/oauth-authorization-server, RFC 8414). The client registers itself (/_oauth/register, RFC 7591), or uses the https URL of its Client ID Metadata Document as its client_id (Claude Code, Codex and opencode do), and opens <workspace origin>/_oauth/authorize in your browser. There, whoever the workspace's front door says you are (Tailscale; on bun run dev's http://acme.localhost:<port>, you) sees which agent asks, which host it sends you back to, and Allow. Nobody signed in, or someone the workspace doesn't let in, gets a page saying why, and no code. You're asked once per agent: the same agent sending you back to the same place goes straight back next time, until you sign it out.

An agent that isn't connected yet reads <workspace origin>/auth.md (or the workspace host's home with Accept: text/markdown): the address to add, the commands for Claude Code, Codex and the CLI, and what to tell its human. The 401 for a request with no token says the same in its body, for an agent whose client doesn't do OAuth by itself: what to tell the person it works for, and where /auth.md is.

The base host's home hands a person one prompt to paste into their agent: "Read <base>/start.md, then help me build a tool". /start.md is a first run for that agent: offer five picks (a message board, a journal, a task organizer, a drawing board, or their own), then connect if it isn't yet, then add the starter app they picked (starter_add) or build the smallest version of their own, and send the link with four numbered next steps. No other question comes before the link. The CLI install ends at once with the code the sign-in page shows, so the agent can tell the person, then waits with openbelt login --wait. The connect steps are in the page itself, the chat apps' among them, since they can't add a server themselves: Claude's is a link to claude.ai's Add custom connector dialog with the name and address filled in (customize/connectors?modal=add-custom-connector&connectorName=…&connectorUrl=…), ChatGPT's the steps at chatgpt.com/plugins; either way the person comes back to the same chat. ChatGPT opens the link a person pastes but not links it finds inside a page, so it can't follow one to /auth.md. A chat app's commands run in a cloud sandbox, so /start.md sends it past the CLI install. The pick and the build are the docs tool's start page (Getting started), every section of it, which the MCP instructions point a connected agent to when someone asks for their first tool.

Claude Code and pi send a token over plain HTTP only to the host localhost, and bun run dev's door doesn't answer that name, so locally give them the https://acme.<your domain>:8445/mcp address it prints. Codex, opencode and the MCP SDK take http://acme.localhost:<port>/mcp too.

One address for every workspace

Under email sign-in (OPENBELT_SIGNIN=email), the base host (no workspace in its name: https://<OPENBELT_HOST>, or OPENBELT_BASE_HOST when it has a domain of its own, http://localhost:1337) is one MCP address for every workspace, for someone who doesn't know their workspace's host or has none yet:

claude mcp add --transport http openbelt https://<your domain>/mcp   # then /mcp, and sign in

Its /mcp 401 and OAuth metadata name the base host. The person signs in there with an email code, or with Google when it's set up (Email sign-in), then a page asks which workspace the agent works in: one they're in, one they're invited to (picking it accepts the invite), or a new one named from their work domain (ada@initech.com: initech; personal mail: their own name), which they make there as its first admin, invite-only.

Signed out, the agent's link opens a sign-in page that names the agent the way the consent page does ("Connect paperbot to OpenBelt", and where it sends you back), so continuing there allows it. Then nothing more is asked when there is nothing to choose: someone in exactly one workspace goes straight back to the agent in it, and someone in none (and with no colleague's workspace to ask to join) gets one named for them, as its first admin. With an invite, a colleague's workspace or two of their own, the picker asks as before. An agent that knows the person's email (login_hint) and a person signed in to Google make this one tap. The code and tokens carry the workspace they were made in, by its id (initech~pra_...; a renamed workspace keeps it, Renaming the workspace), so the base host's /mcp, /_oauth/token and /_oauth/revoke pass each to that workspace's own: the agent is that person in that workspace, as if it had signed in on the workspace's host, and Settings, Agents there lists it. Which workspaces to offer comes from the base host's index of who is in which workspace (each workspace sends its people as they're added), checked with each workspace when the page is made.

To name the workspace in the address, add ?workspace=<name>:

claude mcp add --transport http openbelt-initech 'https://<your domain>/mcp?workspace=initech'

Its 401 and protected-resource metadata carry the name, so the client's sign-in asks for that resource, and the page offers that workspace alone (no Create). Any other pick is refused back to the agent, naming the one to pick, and someone who isn't in it is told so before any picker. A sign-in for another workspace used at that address is a 401 (error="invalid_token") that says to sign in again, so a client set up for one workspace never works in another. Two workspaces from one client: add it twice, one name each. A workspace's own host (https://initech.<host>/mcp) is always that workspace and needs no name.

Grok Bot and other cloud clients

A cloud client (Grok Bot, Cursor's cloud agents, claude.ai, ChatGPT) runs on its maker's servers, so the workspace host has to be reachable from the internet: a deploy on a domain, not bun run dev or a tailnet-only OpenBelt. Only signing in goes through your browser. Behind a sign-in proxy, keep /mcp, the OAuth metadata, /_oauth/token, /_oauth/register, /_oauth/device_authorization and /favicon.* open, and let /_oauth/authorize and /_oauth/device ask the proxy who you are first.

In Grok Bot, ask in the chat: "Add a custom MCP server called openbelt at https://acme./mcp" (with "custom server", or it looks in its marketplace), then Authorize on the card it shows and Allow on OpenBelt's page within about 15 minutes. Grok Bot signs in as Cursor (it's Cursor's client), so the consent page and Settings, Agents say Cursor and send you back to www.cursor.com. OpenBelt shows itself with its mark: initialize's serverInfo.icons (to clients on 2025-11-25 or later), and /favicon.ico. The server icon uses the Ink tile with a 54% mark; browser favicons use the same Ink style with a 62% mark for legibility at 16-32px.

Refreshing, and how OpenBelt forgives clients

What goes wrong with OAuth for MCP is how clients keep tokens: several processes share one login and refresh at once, a refreshed token's write gets lost and the old one comes back, some never refresh. Measured on OpenBelt (each client signed in, calls spaced past a 60 second token, two processes started together):

ClientRefreshesTwo processes at once
Codex 0.164before the token runs outone refresh, both use it
Claude Code 2.1at every start, often several timesone after the other, no clash
pi 1.4before the token runs outone refresh, both use it
opencode 2.2after a 401both refresh the same token
MCP SDK 1.32 (scripts)after a 401up to the program

On a refresh that fails (invalid_grant), each tries once and asks you to sign in again; none loops. So:

Tokens

An API token suits any agent on your own machine, and anything that can't sign in (a script, a CI job), sent as Authorization: Bearer <token>.

Make one in your settings (Agents, <workspace host>/agents, signed in through the workspace's front door: it's shown once, with the claude mcp add command), or with a token, another for yourself (bun run workspace tokens create --label laptop, or POST /_me/tokens/create); a workspace admin lists and revokes anyone's. The platform's admin token makes one for any email, adding them to the workspace when they're new:

curl -X POST http://acme.localhost:1337/_ops/tokens \
  -H "Authorization: Bearer $OPENBELT_ADMIN_TOKEN" -d '{"email": "ada@acme.com", "days": 30}'
# {"workspace": "acme", "user": "ada@acme.com", "person": "p_...", "id": "t_...", "token": "pr_...", "expires": "...", "mcp": "http://acme.localhost:1337/mcp"}

("user" still works in place of "email".) bun run dev prints one for you, and bun run try:pi wires one into pi. Only the token's hash is stored, so it's shown once. A refused token is a 401 that says why: not this workspace's, expired (when), or revoked (when, and by whom, such as the person being removed).

Tokens made before people existed kept working: each one's user became a person (the email lowercased; a user that wasn't an email became <user>@legacy.invalid), and the apps they own name them.

Tools

tools/list gives an agent search and call. Each operation below is run with call({ tool, args }); search gives its description and input schema (the text is in packages/platform/src/mcp.ts). A name that isn't an operation is refused with a pointer to search. The docs operation is the guide agents read first: sections of Getting started, Apps, SDK, Functions, Code, Who can change what, Who is viewing, Debugging and Connections, as those pages have them. With no arguments it's an index (each page, a line on what it covers, its sections); docs({ page }) is one page and docs({ page, section }) one section.

Every result but docs (which is the guide's text) carries trace, the id to pass to app_logs, and every error ends with (trace <id>): give it to whoever looks into it. The workspace's admins see each call in its activity (Agents' tool calls).

A result is JSON, given once as text and once as structuredContent, as the MCP spec asks of a tool with an output schema. Clients show the model one of the two: Claude Code shows the text, Codex and opencode structuredContent, so neither can be dropped without hiding the result from some agent. Only a client that hands the model the whole result (pi's code mode) sees it twice; read structuredContent there. Results stay small instead: app_files takes paths, around and lines, a deploy's diff is cut at 4 KB (app_diff pages it), and tool descriptions are short. The server's instructions are short too (Codex repeats them in every tool its tool search returns); the full introduction opens docs().

Refusals come back as tool errors (isError: true) whose text says what to change (check_app's also carry a report as structuredContent, with the reason in errors): a missing index.html, a name someone else owns (with a free one to use), an app that doesn't exist (with the tool that lists them), a deploy that conflicts with a newer one (with a diff of it).

In search results, a connection's matchedToolCount counts this query's matches. schemasExpanded: false means its tool schemas have not been loaded. Follow inspect to read the connection; an empty tools array does not establish that the connection has no tools.

Sessions

MCP 2026-07-28 clients send every call without a session. Older 2025-* clients open a session and OpenBelt keeps it across restarts so an evicted object resumes it transparently.

Tasks

OpenBelt advertises the MCP Tasks extension (io.modelcontextprotocol/tasks, SEP-2663) on 2026-07-28. When a client includes io.modelcontextprotocol/tasks in its per-request clientCapabilities, long-running operations return a CreateTaskResult handle (resultType: "task") and clients poll tasks/get or stop them cooperatively with tasks/cancel:

Clients that do not declare io.modelcontextprotocol/tasks always receive synchronous results.

Each person gets their own MCP server instance (a Durable Object, by their id). It keeps 2025-era sessions, and saves each one's initialize request: an idle instance sleeps after ten minutes (OPENBELT_ACTOR_SLEEP_SECONDS), which loses the sessions in memory, and the next request on a saved session starts it again under the id the client already has, once however many requests arrive together. So an agent can idle as long as it likes. A session that can't be started again (one this instance never issued, or one older than the person's newest 50) gets a 404, and the client starts a new session, as the MCP spec says (one from before people, when instances were by email, is moved over first). The 404's body is a JSON-RPC error (code -32001) that names the session, says why, and says to send initialize again, and the platform log has the same line (MCP session <id> can't be resumed: <why>), with the trace. 2026-07-28 clients are sessionless, and OpenBelt's tool list never changes, so it takes no subscriptions: subscriptions/listen is refused (-32601, method not found). Every request is checked against its token, so a session id alone grants nothing, and a removed person's session is refused on its next request.

Source: docs/mcp.md on GitHub