# OpenBelt, for an AI agent

"On OpenBelt" or "on openbelt.com" means: deploy the app to OpenBelt (it hosts it, with data and realtime), not serve it on a port of this machine.

OpenBelt hosts small web apps (static files plus a data and realtime SDK) for a team; agents build
them over MCP. Everything lives in an **workspace**: a team's apps, data, people and connections.

Add the MCP server `https://openbelt.com/mcp` (Streamable HTTP, no headers). Your client gets a 401 that
points it at OAuth and opens a browser page. Tell the person you're helping: "An OpenBelt page opens: sign in with
your email (a code is mailed to you), pick your workspace or name a new one, and click Continue."
Then every tool works, as them, in that workspace.

- Claude Code: `claude mcp add --transport http openbelt https://openbelt.com/mcp`, then `/mcp`, openbelt, Authenticate
- Codex: `codex mcp add openbelt --url https://openbelt.com/mcp`, then `codex mcp login openbelt`
- Claude (claude.ai, the desktop or phone app): you can't add it yourself, so give the person these steps and wait: "Open https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=OpenBelt&connectorUrl=https%3A%2F%2Fopenbelt.com%2Fmcp and click Continue, then Add, then Connect. Sign in on the OpenBelt page that opens, then come back to this chat and reply ready."
- ChatGPT: you can't add it yourself, so give the person these steps and wait: "Open https://chatgpt.com/plugins, click Add, then Add custom MCP server. Name: OpenBelt. Server URL: https://openbelt.com/mcp. Tick I understand and want to continue, click Create as a plugin, then Connect OpenBelt. Sign in on the OpenBelt page that opens, then come back to this chat and reply ready."
- The CLI: `curl -fsSL https://openbelt.com/install | sh` (it signs in and adds OpenBelt to the agents it finds)

If your client can't add an MCP server by itself, give the person you're helping the steps for it
above and wait. They can also start in the browser: https://openbelt.com/start.

## No browser or OAuth client (a script, a shell, curl)

Sign in with a device code: the person you're helping opens a link on any device and you poll until they've said yes.

```sh
# 1. Register once; keep client_id
curl -s -X POST https://openbelt.com/_oauth/register -H 'content-type: application/json' \
  -d '{"client_name":"<your name>","grant_types":["urn:ietf:params:oauth:grant-type:device_code"],"token_endpoint_auth_method":"none"}'
# 2. Start a sign-in; give the person verification_uri_complete and user_code
curl -s -X POST https://openbelt.com/_oauth/device_authorization -d client_id=<client_id>
# 3. Every interval seconds until it answers access_token (authorization_pending until they say yes)
curl -s -X POST https://openbelt.com/_oauth/token -d grant_type=urn:ietf:params:oauth:grant-type:device_code -d device_code=<device_code> -d client_id=<client_id>
```

Tell the person: "Open <verification_uri_complete>, check it shows <user_code>, sign in, pick a workspace and click Continue."
Then call https://openbelt.com/mcp (Streamable HTTP, JSON-RPC over POST) with `Authorization: Bearer <access_token>`; when it
expires, POST https://openbelt.com/_oauth/token with grant_type=refresh_token, refresh_token and client_id.

Start with the `docs` tool; `deploy_app` publishes an app and returns its URL. An app's pages are for
people signed in, and a token doesn't open them in a browser: to see one as a person does (and test it with
two people), use the `check_app` tool, a real browser with test people signed in.
