How to Run a Subject Line A/B Test with marginal
This how-to guide walks through running a subject line A/B test using marginal, the hosted email MCP server for AI agents. You'll go from idea to a clear winner using four tools — no dashboards, no glue code.
Before you start
marginal connects to AI agent clients over the Model Context Protocol, so the entire test runs inside the assistant you already use. Point your client at the endpoint and authenticate with a Bearer API key before you begin.
- Endpoint: https://marginal.sh/mcp
- Auth: a Bearer key in the form marg_live_...
- Compatible clients: Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, Zed, and OpenAI Codex
- Free tier covers 100 experiments/month — plenty for iterating on subject lines
- Full setup details live in the marginal docs at https://marginal.sh/docs/
Step 1: Generate subject line variants
Start by asking your agent to draft candidates with the generate_variants tool. Give it the core message, your audience, and the tone you want — the tool returns distinct subject lines you can test against each other.
Aim for a small set of meaningfully different angles rather than near-duplicates. A curiosity-driven line versus a benefit-driven line gives you a cleaner read on what your audience responds to.
- Provide context: campaign goal, segment, and brand voice
- Request 2–4 variants so the test stays interpretable
- Keep one variable in focus (e.g. urgency vs. clarity) per test
Step 2: Launch the test and track engagement
Once you've chosen your variants, call launch_test to start a managed send. marginal handles the delivery and splits your audience across the subject lines, then tracks opens and clicks automatically.
Because the send is managed by the hosted server, you don't wire up tracking pixels or webhooks yourself. The AI agent email marketing loop stays entirely conversational.
- Pass your chosen variants and the audience to launch_test
- Open and click tracking is recorded for each variant
- No self-hosting — marginal runs the experiment for you
Step 3: Read results and decide what to send next
Call get_results to see within-test lift metrics comparing each subject line's open and click performance. This tells you which variant won and by how much, so the decision is grounded in data rather than a guess.
To close the loop, use recommend_next. Based on the test outcome, marginal suggests the strongest follow-up direction — turning a single subject line A/B test into an ongoing optimization habit. That's the full marginal MCP tutorial flow: generate, launch, measure, iterate.
- get_results returns per-variant lift on opens and clicks
- recommend_next proposes the best follow-up subject direction
- Repeat the cycle to compound learnings across campaigns
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