CrewAI Email Campaign Agent: Run Subject Line Tests via MCP
If you're orchestrating multi-agent workflows in CrewAI and want one of those agents to actually send and optimize email, marginal gives it the tools to do so. This guide shows how a CrewAI email campaign agent can generate variants, launch tests, and read lift metrics through a hosted email MCP server.
What the agent needs to handle a campaign
A useful AI agent email marketing role isn't just copywriting — it's the full loop: drafting subject lines, splitting an audience, sending, then deciding what to do next based on real engagement. CrewAI is good at coordinating that loop across roles, but it needs a backend that can run an actual subject line A/B test and report results.
marginal is a hosted email MCP server that exposes exactly those primitives as tools. Your CrewAI email campaign agent calls them like any other tool, so you don't write send logic or tracking pipelines yourself.
- generate_variants — produce candidate subject lines for a campaign
- launch_test — split the audience and start a managed send
- get_results — pull open/click tracking and within-test lift
- recommend_next — get a data-backed suggestion for the next move
How a CrewAI crew maps to marginal's tools
A natural setup is a small crew where one agent owns ideation and another owns measurement. The writer agent calls generate_variants and launch_test; the analyst agent polls get_results and calls recommend_next once enough data lands. CrewAI's task delegation keeps the two from stepping on each other.
Because marginal manages the send and tracking, your agents stay focused on decisions rather than infrastructure. There's no self-hosted server to operate and no separate tracking service to wire up.
- Writer agent: generate_variants → launch_test with a chosen split
- Analyst agent: get_results on an interval until the test matures
- Decision step: recommend_next returns the winning variant and rationale
- Crew memory holds the test ID so handoffs between agents stay coherent
Connecting CrewAI to the endpoint
marginal lives at the MCP endpoint https://marginal.sh/mcp and authenticates with a Bearer API key in the marg_live_ format. Point your CrewAI tool layer at that endpoint, supply the key, and the four tools become available to any agent in the crew.
You don't connect provider credentials like Mailchimp or Klaviyo keys to get started — marginal handles the managed send side. Full tool schemas and request examples are at https://marginal.sh/docs/, and the same MCP integration works from clients like Cursor, Claude Code, Windsurf, Cline, Continue, and Zed if you want to drive it interactively too.
- Endpoint: https://marginal.sh/mcp
- Auth: Bearer API key (marg_live_...)
- Registry id: sh.marginal/mcp
- Free tier: 100 experiments per month to prototype your crew
A practical first run
Start small: have the crew generate three or four subject lines for one campaign, launch a subject line A/B test on a representative slice of your list, and let it report lift after the test window. Once the loop is stable, let recommend_next drive whether to roll the winner out or iterate on new angles.
Keeping each step as a discrete tool call also makes the agent's reasoning auditable — you can log what was generated, what was launched, and which variant won, which is exactly what you want from an autonomous email workflow.
- Limit early tests to a small audience slice to validate the loop
- Give the analyst agent a clear threshold before calling recommend_next
- Log test IDs and results for traceability across crew runs
- Promote winners only after lift is statistically meaningful
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