# Getting Trinity credentials as an AI agent

Trinity gives an agent one bearer token, approved once in the browser by the person the agent works for. The token opens Trinity's MCP server and acts as that person. There is no API key screen, no test key, no CLI and no OAuth client registration.

## Fastest path: one browser approval

1. `POST https://app.usetrinity.ai/api/v1/devices/authorize/start` with `{"tool": "other", "name": "<a short name for this agent>"}`. Keep the `deviceCode` it answers secret.
2. Tell the person, in one line, to open `verificationUrl` and approve the request that shows `verificationCode`.
3. Every `intervalSeconds`, `POST https://app.usetrinity.ai/api/v1/devices/authorize/exchange` with `{"deviceCode", "hostname", "machineId"}`. `machineId` names this machine: derive it with the [quickstart's recipe](https://app.usetrinity.ai/docs/), never send the raw machine id, and never let two agents share one. `202` means not approved yet. `200` answers `token` and `mcpUrl`. `404` means the request expired: start again once.
4. Verify:

```bash
curl -s -X POST https://app.usetrinity.ai/api/v1/agent/mcp \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'
```

Every step with `curl`: [quickstart](https://app.usetrinity.ai/docs/). The same steps as plain instructions: [agent-setup/other.txt](https://app.usetrinity.ai/agent-setup/other.txt). The endpoints: [openapi.json](https://app.usetrinity.ai/openapi.json).

## MCP

Connect to `https://app.usetrinity.ai/api/v1/agent/mcp` over Streamable HTTP with the header `Authorization: Bearer <token>`. Trinity has no OAuth sign-in for MCP yet, so a client that can only connect through OAuth cannot use it. Use a client that takes a custom header. Tools: [MCP reference](https://app.usetrinity.ai/docs/mcp).

Claude Code, Codex, Cursor, Gemini CLI and GitHub Copilot CLI have a Trinity plugin that does this pairing and also records coding sessions: [agent-setup.txt](https://app.usetrinity.ai/agent-setup.txt).

## Where a human must step in

- Signing up. The person signs in at https://app.usetrinity.ai with Google or GitHub and creates or joins an organization. An agent cannot create the account.
- Approving the token. One click on the `verificationUrl` page, signed in. The agent never sees their session.
- Paying, after two weeks. An owner subscribes in the dashboard. Until then the person cannot approve a new token, so your request stays pending until it expires with `404`; tell the person rather than starting again in a loop. Writes fail while existing tokens can still read, and once a paid subscription lapses, reads fail too.

## Limits

- Free for two weeks with no card, then $50 a seat a month ([pricing](https://usetrinity.ai/pricing)).
- 10 authorization starts a minute per IP address. A request lasts 10 minutes. Poll every 2 seconds.
- Each tool call has 20 seconds.
- The token endpoints answer `{"error": "<one line>"}` with a status code. The MCP server answers `401` for an unknown token and `403` for a revoked device: pair again for either.
