← All guides marginal.sh

Programmatic Email A/B Testing for AI Agents

Updated June 2026 · Hosted email MCP server

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.

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.

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.

Documentation · Sign up · FAQ