> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agent-loadout.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Claude Code, Codex, or Cursor to Agent Loadout

> One MCP server URL and one scoped token connects Claude Code, Codex CLI, Cursor, ChatGPT, or any REST client to your agent's inbox, vault, and machines.

Every client that talks to Agent Loadout uses the same server URL and the same token. You connect once, the agent's 33 MCP tools become available in your client, and swapping to a different client means pointing it at the same URL — no new agent, no new credentials.

**MCP server URL**

```
https://agent-loadout.com/api/mcp
```

The server uses OAuth 2.1 with PKCE. Clients that support browser-based OAuth (Claude Code, Cursor, ChatGPT) handle authentication automatically. For programmatic access, use a token you issue in the agent's **Tokens** tab.

> [tab] Claude Code
>
> Run the following command in your terminal. Claude Code opens your browser so you can sign in, choose an agent, and approve its permissions.
>
> ```bash Connect Claude Code theme={null}
> claude mcp add --transport http agent-loadout https://agent-loadout.com/api/mcp
> ```
>
> After you approve access in the browser:
>
> 1. Return to your terminal — Claude Code reports **33 tools available**.
> 2. Open a new chat session and enable Agent Loadout in the tools menu if prompted.
> 3. Ask Claude Code which agent it is connected to, and it will call `get_agent` to confirm.
>
> No local installation or API key is required. To disconnect, revoke the token in the agent's **Tokens** tab and remove `agent-loadout` from Claude Code's MCP server list.

> [tab] Codex CLI
>
> Add Agent Loadout as an HTTP MCP server in your Codex configuration file. The exact path depends on your Codex installation — typically `~/.codex/config.json` or `codex.yaml`.
>
> ```json codex.json theme={null}
> {
>   "mcpServers": {
>     "agent-loadout": {
>       "type": "http",
>       "url": "https://agent-loadout.com/api/mcp"
>     }
>   }
> }
> ```
>
> On first use, Codex will prompt you to authenticate. Sign in to Agent Loadout in the browser, choose your agent, and approve its permissions. Codex stores the resulting token and refreshes it automatically.
>
> > [!TIP]
> >
> > If Codex does not prompt for authentication automatically, generate a token in the agent's **Tokens** tab and supply it via the `AGENT_LOADOUT_TOKEN` environment variable instead.

> [tab] Cursor
>
> Add Agent Loadout in Cursor's MCP settings:
>
> 1. Open **Cursor Settings** (⌘, on macOS or **File → Preferences → Settings** on Windows/Linux).
> 2. Navigate to the **MCP** section.
> 3. Choose **Add new MCP server**.
> 4. Enter the name `agent-loadout` and the server URL `https://agent-loadout.com/api/mcp`.
> 5. Save the settings.
>
> Cursor opens your browser to complete authentication. Sign in to Agent Loadout, select the agent you want Cursor to use, and approve the requested permissions. The tools become available in Cursor's chat panel automatically.

> [tab] ChatGPT
>
> ChatGPT supports Agent Loadout via a custom connector. A directory listing is not yet published, so you need to add it manually.
>
> > [!NOTE]
> >
> > Custom connectors require Developer mode. Availability depends on your ChatGPT account and workspace policy.
>
> 1. In ChatGPT, open **Settings → Security and login** and enable **Developer mode**.
> 2. Open **Plugins**, choose the **plus button**, and name the connection **Agent Loadout**.
> 3. Enter the server URL `https://agent-loadout.com/api/mcp` and choose **OAuth** when asked for the authentication method.
> 4. Complete sign-in to Agent Loadout in the browser and review the requested access.
> 5. In a new chat, open the tools menu and add **Agent Loadout** to the conversation.
>
> After setup, enable Agent Loadout in any chat session from the tools menu to make the agent's capabilities available.
>
> To start an automation from an event, describe the trigger in a chat, for example *"When a new email arrives in my agent's inbox, summarize it and draft a reply."* ChatGPT subscribes to the matching [event](https://docs.agent-loadout.com/api-reference/mcp/events.md) and runs the automation each time it fires.

> [tab] OpenAI Agents API
>
> The [OpenAI Agents API](https://developers.openai.com/api/docs/guides/agents-api/quickstart) is in beta. It connects to Agent Loadout from OpenAI's servers while a session runs. There is no browser sign-in, so you give it a static agent token.
>
> **1. Create an agent token**
>
> Open the agent's **Tokens** tab, choose **Create token**, and select only the scopes the agent needs, for example `email:read` and `email:send` to read and answer mail. Copy the `alt_…` token; it is shown only once. To issue tokens from your backend instead, call `POST /api/v1/agents/<AGENT_ID>/tokens` with an organization key that has `tokens:manage`.
>
> > [!WARNING]
> >
> > Access tokens from the browser sign-in expire after one hour, so they do not work as a stored credential. Never give an OpenAI agent an organization key (`alk_…`).
>
> **2. Attach the MCP server**
>
> Add Agent Loadout to the agent's `tools` when you create a session. OpenAI encrypts `transport.authorization` and omits it from the returned session.
>
> ```typescript TypeScript theme={null}
> import OpenAI from "openai";
>
> const client = new OpenAI();
> const session = await client.beta.agents.sessions.create({
>   agent: {
>     model: "gpt-6-astra",
>     tools: [{
>       type: "mcp",
>       server_label: "agent_loadout",
>       transport: {
>         type: "http",
>         server_url: "https://agent-loadout.com/api/mcp",
>         authorization: `Bearer ${process.env.AGENT_LOADOUT_TOKEN}`,
>       },
>       allowed_tools: ["list_inboxes", "list_messages", "read_message", "reply_to_message", "wait_for_message"],
>       required: true,
>     }],
>   },
>   environment: { type: "none" },
>   input: "Summarize the new messages in my inbox.",
> });
> ```
>
> ```bash curl theme={null}
> curl https://api.openai.com/v1/agents/sessions \
>   -H "OpenAI-Beta: agents=v1" \
>   -H "Authorization: Bearer $OPENAI_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "agent": {
>       "model": "gpt-6-astra",
>       "tools": [{
>         "type": "mcp",
>         "server_label": "agent_loadout",
>         "transport": {
>           "type": "http",
>           "server_url": "https://agent-loadout.com/api/mcp",
>           "authorization": "Bearer '"$AGENT_LOADOUT_TOKEN"'"
>         },
>         "required": true
>       }]
>     },
>     "environment": { "type": "none" },
>     "input": "Which Agent Loadout agent am I connected to?"
>   }'
> ```
>
> Store the returned session ID. The session keeps its conversation, so you can send it more work later.
>
> > [!TIP]
> >
> > Agent Loadout enforces the token's scopes on every call. `allowed_tools` additionally limits which tools the OpenAI agent can discover and call, which keeps its tool list short.
>
> > [accordion] Keep the token in an OpenAI vault
> >
> > To reuse the token across sessions, store it in an [OpenAI vault](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults) and pass `vault_ids` when you create a session. The MCP entry then needs only the server URL. Vault credentials apply to connections from OpenAI, the default `connection_origin`.
> >
> > ```typescript Vault credential theme={null}
> > const vault = await client.beta.agents.vaults.create({ name: "Agent Loadout" });
> > await client.beta.agents.vaults.credentials.create(vault.id, {
> >   name: "Agent Loadout token",
> >   auth: {
> >     type: "static_bearer",
> >     mcp_server_url: "https://agent-loadout.com/api/mcp",
> >     token: process.env.AGENT_LOADOUT_TOKEN!,
> >   },
> > });
> >
> > const session = await client.beta.agents.sessions.create({
> >   agent: {
> >     model: "gpt-6-astra",
> >     tools: [{
> >       type: "mcp",
> >       server_label: "agent_loadout",
> >       transport: { type: "http", server_url: "https://agent-loadout.com/api/mcp" },
> >     }],
> >   },
> >   environment: { type: "none" },
> >   input: "Summarize the new messages in my inbox.",
> >   vault_ids: [vault.id],
> > });
> > ```
>
> > [accordion] React to inbound mail
> >
> > To wake a session when mail arrives, open **Webhooks** in the dashboard, choose **New webhook**, and subscribe your server to `message.received`. Verify the `X-Loadout-Signature` header with the signing secret, then send an `agent.session.input.message` event to the session you stored for that inbox. If the agent is working, the message steers the current turn; otherwise it starts a new one.
> >
> > Pass the message ID, not the mail text. The agent reads the message with `read_message`, so mail stays untrusted data rather than instructions.
> >
> > ```typescript Forward new mail to a session theme={null}
> > import OpenAI from "openai";
> > import { verifyWebhookSignature } from "@agent-loadout/sdk";
> >
> > const client = new OpenAI();
> >
> > export async function handleLoadoutWebhook(request: Request, sessionId: string) {
> >   const body = await request.text();
> >   const valid = await verifyWebhookSignature(process.env.LOADOUT_WEBHOOK_SECRET!, {
> >     signature: request.headers.get("x-loadout-signature"),
> >     timestamp: request.headers.get("x-loadout-timestamp"),
> >   }, body);
> >   if (!valid) return new Response("Invalid signature", { status: 401 });
> >
> >   const event = JSON.parse(body);
> >   if (event.type === "message.received") {
> >     await client.beta.agents.sessions.events.create(sessionId, {
> >       events: [{
> >         type: "agent.session.input.message",
> >         input: [{ role: "user", content: [{ type: "input_text", text: `New mail ${event.data.message_id} arrived. Read it with read_message and handle it.` }] }],
> >       }],
> >     });
> >   }
> >   return new Response(null, { status: 204 });
> > }
> > ```
> >
> > Within a turn, the agent can also call `wait_for_message` to wait up to 25 seconds for a reply it just asked for.

> [tab] REST API
>
> Use the same token for direct REST calls. Pass it as a `Bearer` token in the `Authorization` header. The base URL is `https://agent-loadout.com/api/v1`.
>
> ```bash Verify your identity theme={null}
> curl https://agent-loadout.com/api/v1/me \
>   -H "Authorization: Bearer $AGENT_LOADOUT_TOKEN"
> ```
>
> ```bash List inboxes theme={null}
> curl https://agent-loadout.com/api/v1/inboxes \
>   -H "Authorization: Bearer $AGENT_LOADOUT_TOKEN"
> ```
>
> ```bash Send a message theme={null}
> curl -X POST https://agent-loadout.com/api/v1/inboxes/<INBOX_ID>/messages \
>   -H "Authorization: Bearer $AGENT_LOADOUT_TOKEN" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "to": ["person@example.com"],
>     "subject": "Hello from my agent",
>     "text": "Sent by my agent.",
>     "idempotency_key": "hello-1"
>   }'
> ```
>
> The full OpenAPI spec is at `https://agent-loadout.com/api/v1/openapi.json`. Errors return JSON with a matching HTTP status code:
>
> ```json Error response theme={null}
> {
>   "error": {
>     "code": "forbidden",
>     "message": "…",
>     "hint": "…"
>   }
> }
> ```
>
> Status codes: `400` bad request, `401` unauthenticated, `403` forbidden, `404` not found, `409` conflict, `429` rate limited, `402` quota or budget reached.

## Try it after connecting

Once your client is connected, try these prompts in any chat session. Tool access follows the agent's granted permissions and equipped resources.

```
Which Agent Loadout agent am I connected to, and what is its email address?
```

```
Summarize the new messages in my Agent Loadout inbox.
```

```
Draft a reply to the newest email. Save it without sending it.
```

```
List the accounts in my agent's vault without showing their passwords.
```

```
Show my agent's payment cards and spending limits without revealing card details.
```

```
List my agent's machines and tell me which are running.
```

> [!NOTE]
>
> Email, credentials, cards, and machines all share the same connection. Access to a credential's value must be enabled for the agent. Cards and machines must also be available in your workspace. Sending and running machines follow your account's plan limits.

## Troubleshooting

> [accordion] The connector option is missing in my client
>
> Some accounts require Developer mode or a workspace administrator to enable custom connectors. Check the official setup guide linked in your client's own documentation. For ChatGPT specifically, Developer mode must be enabled under **Settings → Security and login** before the custom connector UI appears.

> [accordion] I signed in, but my chat cannot see any tools
>
> Complete the access-approval step in the browser first, then return to your client. If the tools still do not appear:
>
> * Start a **new conversation** — some clients require a fresh session before tools become visible.
> * Look for a **Refresh tools** or **Reconnect** option in the client's MCP or connector settings.
> * Make sure you approved permissions for the correct agent during the OAuth flow. If you are unsure, disconnect and reconnect to choose again.

> [accordion] A tool returns 'permission denied' or 'resource not found'
>
> This means the token used for the connection does not include the required capability, or the resource (inbox, credential, machine) is not equipped on the selected agent. To fix it:
>
> 1. Open the agent's **Tokens** tab and check which capabilities the token carries.
> 2. Open the agent's **Equipment** tab and confirm the inbox, vault entries, or machines are present.
> 3. If you need to add capabilities, issue a new token with the required scopes and reconnect — or disconnect and reconnect to choose a different agent.

> [accordion] How do I disconnect Agent Loadout from a client
>
> 1. In the Agent Loadout dashboard, open the agent's **Tokens** tab.
> 2. Find the token issued for that client and choose **Revoke**. This immediately stops all access from that token.
> 3. In your client's MCP or connectors settings, remove the Agent Loadout server entry.
>
> You can reconnect at any time by pointing the client at `https://agent-loadout.com/api/mcp` again and completing a new OAuth flow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.