How to Connect an MCP Server for Email Marketing
This how-to guide walks you through connecting an MCP server for email marketing using marginal — the hosted email MCP server for AI agents. In a few steps you'll wire up an API key, register the endpoint, and let your agent run a subject line A/B test.
What you need before you connect
marginal is fully hosted, so there's nothing to deploy and no self-hosted MCP server to maintain. You only need an MCP-capable client and an API key to start.
Because marginal handles managed sends and tracking, you won't be juggling provider credentials in your config. The single bearer token authenticates every tool call.
- An MCP client such as Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, or Zed
- A marginal API key in the form marg_live_...
- The endpoint URL: https://marginal.sh/mcp
- The free tier covers 100 experiments/month — enough to test the full flow
Step 1: Get your API key and endpoint
Grab your bearer key from your marginal account, then point your client at the registry name sh.marginal/mcp or the direct endpoint at https://marginal.sh/mcp. marginal authenticates with a single Bearer API key, so keep marg_live_... values out of source control and in your client's secret config or environment.
Once the endpoint and key are in place, your AI agent can discover the four core tools: generate_variants, launch_test, get_results, and recommend_next.
- Registry: sh.marginal/mcp
- Endpoint: https://marginal.sh/mcp
- Auth header: Authorization: Bearer marg_live_...
- Reference the setup docs at https://marginal.sh/docs/ for client-specific paths
Step 2: Run your first subject line A/B test
With the connection live, this marginal MCP tutorial gets practical fast. Ask your agent to draft variants, launch the experiment, and report lift — all through MCP tool calls.
Each tool maps to a clear stage of the experiment lifecycle, so an AI agent email marketing workflow reads almost like plain English.
- generate_variants — produce candidate subject lines for a campaign
- launch_test — start a managed send with the variants split across recipients
- get_results — pull open/click tracking and within-test lift metrics
- recommend_next — let marginal suggest the winning variant or the next experiment
Step 3: Read results and iterate
After a subject line A/B test runs, call get_results to see opens, clicks, and within-test lift for each variant. marginal scopes lift to the test itself, so you compare like-for-like instead of guessing against historical baselines.
Use recommend_next to close the loop. Your agent can deploy the winner, then immediately generate a fresh round of variants — turning a one-off test into a continuous optimization habit without leaving your editor.
- Check open and click rates per variant
- Compare within-test lift to pick a confident winner
- Feed the winner into recommend_next for the next iteration
- Stay within the free tier's 100 experiments/month as you scale up
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