← All guides marginal.sh

Running a subject line test with marginal-cli

Updated June 2026 · Hosted email MCP server

If you searched for "marginal-cli subject line test," you want to spin up a subject line A/B test from a command-line or agent workflow without wiring up an ESP by hand. marginal is a hosted email MCP server that exposes the whole loop — generate, launch, measure — as MCP tools your agent can call.

What the subject line test flow looks like

A subject line test in marginal moves through four tool calls. You start with candidate copy, fan it out into variants, send them, and let the platform track opens and clicks so you can compare within-test lift.

Whether you drive this from a CLI script or an AI agent, the sequence is the same and each step maps to a single MCP tool.

Why use marginal instead of a hand-rolled script

Most subject line A/B test scripts break down on the boring parts: managing the send, deduping recipients, and attributing opens and clicks back to the right variant. marginal handles those as a hosted service, so your CLI or agent only deals with intent and results.

It's a hosted email MCP server — there is nothing to self-host. You authenticate with a Bearer API key (marg_live_...) and point your client at https://marginal.sh/mcp.

Driving the test from an AI agent

Because marginal is exposed over MCP, AI agent email marketing workflows can run the full subject line test without custom glue code. An agent in Claude Code, Cursor, or Codex can call generate_variants, launch_test, then poll get_results and act on recommend_next.

This makes "test my subject lines and tell me the winner" a single conversational task. The agent reasons over the lift metrics and decides whether to ship the leader or generate a fresh round of variants.

Getting started

Connect any MCP-capable client to the marginal endpoint, add your API key, and your first subject line A/B test is a few tool calls away. See the docs for tool schemas and example payloads.

Endpoint: https://marginal.sh/mcp · Registry: sh.marginal/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.

Documentation · Sign up · FAQ