e2a — email for AI agents
v0.3.2Authenticated email gateway for AI agents — per-agent inboxes, HITL approval, SPF/DKIM verified.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
send_email Send email
Send a new email from the agent's inbox. Use this for outbound mail to a fresh recipient. To reply to a thread you received, use `reply_to_message` instead so threading headers (In-Reply-To, References) are preserved. Attach files via the `attachments` array — pass base64 strings from another tool's output verbatim. If the agent has HITL approval enabled, the message is held for human review and the response indicates `status: pending_approval` rather than `sent`.
| Parameter | Type | Description |
|---|---|---|
body * | string | Plain-text body. Use `html_body` for HTML. |
subject * | string | |
to * | array | Recipient email addresses (one or more). |
agent_email | string | Sending agent's inbox. Omit when E2A_AGENT_EMAIL is set in the server environment. |
attachments | array | Optional list of file attachments. Each entry is base64-encoded; the MCP server forwards them verbatim to the e2a backend, which handles MIME composition. To forward an attachment received on an inbou… |
bcc | array | |
cc | array | |
conversation_id | string | Optional conversation grouping ID. Server generates one if omitted. |
html_body | string |
reply_to_message Reply to a received message
Reply to an inbound message identified by `message_id`. Preserves the References and In-Reply-To headers so the reply lands in the same email thread as the original. Pass `reply_all: true` to copy the original Cc list. Attach files via `attachments`. Subject is auto-derived (Re: …) by the server.
| Parameter | Type | Description |
|---|---|---|
body * | string | Plain-text reply body. |
message_id * | string | ID of the inbound message to reply to (e.g. msg_…). |
agent_email | string | |
attachments | array | Optional list of file attachments. Each entry is base64-encoded; the MCP server forwards them verbatim to the e2a backend, which handles MIME composition. To forward an attachment received on an inbou… |
bcc | array | |
cc | array | |
conversation_id | string | |
html_body | string | |
reply_all | boolean | If true, copy the original message's Cc list. |
list_messages List inbound messages
List messages the agent has received, newest first. Filter by `status` (unread/read/all; default unread) and paginate with `page_size` + `token`. Returns summaries only — use `get_message` for the full body.
| Parameter | Type | Description |
|---|---|---|
agent_email | string | |
page_size | integer | |
status | string | |
token | string | Pagination token from a previous response. |
get_message Get a message
Fetch full detail for one inbound message — body, headers, conversation id, and attachment metadata. Pass the `message_id` from `list_messages`. Attachment bytes are NOT included (would blow context for any non-trivial PDF); the response lists each attachment's filename, content_type, and size_bytes only. Use `get_attachment_data` to fetch the actual bytes of one attachment when you need to inspect or forward it. The raw MIME blob is also omitted from this response for the same reason.
| Parameter | Type | Description |
|---|---|---|
message_id * | string | |
agent_email | string |
get_attachment_data Fetch one attachment's bytes from an inbound message
Returns the base64-encoded content of one attachment from an inbound message. Use this when you want to inspect, forward, or hand off an attachment surfaced by `get_message`. Indexes are 0-based and stable within a message (see `attachments[].index` from get_message). To forward to another recipient, pass the returned `{filename, content_type, data}` verbatim as an entry in `send_email`'s or `reply_to_message`'s `attachments[]` array. Refuses attachments larger than 2 MB after decoding — these are too big for inline retrieval and the LLM context cost would be prohibitive.
| Parameter | Type | Description |
|---|---|---|
attachment_index * | integer | 0-based index into the `attachments[]` returned by get_message. The index reflects the order attachments appear in the MIME message and is stable for a given message_id. |
message_id * | string | |
agent_email | string | Agent inbox holding the message. Omit when E2A_AGENT_EMAIL is set in the server environment. |
list_agents List agents
List every agent inbox owned by the authenticated user. Useful for orientation — which inbox to send `from` or query messages against. Read-only.
whoami Get the default agent's identity
Return the agent inbox this server is scoped to. Resolution order: (1) E2A_AGENT_EMAIL from the server env when set, (2) the sole agent on the account when there's exactly one. Errors only when neither path resolves — typically because the account owns multiple agents and you should pick one via `list_agents` + pass `agent_email` explicitly to other tools.
create_agent Create a new agent inbox on the shared domain
Register a new agent using a slug on the deployment's shared domain (e.g. slug 'support-bot' → support-bot@<shared-domain>). Defaults to `local` mode so the agent receives mail via `list_messages` polling — no webhook server required. Pass `agent_mode: 'cloud'` and `webhook_url` for push delivery; in that case the webhook handler MUST HMAC-verify every delivery against the account's webhook signing secret (`E2A_WEBHOOK_SECRET`, shown in the dashboard) — the e2a SDK exposes `parseWebhook(body, secret)` for this. For a custom (non-shared) domain, use `register_domain` to start the verifica…
| Parameter | Type | Description |
|---|---|---|
slug * | string | Local part of the new email address. Lowercase letters, numbers, and hyphens; must start with a letter or number. |
agent_mode | string | `local` (default) for poll-based delivery via this MCP server. `cloud` requires `webhook_url` and pushes inbound mail to that URL. |
name | string | Display name for the agent. Defaults to the slug. |
webhook_url | string | Required when `agent_mode` is `cloud`. Ignored in local mode. |
update_agent Update an agent's configuration
Mutate a subset of an agent's settings. Most useful for toggling HITL on/off, changing the approval window, or rebinding the webhook URL when an agent's downstream service moves. Omitted fields keep their current value server-side. Passing all-zero values intentionally is allowed — e.g. `hitl_ttl_seconds: 0` would set the approval window to immediate (not a no-op).
| Parameter | Type | Description |
|---|---|---|
agent_email | string | Agent to update. Defaults to E2A_AGENT_EMAIL when set; required otherwise. |
agent_mode | string | `local` → poll-based delivery (via `list_messages`). `cloud` → push delivery; requires `webhook_url` to be set (now or already on the agent). |
hitl_enabled | boolean | Hold outbound mail for human approval before it ships. When true, `send_email`/`reply_to_message` return a pending message id rather than a sent receipt; reviewers approve via the dashboard or the mag… |
hitl_expiration_action | string | What happens to a pending message at TTL expiry: `approve` ships it; `reject` drops it. |
hitl_ttl_seconds | integer | How long a pending outbound stays in the approval queue before it expires. |
webhook_url | string | URL the cloud-mode delivery will POST to. The handler MUST HMAC-verify each delivery against the account's webhook signing secret. |
delete_agent Delete an agent inbox (DESTRUCTIVE)
Permanently delete the agent identity and CASCADE-remove every message, pending outbound, and webhook-delivery record bound to it. Irreversible. Existing OAuth tokens bound to this agent are revoked automatically. Requires `confirm: true` — set it explicitly to acknowledge the destructive action.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be set to true to proceed. Guard against an LLM hallucinating a delete from ambiguous context. |
agent_email | string | Agent to delete. Defaults to E2A_AGENT_EMAIL when set; required otherwise. |
list_domains List domains
List every custom mail domain registered under the authenticated user, with verification status (verified / pending DNS / failed) and the verification token for each. Useful to discover which domains can already send/receive mail and which still need DNS records to be added. Read-only; cheap to call.
register_domain Register a custom mail domain (returns DNS records to publish)
Register a new domain (e.g. 'mail.acme.com') for outbound + inbound mail. Returns the DNS records (MX, TXT verification token) the user must publish on their DNS provider before the domain becomes usable. **Composition tip**: if a DNS-provider MCP server (Cloudflare, Route 53, NS1, …) is loaded in the same host, hand the returned records to its `create_dns_record`-style tool, wait briefly for propagation, then call `verify_domain` to finalize. If no DNS MCP is available, surface the records to the user verbatim and ask them to add them manually. The domain is created in an unverified state â…
| Parameter | Type | Description |
|---|---|---|
domain * | string | Fully-qualified domain name to register. e.g. 'mail.acme.com'. Subdomains are recommended (so the apex remains free for marketing mail). |
verify_domain Verify a custom mail domain's DNS records
Probe DNS for the MX + TXT records issued by `register_domain` and flip the domain's `verified` bit when the lookup succeeds. Idempotent — safe to retry as many times as DNS propagation needs. Call this once the user (or a DNS MCP) has published the records. Returns the latest domain row, including the resolved-record state for diagnostics if verification is still failing.
| Parameter | Type | Description |
|---|---|---|
domain * | string | Domain to verify. Must have been registered already via `register_domain`. |
delete_domain Delete a custom mail domain (DESTRUCTIVE)
Permanently remove a domain registration. CASCADES to every agent on that domain and every message/pending-outbound/webhook-delivery bound to those agents. Irreversible. Existing OAuth tokens bound to those agents are revoked. Requires `confirm: true` — set it explicitly to acknowledge the destructive scope.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be set to true to proceed. Guard against an LLM hallucinating a delete from ambiguous context. |
domain * | string | Domain to delete. |
list_pending_messages List outbound messages awaiting approval
List outbound emails composed by HITL-enabled agents that are held pending human review, sorted by soonest-expiring first. Use this when the user asks what's waiting for them to approve. Body content is not included in summaries — call `get_pending_message` for the full draft.
get_pending_message Get a pending-approval message
Fetch the full draft (subject, recipients, body, attachments) of one outbound message awaiting human approval. Body content is only present while the message is `pending_approval` — after a terminal transition the server scrubs it.
| Parameter | Type | Description |
|---|---|---|
message_id * | string | The pending message ID (msg_…). |
approve_pending_message Approve a pending outbound message
Send a held outbound message via the upstream relay. Approve-as-is by passing only `message_id`, or apply reviewer edits by supplying any subset of subject / body_text / body_html / to / cc / bcc / attachments — those fields override the stored draft before send. Pass an empty `attachments: []` to strip attachments the agent originally proposed. Returns 409 if the message is no longer pending.
| Parameter | Type | Description |
|---|---|---|
message_id * | string | |
attachments | array | Optional list of file attachments. Each entry is base64-encoded; the MCP server forwards them verbatim to the e2a backend, which handles MIME composition. To forward an attachment received on an inbou… |
bcc | array | |
body_html | string | |
body_text | string | |
cc | array | |
subject | string | |
to | array |
reject_pending_message Reject a pending outbound message
Discard a held outbound message. The message is never sent and body columns are scrubbed; the optional `reason` is stored for audit. Returns 409 if the message is no longer pending.
| Parameter | Type | Description |
|---|---|---|
message_id * | string | |
reason | string |