← All guides marginal.sh

Building API-First Email Campaigns

Updated June 2026 · Hosted email MCP server

API-first email campaigns put sends, tests, and metrics behind clean tool calls instead of dashboards. marginal is a hosted email MCP server that exposes that workflow to your code and your AI agents over a single endpoint.

What 'API-first' means for email

In an API-first model, every campaign action is a programmable operation. You don't click through a UI to assemble a send — you call a tool, pass parameters, and get a structured response back. That makes campaigns reproducible, testable, and easy to embed inside larger automation.

marginal delivers this through four MCP tools: generate_variants, launch_test, get_results, and recommend_next. Together they cover the full loop of drafting copy, running a subject line A/B test, measuring within-test lift, and deciding what to send next.

Why AI agents fit the workflow

Because marginal speaks MCP, AI agent email marketing becomes a matter of connecting the server and letting the agent call the tools. An agent in Cursor, Claude Code, or Windsurf can draft variants, launch a test, and interpret results without a human translating between a chat window and a campaign dashboard.

The endpoint is https://marginal.sh/mcp, and authentication uses a Bearer API key in the marg_live_ format. There is nothing to self-host — the server is fully managed, so your agent connects to a stable hosted target.

Running a subject line A/B test

The core experiment in marginal is a subject line A/B test. You generate two or more variants, launch the test as a managed send, and the server tracks opens and clicks while computing lift between variants. That keeps the measurement honest: comparisons are made within the same test rather than against historical averages.

Once results stabilize, recommend_next translates the numbers into an action — pick a winner, extend the test, or iterate on copy. This is the part of API-first email campaigns that turns raw tracking data into decisions.

Getting started with marginal

The free tier includes 100 experiments per month, which is enough to validate API-first email campaigns end to end before scaling. Point your MCP client at the endpoint, add your API key, and start calling tools.

Full tool references and setup steps live in the documentation at https://marginal.sh/docs/. The MCP endpoint itself is https://marginal.sh/mcp.

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