MCP server
anymail runs a remote Model Context Protocol server. An LLM client such as Claude, ChatGPT, Claude Code or Cursor can read your workspace, build and start campaigns, read the inbox and answer replies through tools. After this page you know what the server offers. The client pages show how to connect.
| Endpoint | https://app.anymail.watch/api/mcp |
| Transport | MCP Streamable HTTP, stateless, with JSON responses |
| Methods | POST for JSON-RPC, DELETE (accepted, no effect). GET returns 405. |
| Sign-in | OAuth 2.1 in the browser, or Authorization: Bearer sgn_… with an API token |
| Server info | name anymail, version 1.0.0 |
| Offers | 47 tools, 5 prompts |
Every tool calls one endpoint of the REST API on the same origin with the token the client signed in with. The server can do exactly what the REST API allows. The validation, the scopes, the workspace isolation and the rate limit are the same.
Connect a client#
| Client | Sign-in | Page |
|---|---|---|
| Claude (web, desktop, mobile) | OAuth, no key | Claude |
| Claude Code | OAuth or API token | Claude Code |
| ChatGPT | OAuth, no key | ChatGPT |
| Cursor | OAuth or API token | Cursor |
Claude Code also has a plugin with guided skills for campaigns, replies, reports, imports and suppressions.
Another client#
A client that supports Streamable HTTP and OAuth discovery needs only the URL. It finds the authorization server from the 401 response and registers itself. A client without OAuth sends an API token as a header.
{
"mcpServers": {
"anymail": {
"type": "http",
"url": "https://app.anymail.watch/api/mcp",
"headers": { "Authorization": "Bearer sgn_…" }
}
}
}
A client that supports only local stdio servers can reach the server through the mcp-remote bridge: npx -y mcp-remote https://app.anymail.watch/api/mcp.
Sign-in with OAuth#
The client opens anymail in the browser. Sign in, pick the Workspace and the Access, and press Allow. Read only lets the client call read tools only. Read and write also lets it create prospects, change campaigns and send email. The details of the flow are on Authentication.
Raw protocol#
To debug, call the server with curl. The transport requires the Accept header.
curl -s "https://app.anymail.watch/api/mcp" \
-H "Authorization: Bearer $ANYMAIL_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Call a tool with tools/call.
curl -s "https://app.anymail.watch/api/mcp" \
-H "Authorization: Bearer $ANYMAIL_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_domains","arguments":{}}}'
The server is stateless. A client does not need to call initialize first, the server issues no Mcp-Session-Id and each HTTP request is complete on its own.
Tools#
Each tool has a title and the annotations readOnlyHint, destructiveHint, idempotentHint and openWorldHint, so a client can ask for confirmation before a change. Each tool returns the JSON of the REST API as formatted text in content[0].text. When the response is a JSON object, the tool also returns it as structuredContent. The server validates the arguments (required fields, enum values, types) before it makes any HTTP call.
openWorldHint: true marks the tools that reach outside anymail: start_campaign and reply_to_message send email to real people, create_webhook sends events to a URL.
Campaigns#
| Tool | Calls | Annotations |
|---|---|---|
list_campaigns |
GET /campaigns |
read only |
get_campaign |
GET /campaigns/{id} |
read only |
get_campaign_stats |
GET /campaigns/{id}/stats |
read only |
list_campaign_prospects |
GET /campaigns/{id}/prospects |
read only |
create_campaign |
POST /campaigns |
write |
update_campaign |
PATCH /campaigns/{id} |
write, idempotent |
start_campaign |
POST /campaigns/{id}/start |
write, open world |
pause_campaign |
POST /campaigns/{id}/pause |
write, idempotent |
resume_campaign |
POST /campaigns/{id}/resume |
write, idempotent |
stop_campaign |
POST /campaigns/{id}/stop |
destructive |
delete_campaign |
DELETE /campaigns/{id} |
destructive |
enrol_prospects |
POST /campaigns/{id}/prospects |
write, idempotent |
Steps and variants#
| Tool | Calls | Annotations |
|---|---|---|
list_steps |
GET /campaigns/{id}/steps |
read only |
add_step |
POST /campaigns/{id}/steps |
write |
update_step |
PATCH /campaigns/{id}/steps/{step_id} |
write, idempotent |
delete_step |
DELETE /campaigns/{id}/steps/{step_id} |
destructive |
add_variant |
POST …/steps/{step_id}/variants |
write |
update_variant |
PATCH …/variants/{label} |
write, idempotent |
delete_variant |
DELETE …/variants/{label} |
destructive |
Prospects and companies#
| Tool | Calls | Annotations |
|---|---|---|
list_prospects |
GET /prospects |
read only |
search_prospects |
GET /prospects?q= |
read only |
get_prospect |
GET /prospects/{id} |
read only |
create_prospect |
POST /prospects |
write |
update_prospect |
PATCH /prospects/{id} |
write, idempotent |
delete_prospect |
DELETE /prospects/{id} with mode delete or anonymize |
destructive |
list_companies |
GET /companies |
read only |
get_company |
GET /companies/{id} |
read only |
Inbox and replies#
| Tool | Calls | Annotations |
|---|---|---|
list_inbox_messages |
GET /inbox/messages |
read only |
reply_to_message |
POST /inbox/messages/{id}/reply |
write, open world |
list_replies |
GET /replies |
read only |
classify_reply |
PATCH /replies/{id} |
write, idempotent |
Mailboxes, domains and workspace#
| Tool | Calls | Annotations |
|---|---|---|
list_mailboxes |
GET /mailboxes |
read only |
get_mailbox |
GET /mailboxes/{id} |
read only |
create_mailbox |
POST /mailboxes |
write, open world |
update_mailbox |
PATCH /mailboxes/{id} |
write, idempotent |
list_domains |
GET /domains |
read only |
list_workspaces |
GET /workspaces |
read only |
Suppressions, webhooks and offers#
| Tool | Calls | Annotations |
|---|---|---|
list_suppressions |
GET /suppressions |
read only |
add_suppression |
POST /suppressions |
write, idempotent |
delete_suppression |
DELETE /suppressions/{id} |
destructive |
list_webhooks |
GET /hooks |
read only |
create_webhook |
POST /hooks |
write, open world |
delete_webhook |
DELETE /hooks/{id} |
destructive |
create_offer |
POST /offers |
write, open world |
list_team |
GET /team |
read only |
list_offers |
GET /offers |
read only |
get_offer |
GET /offers/{id} |
read only |
The arguments of a tool are the parameters and body fields of its endpoint. Path ids are id, and step_id and label for steps and variants. tools/list returns the full JSON Schema with a description of each argument.
A tool that returns 204 from the API, such as delete_webhook or delete_campaign, returns the text Done (HTTP 204, no content). with structuredContent of {"ok": true, "status": 204}.
Prompts#
Prompts are ready-made tasks that a client shows as commands, for example /mcp__anymail__build_campaign in Claude Code. Each prompt is text built from the tools above.
| Prompt | Arguments | What it does |
|---|---|---|
build_campaign |
goal (required), prospects |
Checks mailboxes and domains, finds the audience, creates a draft with three plain-text steps, offers an A/B subject test and shows the sequence. It does not start the campaign until you say so. |
review_replies |
campaign_id |
Goes through unread messages, checks the classifications, drafts answers to interested people and sends only the ones you approve. |
campaign_report |
campaign_id (required) |
Reports the funnel, the results per step and variant, and up to three changes worth making. |
connect_mailbox |
email (required) |
Asks for the provider details and an app password, connects the mailbox after a connection test, then checks SPF, DKIM and DMARC of its domain and reminds you to warm it up. |
send_offer |
prospect (required), brief |
Finds the prospect, asks which salesperson the offer comes from, writes the offer as HTML, creates the link with send false for your review and sends only after you say so. |
Errors#
| Situation | What the client sees |
|---|---|
| No header, or a malformed, expired or revoked token | HTTP 401 with JSON {"error":"…"} and WWW-Authenticate: Bearer resource_metadata="https://app.anymail.watch/.well-known/oauth-protected-resource". An OAuth client starts the sign-in from here. |
| Rate limit exceeded | HTTP 429 with Retry-After in seconds. |
| Token check impossible because of a database outage | HTTP 500 with {"error":"Authentication is temporarily unavailable."}. |
GET /api/mcp |
HTTP 405 with Allow: POST, DELETE. |
| Missing or invalid tool arguments | A tool result with isError: true that explains the problem. The server makes no HTTP call. |
| A write tool with a read only token | A tool result with isError: true and HTTP 403 … insufficient_scope. |
The REST API answers 4xx or 5xx |
A tool result with isError: true and the text HTTP <status> from <METHOD> <path>: <API message> (code: <code>). A 429 adds Retry after N seconds. |
| The REST API cannot be reached, or it times out | A tool result with isError: true that says the API could not be reached. |
A tool failure is always a tool result and never a JSON-RPC protocol error, so the model can read the message and correct its input.
Limits#
- Rate limit. 60 requests per minute per token. One tool call uses two requests: the MCP request is authenticated with the same limiter, and the proxied REST call is the second. Plan for about 30 tool calls per minute per token.
tools/listcosts one request. - Request bodies. Up to 64 KiB, as in the REST API. Suppressions, hooks and reply classifications up to 4 KiB.
- Timeout. A proxied REST call stops after 20 seconds and returns a tool error.
- No sessions. The server has no sessions, no resumability and no server-initiated notifications.
- No resources. The server offers tools and prompts.
- Same reach as the REST API. See What the API does not do.