# Integrate with Claude Desktop via MCP

The mailbot MCP server exposes inbox, message, thread, usage, and engagement operations as structured tools. When connected to Claude Desktop (or any MCP client), Claude can read your inbox, send mail, and act on threads without you copying API responses by hand.

This guide focuses on Claude Desktop. The same server works with Claude Code, Cursor, and other MCP-compatible clients.

## What you can do once connected

Once Claude Desktop has access to the mailbot MCP server, you can ask things like:

- *"Create a sandbox inbox called `triage` and tell me its address."*
- *"List unread messages in `support@mydomain.com` from the last 24 hours."*
- *"Reply to the most recent thread with this draft, but ask me to confirm first."*
- *"Show my outbound usage for this month."*

Claude will call the right MCP tool, show the structured result, and then take the next step in conversation.

## Prerequisites

- Claude Desktop installed
- a mailbot API key from [getmail.bot/dashboard](https://getmail.bot/dashboard)
- Node.js 20+ on the machine running Claude Desktop (the MCP server runs locally via `npx`)

## Step 1: Get your API key

In the dashboard, go to **API Keys** and copy a key that starts with `mb_`. Treat it like any other secret. The MCP server runs on your machine, but the key is what authorizes calls against your account.

## Step 2: Edit Claude Desktop's config

Open the Claude Desktop config file:

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

Add the `mailbot` MCP server entry. If you already have other servers, add this alongside them:

```json
{
  "mcpServers": {
    "mailbot": {
      "command": "npx",
      "args": ["mailbot-mcp"],
      "env": {
        "MAILBOT_API_KEY": "mb_your_api_key_here"
      }
    }
  }
}
```

Save and quit Claude Desktop, then reopen. The mailbot tools should now appear in the tools menu inside any conversation.

## Step 3: Confirm the connection

Open a fresh conversation and ask:

> *"List my mailbot inboxes."*

Claude should call `list_inboxes` and return the structured list. If you see an authentication error, double-check the `MAILBOT_API_KEY` value in the config.

## Available tools

See the [MCP tool table](/docs/mcp-server#included-tools) for exact names and parameters. Sending uses `send_message`; replying uses `reply_to_message`.

Domain registration and DNS checks use the REST API. They are not tools in the current published server.

## Practical patterns

### Triage with confirmation

Tell Claude to never send without you confirming:

> *"For any auto-reply you draft, show me the draft first and wait for me to say 'send'."*

Claude will surface the draft, you approve, then it calls `send_message` or `reply_to_message`.

### Daily summary

> *"Every morning, summarize unread mail across all my inboxes from the last 24 hours and tell me which threads need a reply."*

Claude walks `list_inboxes` → `list_messages` → `get_thread` and produces a digest.

### Drafting in voice

Give Claude a few past threads as samples and it will match your tone in drafts. The `get_thread` tool returns the full message history, so you can ask Claude to read the thread context before drafting.

## Security notes

- The MCP server runs locally. It sends your API key to `https://getmail.bot` over HTTPS to authenticate requests.
- Rotate the key in the dashboard if you suspect compromise. Update `claude_desktop_config.json` with the new value.
- For shared machines, consider using a sandbox-only key with limited scope (a key tied to an account whose only inboxes are sandbox).
- Review recorded actions in the [audit log](/docs/api/list-audit-log). Not every read operation creates an audit entry.

## Troubleshooting

| Symptom | Likely cause | Fix |
|---|---|---|
| Tools missing from menu | Config not picked up | Quit Claude Desktop fully and relaunch |
| `401 Unauthorized` | Wrong or expired API key | Regenerate in dashboard, update config |
| `429` rate limit | Burst of tool calls in one turn | Ask Claude to space calls or batch reads |
| Tool returns empty list | Inbox or domain filter mismatch | Check `inbox_id` value, list inboxes first |

## Related concepts

- [Inboxes](/docs/concepts/inboxes-model)
- [Threads and conversation context](/docs/concepts/threads-conversation-context)

## Related API

- [List inboxes](/docs/api/list-inboxes)
- [Send message](/docs/api/send-message)
- [Reply to message](/docs/api/reply-message)
