Programmatic Email A/B Testing for AI Agents
Programmatic email A/B testing means your code—or your AI agent—decides what to test, launches the experiment, and reads the winner without anyone touching a dashboard. marginal exposes that whole loop as an email MCP server so agents can run subject line A/B tests and act on the results.
What programmatic email A/B testing actually requires
Manual A/B testing breaks down the moment you want to run dozens of experiments a week. To make it programmatic you need four things callable from code: variant generation, a way to launch the split test, tracked metrics, and a decision step. marginal maps each of these to a discrete MCP tool so an agent can chain them end to end.
- generate_variants — produce candidate subject lines and bodies
- launch_test — split the audience and start a managed send
- get_results — pull open/click data and within-test lift
- recommend_next — get a data-backed suggestion for the next round
Why run it through an email MCP server
The Model Context Protocol gives AI agents a typed, discoverable interface to external systems. Instead of writing brittle glue against a marketing API, you point a client like Cursor, Claude Code, or Windsurf at https://marginal.sh/mcp and the testing tools appear natively in the agent's toolset.
Because marginal is hosted, there's no self-hosted MCP server to deploy or babysit. You authenticate with a Bearer API key (marg_live_...) and the managed send infrastructure, tracking, and lift math all run server-side—so a subject line A/B test is one tool call away in any supported client.
A typical programmatic loop
For AI agent email marketing, the value is in closing the loop automatically. An agent doesn't just send—it learns from each experiment and feeds that back into the next variant set.
- Ask the agent to draft five subject line variants for a campaign
- Launch the split test against a slice of your list
- Wait for opens and clicks to accumulate, then read lift metrics
- Let recommend_next propose the strongest direction for round two
- Repeat—each cycle is logged as one experiment
Getting started
The free tier includes 100 experiments per month, which is enough to validate a real programmatic email A/B testing workflow before scaling up. marginal works with Cursor, OpenAI Codex, Claude Desktop, Claude Code, Windsurf, Cline, Continue, and Zed.
Add the endpoint to your MCP client, drop in your API key, and your agent can start running subject line tests. Full tool references and setup steps live in the docs at 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