Email for an n8n AI agent
Give the agent its own inbox in one call, then attach Mailgi with n8n's MCP Client Tool node. No code, no Gmail credentials, no shared inbox.
To give an n8n AI Agent email, register an address with one POST to Mailgi, then attach an MCP Client Tool node to the agent with the endpoint https://api.mailgi.xyz/mcp, HTTP Streamable transport and Bearer Auth set to the key. Select mail_send, mail_list and mail_get, and the agent can read and answer mail from its own address on a schedule or on demand.
Give the agent an address
One call, no signup form. Do this once per agent and keep the key in your secrets store.
Register
The response carries the address and an API key that is shown exactly once.
An MCP client can also do this itself: register_agent is one of the tools that work with no key. The key still has to reach your config once, so for a server-side agent the one-off call below is simpler.
# Once, outside the agent: give it an address and keep the key
curl -s -X POST https://api.mailgi.xyz/v1/agents/register \
-H "Content-Type: application/json" -d '{"label":"my-agent"}'
# => {"emailAddress":"buzzing-falcon@mailgi.xyz","apiKey":"amb_..."}
export MAILGI_API_KEY=amb_... # shown once: store it
Attach it to the agent
n8n's AI Agent takes MCP servers as tools. The hosted server needs no community node and nothing to host.
The node
Add an AI Agent node with any chat model, then add an MCP Client Tool under its Tool input.
Create a Bearer Auth credential whose token is the amb_... key. n8n stores it encrypted like any other credential.
The server offers 67 tools: domains, keys, webhooks, billing. Choose Selected and tick the three mail tools; add mail_move or mail_delete if the agent should file or clean up.
Field names are from the MCP Client Tool node, version 1.4, in n8n 2.x. Older versions show “SSE Endpoint” instead: update the node, since Mailgi serves Streamable HTTP only.
AI Agent
└─ Tool: MCP Client Tool
Endpoint https://api.mailgi.xyz/mcp
Server Transport HTTP Streamable
Authentication Bearer Auth
Credential Bearer Token = amb_...
Tools to Include Selected
Tools mail_send, mail_list, mail_get
Run it on a schedule
The workflow
Put a Schedule Trigger in front of the agent, every five minutes or so, and give it the system message on the right.
For mail as it arrives instead of polling, register an n8n Webhook URL with POST /v1/webhook-endpoints. Mailgi sends a signed notice with no content; the agent then reads the message with mail_get.
You have your own email address. Use mail_list and mail_get to check mail, and mail_send to reply. Never invent a message id. Summarise what you did.
What the tools can't do yet
Better to know before the model tries.
No search, no threads
There is no search parameter; mail_list pages newest first and the model matches messages itself. Replies are new messages with “Re:” in the subject.
No attachments
Send links instead. Incoming attachments are not exposed.
Mail to strangers is metered
Sending to other @mailgi.xyz agents is free; to outside addresses it costs $0.0005 per recipient plus $0.02 the first time you write to a new address. With no balance, a send comes back as a tool result starting “HTTP 402” with the top-up link, so the agent can report it instead of the workflow failing.
Questions, answered
01How do I give an n8n AI agent an email address?
Register one with a single POST to https://api.mailgi.xyz/v1/agents/register, then attach an MCP Client Tool node to the AI Agent with the endpoint https://api.mailgi.xyz/mcp, HTTP Streamable transport and a Bearer Auth credential holding the key.
02Why not use n8n's Gmail node?
The Gmail node acts as a person's mailbox: the agent can read everything else in it and every message it sends is from that person. A Mailgi address belongs to the agent alone and needs no Google OAuth app.
03Can the workflow react to new mail instead of polling?
Yes. Register an n8n Webhook URL with POST /v1/webhook-endpoints. Mailgi posts a signed notification with no content when mail arrives, and the agent reads the message with mail_get.
04What does it cost?
Registering and receiving are free, and so is mail between Mailgi agents. Mail to outside addresses costs $0.0005 per recipient plus $0.02 the first time an agent writes to a new address, from a prepaid balance.
One POST to start.
No signup form, no OAuth, no card to start. Receiving is free.
Open the dashboard →