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.
claude mcp add --transport http wemail https://mcp.wemail.io/mcp
# then run /mcp and choose AuthenticateInstall
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.
POST https://mcp.wemail.io/mcp
Authorization: Bearer afn_live_xxx# 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.tgznpx -y wemail-mcp install --api-key afn_live_xxxTools 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
send_email | POST /v3/messages | Optional | Send a single transactional email. Scope: send_only or full_access. |
get_message | GET /v3/messages/{id} | Optional | Fetch a message and its delivery state. |
list_scheduled_messages | GET /v3/messages/scheduled | Optional | List pending scheduled sends, soonest first. |
list_events | GET /v3/events | Optional | Query delivery, open, click, bounce and complaint events (type, message_id, tag, domain, limit). |
get_metrics | GET /v3/metrics | Optional | Time-bucketed delivery counts and rates for a window (from, to), optionally for one sending domain. |
get_metrics_summary | GET /v3/metrics/summary | Optional | One aggregate for a window: delivery counts and rates, bounce classes, engagement, latency percentiles, optional previous-period comparison. |
get_metrics_breakdown | GET /v3/metrics/breakdown | Optional | Ranked table for one dimension — domain, mailbox provider, tag, template, bounce code, complaint type, country or client. |
list_templates | GET /v3/templates | Optional | List server-side templates. |
list_domains | GET /v3/domains | Optional | List domains and check DKIM/SPF verification state. |
list_suppressions | GET /v3/suppressions/{type} | Optional | Read one list: bounces, unsubscribes, complaints or allowlist (addresses that are always delivered). |
list_webhook_deliveries | GET /v3/webhooks/{id}/deliveries | Optional | A webhook endpoint’s delivery history, newest first; failed items are ready to resend. |
test_webhook_endpoint | POST /v3/webhooks/{id}/test | Optional | Fire a signed sample event at a saved endpoint through the real delivery pipeline (10 calls/minute). Scope: full_access. |
validate_email | POST /v3/validate | Optional | Validate an address before sending (live keys spend one verification credit). Scope: send_only or full_access. |
list_uploads | GET /v3/uploads | Optional | List hosted uploads with storage usage against the plan quota. |
create_upload | POST /v3/uploads | Optional | Host 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_messages | GET /v3/inbound/messages | Optional | Received 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_message | GET /v3/inbound/messages/{id} | Optional | One 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_threads | GET /v3/inbound/threads | Optional | Conversations, 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_thread | GET /v3/inbound/threads/{id} | Optional | One 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_inboxes | GET /v3/agent-inboxes | Optional | Your agent inboxes — addresses on your workspace subdomain that receive mail with no DNS setup. Scope: read_only or full_access. |
create_agent_inbox | POST /v3/agent-inboxes | Optional | Create an agent inbox (handle, label, sender_allowlist). Scope: full_access. |
reply_to_inbound_message | POST /v3/inbound/messages/{id}/reply | Optional | Reply 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_messages | POST /v3/inbound/messages/ack | Optional | Acknowledge 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_message | DELETE /v3/inbound/messages/{id}/ack | Optional | Clear one message’s acknowledgement so acked=false returns it again — e.g. to reprocess it. Scope: full_access. |
list_inbound_routes | GET /v3/routes | Optional | Read-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.
- List what is new —
list_inbound_messageswithacked: false(addorder: "asc"to work oldest first). - Read each message —
get_inbound_messagereturns the body, key headers and auth verdicts. - Reply when a reply is warranted —
reply_to_inbound_messageanswers in the same thread from a verified sending domain. - Acknowledge —
ack_inbound_messageswith the ids you handled (up to 500 per call). Useunack_inbound_messageto 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.
{
"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.
# 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.
{
"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.
{
"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.
{
"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.
{
"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_onlykey only to assistants that genuinely need to send mail; analytics agents need nothing more thanread_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.