← All guides marginal.sh

Subject Line A/B Testing in OpenAI Codex

Updated June 2026 · Hosted email MCP server

Connect OpenAI Codex to marginal's hosted email MCP server and run a full subject line A/B test without leaving your agent workflow. Codex calls the MCP tools, marginal handles the sends and tracking.

Connect OpenAI Codex to the marginal MCP server

marginal is a hosted email MCP server — there's nothing to deploy. Point OpenAI Codex at the endpoint, add your Bearer API key, and the subject line A/B testing tools become available to the agent.

Add the configuration below to your Codex MCP settings. Use a key in the marg_live_... format from your marginal dashboard.

The subject line A/B test workflow in Codex

Once connected, an OpenAI Codex agent workflow can run an entire subject line A/B test through four MCP tools. You describe the campaign in natural language and Codex chains the calls, reading results between steps.

This keeps AI agent email marketing tasks inside the same loop where you're already writing code or drafting copy.

Prompting Codex for a clean A/B test

Give Codex enough context to call the tools correctly: the audience, the campaign goal, and how many variants you want. The agent translates that into generate_variants and launch_test calls, then waits before fetching results.

Because marginal tracks opens and clicks per variant, you can ask Codex to summarize which subject line A/B test winner had the strongest lift and why.

Tips for reliable runs

Keeping the OpenAI Codex agent workflow predictable comes down to clear steps and waiting for real data before deciding a winner.

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