Building API-First Email Campaigns
API-first email campaigns put sends, tests, and metrics behind clean tool calls instead of dashboards. marginal is a hosted email MCP server that exposes that workflow to your code and your AI agents over a single endpoint.
What 'API-first' means for email
In an API-first model, every campaign action is a programmable operation. You don't click through a UI to assemble a send — you call a tool, pass parameters, and get a structured response back. That makes campaigns reproducible, testable, and easy to embed inside larger automation.
marginal delivers this through four MCP tools: generate_variants, launch_test, get_results, and recommend_next. Together they cover the full loop of drafting copy, running a subject line A/B test, measuring within-test lift, and deciding what to send next.
- generate_variants — produce candidate subject lines to test
- launch_test — start a managed send across variants
- get_results — pull open/click tracking and lift metrics
- recommend_next — get a data-backed suggestion for the next step
Why AI agents fit the workflow
Because marginal speaks MCP, AI agent email marketing becomes a matter of connecting the server and letting the agent call the tools. An agent in Cursor, Claude Code, or Windsurf can draft variants, launch a test, and interpret results without a human translating between a chat window and a campaign dashboard.
The endpoint is https://marginal.sh/mcp, and authentication uses a Bearer API key in the marg_live_ format. There is nothing to self-host — the server is fully managed, so your agent connects to a stable hosted target.
- Works with Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, Codex, and Zed
- Single hosted endpoint — no infrastructure to run
- Bearer API key auth keeps experiments scoped to your account
Running a subject line A/B test
The core experiment in marginal is a subject line A/B test. You generate two or more variants, launch the test as a managed send, and the server tracks opens and clicks while computing lift between variants. That keeps the measurement honest: comparisons are made within the same test rather than against historical averages.
Once results stabilize, recommend_next translates the numbers into an action — pick a winner, extend the test, or iterate on copy. This is the part of API-first email campaigns that turns raw tracking data into decisions.
- Open and click tracking handled by the server
- Within-test lift metrics for fair comparisons
- Managed sends so you don't wire up delivery yourself
Getting started with marginal
The free tier includes 100 experiments per month, which is enough to validate API-first email campaigns end to end before scaling. Point your MCP client at the endpoint, add your API key, and start calling tools.
Full tool references and setup steps live in the documentation at https://marginal.sh/docs/. The MCP endpoint itself is https://marginal.sh/mcp.
- Free tier: 100 experiments/month
- Endpoint: https://marginal.sh/mcp
- Docs: 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