MailClanker · Docs · REST API

MCP server

Run your newsletter from Claude, Cursor or any client that speaks the Model Context Protocol: “draft this week's issue from my changelog”, “how did the last issue do?”, “add these three beta users”.

1. Create an API key

In API keys, create a key for the agent with only read (to look) and write (to draft, test, manage subscribers and ask for sends). The server is at:

https://mailclanker.com/api/mcp

Never give an agent a key with the send scope. A send-scoped key can email your subscribers through the REST API with no approval step, so the MCP server refuses it (403 send_scope_not_allowed). Agents ask for sends with request_send and a person approves them.

Streamable HTTP transport, authenticated with Authorization: Bearer pk_live_… (the same keys, scopes and 60 requests a minute as the REST API).

2. Connect your client

Claude Code

claude mcp add --transport http newsletter https://mailclanker.com/api/mcp --header "Authorization: Bearer pk_live_xxx"

Claude Desktop

Add a custom connector with the URL above if your plan supports remote connectors with headers. Otherwise add this to claude_desktop_config.json (Settings → Developer → Edit config):

{
  "mcpServers": {
    "newsletter": {
      "type": "http",
      "url": "https://mailclanker.com/api/mcp",
      "headers": {
        "Authorization": "Bearer pk_live_xxx"
      }
    }
  }
}

Older Desktop versions that only run local servers can bridge with mcp-remote:

{
  "mcpServers": {
    "newsletter": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mailclanker.com/api/mcp",
        "--header",
        "Authorization:Bearer ${API_KEY}"
      ],
      "env": {
        "API_KEY": "pk_live_xxx"
      }
    }
  }
}

Cursor

In ~/.cursor/mcp.json (or .cursor/mcp.json in a project):

{
  "mcpServers": {
    "newsletter": {
      "url": "https://mailclanker.com/api/mcp",
      "headers": {
        "Authorization": "Bearer pk_live_xxx"
      }
    }
  }
}

Other clients and the MCP Inspector

Any client with Streamable HTTP and custom headers works. To try the tools by hand:

npx @modelcontextprotocol/inspector --cli https://mailclanker.com/api/mcp --transport http \
  --header "Authorization: Bearer pk_live_xxx" --method tools/list

3. How sending works: always with a person's approval

Agents can be tricked by text they read (prompt injection) or simply make mistakes, so an agent can never send to your subscribers on its own:

  1. The agent drafts, runs the pre-send check and sends test emails (to workspace members only).
  2. request_send does not send. It checks the post and emails your workspace's owners and admins a link to review it, with the subject, a preview, the number of recipients and the credit cost. It also shows under Approvals.
  3. An owner or admin, signed in, clicks Approve & send. Only then does the normal send run, as that person: credits are reserved, the pre-send check and sending limits apply.
  4. If the post changes after the request (an edit by anyone, or publishing it), the request is cancelled and a new one is needed. Links expire after 72 hours.

Posts an agent created or edited also can't be scheduled or put on the public web archive with an API key until a person has approved them. API keys and agents can never change sending domains, delete newsletters, export subscriber lists, change billing or safety settings.

Tools

Every call is logged in your workspace's audit log. Results are compact JSON plus a one-line summary. Resource: newsletter://{newsletter_id}/posts/{post_id} (Markdown). Prompts: write_weekly_issue, repurpose_blog_post.

list_newslettersscope: readREST: GET /api/v1/newsletters

List the newsletters in this workspace with their id, name, slug and number of active subscribers. Call this first to get a newsletter_id for the other tools.

No fields.

get_accountscope: readREST: GET /api/v1/account

Account status (trial, active, review, suspended), credit balance (1 credit = 1 email; AI features cost credits) and how many campaign emails can still be sent today.

No fields.

list_postsscope: readREST: GET /api/v1/newsletters/{id}/posts

Recent posts (issues) of a newsletter, newest first, with status (draft, scheduled, sending, sent, …), approval status and key stats for sent posts. Use get_post for the content.

FieldTypeNotes
newsletter_id *string (uuid)
status"draft" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed"Only posts with this status
limitinteger (1–100) Default: 20.
cursorstring (max 300 chars)next_cursor from a previous call
get_postscope: readREST: GET /api/v1/posts/{id}

One post: title, subject, preview text, Markdown content, status, approval status, the latest pre-send check and stats totals.

FieldTypeNotes
post_id *string (uuid)
create_draftscope: writeREST: POST /api/v1/newsletters/{id}/posts

Create a draft post from Markdown. Nothing is sent. Returns the post and a dashboard_url where a person can review it. Content: Markdown (CommonMark + ~~strike~~; no raw HTML). Extra blocks on their own line: ::button[Label](https://url) and ::embed[Title](https://url "https://thumbnail"). Merge tags: {{first_name|fallback}}, {{name}}, {{email}}, {{custom.field}}.

FieldTypeNotes
newsletter_id *string (uuid)
title *stringInternal title; also used for the web archive URL
subject *stringEmail subject line
preview_textstringInbox preview text
content_markdown *stringThe email body as Markdown
slugstringWeb archive URL slug (generated from the title if omitted)
publish_to_webbooleanPut it on the public archive once sent
update_draftscope: writeREST: PATCH /api/v1/posts/{id}

Change a draft (drafts only). Send only the fields to change. Any change cancels an open send request; ask again with request_send. Content: Markdown (CommonMark + ~~strike~~; no raw HTML). Extra blocks on their own line: ::button[Label](https://url) and ::embed[Title](https://url "https://thumbnail"). Merge tags: {{first_name|fallback}}, {{name}}, {{email}}, {{custom.field}}.

FieldTypeNotes
post_id *string (uuid)
titlestring
subjectstring
preview_textstring
content_markdownstring
slugstring
publish_to_webboolean
revisionintegerThe revision you last read; refused if the post changed since
generate_draftscope: write

Write a draft with the built-in AI writer from notes or a public web page (e.g. a changelog or blog post) and save it as a draft. Costs 500 credits. Nothing is sent. Give either notes or source_url.

FieldTypeNotes
newsletter_id *string (uuid)
notesstringBullet points or rough notes to write from
source_urlstringA public http(s) page to write from
tonestring (max 200 chars)e.g. friendly, concise, technical
run_precheckscope: writeREST: POST /api/v1/posts/{id}/precheck

Run the pre-send check on a post's saved content: compliance (footer, postal address), spam and phishing patterns, links, merge tags. Returns pass/warn/blocked, a score and issues with fixes. The AI part costs 20 credits; re-running on unchanged content is free.

FieldTypeNotes
post_id *string (uuid)
send_testscope: writeREST: POST /api/v1/posts/{id}/test

Email a test of the post (subject prefixed [Test]) to workspace members only. Without emails it goes to the person who created this API key. Max 5 recipients per call, 50 per day. Free.

FieldTypeNotes
post_id *string (uuid)
emailsstring[]Workspace members' addresses; default: the API key creator
request_sendscope: write

Ask a person to approve sending a draft to the newsletter's subscribers. This does NOT send. It checks the post (pre-send check, sending domain, audience), then emails the workspace owners and admins an approval link and returns that link, the recipient count and the credit cost. The send starts only after an owner or admin approves it. Any later edit cancels the request.

FieldTypeNotes
post_id *string (uuid)
send_atstring (date-time)ISO 8601 time to send once approved; omit to send as soon as it's approved
get_post_statsscope: readREST: GET /api/v1/posts/{id}/stats

Results of a sent post: totals (sent, delivered, bounced, complaints, unsubscribes, unique opens and clicks), rates, clicks per link and a plain-English summary. Opens are approximate.

FieldTypeNotes
post_id *string (uuid)
summarize_performancescope: read

AI summary of a newsletter's subscriber growth and engagement over the last `days` days (default 30), with one suggestion. Costs 120 credits.

FieldTypeNotes
newsletter_id *string (uuid)
daysinteger (7–365) Default: 30.
add_subscriberscope: writeREST: POST /api/v1/newsletters/{id}/subscribers

Add one subscriber. Always uses double opt-in: they get a confirmation email and only receive the newsletter after confirming. The newsletter needs a verified sending domain (the confirmation is sent from it), and confirmation emails have a daily limit per workspace. Adding an existing address returns it unchanged; suppressed addresses (unsubscribed, bounced, complained) are refused.

FieldTypeNotes
newsletter_id *string (uuid)
email *string
first_namestring
tagsstring[]
search_subscribersscope: readREST: GET /api/v1/newsletters/{id}/subscribers

Find subscribers of a newsletter by a text query (matches email and names), status and/or tag. At most 50 results; this is not an export.

FieldTypeNotes
newsletter_id *string (uuid)
querystring (max 200 chars)
status"pending" | "active" | "unsubscribed" | "bounced" | "complained"
tagstring (max 100 chars)
limitinteger (1–50) Default: 20.
unsubscribe_subscriberscope: writeREST: POST /api/v1/subscribers/{id}/unsubscribe

Unsubscribe someone (they stop receiving the newsletter and are added to its suppression list). Give subscriber_id, or newsletter_id and email.

FieldTypeNotes
subscriber_idstring (uuid)
newsletter_idstring (uuid)
emailstring