Skip to main content
Migma MCP lets agents work with your Migma brands from an editor or agent client. Agents can prepare emails, fetch email IDs, validate output, create campaign drafts, send tests, export approved emails, manage contacts, and inspect results. For Grok Bot desktop, follow the Grok Bot connection guide to connect Migma, approve access in your browser, and verify your brand with a read-only request.
Remote MCP is available at https://migma.ai/mcp over Streamable HTTP. Add this URL. Your client opens Migma so you can sign in, approve access, and complete credential exchange through OAuth.

Where this lives in Migma

Open My Brands, choose a brand, then open Tools. The app /mcp route redirects to the active brand’s Tools page. OAuth and CLI keys appear in Settings → Developers → API Keys, where you can revoke them.

Choose connection type

Remote MCP

Tool profiles

https://migma.ai/mcp provides the OpenAI profile: email and brand workflows, contacts, sending-domain setup, existing domain history, and account credit reads. It excludes domain shopping and subscription checkout. For domain shopping or subscription management in a general MCP client, connect with https://migma.ai/mcp?profile=general. Local MCP also provides these tools. Both hosted profiles use the same OAuth flow and permission checks. Refresh your client’s tool list after changing its URL. Use this path for clients that support OAuth connection, such as claude.ai custom connectors.
  1. Add Migma as a custom connector with https://migma.ai/mcp.
  2. Follow the client sign-in flow. It opens Migma so you can review and approve access.
  3. On migma.ai/connect/authorize, check the app name, return host, and requested scopes. email:send permits test/direct sends. campaign:write permits campaign creation, send, and schedule. Migma marks both as delivery access.
  4. Approve the connection. Migma gives the client a scoped API key automatically, so there is no key to copy or paste.
OAuth-created keys appear in Settings → Developers → API Keys and can be revoked there.

Claim-code fallback

If a direct client cannot complete an OAuth redirect/callback, fetch https://api.migma.ai/auth.md. The agent shows a claim link, you review and approve scopes in Migma, and the agent polls for its credential. Use claim-code only when the direct client can keep claim_token and the returned credential out of chat, logs, shell history, and shared files. It does not repair a hosted connector whose OAuth callback failed. Do not send an interactive user to Settings to copy a key.

CI and server automation

Manual bearer configuration remains available for CI, cron, or server automation:
Do not put API keys in URLs. Send them through the documented authorization header.

Local MCP

Local MCP is available with npx -y @migma/mcp. Use it only when the client requires a command-based server. Run migma login first (the package reads ~/.migma/config.json), or set MIGMA_API_KEY for CI.
Optional environment variable:
Use MIGMA_PROJECT_ID only for Local MCP when one brand is the default. Remote MCP clients should call migma_list_projects and pass projectId. Remote MCP clients discover brands with migma_list_projects, then pass projectId. For Claude CLI, add the local server with:

Client setup

Cursor

Add Migma MCP to Cursor.

Claude

Connect Claude.ai, Claude Code, or Claude Desktop. Visual setup: Claude tutorial.

ChatGPT

Use the public Migma plugin. Visual setup: ChatGPT tutorial.

Grok

Ask Grok Bot to add Migma Remote MCP, or connect Grok web and Grok Build directly.

Copilot

Connect GitHub Copilot to Migma MCP.

Codex CLI

Add Migma MCP to Codex CLI.

Windsurf

Connect Migma MCP to Windsurf.

Antigravity

Add Migma MCP to Google Antigravity.

Raycast

Use Migma MCP from Raycast AI.

VS Code

Connect Migma MCP to VS Code.

Verify the connection

Ask your client to show your Migma context. migma_get_context returns your workspaces, brands, plan and credits, sending domains, and suggested next actions in one call — pass a workspace id as organizationId to migma_list_projects to work in another workspace. Agents can still use migma_get_capabilities on their own when they need the tool catalog, write/read rules, or guided workflows.

Common workflows

Design emails (show drafts first)

  1. Reuse the working brand and supplied brief or reference. List brands and choose projectId only when needed; ask only for missing required details. Audience and sending-domain setup are not needed for drafts.
  2. For researched work, build an exact source-backed fact checklist. Pass required facts in the prompt and up to five public HTTPS source-image URLs through structured images; prompt-only URLs are not image inputs.
  3. Create or design with one migma_generate_email call (load that tool by exact name). For several emails pass count (max 12) and name each email’s job in the prompt. Do not call generate once per email. Then poll migma_get_generation_status. Existing HTML or .eml uses migma_import_html instead of generate.
  4. Show returned preview images and each canvas link immediately.
  5. After first show, verify every required fact and source image before claiming success. If a preview cannot be attached, show its canvas link and say visual verification is incomplete.
  6. After the first preview, handle requested edits, inbox checks, or campaign setup. Do not run validate or edit tools before that first show. Text-only edit cannot add structured source images; that requires replacement generation.
  7. Run migma_validate_* when the user asks for checks, or as a last step before send.

Edit an email

migma_edit_email starts a queued edit and returns its IDs and status promptly. It keeps the existing emailId, prompt, label, and includeHtml arguments, and adds optional idempotency_key. The tool requires both email:write and email:read. includeHtml on the start call reminds the agent to request HTML on the subsequent status call; it does not make the start call wait.
These queued-edit tools require an MCP build that includes them. If they are missing after refreshing the client’s tool list, use the REST API: POST /v1/emails/{emailId}/edit with async: true and a stable Idempotency-Key, then poll GET /v1/emails/{emailId}/edits/{editId}.
  1. Call migma_edit_email once with the target emailId and prompt. Keep the same idempotency_key if the start result is uncertain.
  2. Poll the read-only migma_get_email_edit_status tool with emailId, editId, and optional includeHtml.
  3. Use that tool’s exact job status. Do not use conversation generation status to decide that the edit finished; a previous conversation turn may already be completed.
  4. Never resubmit an edit while it is pending or processing. On failure, inspect the stored email before starting another edit because changes may have been saved.
  5. When the status is completed, show the returned preview.
The edit worker does not automatically retry the rewrite after a failure or stall. Total time depends on section and image complexity, provider behavior, and retries; there is no fixed maximum edit latency.

Convert existing HTML

  1. List brands and choose projectId.
  2. Call migma_import_html once with the HTML or .eml source (or htmls for several files). Optional instruction: keep it as-is, or apply the brand.
  3. Poll migma_get_generation_status, then show preview images and each canvas link.
  4. Each result is one canvas slot with its own emailId. Edit, send, and export use that id.

Save brand facts

  • Call migma_add_knowledge_base when the user shares lasting facts (tone, products, offers, policies). Do not list first.

Favorite an email for future designs

When the user says “I like this design,” “favorite this email,” or “save this style,” call migma_save_reference with the exact email they chose:
Use the ID already returned by generation status or migma_list_emails for the working brand. For a series, choose one slot’s emailId, not conversationId. Ask which email only when unclear. No HTML fetch, re-import, or duplicate knowledge-base entry is needed. The tool requires project:write and sets the favorite to true. Retrying that same emailId is safe. Confirm only after the response contains favorite: true. Future generation for the same brand uses saved references by default unless disabled, and later saved edits to the favorite update the reference. A favorite is design guidance; current facts and send approval remain separate. For an external email, the same tool accepts projectId + title + html, with an optional screenshotUrl. This creates a reference entry, so it does not share the favorite mode’s safe-repeat behavior. A screenshot alone cannot be saved through this tool. Check migma_get_capabilities if the tool is missing; it may require project:write access or refreshing the client’s cached tools.

Import a CSV audience

  • Call migma_create_contact_import once with the full CSV text and an optional list tag.
  • Leave column mapping empty when headers look like email, first name, or last name.
  • Prefer this over converting CSV rows into a JSON bulk import.
  • The import can wait and return final counts in the same turn.

Import from Klaviyo, Mailchimp, or HubSpot

  • Call migma_list_provider_import_sources with the brand and provider to list audiences, lists, segments, and tags.
  • Call migma_import_contacts_from_provider with one to 25 sources and an optional consentMode (subscribed-only by default).
  • The tool can wait up to 45 seconds, then poll migma_get_contact_import for final counts, tag and segment IDs, and non_sendable contacts.

Export unsubscribers and reconcile a connected store

These workflows require a server release with the tools below. If tools are missing, refresh the client’s catalog and check granted scopes. Connected-store tools are available in the general profile (?profile=general).
  1. Choose the brand, then call migma_create_contact_export with filters: {status: "unsubscribed"} and a stable idempotency_key. Optional saved segment and grouped filters narrow the audience. This requires audience:read.
  2. Poll migma_get_contact_export with the returned jobId and projectId. Only completed includes a private CSV download URL and actual exported count. Queued work is not a finished export; failure is not an empty audience.
  3. The URL expires in one hour. Poll the same job for a fresh URL while it is retained, up to seven days. Retrying creation with the same key and body finds the same job.
  4. To inspect a connected store or CRM, use migma_list_connected_tools, then migma_get_connected_tool for the exact argument schema. Discovery requires email:read; execution requires project:write.
  5. Obtain approval for the concrete external changes before migma_call_connected_tool. Existing enabled-tool grants and approval settings remain enforced. A tool requiring interactive dashboard approval remains blocked here; review its permissions in the brand’s MCP Servers settings.
Exporting does not update Shopify. The default Shopify storefront connection exposes catalog and cart tools, not customer marketing-consent updates. Synchronization needs a connected tool with customer consent-write access. Verify provider results and partial failures before reporting success; never resubscribe exported unsubscribers or automatically retry an unknown write outcome.

Out of credits

  • On an out-of-credits error, call migma_get_credits and explain the limit briefly. Existing drafts and tasks that use no credits can continue.
  • In the general profile or local MCP, use migma_get_upgrade_link when the user asks to manage billing or accepts a relevant billing offer. New subscribers choose a plan before receiving a checkout link. Existing subscribers omit plan to review changes in the billing portal.
  • Passing plan for an existing subscription can change it and charge a prorated payment immediately. Obtain explicit approval for that charge first.
  • Show the returned URL once and check updated credits before resuming blocked work. A link alone does not confirm payment. This tool is absent from the OpenAI profile.

Buy a domain

Use the general hosted profile or local MCP for domain shopping.
  1. Search availability and yearly prices with migma_search_buyable_domains.
  2. Call migma_buy_domain and show the returned checkout URL. The user pays in the browser. A free account can hold one purchased domain; account eligibility and current annual pricing are checked before checkout. The domain purchase renews annually.
  3. Poll migma_get_domain_purchases until the domain is active.
  4. Set it up for sending with migma_setup_domain. When DNS is still required, migma_setup_domain and migma_verify_domain return a connectUrl that opens one-click DNS setup in Migma.

Send or schedule

You approve every send in Migma. When the agent calls migma_send_email, migma_send_campaign, or migma_schedule_campaign, Migma prepares the send and the agent shows you a summary: audience, recipient count, sender, subject, and timing, with a link to migma.ai.
  1. Open the link and sign in. You see the email and the same details.
  2. Click Send or Schedule, or Decline. Edit in Migma opens the campaign or email if you want to change it first.
Migma checks the send again when you approve. If the audience, sender, subject, email, or time changed since the agent prepared it, Migma does not send it, and the agent can prepare a new one. A link stays open for 24 hours. The agent can check what happened with migma_get_send_approval. migma_send_email sends marketing email, so unsubscribed contacts are skipped and the email carries an unsubscribe link. transactional: true is only for a single recipient’s transactional message, such as a receipt, and needs a verified transactional sending identity (notify.<your domain>, set up with migma_provision_stream). Tag and segment sends are always marketing.

Other

  • Open the email in Migma from the returned canvas link
  • Fetch exact emailId values
  • Send a test email
  • Create a campaign draft
  • Export approved email to HTML, PNG, PDF, Klaviyo, Mailchimp, or HubSpot
  • Read campaign metrics and logs
  • Manage contacts, lists, segments, and sending domains
  • Check the plan and remaining credits (migma_get_credits); subscription management (migma_get_upgrade_link) is available in the general profile or local MCP
  • Track existing domains (migma_get_domain_purchases); domain search and checkout (migma_search_buyable_domains, migma_buy_domain) are available in the general profile or local MCP, with payment in the user’s browser
  • Manage DNS records on domains bought in Migma (migma_list_dns_records, migma_add_dns_record, migma_remove_dns_record): add A, AAAA, CNAME, MX, TXT, or NS records like Google Workspace MX or a site-verification TXT, and remove user-added records. Migma’s email sending records are protected, and the root and www names are reserved for domain forwarding

Security

IT and security reviewers: Review Migma MCP covers what the hosted server can do, how OAuth works, permissions including email:send, and how to revoke access.
  • Prefer OAuth connection for clients that support it.
  • Use scoped API keys.
  • Review scopes before approval. email:send allows test/direct sends. campaign:write allows campaign creation, send, and schedule. Only allow either when you trust the connector to deliver mail.
  • Revoke OAuth-created and manually created keys from Settings → Developers → API Keys.
  • Keep human approval enabled before sends, exports, audience changes, and campaign changes.
  • Send API keys through the documented authorization header.
  • Treat MCP like direct API access. Tool calls use the same Migma permissions as SDK, CLI, and REST API requests.

Troubleshooting

Resources

MCP for IT admins

What the hosted server can do, permissions, and how to revoke access.

npm Package

Local MCP package.

Agent Registration

Let agents request scoped access.
Last modified on November 2, 2026