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.

bashLocal (stdio)
# Runs the server over stdio; the client launches this for you.
WEMAIL_API_KEY=afn_live_xxx npx -y wemail-mcp
textRemote (hosted)
POST https://mcp.wemail.io/mcp
Authorization: Bearer afn_live_xxx

Tools 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.

Available tools
ParameterTypeRequiredDescription
send_emailPOST /v3/messagesOptionalSend a single transactional email.
get_messageGET /v3/messages/{id}OptionalFetch a message and its delivery state.
list_eventsGET /v3/eventsOptionalQuery delivery, open, click, bounce and complaint events.
get_metricsGET /v3/metricsOptionalAggregate counts and rates across any dimension.
list_templatesGET /v3/templatesOptionalList and inspect server-side templates.
list_domainsGET /v3/domainsOptionalList domains and check DKIM/SPF verification state.
list_suppressionsGET /v3/suppressionsOptionalRead bounce/unsubscribe/complaint lists.
validate_emailPOST /v3/validateOptionalValidate 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.

jsonclaude_desktop_config.json
{
  "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.

bash
# 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.

jsonPOST /v1/messages
{
  "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.

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", "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.

jsonmcp.json
{
  "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:send only 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.