Subject Line A/B Testing in Claude Code
Wire marginal into Claude Code and let your agent generate, launch, and evaluate subject line A/B tests through plain conversation. This guide covers the MCP setup and a practical Claude Code agent workflow for finding subject lines that win.
Connect marginal to Claude Code
marginal is a hosted email MCP server, so there's nothing to deploy. Add the endpoint and your Bearer API key to Claude Code's MCP configuration, and the tools become available in your next session.
Grab a key (marg_live_...) from your marginal dashboard and drop it into the config below.
- Endpoint: https://marginal.sh/mcp
- Auth: Bearer API key (marg_live_...)
- Registry name: sh.marginal/mcp
- Full setup reference: https://marginal.sh/mcp
MCP config for Claude Code
Add marginal to your Claude Code MCP servers. Once it reloads, ask Claude Code to draft and test subject lines directly.
- generate_variants — produce subject line candidates
- launch_test — send the A/B test to your list
- get_results — pull opens, clicks, and within-test lift
- recommend_next — get a data-backed suggestion for what to try next
{
"mcpServers": {
"marginal": {
"url": "https://marginal.sh/mcp",
"headers": {
"Authorization": "Bearer marg_live_your_key_here"
}
}
}
}
A Claude Code agent workflow for A/B tests
The strength of running a subject line A/B test inside Claude Code is that the whole loop stays in one place. You describe the campaign, the agent calls the right tools in sequence, and you review results without switching to a separate dashboard.
A typical agent workflow looks like this:
- Ask Claude Code to call generate_variants with your campaign context and tone.
- Pick the candidates you like, then have it run launch_test against your audience.
- After the test window, call get_results to see open/click rates and within-test lift.
- Use recommend_next to let marginal suggest the next variant direction to iterate on.
Why pair AI agents with email A/B testing
AI agent email marketing works best when generation and measurement live in the same flow. Instead of copy-pasting subject lines into a marketing tool, Claude Code can propose variants, launch the test, and read the lift metrics back to you — closing the loop on what actually performs.
marginal's free tier includes 100 experiments per month, which is plenty for regular subject line A/B test cycles while you build out your agent workflow. See the docs at https://marginal.sh/docs/ for tool parameters and response formats.
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