mail over MCP, IMAP and HTTP

Send and receive email from a mail client, your code or an agent.

An identity here is an address with a mailbox on this domain. It takes mail from anywhere on the internet and sends to anywhere. Reach it in a browser, from a mail client over IMAP and SMTP, from your own code over HTTPS, or from an agent over MCP. Your token is the password in all of them.

agent session
$ claude mcp add -t http aimail /mcp -H "Authorization: Bearer $AIMAIL_TOKEN"
Added HTTP MCP server aimail
> check the inbox and answer the build notice
mail_list_messages 3 unread
mail_read_message "nightly build failed"
mail_send to ops@example.com
sent as
How it works

The token picks the mailbox.

The token belongs to the identity, so every connection lands in its mailbox and everything you send leaves with its address as the sender.

Client
Browser, mail client, code, agent
Signs in with the token over
HTTPS, IMAP or SMTP.
▶▶
Service
Your agent or service
address and its mailbox.
◀◀
Internet mail
SMTP in and out
Outbound signed with DKIM,
SPF and DMARC published
for the domain.
Ways in

Browser, mail client, code, agent.

Use whichever fits, or use them side by side. The mailbox and the token are the same either way.

Connect an agent

Add it once, or pass it per run.

Add it to the client config once, and it is there in every session:

Claude Code permanent mcp install/config
claude mcp add -t http aimail {origin}/mcp -H "Authorization: Bearer $AIMAIL_TOKEN"
Codex CLI permanent mcp install/config
codex mcp add aimail --url {origin}/mcp --bearer-token-env-var AIMAIL_TOKEN

Or pass it on the command line for a single run, leaving the client config untouched:

Claude Code temporary one-time usage, no permanent mcp install/config
AIMAIL_TOKEN=oa_... claude --strict-mcp-config \
  --mcp-config '{"mcpServers":{"aimail":{"type":"http",
    "url":"{origin}/mcp",
    "headers":{"Authorization":"Bearer ${AIMAIL_TOKEN}"}}}}'
Codex CLI temporary one-time usage, no permanent mcp install/config
AIMAIL_TOKEN=oa_... codex \
  -c 'mcp_servers.aimail.url="{origin}/mcp"' \
  -c 'mcp_servers.aimail.bearer_token_env_var="AIMAIL_TOKEN"'

Either way the address comes from the token, so you never pass it.

Mail client

Ordinary IMAP and SMTP.

Same mailbox as the browser and the API, in whatever mail app you already use.

IMAP:993, TLS
SMTP:465 TLS, or :587 STARTTLS
Usernameyour full address
Passwordyour token
API

HTTPS with a bearer token.

The same token your agent and your mail client use.

curl {origin}/v1/messages -H "Authorization: Bearer $AIMAIL_TOKEN"

Anything you send must carry your own address as the sender.

Storage

Working storage, not an archive.

Older mail is cleared out over time, so keep your own copy of anything you need to keep.