Skip to content

Connect Mailprompt to an MCP client

The Mailprompt MCP server exposes the same 36 tools as the Studio assistant: account overview, catalog, segments, flows, campaigns, email copy, images, coupons, forms, results, audits, suggestions and approval requests.

No tool sends email, takes a flow live or approves anything. A tool can create a draft and request approval; a person with the owner or admin role approves it in the app. Every tool that can cost credits takes confirm: true; without it the call is a dry run that changes nothing.

Hosted connector (OAuth)

The hosted server is a stateless Streamable HTTP endpoint at https://app.mailprompt.ai/api/mcp. It accepts POST only; a GET returns 405. Authentication is OAuth 2.1 with dynamic client registration, PKCE and a consent screen, so a client only ever holds a scoped token rather than an account key.

  1. Add https://app.mailprompt.ai/api/mcp as a connector in the client.
  2. The client discovers the authorization server from the protected-resource metadata and registers itself.
  3. Sign in to Mailprompt and approve the requested scopes. Only an owner or admin can authorize a connector.
  4. The client receives a one-hour access token and a rotating refresh token.

Clients request the read-only scopes by default: profiles:read, flows:read, campaigns:read, results:read. The authorization server advertises the full set below so a write scope can be granted deliberately.

ScopeUsed for
profiles:readReading account data.
profiles:writeCreating or changing drafts and data.
events:writeCreating or changing drafts and data.
lists:writeCreating or changing drafts and data.
flows:readReading account data.
flows:writeCreating or changing drafts and data.
campaigns:readReading account data.
campaigns:writeCreating or changing drafts and data.
results:readReading account data.
webhooks:readReading account data.
webhooks:writeCreating or changing drafts and data.

Revoking the connector in the client stops new tokens. An owner can also remove the client from the account. Each authorization emails the owner, so an unexpected connector is visible.

Local stdio package

The local server runs on your machine and proxies to the public API through the SDK. It reads MAILPROMPT_API_KEY and, optionally, MAILPROMPT_API_URL (default https://api.mailprompt.ai). A capability with no API endpoint answers tool_unavailable_in_stdio instead of pretending to work; use the hosted connector for those.

npx -y @mailprompt/mcp

Read-only keys are the safer default for a local client. A key with write scopes can create drafts, and a key with no approval capability still cannot approve.

Claude Desktop

Add the server to the Claude Desktop configuration file, then restart the app. On macOS the file is ~/Library/Application Support/Claude/claude_desktop_config.json; on Windows it is %APPDATA%\Claude\claude_desktop_config.json.

{
  "mcpServers": {
    "mailprompt": {
      "command": "npx",
      "args": ["-y", "@mailprompt/mcp"],
      "env": {
        "MAILPROMPT_API_KEY": "mp_live_your_key"
      }
    }
  }
}

Claude Code

Use the CLI to register the local server with its environment variable:

claude mcp add mailprompt \
  -e MAILPROMPT_API_KEY=mp_live_your_key \
  -- npx -y @mailprompt/mcp

Or add the hosted connector and complete the OAuth consent flow in the browser:

claude mcp add --transport http mailprompt https://app.mailprompt.ai/api/mcp

Cursor

Add the hosted connector to .cursor/mcp.json in the project (or the global Cursor config). Cursor opens the consent screen the first time the server is used.

{
  "mcpServers": {
    "mailprompt": {
      "url": "https://app.mailprompt.ai/api/mcp"
    }
  }
}

For the local package, use the same mcpServers block as Claude Desktop.

Tool list

Generated from the shared tool registry, so the list cannot drift from what the server actually exposes. 14 of 36 tools can cost credits and take a confirm flag.

ToolScopeCreditsDescription
get_account_overviewreadFreeRead the account profile, plan, credit balance, brand kit summary, catalog/profile counts, flows, campaigns, forms, stores and sending domains. Read-only and free.
crawl_sitewriteMay costCrawl the store homepage plus up to five same-origin pages (robots.txt respected, 2 MB per page) and rebuild the draft brand kit: logo, colours, fonts, voice sample, social links and postal address. The first crawl per account is free; later crawls cost 5 credits.
update_brand_kitwriteFreeUpdate the draft brand kit (name, logo, colours, fonts, voice). Existing fields are merged, not replaced. Free and never sets an email live.
list_productsreadFreeList catalog products for this store, filtered by search, stock, published state, collection, price range, sale, new arrivals, type or tag. Read-only and free.
list_collectionsreadFreeList collections and categories in this store, optionally filtered by title/handle, kind or published state. Read-only and free. Use the returned ids and URLs for collection links.
find_link_targetsreadFreeFind the best product and collection pages in this store to link to, ranked for an email intent and keywords. Returns URLs, ids, prices and plain-English reasons. Read-only and free. Call it before writing any link.
get_productreadFreeGet one catalog product by id, store id or handle, including variants, collections, stock and its last-30-day performance. Read-only and free.
get_collectionreadFreeGet one collection or category by id, store id or handle, with its URL, published state, in-stock product count, a few products and last-30-day performance. Read-only and free.
create_segmentaiMay costCreate a draft segment from a validated definition. Every referenced list, tag, metric, property, product, collection and segment is checked against this account and unknown names come back with the closest match. The deterministic plain-English summary is stored with it. Costs 1 credit and never emails anyone.
preview_segmentreadFreeValidate a proposed segment definition (or a saved segmentId) and return the plain-English summary, a real count, ten sample profiles with masked emails, and validation errors with the closest matching name. Read-only and free. Uses a 5 second statement timeout and reports slow: true instead of hanging.
preview_segment_countreadFreeCount the profiles a saved segment (segmentId) or a proposed segment definition would match. Read-only and free. Prefer preview_segment: it also returns the summary and masked samples. Above 5,000 profiles a send needs human approval.
describe_audiencereadFreeDescribe this account's real audience catalog: profile counts by consent, lists, tags, metrics seen in the last year with their top event properties, profile properties with fill rate and samples, collections, top products by orders, spend percentiles and order-count distribution. Call this before building a segment. Cached 10 minutes and free.
update_segmentaiMay costSave a new version of an existing segment. When a live flow or a scheduled campaign uses the segment, the change is stored as a pending human approval instead of being applied. Costs 1 credit.
explain_segmentreadFreeExplain a segment in plain English and why one person is or is not in it, condition by condition. Read-only and free. Use the customer's email or a profile id from preview_segment.
suggest_segmentsreadFreeReturn the built-in segment recipes that fit this account and have at least 20 real people (VIP, repeat buyers, win-back, cart abandoners, inactive, birthday, local and more), each with its definition, plain-English summary and count. Read-only and free.
create_listwriteFreeCreate a contact list (a group people join from a form, checkout, import or manual addition). A list records consent; it is not a rule. Free.
add_to_listwriteFreeAdd people to a list from explicit emails/profile ids, a segment snapshot or an import. Never grants marketing consent without evidence: pass consentEvidence with consented: true only when the source really captured it (form, confirmed import column, store opt-in); otherwise people stay never_subscribed and the response says so. Adding 1,000 or more people requires human approval. Free.
remove_from_listwriteFreeSoft-remove people from a list. This does not unsubscribe them and does not delete their consent evidence. Free.
import_contactswriteFreeImport up to 5,000 contacts as profiles (consent status and timestamp preserved) and optionally add them to a list. Above 1,000 contacts the import needs a human approval: the tool returns the exact snapshot to pass to request_approval, then accepts approvalId. Free.
create_flowaiMay costCreate a DRAFT flow (never live) from a trigger, audience and 1-50 steps. Every send step must reference an existing draft email document. Costs 10 credits. Going live needs a human approval.
update_flow_stepwriteMay costReplace one step in a DRAFT flow by dot path (e.g. "0", "2.then.1"). Live flows refuse the edit: their changes need a human approval through request_approval. Costs 1 credit.
create_campaignaiMay costCreate a DRAFT campaign from an existing email document and optional segment/schedule. Never sends; sending needs a human approval. Costs 5 credits.
write_emailaiMay costWrite a complete draft email block document from a brief, using the brand kit, real catalog product ids and coupon rule ids. Validates the contract, repairs once on a validation error, renders it and returns the pre-send + guardrail checks. Costs 1 credit. Never sends.
rewrite_copyaiMay costRewrite a piece of email copy to a given instruction and tone. Returns plain text only. Costs 1 credit.
generate_subject_linesaiMay costGenerate 1-10 subject-line options for a brief or an existing draft. Returns plain strings. Costs 1 credit.
generate_imageaiMay costGenerate a hero/lifestyle image, or a product scene that MUST start from a real catalog photo. Stored in our own storage and returned as our URL, never a provider URL. Costs 3 credits (fast) or 10 (premium/product scene).
generate_image_from_attachmentaiMay costGenerate or edit an image from an image the user attached. Use this for "make a lifestyle shot of this product" and "generate an image like this". Costs 3 credits (fast) or 10 (premium/product scene). The source attachment must exist in this account.
upload_attachmentwriteFreeUpload an image (base64, at most 10 MB, or a public https URL fetched through the SSRF guard) and return its attachmentId. Uploading is free. Use the id with tools that accept an attachmentId.
create_coupon_rulewriteFreeCreate a coupon rule (percentage or fixed amount off) that emails can reference. Never issues or sends a code. Free.
create_formaiMay costCreate a DRAFT signup form (popup, flyout, embed, full page, spin-to-win) with AI-written copy from a brief, or explicit copy, plus display targeting. Never publishes the form. Costs 1 credit when a brief is used, otherwise free.
get_resultsreadFreeRead sent/opened/clicked counts, click-based attributed revenue and order counts for the last N days, optionally filtered to one flow or campaign. Read-only and free.
explain_resultsaiMay costExplain the numbers from get_results in plain language, with a concrete suggested next step. Never invents causes. Costs 1 credit.
run_auditreadFreeRun the free account audit: signup form and popup presence, SPF/DMARC/DKIM, and missing welcome/abandonment/browse/winback flows. Returns a 0-100 score and a fixable list. Free.
suggest_this_weekaiMay costProduce 3-5 draft suggestions for what to send this week, based on real store data (best sellers, stock, flow gaps, recent campaign results). Creates Suggestion rows, never a campaign or send. Costs 1 credit.
request_approvalapprovalsFreeCreate a pending Approval with a snapshot for a human OWNER/ADMIN to approve: taking a draft flow live, changing a live flow, sending a campaign or importing over 1,000 contacts. This is the ONLY tool that touches approvals, and it cannot approve anything itself. A campaign send approval already shows its recipient count, so it is the single human gate for a large audience. Failing guardrails block the request. Free.
get_deliverabilityreadFreeRead sending-domain status and health, account pause/warm-up state, and recent bounce and complaint counts. Read-only and free.