# Agent Mail — how to use (mcp.ai)

Connect your Agent Mail account and use 5 tools for AI agents straight from your AI agent. Connect with your own API key. AgentMail provides AI agents with their own email inboxes, enabling them to send, receive, and act upon emails for communication with services, people, and other agents.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_agent_mail?ms=1787295840000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `agent_mail_create_inbox`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/agent_mail`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/agent_mail/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/agent_mail/create/inbox` — Create a new AgentMail inbox via API. Returns the inbox_id and email address for sending/receiving messages. Use when provisioning new inboxes for agents or workflows.
  - body: { domain?: string, username?: string, client_id?: string, display_name?: string }
- `POST https://api.mcp.ai/api/agent_mail/get/message` — Retrieve the complete details of a specific email message from an AgentMail inbox. This action returns the full message content including sender, recipients, subject, body (both text and HTML), attach
  - body: { inbox_id: string, message_id: string }
- `POST https://api.mcp.ai/api/agent_mail/list/inboxes` — List all inboxes available to the authenticated AgentMail account. Use this to discover valid inbox_id values for message operations.
  - body: { limit?: integer, ascending?: boolean, page_token?: string }
- `POST https://api.mcp.ai/api/agent_mail/list/messages` — List messages from an AgentMail inbox. Returns a `messages` array; each message uses `message_id` and `timestamp` fields (not `id`, `date`, or `items`).
  - body: { after?: string, limit?: integer, before?: string, labels?: string[], inbox_id: string, ascending?: boolean, page_token?: string, include_spam?: boolean }
- `POST https://api.mcp.ai/api/agent_mail/send/email` — Send an email using AgentMail API
  - body: { cc?: string[], to: string[], bcc?: string[], html?: string, text?: string, labels?: string[], subject: string, inbox_id: string, reply_to?: string[] }

## Example prompts
- "What can I do in Agent Mail?"
- "Show me a summary of my Agent Mail account"

## More
- Page: https://mcp.ai/agent_mail
- Agent spec (llms.txt): https://mcp.ai/agent_mail/llms.txt
- Postman collection: https://mcp.ai/agent_mail/postman.json
