diff --git a/README.md b/README.md index b26fae1..15c2c56 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Sending EmailsWebhook IntegrationOpenAPI • + CLI ToolEnvironment VariablesGithub OAuth ConfigGoogle OAuth Config • @@ -68,6 +69,7 @@ The documentation site contains detailed usage guides, API documentation, deploy - 🔔 **Webhook Notification**: Support receiving new email notifications via webhook - 🛡️ **Permission System**: Role-based access control system - 🔑 **OpenAPI**: Support accessing OpenAPI via API Key +- 🤖 **Agent-first CLI**: CLI tool designed for AI agents to automate email workflows - 🌍 **Multi-language Support**: Supports Chinese and English interfaces, freely switchable ## Tech Stack @@ -533,6 +535,56 @@ GET /api/emails/{emailId}/messages/{messageId}/share DELETE /api/emails/{emailId}/messages/{messageId}/share/{shareId} ``` +## CLI Tool + +MoeMail provides an agent-first CLI tool for AI agents and automation workflows. + +### Install + +```bash +npm i -g @moemail/cli +``` + +### Quick Start + +```bash +# Configure API endpoint and key +moemail config set api-url https://moemail.app +moemail config set api-key YOUR_API_KEY + +# Create temporary email +moemail create --domain moemail.app --expiry 1h --json + +# Wait for new messages (polling) +moemail wait --email-id --timeout 120 --json + +# Read message content +moemail read --email-id --message-id --json + +# Delete email +moemail delete --email-id +``` + +### Agent Workflow + +A typical AI agent verification flow in 3 tool calls: + +```bash +# 1. Create mailbox +EMAIL=$(moemail create --domain moemail.app --expiry 1h --json) +EMAIL_ID=$(echo $EMAIL | jq -r '.id') +ADDRESS=$(echo $EMAIL | jq -r '.address') + +# 2. Wait for verification email +MSG=$(moemail wait --email-id $EMAIL_ID --timeout 120 --json) +MSG_ID=$(echo $MSG | jq -r '.messageId') + +# 3. Read content, extract verification code +CONTENT=$(moemail read --email-id $EMAIL_ID --message-id $MSG_ID --json) +``` + +For full documentation, see [packages/cli/README.md](packages/cli/README.md). + ## Environment Variables ### Authentication diff --git a/README.zh-CN.md b/README.zh-CN.md index a8e55c1..a8edc37 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -29,6 +29,7 @@ 发件功能Webhook 集成OpenAPI • + CLI 工具环境变量Github OAuth App 配置Google OAuth App 配置 • @@ -68,6 +69,7 @@ - 🔔 **Webhook 通知**:支持通过 webhook 接收新邮件通知 - 🛡️ **权限系统**:支持基于角色的权限控制系统 - 🔑 **OpenAPI**:支持通过 API Key 访问 OpenAPI +- 🤖 **Agent CLI**:专为 AI Agent 设计的命令行工具,自动化邮箱工作流 - 🌍 **多语言支持**:支持中文和英文界面,可自由切换 ## 技术栈 @@ -785,6 +787,56 @@ const data = await res.json(); console.log('分享链接:', `https://your-domain.com/shared/message/${data.token}`); ``` +## CLI 工具 + +MoeMail 提供了专为 AI Agent 设计的命令行工具,用于自动化邮箱工作流。 + +### 安装 + +```bash +npm i -g @moemail/cli +``` + +### 快速上手 + +```bash +# 配置 API 地址和密钥 +moemail config set api-url https://moemail.app +moemail config set api-key YOUR_API_KEY + +# 创建临时邮箱 +moemail create --domain moemail.app --expiry 1h --json + +# 等待新邮件(轮询) +moemail wait --email-id --timeout 120 --json + +# 读取邮件内容 +moemail read --email-id --message-id --json + +# 删除邮箱 +moemail delete --email-id +``` + +### Agent 工作流 + +AI Agent 仅需 3 次调用即可完成验证流程: + +```bash +# 1. 创建邮箱 +EMAIL=$(moemail create --domain moemail.app --expiry 1h --json) +EMAIL_ID=$(echo $EMAIL | jq -r '.id') +ADDRESS=$(echo $EMAIL | jq -r '.address') + +# 2. 等待验证邮件 +MSG=$(moemail wait --email-id $EMAIL_ID --timeout 120 --json) +MSG_ID=$(echo $MSG | jq -r '.messageId') + +# 3. 读取内容,提取验证码 +CONTENT=$(moemail read --email-id $EMAIL_ID --message-id $MSG_ID --json) +``` + +详细文档见 [packages/cli/README.md](packages/cli/README.md)。 + ## 环境变量 本项目使用以下环境变量: diff --git a/packages/cli/README.md b/packages/cli/README.md index 72df70c..6cf8d2a 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -5,7 +5,7 @@ Agent-first CLI for MoeMail temporary email service ## Install ```bash -npm i -g moemail-cli +npm i -g @moemail/cli ``` ## Quick Start diff --git a/public/llms.txt b/public/llms.txt index 15f0f6b..8ede5c6 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -6,7 +6,7 @@ MoeMail provides disposable email addresses. Install the CLI for programmatic ac ## CLI Tool -Install: npm i -g moemail-cli +Install: npm i -g @moemail/cli Setup: moemail config set api-url https://moemail.app && moemail config set api-key YOUR_KEY