Overview
Mailchimp campaign management. Draft, test, and send email campaigns, manage audiences and subscribers, and review post-send analytics, with optional local image and template directories for authoring.
Tools
Resources
All resource data is also reachable through tools; audiences and campaigns are listed with each tool's list operation.
Prompts
Design reference: docs/email-design-playbook.md.
Capability reference
mailchimp_account tool
operation: inforeturns profile, plan, data center, total subscribers, and industry benchmarks;operation: activity-feedreturns Chimp Chatter events, paged bycount(max 100, default 20) andoffset- An empty activity feed carries a
notenaming the likely causes
mailchimp_audiences tool
- Operations:
list,get,create,update, the analytics readslist-activity,list-growth,list-clients,list-abuse-reports,list-locations, andget-signup-forms/customize-signup-forms(takessignupFormConfig); every operation exceptlistandcreateneedsaudienceId createrequiresname,contact(company,address1,city,state,zip,country),permissionReminder, andcampaignDefaults(fromName,fromEmail,language)
mailchimp_audience_overview tool
audienceIdplusgrowthMonths(1–36, default 12); returns info, stats, contact, campaign defaults, growth history, top email clients, and the merge-field schemanotes[]explains empty growth or email-client arrays, separating "no data yet" from zero engagement
mailchimp_subscribers tool
audienceIdon every call andemailon every operation exceptlist(filterable bystatus); operations:list,get,update,archive,list-tags,set-tags,list-notes/add-note/update-note/delete-note(bynoteId), andlist-activity/list-events/list-goals- Addresses are trimmed and rejected if the local or domain part is missing; an empty
listemail stays unfiltered.updatetosubscribedasks for confirmation when resuming a subscription; already-subscribed members are left as they are set-tagsis declarative:tagsbecomes the full active set and every other tag is removed unless named inpreserveTags(static-segment membership is stored as a tag). ReturnstagsAdded,tagsRemoved, andtagsActive
mailchimp_upsert_subscriber tool
audienceId,email, andstatusrequired; optionalmergeFields,tags+preserveTags(same declarative sync asset-tags),note,vip,language;updateExistingStatus: falseappliesstatusto new records only- Returns
isNew, the resultingstatus,tagsAdded/tagsRemoved/tagsFinal,noteAttached, andwebUrl status: "pending"uses Mailchimp's double opt-in flow. New or resumedsubscribedstatus asks for confirmation of documented consent before anything is written; declining writes nothing. Already-subscribed updates andupdateExistingStatus: falsekeep the existing status without asking
mailchimp_find_subscriber tool
emailaccepts an address or free-form search fragment, including a fragment without@, scoped to oneaudienceIdor, when omitted, every audience on the account (echoed assearchedAcross)- Returns
exactMatchesandfuzzyMatcheswith merge fields and stats;includeTags(defaulttrue) adds each match's tags at one extra call per match
mailchimp_import_subscribers tool
audienceIdand 1–500subscribersrows per call;statusdefaults topending(double opt-in) and a per-rowstatusoverrides it;updateExistingdefaults tofalse, so existing records are skipped- Any row that would be
subscribedneeds one confirmation before the whole batch writes; declining writes nothing. Pending-only imports need none - Returns
totalCreated,totalUpdated,errorCount, and per-rowsucceededandfailedentries; incomplete addresses fail asinvalid_email, and a batch with no valid rows makes no upstream request
mailchimp_segments tool
audienceIdon every call andsegmentIdon every operation exceptlist(filterable bytype:saved,static,fuzzy) andcreate;create/updatetakename,staticEmails, or saved-segmentoptionsbatch-update-membersappliesmembersToAdd/membersToRemoveto a static segment and returnsadded,removed, and per-emailerrors- Free plans get static and basic saved segments; advanced conditions need Premium and fail as
mailchimp_forbidden
mailchimp_merge_fields tool
list,get,create,update;createrequiresname,tag(10 characters max), andtype;get/updatetakemergeIdoptionscarries type-specific config:choicesfordropdown/radio,date_formatfordate/birthday,phone_formatforphone
mailchimp_campaigns tool
- Operations:
list(filter bystatus,listId,sinceSendTime/beforeSendTime),get,create(typeofregular/plaintext/rss, plusrecipientsandsettings),update,replicate,get-content,set-content,get-checklist,cancel-send,create-resend,pause-rss,resume-rss; all butlistandcreatetakecampaignId set-contentacceptshtml,plainText,templateId+templateSections,archiveContent,url, orlocalTemplate(exclusive withhtmlandtemplateId);get-checklistreturnsisReadyand typed itemsget-contentacceptsvariant: html | plainText | archiveHtml | all(defaultall); empty bodies are omitted- No send, test, schedule, or delete here; dispatch goes through
mailchimp_send_campaignormailchimp_replicate_campaign
mailchimp_send_campaign tool
audienceId,subject,fromName,replyTo, andcontent(at least one ofhtml,plainText,templateId,localTemplate) required;modeisdraft(default),test(needstestEmails, max 50),send, orschedule(needsscheduleTimeat least 15 minutes out)- Returns
campaignId, the effectivemode,status,recipientCount,webUrl, and non-blockingchecklistWarnings; blocking checklist errors throwpre_send_checklist_failedoutsidedraft, andcleanupOnError(defaulttrue) deletes the draft after a mid-flow failure sendandschedulerequireconfirmSend: true, then a single-use confirmation prompt before any campaign is created; declining leaves a draft and setscancelledByUser. Changed content or a replay asks again, and creation is never retried after an ambiguous upstream failure
mailchimp_replicate_campaign tool
sourceCampaignIdplus optionalsubjectOverride,previewTextOverride,fromNameOverride,replyToOverride,titleOverride,audienceOverride,segmentOverride, andcontentOverride;mode,testEmails,scheduleTime, andcleanupOnErrorwork as inmailchimp_send_campaign- Returns the new
campaignId,overridesApplied[], and the same status, checklist, andcancelledByUserfields - Same
confirmSend: trueplus confirmation-prompt gate forsendandschedule
mailchimp_reports tool
list(filter bytype,sinceSendTime/beforeSendTime),get, orslicewith acampaignIdand adimension:abuse-reports,advice,click-details(one URL vialinkId),open-details(one member viasubscriberHash),domain-performance,eepurl,email-activity,locations,sent-to,unsubscribedslicereturnsrowsshaped by the dimension plustotalItems;getthrowscampaign_not_sentfor a campaign with no send
mailchimp_campaign_report tool
campaignIdplusincludeTopN(1–100, default 10) rows per slice- Returns
delivery(delivered, bounces by type, abuse reports),engagement(opens, clicks, unsubscribes),topClickedLinks,topLocations,recentUnsubscribes, andindustryBenchmarkswhen Mailchimp has them; throwscampaign_not_sentfor a campaign with no send
mailchimp_templates tool
list(filter bytypeofuser/base/gallery,category,folderId),get,get-default-content,create,update, anddelete;updateaccepts onlyname,html, andfolderId, so per-section edits go through a campaign'stemplateSections- Reads of
baseandusertemplates work on free plans; writes andgalleryreads need a paid plan and fail asmailchimp_forbidden.mailchimp_local_templatesis the authoring path on every plan
mailchimp_files tool
list(filter bytype,folderId,sinceCreatedAt/beforeCreatedAt),get,upload(namewith extension plus base64fileData, nodata:prefix),update(rename, or move withfolderId,0for root),delete, and read-onlylist-folders/get-folder; uploads cap at 1 MB per image and 10 MB per other file, and.webp/.avifare not accepteduploadandgetreturnfullSizeUrl, the public CDN URL to embed in campaign HTML;listaddstotalFileSizeInBytes
mailchimp_search tool
scope(membersorcampaigns) andquery;audienceIdnarrows a member search;includeTopN(1–100, default 10) caps each result array- Members return as
exactandfuzzywith upstreamtotalExact/totalFuzzy; campaigns asmatcheswith asnippetandtotalMatches; an empty result carries anote
mailchimp_assets tool
list,info(byrelPath; returnssha256and anycachedupload),sync(uploads uncached files ahead of a send; returnsuploaded,cached, andskippedwith reasons), andclear-cache@assets/<path>references in content passed tomailchimp_send_campaign,mailchimp_replicate_campaign, ormailchimp_campaignsset-contentupload to File Manager and are rewritten to CDN URLs. Uploads are cached by SHA-256 in<assetsDir>/.mailchimp-cache.json; oversize files and paths outside the directory are rejected before upload- Listed only when
MAILCHIMP_ASSETS_DIRis set
mailchimp_local_templates tool
list,get(source plus parsed metadata),render-preview(nameplusvars; returns HTML, sends nothing), andseed-from-mailchimp(writes Mailchimp templatemailchimpTemplateIdto disk asname)- Templates are
.etafiles with optional YAML frontmatter forsubject,previewText, andvars; a declared var left unsupplied fails the render. Campaign tools render one viacontent.localTemplate+content.localTemplateVars, exclusive withhtmlandtemplateId. Example templates - Listed only when
MAILCHIMP_TEMPLATES_DIRis set
mailchimp_playbook tool
topic:send,post-send-review,deliverability,list-hygiene,onboarding,subscriber-triage, ordesign-campaign;audienceIdforsend/list-hygiene/design-campaign,campaignIdforpost-send-review,emailforsubscriber-triage- Returns markdown
instructionstuned to live numbers, aliveStatesnapshot, andnextToolSuggestionswith pre-filled inputs; makes no writes
mailchimp://account resource
- No parameters;
application/jsonwith profile, plan, data center, total subscribers, andfetchedAt - Same data as
mailchimp_accountoperation: info
mailchimp://audiences/{audienceId} resource
- Name, contact, stats, campaign defaults, permission reminder, double opt-in status, and subscribe URL
audienceIdcomes frommailchimp_audiencesoperation: list
mailchimp://campaigns/{campaignId} resource
- Status, settings, recipients, tracking, and report summary
campaignIdcomes frommailchimp_campaignsoperation: list
mailchimp://campaigns/{campaignId}/report resource
- Emails sent, bounces, opens, clicks, unsubscribes, abuse reports, and industry stats
- Fails with a validation error until the campaign has been sent
newsletter_from_source prompt
- Arguments:
source(URL or free-form brief) required;audienceIdandseasonalContextoptional - Returns one user message that chains
mailchimp_playbook(topic: design-campaign) into an HTML draft, then draft, test, and send viamailchimp_send_campaign
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Mailchimp-specific:
- Marketing API v3 client that derives the API host and data center from the key's
-<dc>suffix, with retries, a process-wide concurrency limit (MAILCHIMP_CONCURRENCY_LIMIT), and a cooldown after a 429 - Send gates: campaigns default to
draft,send/scheduleneedconfirmSend: trueplus a confirmation prompt, and new or resumedsubscribedsubscriptions need confirmation too; imports default topending - No irreversible deletes: removing audiences, merge fields, or campaigns, and permanently deleting subscribers, stay in the Mailchimp UI;
archiveis the strongest subscriber removal - Local authoring:
@assets/<path>files upload and rewrite at send time, and.etatemplates render locally, which covers free plans where the Templates API is read-only - List operations page with
count(max 1000) andoffset
Agent-friendly output:
- Explained empties:
note/notes[]on empty activity feeds, audience overviews, and searches say whether data is missing or genuinely zero - Partial failure:
mailchimp_import_subscribersandmailchimp_segmentsbatch-update-membersreturn per-row successes and errors instead of failing the batch - Discriminated outputs:
operation,dimension, andmodesay which fields are populated;isNewandcancelledByUserreport what actually happened - Typed errors: every declared reason (
campaign_not_sent,pre_send_checklist_failed,mailchimp_forbidden, …) carries a recovery hint for the caller's next move
Getting started
Add the following to your MCP client configuration file. See docs/api-key.md for how to generate a Mailchimp API key.
{
"mcpServers": {
"mailchimp-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/mailchimp-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"MAILCHIMP_API_KEY": "your-key-with-dc-suffix-e.g.-us22"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"mailchimp-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/mailchimp-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"MAILCHIMP_API_KEY": "your-key-with-dc-suffix-e.g.-us22"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"mailchimp-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "MAILCHIMP_API_KEY=your-key-with-dc-suffix-e.g.-us22",
"ghcr.io/cyanheads/mailchimp-mcp-server:latest"
]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 MAILCHIMP_API_KEY=... bun run start:http
# Server listens at http://localhost:3010/mcp
Prerequisites
- Bun v1.4.0 or higher (or Node.js v24+).
- A Mailchimp Marketing API key. Its
-dcsuffix (e.g.-us22) identifies your data center and is parsed at startup.
Installation
- Clone the repository:
git clone https://github.com/cyanheads/mailchimp-mcp-server.git
- Navigate into the directory:
cd mailchimp-mcp-server
- Install dependencies:
bun install
- Configure environment:
cp .env.example .env
# edit .env and set MAILCHIMP_API_KEY
Configuration
See .env.example for the full list of optional overrides.
Running the server
Local development
-
Watch mode (transport via
MCP_TRANSPORT_TYPE):bun run dev # stdio (default) MCP_TRANSPORT_TYPE=http bun run dev # http -
Build and run:
bun run rebuild bun run start:stdio # or bun run start:http -
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t mailchimp-mcp-server .
docker run --rm -e MAILCHIMP_API_KEY=your-key-us22 -p 3010:3010 mailchimp-mcp-server
The Dockerfile defaults to HTTP transport, stateful session mode, and logs to /var/log/mailchimp-mcp-server. OpenTelemetry peer dependencies are installed by default; build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor request-scoped logging - Register new tools and resources via the barrels in
src/mcp-server/*/definitions/index.ts - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
License
Apache-2.0 — see LICENSE for details.