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.
The wemail MCP server
There are two ways to run it, both live today. Local (stdio) runs the server on your machine — best for desktop apps and editors. Remote (HTTP) connects to our hosted endpoint — best for cloud agents and API integrations. Both authenticate with a wemail API key.
# Runs the server over stdio; the client launches this for you.
WEMAIL_API_KEY=afn_live_xxx npx -y wemail-mcpPOST https://mcp.wemail.io/mcp
Authorization: Bearer afn_live_xxxTools exposed
The server maps the wemail REST API to MCP tools. Read-only tools are always available; sending and mutation tools respect the scopes of the API key you provide.
| Parameter | Type | Required | Description |
|---|---|---|---|
send_email | POST /v3/messages | Optional | Send a single transactional email. |
get_message | GET /v3/messages/{id} | Optional | Fetch a message and its delivery state. |
list_events | GET /v3/events | Optional | Query delivery, open, click, bounce and complaint events. |
get_metrics | GET /v3/metrics | Optional | Aggregate counts and rates across any dimension. |
list_templates | GET /v3/templates | Optional | List and inspect server-side templates. |
list_domains | GET /v3/domains | Optional | List domains and check DKIM/SPF verification state. |
list_suppressions | GET /v3/suppressions | Optional | Read bounce/unsubscribe/complaint lists. |
validate_email | POST /v3/validate | Optional | Validate an address before sending. |
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", "wemail-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 wemail-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": "claude-opus-4-1",
"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", "wemail-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", "wemail-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. - Grant
messages:sendonly to assistants that genuinely need to send mail. - 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.