Connect agents
Add your instance to Claude Code, Codex CLI, Cursor, OpenCode, or any MCP client.
Every instance serves one MCP server at https://<your-app-host>/mcp over Streamable HTTP. Any MCP client can connect in one of two ways:
- OAuth. Clients that support MCP OAuth need only the URL. They register themselves, and you log in through your instance’s login page.
- Personal access token. For clients and scripts without OAuth, create a token in the dashboard under Settings → Connections and send it as
Authorization: Bearer oa_pat_…. Tokens can be revoked at any time.
Scripts that call /mcp or /api/v1 should send their own User-Agent, for example User-Agent: my-script/1. Some hosts refuse a library’s default one, such as Python urllib’s Python-urllib/3.x, with 403 and the body error code: 1010, before the token is checked.
Setup’s agent-config step prints each snippet below with your URL filled in, and the dashboard’s Settings → Connections page shows them too. The examples use artifacts.example.com and the default server name, open-artifacts; setup names the server after its --name flag.
Claude Code, Cursor, and OpenCode use OAuth, so their snippets are only the URL: no token, no header. A token is for a client without OAuth. Setup saves the owner’s token to ~/.open-artifacts/<host-slug>-pat-token (mode 0600; the host slug is the app host lowercased, with every run of other characters turned into -). The token variants below read that file; replace <token file> with its absolute path. Never paste a token into a command, a config file, or a chat.
Steps
- Pick the auth method. Use OAuth if this agent’s client supports MCP OAuth. Otherwise point the client at the token file setup saved, or ask the user to create a personal access token in the dashboard under Settings → Connections. Don’t run setup with
--new-owner-tokenfor this: it revokes the token the first agent uses. - Add the server to this agent’s MCP config, using the snippet for its client from the Connect agents doc. Name the server after setup’s
--name, which defaults toopen-artifacts. - Check the connection by calling
list_artifacts.
Claude Code
claude mcp add --transport http -s user open-artifacts https://artifacts.example.com/mcp
Then run /mcp in Claude Code and log in.
Cursor
In .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every project:
{
"mcpServers": {
"open-artifacts": {
"url": "https://artifacts.example.com/mcp"
}
}
}
Cursor opens a login when it connects.
OpenCode
In opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"open-artifacts": {
"type": "remote",
"url": "https://artifacts.example.com/mcp",
"enabled": true
}
}
}
Then run opencode mcp auth open-artifacts and log in.
Without OAuth
OpenCode with the token file. In opencode.json, OpenCode reads the file itself:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"open-artifacts": {
"type": "remote",
"url": "https://artifacts.example.com/mcp",
"enabled": true,
"oauth": false,
"headers": {
"Authorization": "Bearer {file:<token file>}"
}
}
}
}
Codex CLI
Codex CLI supports browser OAuth:
codex mcp add open-artifacts --url https://artifacts.example.com/mcp
codex mcp login open-artifacts
Log in with your instance account in the browser, then run codex mcp list to check the connection. No PAT is needed. If an existing config sets bearer_token_env_var or http_headers_helper, remove that setting before using OAuth.
If the bus (oa-bus) is installed on this machine and a PAT is saved at ~/.open-artifacts/<host-slug>-pat-token, the next oa-bus install or bus update swaps this entry for the bus’s local proxy, so each Codex chat shows as its own session on pages. Codex then sends that PAT, so it acts as the person the PAT belongs to, not as the browser sign-in you just made; the sign-in stays saved and unused. If you delete the PAT file later, Codex’s Open Artifacts tools stop working until you save a PAT there again or run oa-bus uninstall, which puts the entry back.
Token fallback
If OAuth is unavailable, use the token file. This needs Codex 0.163 or later. In ~/.codex/config.toml:
[mcp_servers.open-artifacts]
url = "https://artifacts.example.com/mcp"
http_headers_helper = "T=$(cat <token file>) && printf '{\"Authorization\":\"Bearer %s\"}' \"$T\""
Codex runs the helper each time it connects, so you export nothing. Then run codex mcp list to check the connection.
Disconnect an agent
-
Remove the server from the agent. Use your server name (
open-artifactsby default):Agent Remove it Claude Code claude mcp remove -s user open-artifactsCodex CLI codex mcp remove open-artifactsCursor Delete the open-artifactsentry undermcpServersin~/.cursor/mcp.json(or the project’s.cursor/mcp.json).OpenCode Delete the open-artifactsentry undermcpinopencode.json.Then restart the agent. If you used the token variant, the entry also holds the
<token file>path, so deleting the entry removes that too. -
Revoke the token, if the agent used one. Revoking it in the dashboard under Settings → Connections is what cuts the agent off. Removing the entry only stops the agent from trying.
-
Delete the token file
~/.open-artifacts/<host-slug>-pat-tokenonly when no other agent on this machine uses it. Deleting it doesn’t revoke anything.
Other clients
Give the client the URL https://artifacts.example.com/mcp. If it supports OAuth, that’s all it needs. Otherwise add the header Authorization: Bearer <YOUR_TOKEN>. Many clients accept this JSON, which setup prints as json. Replace <YOUR_TOKEN> with the contents of the token file yourself, and keep the file out of git:
{
"mcpServers": {
"open-artifacts": {
"type": "http",
"url": "https://artifacts.example.com/mcp",
"headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
}
}
}
Each version an agent publishes records the client’s name and version, or the token’s label, so you can see which agent made what.