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

# MCP

> Connect your AI assistant to Adraa Inbox through OAuth and use tools for conversations, contacts, WhatsApp, broadcasts, and flows.

Use the Model Context Protocol (MCP) to let an AI assistant work in your Adraa Inbox workspace. The server exposes **44 tools**, covering every operation in the documented REST API, plus workspace setup, automation, and account discovery.

| Setting | Value |
| - | - |
| Server URL | `https://api.inbox.adraa.ai/mcp` |
| Transport | Streamable HTTP |
| Authentication | OAuth authorization code flow with S256 PKCE |
| Workspace access | An active workspace admin chooses one workspace during consent. |

## Add the server to your agent

With your client installed, use the matching setup below. These commands configure the MCP connection; the login step authenticates your Adraa Inbox account.

> [tab] Claude Code
>
> Add the remote server for your user account, sign in, and check its status:
>
> ```bash theme={null}
> claude mcp add --transport http --scope user adraa-inbox https://api.inbox.adraa.ai/mcp
> claude mcp login adraa-inbox
> claude mcp get adraa-inbox
> ```
>
> Inside a Claude Code session, you can also run `/mcp`, select **adraa-inbox**, and authenticate there.
>
> To create a connection with explicit read-only inbox permissions, use this instead of the first command, then run the login command:
>
> ```bash theme={null}
> claude mcp add-json --scope user adraa-inbox '{"type":"http","url":"https://api.inbox.adraa.ai/mcp","oauth":{"scopes":"inbox:read contacts:read whatsapp:read"}}'
> ```
>
> `--scope user` controls where Claude Code saves the configuration. OAuth permissions are the space-separated names in `oauth.scopes`.
>
> See the [official Claude Code MCP guide](https://code.claude.com/docs/en/mcp).

> [tab] Codex
>
> Add the server, request read-only inbox permissions, and verify configuration:
>
> ```bash theme={null}
> codex mcp add adraa-inbox --url https://api.inbox.adraa.ai/mcp
> codex mcp login adraa-inbox --scopes inbox:read,contacts:read,whatsapp:read
> codex mcp list
> ```
>
> Codex may start authorization while adding the server. Complete the browser flow when prompted. The login command explicitly requests conversation, contact, and WhatsApp template reads.
>
> Add a write scope when you want the assistant to perform that operation. For example, template submission and delivery also need `whatsapp:write`:
>
> ```bash theme={null}
> codex mcp login adraa-inbox --scopes inbox:read,contacts:read,whatsapp:read,whatsapp:write
> ```
>
> See the [official Codex MCP guide](https://learn.chatgpt.com/docs/extend/mcp?surface=cli).

> [tab] Gemini CLI
>
> Add a Streamable HTTP server to your user configuration, then start Gemini:
>
> ```bash theme={null}
> gemini mcp add --transport http --scope user adraa-inbox https://api.inbox.adraa.ai/mcp
> gemini
> ```
>
> Inside Gemini CLI, authenticate and inspect the server:
>
> ```text theme={null}
> /mcp auth adraa-inbox
> /mcp list
> ```
>
> Gemini discovers Adraa Inbox's OAuth endpoints automatically. To pin permissions, merge an OAuth block into the server entry in `~/.gemini/settings.json` before authenticating:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "adraa-inbox": {
>       "httpUrl": "https://api.inbox.adraa.ai/mcp",
>       "oauth": {
>         "enabled": true,
>         "scopes": ["inbox:read", "contacts:read", "whatsapp:read"]
>       }
>     }
>   }
> }
> ```
>
> See the [official Gemini CLI MCP guide](https://geminicli.com/docs/tools/mcp-server/).

> [tab] Cursor
>
> Merge this entry into `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` for all projects:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "adraa-inbox": {
>       "url": "https://api.inbox.adraa.ai/mcp"
>     }
>   }
> }
> ```
>
> In Cursor, enable the server in MCP settings and complete OAuth when prompted. With the Cursor CLI installed, you can sign in and list tools from the terminal:
>
> ```bash theme={null}
> agent mcp login adraa-inbox
> agent mcp list-tools adraa-inbox
> ```
>
> See the official [Cursor MCP configuration](https://cursor.com/docs/mcp) and [Cursor CLI commands](https://cursor.com/docs/cli/mcp).

## Sign in to Adraa Inbox

1. Run your client's login command above, or select its MCP authentication action. It opens an Adraa Inbox authorization page in your browser.
2. If you are not signed in, enter your Adraa Inbox email and verify the code sent to that address. Complete any additional account verification when prompted.
3. Choose the workspace you want the agent to access. Your account must be an active admin of that workspace.
4. Review the requested permissions and approve the connection.
5. Return to your terminal or editor and refresh the MCP tool list. Ask the assistant to call `get_me` to confirm the workspace when `inbox:read` was granted.

If you are already signed in, you can go straight to workspace selection and consent. Your client completes the callback and stores its OAuth credentials. Do not paste an API token, email verification code, or OAuth callback URL into the assistant's chat.

> [!NOTE]
>
> MCP sign-in is separate from signing in to Claude, Codex, Gemini, or Cursor. You use your Adraa Inbox account for the authorization page. No workspace API token or OAuth client secret is required.

### If the browser does not open

Open the authorization URL printed by your client. Codex and current Claude Code versions also support an explicit manual-browser flow:

```bash theme={null}
codex mcp login adraa-inbox --no-browser --scopes inbox:read,contacts:read,whatsapp:read
claude mcp login adraa-inbox --no-browser
```

Run only the command for your client. Finish the browser flow and return the redirect URL to the originating terminal if it asks for it. Gemini's OAuth flow requires a browser and a reachable local callback.

### If you need more permissions

Update the scopes your client requests and sign in again. For Codex, use `codex mcp login` with the revised `--scopes` list. For Claude Code, update `oauth.scopes` and rerun `claude mcp login adraa-inbox`. For Gemini CLI, update `oauth.scopes` and rerun `/mcp auth adraa-inbox`.

The consent page shows what the new connection can do. Refreshing a token or restarting the agent does not add permissions to an existing grant. The table below lists the scope needed for each capability.

## Permissions

The client requests scopes during authorization. Approve only the access needed for your task.

| Scope | Access |
| - | - |
| `setup:read` | Inspect workspace setup, teams, and knowledge websites. |
| `setup:write` | Update supported settings, manage team membership, and add knowledge text. |
| `flows:read` | Read flow definitions and starter templates, and validate definitions. |
| `flows:write` | Create and update inactive flow drafts. |
| `flows:publish` | Publish a reviewed flow version. |
| `inbox:read` | Inspect connection context, conversations, and messages. |
| `inbox:write` | Create conversations, assign, close or reopen them, send messages, and add notes. |
| `contacts:read` | Read contact profiles and workspace tags. |
| `contacts:write` | Update contact names and custom fields, and replace contact tags. |
| `whatsapp:read` | List connected accounts and inspect their templates and approval statuses. |
| `whatsapp:write` | Submit templates for approval and send approved templates. |
| `agents:read` | List workspace agents and inspect an agent. |
| `agents:write` | Add agents, change their details or role, and remove them from the workspace. |
| `broadcasts:read` | List contact groups and their members. |
| `broadcasts:write` | Create contact groups and send WhatsApp broadcasts. |

The existing setup and flow scopes keep their behavior. The ten inbox, contact, WhatsApp, agent, and broadcast scopes are additional permissions. When a client does not specify scopes, the default remains `setup:read flows:read`.

If a tool reports insufficient scope, configure your client to request the required scope and authorize a new connection. Refreshing an existing token does not add permissions. A server update does not expand an earlier grant.

## Tool reference

MCP exposes every operation in the documented [public REST API](https://docs.inbox.adraa.ai/api-reference/introduction.md), along with helpers for account selection, template status, workspace setup, and flows. Each tool uses the selected workspace and enforces its required scope.

| Task | Tools |
| - | - |
| Inspect connection context | `get_me` |
| Inspect the inbox | `list_conversations`, `get_conversation`, `list_messages` |
| Work a conversation | `create_conversation`, `assign_conversation`, `close_conversation`, `reopen_conversation`, `send_message`, `send_whatsapp_interactive`, `add_note` |
| Inspect contacts | `list_contacts`, `get_contact`, `list_tags` |
| Update contacts | `update_contact`, `set_contact_tags` |
| Inspect agents | `list_agents`, `get_agent` |
| Manage agents | `create_agent`, `update_agent`, `remove_agent` |
| Manage contact groups and broadcasts | `list_contact_groups`, `create_contact_group`, `send_broadcast`, `send_audience_broadcast` |
| Work with WhatsApp templates | `list_whatsapp_accounts`, `list_whatsapp_templates`, `list_whatsapp_account_templates`, `submit_whatsapp_template`, `send_whatsapp_template` |
| Configure the workspace | `get_workspace_setup`, `update_workspace_settings`, `list_agent_groups`, `create_agent_group`, `set_agent_group_members`, `list_website_sources`, `add_knowledge_text` |
| Build automation | `list_flows`, `get_flow`, `list_flow_templates`, `create_flow_draft`, `update_flow_draft`, `validate_flow`, `publish_flow` |

Use list and get tools to resolve IDs before writing. Follow the returned pagination fields for additional results. `list_messages` accepts `conversationId` to focus on one conversation; it still defaults to inbound messages, so use `direction: "all"` to read both directions. Read the current flow version before updating or publishing it.

`update_contact` merges supplied custom fields; a `null` value removes that field. `set_contact_tags` replaces the contact's full tag set, so include every tag you want to keep. Assignment changes replace the current assignment.

Agent administration follows the public API's protections for managed agents and the last workspace admin. `remove_agent` removes workspace membership. `send_broadcast` sends to a saved contact group; `send_audience_broadcast` supports the API's audience options. Broadcasts send customer messages and can incur delivery charges, so inspect the audience and template before sending.

## WhatsApp template workflow

1. Call `list_whatsapp_accounts` and choose the connected number for your task.
2. Draft the template and call `submit_whatsapp_template` with that account in `from`. Include body samples and any button samples.
3. Call `list_whatsapp_account_templates` for the same `from` to inspect approval status and button definitions. You can filter by `status`, such as `APPROVED`.
4. Once approved, call `send_whatsapp_template` with the recipient, template name, language, and variable values.

Submission starts provider review. It does not send a message, and a successful submission does not mean approval. Sending is a separate action that can contact a customer.

`list_whatsapp_templates` mirrors the public API's approved-template list across the workspace. Use `list_whatsapp_account_templates` when you need a specific account's pending or rejected templates and full component definitions.

The account-template helper returns up to `limit` templates per page (1–100, default 50). Pass its `nextCursor` as `cursor` to get the next page, keeping `from` and `status` unchanged. A `null` cursor marks the last page. If a cursor becomes invalid after the template list changes, restart the listing for the same account and filters.

For a dynamic website button, submit a URL with one `{{1}}` placeholder at the end and a full sample URL:

```json theme={null}
{
  "type": "URL",
  "text": "Track order",
  "url": "https://shop.example.com/orders/{{1}}",
  "example": ["https://shop.example.com/orders/A-100"]
}
```

When sending, supply the suffix through `buttonParameters`, separately from body `parameters`:

```json theme={null}
{
  "buttonParameters": [
    { "index": 0, "subtype": "url", "value": "A-100" }
  ]
}
```

Button indexes start at zero. See [Templates](https://docs.inbox.adraa.ai/guide/templates.md) for the full submission example and supported content.

## Example tool call

Your MCP client discovers tool schemas through `tools/list` and invokes tools through `tools/call`. Let the client handle OAuth and send requests to the MCP server URL.

For example, read both directions of one conversation's history:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_messages",
    "arguments": {
      "conversationId": "cmbxgz9pq0003ph01m4n5o6p7",
      "direction": "all",
      "limit": 25
    }
  }
}
```

Use a conversation ID returned by `list_conversations`. This call requires `inbox:read`. Follow `nextCursor` to retrieve more messages.

## Resources and prompts

Clients that support MCP resources can discover these with `resources/list` and retrieve them with `resources/read`:

| Resource URI | Contents |
| - | - |
| `adraa://guide/api` | REST-to-tool mappings, scopes, pagination, and write behavior. |
| `adraa://guide/whatsapp` | Template approval, dynamic URL examples, and delivery guidance. |
| `adraa://workspace/context` | The selected workspace, signed-in agent ID, and granted scopes. No access tokens are included. |

Discover reusable prompts with `prompts/list`, then call `prompts/get` with the named arguments:

| Prompt | Argument | Purpose |
| - | - | - |
| `plan_inbox_task` | `goal` | Plan a task around the relevant reads, IDs, scopes, and requested changes. |
| `prepare_whatsapp_template` | `purpose` | Draft template content, body samples, and dynamic URL button configuration. |

Retrieving a resource or prompt does not submit a template, publish a flow, or send a customer message.

## Errors and rate limits

| Response | What to do |
| - | - |
| HTTP `401`, `invalid_token` | Reconnect through your client's OAuth flow. The grant, admin session, or workspace access may no longer be valid. |
| HTTP `403`, `insufficient_scope` | Request the scope named in the response's `WWW-Authenticate` header and approve a new connection. |
| Tool result with `isError: true` | Inspect `structuredContent.error.code`, `message`, and any field-level `details`. Correct validation or business errors before repeating the action. |
| HTTP `429`, `RATE_LIMIT_EXCEEDED` | Respect `Retry-After`. Broadcast sends allow 10 requests per minute; template submissions, notes, resource creation, and agent/contact edits allow 30; message sends, assignments, and conversation lifecycle writes allow 60. |

The general limit is 100 requests per minute per IP. Per-operation write limits also apply. A successful send attempt does not prove recipient delivery. If a write times out, inspect the resulting messages, templates, or campaigns before retrying to avoid duplicates.

If your client cannot find the inbox tools, refresh its tool list and check that the deployment includes the extended MCP server. Granting a scope does not add tools to an older server release.

## Manage connected applications

Open **Settings → API → Connected AI apps** to inspect each application's workspace and permissions. Select **Disconnect** to revoke that application's connection. You can authorize a new connection later.

## Build an MCP client

The server advertises OAuth discovery metadata at:

* `https://api.inbox.adraa.ai/.well-known/oauth-protected-resource/mcp`
* `https://api.inbox.adraa.ai/.well-known/oauth-authorization-server`

Use the advertised authorization, registration, and token endpoints. Keep the MCP resource URL bound to `https://api.inbox.adraa.ai/mcp` throughout authorization. The server requires a state value and S256 PKCE, and supports public client registration.

For reusable agent instructions and direct REST workflows, see [Agent skills](https://docs.inbox.adraa.ai/guide/agents.md). See the [API reference](https://docs.inbox.adraa.ai/api-reference/introduction.md) for request fields shared with the MCP tools.


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