← All guides marginal.sh

Running email A/B tests in n8n with the marginal MCP

Updated June 2026 · Hosted email MCP server

If you orchestrate workflows in n8n and want your AI agents to test subject lines without hand-coding ESP calls, the n8n email A/B test MCP pattern lets an agent generate variants, launch a managed send, and act on results — all through marginal's hosted endpoint.

Why pair n8n with an email MCP server

n8n is great at moving data between systems, but it doesn't know how to design a subject line A/B test or decide a winner. marginal is an email MCP server built for AI agents: it exposes four focused tools — generate_variants, launch_test, get_results, and recommend_next — over a single hosted endpoint.

By calling marginal from an agent node, your n8n workflow can trigger a full experiment lifecycle. The agent reasons about copy and timing; marginal handles managed sends, open/click tracking, and within-test lift metrics.

A typical subject line A/B test flow

Most n8n teams trigger marginal from a scheduled or webhook-driven workflow that hands context to an AI agent. The agent then walks the four tools in order, producing a subject line A/B test the agent can monitor and learn from.

Connecting marginal to your agent runtime

marginal speaks the Model Context Protocol, so any MCP-capable client can drive these tools. While n8n orchestrates the surrounding workflow, the agent step itself connects to marginal the same way an MCP client like Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, Zed, or OpenAI Codex would.

Point your agent at https://marginal.sh/mcp, supply the Bearer API key, and the four tools become callable. This keeps AI agent email marketing logic in one place instead of scattered across custom HTTP nodes.

Tips for reliable n8n email A/B test MCP runs

Because marginal returns structured results, it's easy to branch your n8n workflow on the outcome — for example, routing a winning variant to a broader send or queueing recommend_next for a follow-up experiment.

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