给 AI Agent 用的临时邮箱
MoeMail 的 MCP server、CLI 和 Agent skill。你的 Agent 自己创建邮箱、等待验证邮件、读出验证码、删掉邮箱——走的就是驱动 moemail.app 的那套 API。
8 个 MCP 工具 · npx 直接运行,无需部署 · 支持 Claude Desktop、Cursor、Claude Code、Codex
三种接入方式
Agent skill
moemail skill install 把一份 SKILL.md 装进 Claude Code 或 Codex,Agent 在被要求之前就已经知道「创建 → 等待 → 读取 → 删除」这套流程。
工具列表
名称与 server 实际注册的完全一致。让 Agent 真正能用起来的是 wait_for_email:它最多阻塞 90 秒,超时返回 status: "timeout" 而不是报错,Agent 只需再调一次。
- create_email
- 创建邮箱,返回
id和address。有效期1h、24h、3d或permanent。 - wait_for_email
- 轮询直到有新邮件到达(单次 ≤ 90 秒),超时则平稳返回。
- list_messages
- 邮箱收到的邮件列表,最新的在前。
- read_message
- 单封邮件的完整正文与 HTML。
- list_emails
- 这个 API Key 名下的所有邮箱。
- send_email
- 用临时地址回信(需要发信额度)。
- delete_message
- 删除一封邮件。
- delete_email
- 删除邮箱及其中全部内容。
一次会话是什么样
取验证码的完整循环,按 Agent 实际发出的工具调用呈现:四次调用,加上邮件到达前的若干次轮询。
用一个一次性地址在 example.com 注册 beta,然后告诉我验证码。
Agent 创建一个邮箱,把地址填进注册表单。
→ create_email { "expiry": "1h" }
← { "id": "k3f…", "address": "x7q2m9@moemail.app", "expiresAt": "…T15:04:05.000Z" }然后等待。每次轮询算一次 API 调用;这里邮件在 12 秒后到达。
→ wait_for_email { "emailId": "k3f…", "timeoutSec": 90 }
← { "status": "received", "elapsedSec": 12,
"message": { "messageId": "m81…", "from": "no-reply@example.com",
"subject": "Your code is 482913", "receivedAt": "…" } }它读取邮件,从正文里取出验证码。
→ read_message { "emailId": "k3f…", "messageId": "m81…" }
← { "id": "m81…", "from": "no-reply@example.com", "subject": "Your code is 482913",
"content": "Enter 482913 to finish signing up. …", "html": "…", … }最后删除邮箱,不留任何东西。
→ delete_email { "emailId": "k3f…" }
← { "success": true, "deleted": "k3f…" }完成——验证码是 482913。邮箱已删除。
连接客户端
把你的 Key 填到圆点的位置。mcpServers 这一块在 Claude Desktop、Cursor 和 Windsurf 里完全相同;Claude Code 和 Codex 用各自的格式写同一条命令。
{
"mcpServers": {
"moemail": {
"command": "npx",
"args": ["-y", "@moemail/mcp"],
"env": {
"MOEMAIL_API_KEY": "mk_••••••••••••"
}
}
}
}{
"mcpServers": {
"moemail": {
"command": "npx",
"args": ["-y", "@moemail/mcp"],
"env": {
"MOEMAIL_API_KEY": "mk_••••••••••••"
}
}
}
}claude mcp add moemail -e MOEMAIL_API_KEY=mk_•••••••••••• -- npx -y @moemail/mcp[mcp_servers.moemail]
command = "npx"
args = ["-y", "@moemail/mcp"]
env = { MOEMAIL_API_KEY = "mk_••••••••••••" }自部署的 MoeMail?加一个指向你实例的 MOEMAIL_API_URL——两个包默认都指向 moemail.app。
或者在 shell 里直接用
同一套 API,不需要 Agent 运行时。每条命令都接受 --json;退出码 1 是运行时错误,2 是配置或鉴权错误,脚本因此能区分「邮件还没到」和「Key 不对」。
npm i -g @moemail/cli
moemail config set api-key mk_••••••••••••
# 1. a mailbox that lives for an hour
moemail create --expiry 1h --json
# {"id":"k3f…","address":"x7q2m9@moemail.app","expiresAt":"2026-09-02T15:04:05.000Z"}
# 2. block until the verification mail lands (exit 1 on timeout)
moemail wait --email-id k3f… --timeout 120 --json
# {"messageId":"m81…","from":"no-reply@example.com","subject":"Your code is 482913","receivedAt":"…"}
# 3. read it, then clean up
moemail read --email-id k3f… --message-id m81… --json
moemail delete --email-id k3f…只教一次
CLI 自带一份 skill 文件。装好之后,Claude Code 或 Codex 遇到需要一次性收件箱的任务时会自己去用 moemail,不必每次都由你解释流程。
moemail skill install # auto-detects Claude Code and Codex
moemail skill install --platform claude # ~/.claude/skills/moemail/SKILL.md
moemail skill install --platform codex # ~/.codex/skills/moemail/SKILL.mdKey、额度与价格
两个包都用 MoeMail API Key 鉴权。在个人中心创建即可——与 REST API 用的是同一把 Key,也共用同一份月度额度。
API 访问是付费附加项:默认套餐不含免费调用次数。在商店用 MoeCoin 购买 API 调用包或升级为 Duke。网页收件箱本身始终免费,你可以先看看邮箱的实际效果,再为 API 付费。
请为轮询预留额度:wait_for_email 的每次轮询、CLI wait 的每次探测都算一次调用。一次典型的验证流程——创建、等待、读取、删除——是四次调用加上轮询次数。