# Connect an AI bot with MCP

Give Cursor, Claude, ChatGPT, Grok, or a custom agent a key so it can draft, send, and read mail in your FlareMail inbox.

4 min read. HTML: https://sendwithflare.com/help/mcp-bots/

FlareMail speaks **MCP** (Model Context Protocol). That means any AI app that can connect to a remote MCP server — Cursor, Claude Desktop, ChatGPT, Grok, or a bot you wrote — can use your mailbox the way the FlareMail app does: list mail, read a thread, save a draft, or send.

*Settings → Bots & MCP. Grok uses the OAuth fields; other apps use a named API key.*

## Grok Custom Connector (OAuth)

Grok’s Custom Connector form asks for OAuth credentials, not a Bearer token. Use the public PKCE client — leave the secret blank:

- **Client ID** — `flaremail-mcp`
- **Client Secret** — leave empty
- **Authorization Endpoint** — `https://flaremail-api.tcrxx0.workers.dev/oauth/authorize`
- **Token Endpoint** — `https://flaremail-api.tcrxx0.workers.dev/oauth/token`
- **Scopes** — type `email` and press Enter
- **Token Auth Method** — `none (PKCE only, recommended)`

The MCP server URL is `https://flaremail-api.tcrxx0.workers.dev/mcp`. After you save, Grok opens a FlareMail login page. Sign in with the same email and password as the app, then click **Allow access**.

> **NOTE:** Google-only FlareMail accounts need a password set before Grok can connect. API keys (below) still work for Cursor and Claude without a password.

## Create a key in Settings

1. **Open Bots & MCP** — In the app, open **Settings** (`⌘` `,`) and choose **Bots & MCP** in the sidebar.
2. **Name the bot** — Use a label you’ll recognize later, like `Grok bot` or `Cursor`. Each bot should get its own key so you can revoke one without breaking the others.
3. **Create key** — FlareMail shows the secret token **once**. Copy it immediately — it cannot be retrieved later.
4. **Copy the MCP URL** — The URL is your Worker’s `/mcp` endpoint. Paste it into the client together with `Authorization: Bearer fm_live_…`.

> **WARNING:** Treat an MCP key like a password. Anyone who has it can send as you. Revoke it from the same Settings panel if a laptop is lost or a bot is retired.

## Point the client at FlareMail

Most MCP apps take a small JSON snippet. Settings copies one for you. It looks like this:

```
{
  "mcpServers": {
    "flaremail": {
      "url": "https://flaremail-api.tcrxx0.workers.dev/mcp",
      "headers": {
        "Authorization": "Bearer fm_live_YOUR_KEY"
      }
    }
  }
}
```

- **Cursor** — put it in `.cursor/mcp.json` in the project, or in your user MCP config.
- **Claude Desktop** — add the same block to `claude_desktop_config.json`.
- **ChatGPT and other bots** — paste the URL and Bearer token wherever the product asks for a remote MCP server.
- **Grok on the web** — use the OAuth fields above, not this JSON snippet.

## What the bot can do

Once connected, the agent can call FlareMail tools on your account:

- `send_email` / `send_draft` / `reply_to_email` / `create_draft` / `schedule_email` — write mail.
- `list_emails` / `get_email` / `search_emails` — read mail.
- `import_contacts` / `import_drafts` / `list_contacts` / `get_contact` — directory. Always pass a `mailbox` (one of your addresses) so people land in the right identity.
- `whoami` / `list_mailboxes` / `inbox_counts` — which account and addresses it is using.

> **TIP:** Ask the bot to **import drafts** or **create a draft** when you want to review before anything leaves. `send_draft` (or `send_email` with `draft_id`) delivers a saved draft and removes it from Drafts. `send_email` also clears matching To+subject drafts. Imported contacts must name a mailbox from `list_mailboxes`.

## Admin: rename, audit, revoke

All of this stays in **Settings → Bots & MCP**:

- **Rename** a key by editing its label — useful when you have several bots.
- **Last used** shows whether a key is actually being called.
- **Revoke** immediately invalidates the token. Create a new key if that bot should come back.

In-app polish and summaries are a different feature — see [AI assist](/help/ai-assist/). MCP is for external agents acting on the mailbox.
