Codex MCP Email Integration with marginal
If you run OpenAI Codex and want it to handle real email experiments, marginal exposes a hosted email MCP server that Codex can call directly. This guide covers what the Codex MCP email integration does, the tools available, and how subject line testing fits into an agent workflow.
What the Codex MCP email integration gives you
marginal is a hosted MCP server for email marketing, which means Codex talks to it over the Model Context Protocol at https://marginal.sh/mcp using a Bearer API key. There's nothing to deploy — no self-hosted MCP server to maintain. Codex gets a set of tools it can invoke as part of a task, and marginal handles the sends, tracking, and lift math.
- Endpoint: https://marginal.sh/mcp
- Registry name: sh.marginal/mcp
- Auth: Bearer API key in the form marg_live_...
- Free tier: 100 experiments per month
The MCP tools Codex can call
Once connected, Codex sees four tools. Together they cover a full subject line A/B test loop: draft candidates, run the test, read results, and decide what to do next.
- generate_variants — produce subject line candidates for a campaign
- launch_test — start a managed subject line A/B test with real sends
- get_results — pull open/click tracking and within-test lift metrics
- recommend_next — get a data-backed suggestion for the next step
A subject line A/B test, driven by an agent
The point of AI agent email marketing is that Codex can chain these tools without you copy-pasting between tools. You describe the campaign, Codex generates variants, launches the test, and comes back with the winner once enough opens and clicks land.
Because marginal reports within-test lift rather than just raw open rates, the recommend_next output is grounded in how variants performed against each other in the same send — useful when Codex is reasoning about which subject line to scale.
- Ask Codex to draft 4 subject lines for a re-engagement email
- Launch a managed test split across your list
- Let tracking accumulate, then read lift per variant
- Have Codex recommend and roll out the winner
Beyond Codex
The same email MCP server works across other MCP clients, so a workflow you prototype in Codex can move to your wider toolchain without rewriting anything. The tool surface and endpoint stay identical.
Supported clients include Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, and Zed alongside OpenAI Codex. Full setup details 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.
- 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