MCP servers

Connect the wemail API to any MCP-capable assistant — Claude, ChatGPT, Gemini, Cursor — so it can send mail, inspect events and manage domains for you.

The Model Context Protocol (MCP) is an open standard that lets LLM assistants and agents call external tools through a uniform interface. The wemail MCP server exposes the wemail API as MCP tools, so any MCP-capable client can send email, look up message events, manage domains and more — using your existing API key.

Connect in one click (sign in, no key)

Apps that support MCP sign-in connect with OAuth: you sign in to wemail, choose the workspace and what the app may do (Full access, Send only or Read only), and the app is connected. Each connection shows on the API keys page as a key named MCP — <app> — delete it to disconnect.

Cursor: Add to Cursor · VS Code: Add to VS Code

Claude (claude.ai and Desktop): Settings → Connectors → Add custom connector → URL https://mcp.wemail.io/mcp → Connect. ChatGPT: Settings → Apps & Connectors → Advanced → Developer mode → Create → URL https://mcp.wemail.io/mcp, authentication OAuth.

bashClaude Code
claude mcp add --transport http wemail https://mcp.wemail.io/mcp
# then run /mcp and choose Authenticate

Install

Pick one of three options, in order of preference. 1. Hosted — nothing to install: point the client at https://mcp.wemail.io/mcp with a Bearer API key (or sign in with OAuth, above) (best for cloud agents and API integrations). 2. Download from wemail — run the local server straight from our download URL; it always serves the latest build and needs no npm registry. 3. npm — npx -y wemail-mcp from the public npm registry; it works, but the npm release may lag behind the download.

text1. Hosted (streamable HTTP)
POST https://mcp.wemail.io/mcp
Authorization: Bearer afn_live_xxx
bash2. Download from wemail (latest, no npm needed)
# Wire the server into every detected client (Claude Code, Cursor, Gemini CLI, Codex CLI, VS Code, Cline):
npx -y https://api.wemail.io/v3/sdks/mcp install --api-key afn_live_xxx

# Or run it directly over stdio (clients usually launch this for you):
WEMAIL_API_KEY=afn_live_xxx npx -y https://api.wemail.io/v3/sdks/mcp

# Or keep the tarball yourself:
curl -L -o wemail-mcp.tgz https://api.wemail.io/v3/sdks/mcp
WEMAIL_API_KEY=afn_live_xxx npx -y ./wemail-mcp.tgz
bash3. npm (may lag behind)
npx -y wemail-mcp install --api-key afn_live_xxx

Tools exposed

The server maps the wemail REST API to 25 MCP tools, identical on the hosted endpoint and the local package. Every tool calls the API with the key you provide, so the key’s scope decides what works: read tools work with any scope (read_only, send_only, full_access) except the inbound tools, which need read_only or full_access; send_email and validate_email need send_only or full_access; test_webhook_endpoint, create_upload, reply_to_inbound_message, ack_inbound_messages and unack_inbound_message need full_access. A call the scope does not allow returns the API’s 403 insufficient_scope.

Available tools
ParameterTypeRequiredDescription
send_emailPOST /v3/messagesOptionalSend a single transactional email. Scope: send_only or full_access.
get_messageGET /v3/messages/{id}OptionalFetch a message and its delivery state.
list_scheduled_messagesGET /v3/messages/scheduledOptionalList pending scheduled sends, soonest first.
list_eventsGET /v3/eventsOptionalQuery delivery, open, click, bounce and complaint events (type, message_id, tag, domain, limit).
get_metricsGET /v3/metricsOptionalTime-bucketed delivery counts and rates for a window (from, to), optionally for one sending domain.
get_metrics_summaryGET /v3/metrics/summaryOptionalOne aggregate for a window: delivery counts and rates, bounce classes, engagement, latency percentiles, optional previous-period comparison.
get_metrics_breakdownGET /v3/metrics/breakdownOptionalRanked table for one dimension — domain, mailbox provider, tag, template, bounce code, complaint type, country or client.
list_templatesGET /v3/templatesOptionalList server-side templates.
list_domainsGET /v3/domainsOptionalList domains and check DKIM/SPF verification state.
list_suppressionsGET /v3/suppressions/{type}OptionalRead one list: bounces, unsubscribes, complaints or allowlist (addresses that are always delivered).
list_webhook_deliveriesGET /v3/webhooks/{id}/deliveriesOptionalA webhook endpoint’s delivery history, newest first; failed items are ready to resend.
test_webhook_endpointPOST /v3/webhooks/{id}/testOptionalFire a signed sample event at a saved endpoint through the real delivery pipeline (10 calls/minute). Scope: full_access.
validate_emailPOST /v3/validateOptionalValidate an address before sending (live keys spend one verification credit). Scope: send_only or full_access.
list_uploadsGET /v3/uploadsOptionalList hosted uploads with storage usage against the plan quota.
create_uploadPOST /v3/uploadsOptionalHost a file (sent base64-encoded) and get a link to put in email HTML instead of attaching it. Scope: full_access (paid plans).
list_inbound_messagesGET /v3/inbound/messagesOptionalReceived inbound mail, newest first, as compact summaries (sender, subject, snippet, automated, auth verdicts, acked_at). Filters: acked (false = only messages you have not acknowledged yet), domain, recipient, since, cursor, limit (≤ 50), order, automated (default human). Scope: read_only or full_access.
get_inbound_messageGET /v3/inbound/messages/{id}OptionalOne inbound message: text body (HTML stripped to text when there is no text part) capped at 20 KB, key headers, attachment metadata, auth verdicts. Scope: read_only or full_access.
list_threadsGET /v3/inbound/threadsOptionalConversations, latest activity first: subject, participants, counts, last_direction (who wrote last), latest_inbound_id. A person answering one of your emails starts their own conversation; sending never creates one. Filters: automated (human default, automated, all), acked, domain, recipient, from (one person), since. Scope: read_only or full_access.
get_threadGET /v3/inbound/threads/{id}OptionalOne conversation oldest first — inbound emails (body capped at 8 KB each), the email of yours it answers and your replies, with parent_id for the reply tree. Scope: read_only or full_access.
list_agent_inboxesGET /v3/agent-inboxesOptionalYour agent inboxes — addresses on your workspace subdomain that receive mail with no DNS setup. Scope: read_only or full_access.
create_agent_inboxPOST /v3/agent-inboxesOptionalCreate an agent inbox (handle, label, sender_allowlist). Scope: full_access.
reply_to_inbound_messagePOST /v3/inbound/messages/{id}/replyOptionalReply in the same thread (text, optional html, from, reply_all) from a verified sending domain; returns message_id, to, subject. Replies are marked automatic and the loop guard always applies — no override from MCP. Scope: full_access.
ack_inbound_messagesPOST /v3/inbound/messages/ackOptionalAcknowledge 1–500 processed messages (ids) so acked=false no longer returns them. Idempotent; unknown ids come back in not_found. Scope: full_access.
unack_inbound_messageDELETE /v3/inbound/messages/{id}/ackOptionalClear one message’s acknowledgement so acked=false returns it again — e.g. to reprocess it. Scope: full_access.
list_inbound_routesGET /v3/routesOptionalRead-only list of your inbound routes — match expression, action types, enabled — so the agent knows which addresses it receives mail for.

Agent inbox

An agent can work a mailbox end to end with four tools. The acknowledgement is what makes the loop safe to restart: a message stays in the acked=false list until the agent confirms it handled it, so nothing is lost when the agent was down and nothing is processed twice.

  1. List what is new — list_inbound_messages with acked: false (add order: "asc" to work oldest first).
  2. Read each message — get_inbound_message returns the body, key headers and auth verdicts.
  3. Reply when a reply is warranted — reply_to_inbound_message answers in the same thread from a verified sending domain.
  4. Acknowledge — ack_inbound_messages with the ids you handled (up to 500 per call). Use unack_inbound_message to put one back.

Authentication

Provide a wemail API key via the WEMAIL_API_KEY environment variable (local) or an Authorization: Bearer header (remote). Use a test-mode key (afn_test_…) while wiring things up — test sends are rendered and scored but never delivered.


Claude Desktop

Add the server to claude_desktop_config.json (Settings → Developer → Edit Config), then restart Claude Desktop.

jsonclaude_desktop_config.json
{
  "mcpServers": {
    "wemail": {
      "command": "npx",
      "args": ["-y", "https://api.wemail.io/v3/sdks/mcp"],
      "env": { "WEMAIL_API_KEY": "afn_live_xxx" }
    }
  }
}

Claude Code

Use the claude mcp add command — local stdio or the hosted remote endpoint.

bash
# Local (stdio)
claude mcp add wemail --env WEMAIL_API_KEY=afn_live_xxx -- npx -y https://api.wemail.io/v3/sdks/mcp

# Remote (hosted)
claude mcp add --transport http wemail https://mcp.wemail.io/mcp \
  --header "Authorization: Bearer afn_live_xxx"

Anthropic API (MCP connector)

The Messages API can call remote MCP servers directly via the MCP connector. Pass the wemail endpoint in mcp_servers; see the Anthropic docs for the current beta header.

jsonPOST /v1/messages
{
  "model": "<a current Claude model id>",
  "max_tokens": 1024,
  "messages": [{ "role": "user", "content": "Email a launch summary to ops@acme.io" }],
  "mcp_servers": [
    {
      "type": "url",
      "url": "https://mcp.wemail.io/mcp",
      "name": "wemail",
      "authorization_token": "afn_live_xxx"
    }
  ]
}

OpenAI / ChatGPT

In the Responses API (and the Agents SDK) add the wemail server as a remote MCP tool. In ChatGPT (Pro/Team/Enterprise), add it under Settings → Connectors using the hosted URL.

jsonPOST /v1/responses
{
  "model": "gpt-5",
  "input": "Check today's bounce rate for acme.io",
  "tools": [
    {
      "type": "mcp",
      "server_label": "wemail",
      "server_url": "https://mcp.wemail.io/mcp",
      "headers": { "Authorization": "Bearer afn_live_xxx" }
    }
  ]
}

Google Gemini

The Gemini CLI reads MCP servers from its settings.json. The Gemini API supports MCP via the GenAI SDK tool interface.

json~/.gemini/settings.json
{
  "mcpServers": {
    "wemail": {
      "command": "npx",
      "args": ["-y", "https://api.wemail.io/v3/sdks/mcp"],
      "env": { "WEMAIL_API_KEY": "afn_live_xxx" }
    }
  }
}

Cursor, Continue, VS Code & other clients

Editor and agent clients that speak MCP use the same mcpServers shape. Drop this into the client's MCP config — .cursor/mcp.json (Cursor), .vscode/mcp.json (VS Code), or the equivalent for Continue, Cline and Windsurf.

jsonmcp.json
{
  "mcpServers": {
    "wemail": {
      "command": "npx",
      "args": ["-y", "https://api.wemail.io/v3/sdks/mcp"],
      "env": { "WEMAIL_API_KEY": "afn_live_xxx" }
    }
  }
}

Security & best practices

  • Start with a test-mode key (afn_test_…) and a read-only scope while you validate the setup.
  • Give a send_only key only to assistants that genuinely need to send mail; analytics agents need nothing more than read_only.
  • Prefer the hosted endpoint for shared/cloud agents so keys never live on disk.
  • Rotate the key from the Console if it is ever exposed — revoking it immediately disconnects every client.