AgentMail MCP CLI
/install agentmail-mcp-cli
AgentMail MCP CLI
Email management for AI agents via the AgentMail API.
Documentation: https://docs.agentmail.to Get API Key: https://agentmail.to
Prerequisites
Required:
- Node.js >= 20.0.0
- AgentMail API key from agentmail.to
Installation:
npm install -g openclaw-agentmail-cli
This installs the agentmail command globally.
Authentication
Set your API key (get one from agentmail.to):
# Option 1: Environment variable (recommended)
export AGENTMAIL_API_KEY="your_api_key"
agentmail inboxes list
# Option 2: CLI parameter
agentmail --api-key "your_api_key" inboxes list
Quick Reference
Inbox Management
# List all inboxes
agentmail inboxes list
# List with limit
agentmail inboxes list --limit 5
# Create a new inbox
agentmail inboxes create --display-name "My Agent"
# Create with username and domain
agentmail inboxes create --username myagent --domain agentmail.to --display-name "My Agent"
# Get inbox details
agentmail inboxes get \x3Cinbox-id>
# Delete an inbox (destructive!)
agentmail inboxes delete \x3Cinbox-id>
Thread Management
# List threads in inbox
agentmail threads list \x3Cinbox-id>
# List with options
agentmail threads list \x3Cinbox-id> --limit 10
# Filter by labels
agentmail threads list \x3Cinbox-id> --labels '["unread"]'
# Filter by date
agentmail threads list \x3Cinbox-id> --after "2024-01-01" --before "2024-12-31"
# Get thread details (includes all messages)
agentmail threads get \x3Cinbox-id> \x3Cthread-id>
Send Messages
# Send a simple email
agentmail messages send \x3Cinbox-id> \
--to [email protected] \
--subject "Hello" \
--text "Email body here"
# Send to multiple recipients
agentmail messages send \x3Cinbox-id> \
--to [email protected] \
--to [email protected] \
--subject "Team Update" \
--text "Hello team..."
# Send with CC and BCC
agentmail messages send \x3Cinbox-id> \
--to [email protected] \
--cc [email protected] \
--bcc [email protected] \
--subject "Important" \
--text "Please review..."
# Send HTML email
agentmail messages send \x3Cinbox-id> \
--to [email protected] \
--subject "Newsletter" \
--html "\x3Ch1>Hello\x3C/h1>\x3Cp>HTML content\x3C/p>"
# Send with labels
agentmail messages send \x3Cinbox-id> \
--to [email protected] \
--subject "Outreach" \
--text "Hello..." \
--labels '["campaign","outbound"]'
Reply & Forward
# Reply to a message
agentmail messages reply \x3Cinbox-id> \x3Cmessage-id> \
--text "Thank you for your email."
# Reply with HTML
agentmail messages reply \x3Cinbox-id> \x3Cmessage-id> \
--html "\x3Cp>Thank you!\x3C/p>"
# Reply all
agentmail messages reply \x3Cinbox-id> \x3Cmessage-id> \
--text "Replying to everyone..." \
--reply-all
# Forward a message
agentmail messages forward \x3Cinbox-id> \x3Cmessage-id> \
--to [email protected] \
--text "FYI - see below"
# Forward to multiple
agentmail messages forward \x3Cinbox-id> \x3Cmessage-id> \
--to [email protected] \
--cc [email protected] \
--subject "Fwd: Customer Inquiry" \
--text "Please review"
Labels & Organization
# Add labels to a message
agentmail messages update \x3Cinbox-id> \x3Cmessage-id> \
--add-labels '["important","needs-review"]'
# Remove labels
agentmail messages update \x3Cinbox-id> \x3Cmessage-id> \
--remove-labels '["unread"]'
# Add and remove simultaneously
agentmail messages update \x3Cinbox-id> \x3Cmessage-id> \
--add-labels '["processed"]' \
--remove-labels '["unread","pending"]'
Attachments
# Get attachment details and download URL
agentmail attachments get \x3Cthread-id> \x3Cattachment-id>
Available Commands
| Command | Description |
|---|---|
inboxes list |
List all inboxes |
inboxes get \x3Cid> |
Get inbox details |
inboxes create |
Create new inbox |
inboxes delete \x3Cid> |
Delete inbox |
threads list \x3Cinbox-id> |
List threads |
threads get \x3Cinbox-id> \x3Cthread-id> |
Get thread with messages |
messages send \x3Cinbox-id> |
Send new email |
messages reply \x3Cinbox-id> \x3Cmsg-id> |
Reply to email |
messages forward \x3Cinbox-id> \x3Cmsg-id> |
Forward email |
messages update \x3Cinbox-id> \x3Cmsg-id> |
Update labels |
attachments get \x3Cthread-id> \x3Catt-id> |
Get attachment |
Command Options Reference
inboxes list
-l, --limit \x3Cn>- Max items (default: 10)--page-token \x3Ctoken>- Pagination token
inboxes create
-u, --username \x3Cname>- Email username-d, --domain \x3Cdomain>- Email domain-n, --display-name \x3Cname>- Display name
threads list
-l, --limit \x3Cn>- Max items (default: 10)--page-token \x3Ctoken>- Pagination token--labels \x3Cjson>- Filter by labels (JSON array)--before \x3Cdatetime>- Before date (ISO 8601)--after \x3Cdatetime>- After date (ISO 8601)
messages send
--to \x3Cemail>- Recipient (repeatable)--cc \x3Cemail>- CC recipient (repeatable)--bcc \x3Cemail>- BCC recipient (repeatable)-s, --subject \x3Ctext>- Subject line-t, --text \x3Cbody>- Plain text body--html \x3Cbody>- HTML body--labels \x3Cjson>- Labels (JSON array)
messages reply
-t, --text \x3Cbody>- Plain text body--html \x3Cbody>- HTML body--reply-all- Reply to all recipients--labels \x3Cjson>- Labels (JSON array)
messages forward
--to \x3Cemail>- Recipient (repeatable)--cc \x3Cemail>- CC recipient (repeatable)--bcc \x3Cemail>- BCC recipient (repeatable)-s, --subject \x3Ctext>- Subject line-t, --text \x3Cbody>- Plain text body--html \x3Cbody>- HTML body--labels \x3Cjson>- Labels (JSON array)
messages update
--add-labels \x3Cjson>- Labels to add (JSON array)--remove-labels \x3Cjson>- Labels to remove (JSON array)
Common Workflows
Check for New Emails
# List unread threads
agentmail threads list \x3Cinbox-id> --labels '["unread"]' --limit 20
Process and Archive Email
# 1. Get thread
agentmail threads get \x3Cinbox-id> \x3Cthread-id>
# 2. Process content (your logic)
# 3. Mark as processed
agentmail messages update \x3Cinbox-id> \x3Cmessage-id> \
--add-labels '["processed"]' \
--remove-labels '["unread"]'
Auto-Reply Workflow
# 1. Check for emails needing reply
agentmail threads list \x3Cinbox-id> --labels '["needs-reply"]'
# 2. Get thread details
agentmail threads get \x3Cinbox-id> \x3Cthread-id>
# 3. Send reply
agentmail messages reply \x3Cinbox-id> \x3Cmessage-id> \
--text "Thank you for reaching out. We will respond within 24 hours."
# 4. Update labels
agentmail messages update \x3Cinbox-id> \x3Cmessage-id> \
--add-labels '["auto-replied"]' \
--remove-labels '["needs-reply","unread"]'
Create Inbox and Send First Email
# 1. Create inbox
agentmail inboxes create --display-name "Sales Bot"
# Note the inboxId from response
# 2. Send email
agentmail messages send \x3Cnew-inbox-id> \
--to [email protected] \
--subject "Introduction" \
--text "Hello! I wanted to reach out..."
Error Handling
If commands fail, check:
- API Key: Ensure
AGENTMAIL_API_KEYis set - IDs: Verify inbox/thread/message IDs exist
- JSON: Use proper JSON for array options:
'["value"]'
Alternative: MCPorter Syntax
If the MCP compatibility is restored, you can also use MCPorter:
# List inboxes
npx mcporter call agentmail.list_inboxes
# Send message
npx mcporter call agentmail.send_message \
inboxId:\x3Cinbox-id> \
to:'["[email protected]"]' \
subject:"Hello" \
text:"Body"
Links
- API Documentation: https://docs.agentmail.to
- Get API Key: https://agentmail.to
- MCP Server: https://github.com/agentmail-to/agentmail-mcp
- Node SDK: https://github.com/agentmail-to/agentmail-node
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install agentmail-mcp-cli - 安装完成后,直接呼叫该 Skill 的名称或使用
/agentmail-mcp-cli触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
AgentMail MCP CLI 是什么?
Manage AI agent email accounts via AgentMail API. Create inboxes, send/receive/reply to emails, manage threads and attachments. Use for "email", "agentmail",... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 419 次。
如何安装 AgentMail MCP CLI?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install agentmail-mcp-cli」即可一键安装,无需额外配置。
AgentMail MCP CLI 是免费的吗?
是的,AgentMail MCP CLI 完全免费(开源免费),可自由下载、安装和使用。
AgentMail MCP CLI 支持哪些平台?
AgentMail MCP CLI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 AgentMail MCP CLI?
由 Florian Heiwig(@flohiwg)开发并维护,当前版本 v1.0.3。