← All guides marginal.sh

How to connect Codex to an email MCP server

Updated June 2026 · Hosted email MCP server

If you want your AI agent to draft subject lines, launch experiments, and read open and click metrics without leaving your editor, you can connect Codex to email MCP through marginal — a hosted email marketing MCP server built for exactly this workflow.

What you get when you connect Codex to email MCP

marginal exposes a small, focused set of tools over the Model Context Protocol so Codex can run a complete subject line A/B test loop. There's nothing to deploy: the endpoint is hosted at https://marginal.sh/mcp and authenticated with a Bearer API key.

Configure Codex with your marginal API key

OpenAI Codex speaks MCP, so wiring it up to the marginal email MCP server is a configuration step rather than a coding project. Generate an API key (it looks like marg_live_...) from your marginal dashboard, then point Codex at the hosted endpoint.

Add the server to your Codex MCP configuration with the registry name sh.marginal/mcp and the endpoint https://marginal.sh/mcp. Supply the key as a Bearer credential so every tool call is authenticated. Once registered, the four tools appear to the agent automatically.

Run your first subject line A/B test from Codex

With the connection live, ask Codex to test a campaign in plain language. A typical flow asks the agent to generate several variants, launch a managed send, and then check back once data arrives. Because marginal reports within-test lift, the agent can compare variants on a fair basis instead of guessing.

This is what AI agent email marketing looks like in practice: the model owns the iteration loop, and you review the recommendation. Codex calls generate_variants, then launch_test, then get_results, and recommend_next closes the loop with a suggested winner or follow-up test.

Limits, docs, and next steps

The free tier includes 100 experiments per month, which is plenty for validating the workflow and running real subject line A/B tests on smaller lists. If you also work in Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, or Zed, the same marginal server connects there with identical configuration.

Full tool schemas, parameter details, and example payloads live in the documentation 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.

Documentation · Sign up · FAQ