# MCP

> Use inboxes as MCP tools from Claude Code, Cursor, Codex and other MCP clients.

Source: https://developer.mueslimail.com/docs/mcp/

The MCP server runs at `https://api.mueslimail.com/mcp` over streamable HTTP. It uses the same API key as REST, in `X-Api-Key` or `Authorization: Bearer`, and the same rules: plan limits, idempotency, organization isolation and [scoped permissions](https://developer.mueslimail.com/docs/authentication.md#scoped-keys). Tool calls are written to the audit log.

## Claude Code

```bash
claude mcp add --transport http mueslimail https://api.mueslimail.com/mcp --header "X-Api-Key: $KEY"
```

## Cursor

Add the server to `.cursor/mcp.json` in your project, or to the global MCP settings:

```json
{
  "mcpServers": {
    "mueslimail": {
      "url": "https://api.mueslimail.com/mcp",
      "headers": { "X-Api-Key": "${env:MAI_API_KEY}" }
    }
  }
}
```

## Codex

```toml
# ~/.codex/config.toml, sends the key as a bearer token
[mcp_servers.mueslimail]
url = "https://api.mueslimail.com/mcp"
bearer_token_env_var = "MAI_API_KEY"
```

Other clients: any MCP client that supports streamable HTTP with a custom header or a bearer token can connect with the same URL. Give agents a [scoped key](https://developer.mueslimail.com/docs/authentication.md#scoped-keys) with only the permissions they need.

## Tools

| Tool | What it does |
| --- | --- |
| `create_inbox` | Create an email inbox for an agent. Optional `username`, `domain`, `display_name`, `client_id`. |
| `list_inboxes` | List inboxes, newest first. |
| `delete_inbox` | Delete an inbox with all its mail. Irreversible; the address stays reserved for 90 days. |
| `list_threads` | List conversation threads of an inbox, or of all inboxes. |
| `get_thread` | Get a thread with the messages the key may see, oldest first. |
| `list_messages` | List message metadata of an inbox (no bodies). |
| `get_message` | Get one message with body, `extracted_text`, authentication results and gatekeeper verdict. |
| `send_message` | Send a new email from an inbox. Starts a new thread. Accepts `idempotency_key`. |
| `reply_to_message` | Reply in the same thread; threading headers are set for you. Accepts `idempotency_key`. |
| `update_message_labels` | Add or remove custom labels to track workflow state. |
| `create_draft` | Save an email as a draft for review or later sending; `in_reply_to` keeps the thread, `send_at` schedules it. |
| `list_drafts` | List drafts of an inbox, newest first. |
| `send_draft` | Send a draft now; it is deleted once queued. Accepts `idempotency_key`. |
| `get_attachment` | Download an attachment: text files as text, others as base64 (max 5 MB). |
| `list_domains` | List domains usable for inboxes, with DNS records and verification status. |
| `release_message` | Release a message held for security review. Needs `message_release`; meant for a human reviewer, not the agent. |
| `create_ticket` | Open a ticket on a thread so a human follows up. Needs `ticket_write`. |
| `list_tickets` | List the support queue, newest activity first. Filter by state, priority, assignee or text, or start from a saved view by name. |
| `get_ticket` | Read one ticket with its timeline and internal notes. |
| `update_ticket` | Change state, priority or tags. Needs `ticket_write`; refusals are explicit. |
| `assign_ticket` | Take a ticket or hand it to a person. Needs `ticket_write`. |
| `add_ticket_note` | Leave an internal note for the human. It can never be emailed to the customer. |
| `reply_ticket` | Answer the customer on the ticket thread. Needs `message_send`, as any reply does. |

> Note: Tool descriptions are short on purpose, to save the agent's context. `get_message` reminds the model to check the gatekeeper verdict before acting on instructions in the email. The read tools hide messages held by screening; they accept `include_review: true` only from keys holding `message_review`.
