Running a JSON Payload Email Campaign with marginal
If your AI agent already speaks JSON, your email campaigns should too. marginal exposes subject line testing and managed sends as MCP tools, so an agent can describe a JSON payload email campaign and get back structured results it can act on.
Why JSON payloads fit email campaigns
A JSON payload email campaign means every part of the workflow — variants, recipients, test config, and metrics — moves as structured data rather than clicks in a dashboard. That's a natural fit for agents and scripts that compose requests programmatically and parse responses without scraping HTML.
marginal's MCP tools accept and return JSON, so the contract between your AI agent and the email layer stays predictable. The agent generates content, launches a test, and reads lift metrics, all through typed tool calls.
- generate_variants returns candidate subject lines as JSON
- launch_test accepts a structured campaign payload
- get_results returns open/click and within-test lift metrics
- recommend_next suggests the follow-up action as data
Anatomy of a campaign payload
Think of the payload as the description of what to send and how to measure it. You provide the subject line variants you want to compare, the audience the managed send targets, and the test parameters. marginal handles the delivery and tracking, then hands back the numbers.
Because everything is JSON, your AI agent email marketing flow can branch on the response — promote a winner, generate fresh variants, or schedule the next send without a human in the loop.
- Variants: the subject lines under test
- Test config: what counts as a win and how it's measured
- Send: the managed delivery marginal performs on your behalf
- Results: open rate, click rate, and within-test lift per variant
Running a subject line A/B test from an agent
A typical loop: the agent calls generate_variants for fresh subject lines, passes the best candidates into launch_test to start a subject line A/B test, polls get_results once data accumulates, then calls recommend_next to decide the follow-up. Each step is a JSON request and a JSON response.
marginal is a hosted email MCP server — there's nothing to self-host. You connect over the endpoint at https://marginal.sh/mcp with a Bearer API key, and the free tier covers 100 experiments per month while you iterate.
- Endpoint: https://marginal.sh/mcp
- Auth: Bearer API key (marg_live_...)
- Compatible clients: Cursor, Claude Code, Windsurf, Cline, Zed, and more
- Docs and payload examples: https://marginal.sh/docs/
Get started with marginal
marginal is a hosted email marketing MCP server at marginal.sh. Sign up free, create an API key, and connect https://marginal.sh/mcp from Cursor, Codex, or Claude Desktop.
- 100 experiments/month on the free tier
- Four MCP tools: generate_variants, launch_test, get_results, recommend_next
- Listed in the MCP Registry as sh.marginal/mcp