Email MCP Server for OpenAI Codex
marginal is a hosted email marketing MCP server that plugs into OpenAI Codex. Once connected, your agent can draft subject line variants, launch A/B tests, and read back open and click results without leaving your workflow.
Why pair OpenAI Codex with marginal
OpenAI Codex is built to take action on your behalf, but it needs structured tools to do anything useful with email. marginal exposes a small, well-defined set of MCP tools so Codex can reason about campaigns and then execute them through a hosted endpoint.
Because marginal is fully hosted, there's no server to run or maintain. You point OpenAI Codex at the MCP endpoint, authenticate with a Bearer API key, and the tools become available to the agent immediately.
- generate_variants — produce subject line candidates for a campaign
- launch_test — start a managed subject line A/B test and send it
- get_results — pull open/click tracking and within-test lift
- recommend_next — get a data-backed suggestion for the next step
Configure the OpenAI Codex MCP connection
Add marginal as an MCP server in your OpenAI Codex configuration. Use the hosted endpoint and pass your API key as a Bearer token. Keys start with marg_live_ and are issued from your marginal account.
Save the config, restart Codex, and confirm the four marginal tools appear in the agent's available tool list.
- Endpoint: https://marginal.sh/mcp
- Registry name: sh.marginal/mcp
- Auth header: Authorization: Bearer marg_live_...
- Full setup reference: https://marginal.sh/docs/
{
"mcpServers": {
"marginal": {
"url": "https://marginal.sh/mcp",
"headers": {
"Authorization": "Bearer marg_live_xxxxxxxxxxxx"
}
}
}
}
Run a subject line A/B test from Codex
With the email MCP integration live, you can describe a campaign in plain language and let OpenAI Codex handle the mechanics. A typical loop has the agent generate variants, launch a test, then check results once enough opens and clicks have accumulated.
This makes AI agent email marketing concrete: Codex isn't just suggesting copy, it's running a real subject line A/B test and reporting which variant wins based on measured lift.
- Ask Codex to call generate_variants for a few subject line options
- Have it launch_test to send the managed A/B test to your list
- Use get_results to inspect open rate, click rate, and lift
- Call recommend_next to decide whether to roll out the winner
What to know before you start
The free tier covers 100 experiments per month, which is enough to validate the OpenAI Codex MCP workflow before scaling up. Tracking, sends, and lift metrics are all handled by the hosted marginal service.
- No self-hosted server — marginal runs the email MCP server for you
- Tracking and managed sends are included with every test
- Works alongside other clients like Cursor, Claude Code, and Windsurf
- Keep your marg_live_ key out of source control and shared logs
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