@bencibro/tempmail-mcp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/GUIDE.md +286 -0
  2. package/GUIDE.zh-CN.md +287 -0
  3. package/LICENSE +21 -0
  4. package/README.md +308 -0
  5. package/README.zh-CN.md +308 -0
  6. package/dist/base-provider.d.ts +21 -0
  7. package/dist/base-provider.d.ts.map +1 -0
  8. package/dist/base-provider.js +36 -0
  9. package/dist/base-provider.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +519 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/provider-manager.d.ts +36 -0
  15. package/dist/provider-manager.d.ts.map +1 -0
  16. package/dist/provider-manager.js +67 -0
  17. package/dist/provider-manager.js.map +1 -0
  18. package/dist/providers/auto-register.d.ts +45 -0
  19. package/dist/providers/auto-register.d.ts.map +1 -0
  20. package/dist/providers/auto-register.js +249 -0
  21. package/dist/providers/auto-register.js.map +1 -0
  22. package/dist/providers/catchmail.d.ts +20 -0
  23. package/dist/providers/catchmail.d.ts.map +1 -0
  24. package/dist/providers/catchmail.js +79 -0
  25. package/dist/providers/catchmail.js.map +1 -0
  26. package/dist/providers/guerrillamail.d.ts +21 -0
  27. package/dist/providers/guerrillamail.d.ts.map +1 -0
  28. package/dist/providers/guerrillamail.js +114 -0
  29. package/dist/providers/guerrillamail.js.map +1 -0
  30. package/dist/providers/mail-cx.d.ts +30 -0
  31. package/dist/providers/mail-cx.d.ts.map +1 -0
  32. package/dist/providers/mail-cx.js +154 -0
  33. package/dist/providers/mail-cx.js.map +1 -0
  34. package/dist/providers/mail-tm.d.ts +16 -0
  35. package/dist/providers/mail-tm.d.ts.map +1 -0
  36. package/dist/providers/mail-tm.js +109 -0
  37. package/dist/providers/mail-tm.js.map +1 -0
  38. package/dist/providers/maildrop.d.ts +22 -0
  39. package/dist/providers/maildrop.d.ts.map +1 -0
  40. package/dist/providers/maildrop.js +88 -0
  41. package/dist/providers/maildrop.js.map +1 -0
  42. package/dist/providers/one-secmail.d.ts +22 -0
  43. package/dist/providers/one-secmail.d.ts.map +1 -0
  44. package/dist/providers/one-secmail.js +98 -0
  45. package/dist/providers/one-secmail.js.map +1 -0
  46. package/dist/types.d.ts +96 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +5 -0
  49. package/dist/types.js.map +1 -0
  50. package/dist/utils.d.ts +33 -0
  51. package/dist/utils.d.ts.map +1 -0
  52. package/dist/utils.js +100 -0
  53. package/dist/utils.js.map +1 -0
  54. package/package.json +56 -0
package/GUIDE.md ADDED
@@ -0,0 +1,286 @@
1
+ # AI Guide: How to Use TempMail MCP
2
+
3
+ > This document is written for **AI agents** (Claude, GPT, etc.) that have access to the TempMail MCP server. It explains every available tool, when to use which, and provides copy-paste-ready decision trees for common tasks.
4
+
5
+ ---
6
+
7
+ ## Quick Start: The 3-Step Pattern
8
+
9
+ Almost every task with this MCP follows the same 3-step pattern:
10
+
11
+ ```
12
+ 1. create_mailbox → get a temporary email address
13
+ 2. [do something that sends email to that address]
14
+ 3. wait_for_email / get_verification_code → retrieve the result
15
+ ```
16
+
17
+ That's it. Everything else is optimization (choosing the right provider, filtering, cleanup).
18
+
19
+ ---
20
+
21
+ ## Tool Reference (Quick)
22
+
23
+ | Tool | Purpose | Key Parameters |
24
+ |------|---------|---------------|
25
+ | `list_providers` | See which providers are available | — |
26
+ | `get_domains` | Get available email domains | `provider` |
27
+ | `create_mailbox` | Create a temp email inbox | `provider`, `username`, `domain` |
28
+ | `get_messages` | List current emails | `address` |
29
+ | `get_message` | Read full email content | `address`, `messageId` |
30
+ | `wait_for_email` | Block until email arrives | `address`, `subjectContains`, `fromContains`, `timeoutMs` |
31
+ | `get_verification_code` | Wait + extract OTP/code | `address`, `subjectContains`, `fromContains`, `timeoutMs` |
32
+ | `list_mailboxes` | Show all created mailboxes | — |
33
+ | `delete_mailbox` | Clean up | `address` |
34
+ | `auto_register` | Auto-obtain API key | `provider` (`"maildrop"` or `"mail.cx"`) |
35
+
36
+ ---
37
+
38
+ ## Choosing a Provider
39
+
40
+ ### Default: `mail.tm`
41
+
42
+ Use `mail.tm` unless you have a specific reason not to. It's free, no API key needed, reliable, and supports account-based mailboxes.
43
+
44
+ ### When to use other providers
45
+
46
+ | If you need... | Use |
47
+ |---|---|
48
+ | No setup, fastest path | `mail.tm` (default) |
49
+ | A specific username | `guerrillamail` (supports custom usernames, 60-min expiry) |
50
+ | The simplest API | `1secmail` (implicit mailbox, no account) |
51
+ | Custom domains | `catchmail` (MX-based) or `mail.cx` |
52
+ | Long-polling (faster email arrival) | `mail.cx` (25s server-side hold) |
53
+ | High volume (300/day) | `maildrop` (requires API key — use `auto_register`) |
54
+ | High volume (500/day) | `mail.cx` (requires API token — use `auto_register`) |
55
+
56
+ ### When to call `auto_register`
57
+
58
+ Call `auto_register` when:
59
+ - The user needs `maildrop` or `mail.cx` but no API key is configured.
60
+ - You see `"maildrop"` or `"mail.cx"` missing from `list_providers` results.
61
+ - The user explicitly asks to "register" or "get an API key".
62
+
63
+ ```json
64
+ // Call auto_register — it takes ~2s for maildrop, ~15-30s for mail.cx
65
+ { "provider": "maildrop" }
66
+ { "provider": "mail.cx", "tokenName": "my-project" }
67
+ ```
68
+
69
+ After `auto_register`, the provider is **immediately available** in the current session — no need to restart or reconfigure.
70
+
71
+ ---
72
+
73
+ ## Common Workflows
74
+
75
+ ### Workflow 1: Website Registration with Email Verification
76
+
77
+ This is the most common task: register on a website that requires email verification.
78
+
79
+ ```
80
+ Step 1: create_mailbox
81
+ → Returns: { address: "abc123@somedomain.com", ... }
82
+
83
+ Step 2: [User or you register on the website using this email address]
84
+
85
+ Step 3: get_verification_code
86
+ → Waits for a verification email
87
+ → Automatically extracts the code
88
+ → Returns: { code: "829451", from: "noreply@example.com", ... }
89
+
90
+ Step 4: [Enter the code on the website to complete registration]
91
+
92
+ Step 5: delete_mailbox (optional cleanup)
93
+ ```
94
+
95
+ **Tip:** Use `subjectContains` to filter for the right email:
96
+ - `"verification"` — most common
97
+ - `"confirm"` — alternative
98
+ - `"code"` — another common one
99
+ - `"activate"` — account activation emails
100
+
101
+ ### Workflow 2: Waiting for a Specific Email
102
+
103
+ If you need a specific email (not just any verification code):
104
+
105
+ ```
106
+ Step 1: create_mailbox
107
+ Step 2: [Trigger the email — fill form, request password reset, etc.]
108
+ Step 3: wait_for_email
109
+ - Set subjectContains to filter by subject
110
+ - Set fromContains to filter by sender
111
+ - Set timeoutMs to 60000 (60s) or higher if needed
112
+ Step 4: get_message (if you need full body, attachments, etc.)
113
+ Step 5: delete_mailbox (cleanup)
114
+ ```
115
+
116
+ ### Workflow 3: Manual Email Checking
117
+
118
+ If you just want to see what's in the inbox:
119
+
120
+ ```
121
+ Step 1: create_mailbox
122
+ Step 2: get_messages → See all emails (summary only)
123
+ Step 3: get_message → Read a specific email in full
124
+ ```
125
+
126
+ ### Workflow 4: Setting Up All Providers
127
+
128
+ If the user wants maximum capacity:
129
+
130
+ ```
131
+ Step 1: auto_register (provider: "maildrop") → ~2 seconds
132
+ Step 2: auto_register (provider: "mail.cx") → ~15-30 seconds
133
+ Step 3: list_providers → Now shows all 6 providers
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Important Details
139
+
140
+ ### Mailbox State
141
+
142
+ - Mailboxes are tracked **in-memory per session**. If the MCP server restarts, all mailbox references are lost.
143
+ - Always use `create_mailbox` before `get_messages`, `wait_for_email`, or `get_verification_code`.
144
+ - If you get "No mailbox found for address", call `create_mailbox` first.
145
+
146
+ ### Timeouts
147
+
148
+ - Default timeout for `wait_for_email` and `get_verification_code` is **60 seconds**.
149
+ - If the email might take longer (slow sender, network issues), increase `timeoutMs` to `120000` (2 min).
150
+ - For `mail.cx`, the server uses 25-second long-polling, so emails arrive faster.
151
+
152
+ ### Verification Code Extraction
153
+
154
+ `get_verification_code` uses pattern matching to extract codes:
155
+ - Looks for keywords: `code`, `verification`, `verify`, `otp`, `pin`, `passcode`
156
+ - Extracts 4-8 digit numbers or alphanumeric codes near those keywords
157
+ - Falls back to any standalone 4-8 digit number
158
+
159
+ If extraction fails (returns `code: null`), call `get_message` and read the email body manually.
160
+
161
+ ### Error Handling
162
+
163
+ - `isError: true` in the response means the tool call failed. Read the `text` field for details.
164
+ - Common errors: mailbox not found, timeout waiting for email, provider not available.
165
+ - For provider not available: use `auto_register` or check `list_providers`.
166
+
167
+ ### Provider Quotas
168
+
169
+ | Provider | Limit | Behavior when exceeded |
170
+ |---|---|---|
171
+ | Mail.tm | 8 QPS | Rate limited (429) |
172
+ | Guerrilla Mail | Unlimited | — |
173
+ | 1secmail | Unlimited | — |
174
+ | Catchmail | 1 req/s | Rate limited |
175
+ | MailDrop | 300/day | 429 error |
176
+ | Mail.cx | 500/day | 429 error |
177
+
178
+ If you hit a quota, switch to another provider or use `auto_register` to get a new key.
179
+
180
+ ---
181
+
182
+ ## Response Formats
183
+
184
+ ### `create_mailbox` response
185
+
186
+ ```json
187
+ {
188
+ "success": true,
189
+ "address": "abc123@somedomain.com",
190
+ "provider": "mail.tm",
191
+ "createdAt": "2026-01-01T00:00:00.000Z",
192
+ "message": "Mailbox created. Use 'get_messages' to check for incoming emails..."
193
+ }
194
+ ```
195
+
196
+ ### `get_verification_code` response
197
+
198
+ ```json
199
+ {
200
+ "success": true,
201
+ "code": "829451",
202
+ "messageId": "msg_abc123",
203
+ "from": "noreply@example.com",
204
+ "subject": "Your verification code",
205
+ "date": "2026-01-01T00:00:00.000Z",
206
+ "bodyPreview": "Your verification code is 829451..."
207
+ }
208
+ ```
209
+
210
+ If no code could be extracted:
211
+
212
+ ```json
213
+ {
214
+ "success": true,
215
+ "code": null,
216
+ "messageId": "msg_abc123",
217
+ ...
218
+ }
219
+ ```
220
+
221
+ ### `auto_register` response
222
+
223
+ ```json
224
+ {
225
+ "success": true,
226
+ "provider": "maildrop",
227
+ "apiKey": "md_abc123...",
228
+ "email": "tmp_xxx@maildrop.cc",
229
+ "registeredAt": "2026-01-01T00:00:00.000Z",
230
+ "instructions": "API key is now active for this session. To make it permanent, set:\n MAILDROP_API_KEY=md_abc123..."
231
+ }
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Anti-Patterns: What NOT to Do
237
+
238
+ 1. **Don't call `get_messages` in a tight loop.** Use `wait_for_email` or `get_verification_code` instead — they handle polling internally and are more efficient.
239
+
240
+ 2. **Don't hardcode provider names unless necessary.** Call `list_providers` first to see what's available.
241
+
242
+ 3. **Don't forget to pass the `address`.** All email-reading tools require the exact address returned by `create_mailbox`.
243
+
244
+ 4. **Don't ignore `isError` responses.** If a tool returns `isError: true`, read the message and adjust your approach.
245
+
246
+ 5. **Don't create multiple mailboxes for one task.** One mailbox per registration flow is enough.
247
+
248
+ 6. **Don't call `auto_register` repeatedly.** It creates real accounts. Call it once per provider, save the key, and reuse it.
249
+
250
+ ---
251
+
252
+ ## Decision Tree: Which Tool to Call
253
+
254
+ ```
255
+ What does the user want?
256
+
257
+ ├── "I need a temp email"
258
+ │ └── create_mailbox (provider: "mail.tm" by default)
259
+
260
+ ├── "I'm waiting for a verification code"
261
+ │ └── get_verification_code (address, subjectContains: "verification")
262
+
263
+ ├── "I'm waiting for a specific email"
264
+ │ └── wait_for_email (address, subjectContains / fromContains)
265
+
266
+ ├── "Show me what's in the inbox"
267
+ │ └── get_messages (address)
268
+
269
+ ├── "Read a specific email"
270
+ │ └── get_message (address, messageId)
271
+
272
+ ├── "I need MailDrop / mail.cx but have no API key"
273
+ │ └── auto_register (provider: "maildrop" or "mail.cx")
274
+
275
+ ├── "What providers are available?"
276
+ │ └── list_providers
277
+
278
+ ├── "What domains can I use?"
279
+ │ └── get_domains (provider)
280
+
281
+ ├── "Show me all my temp mailboxes"
282
+ │ └── list_mailboxes
283
+
284
+ └── "Delete / clean up a mailbox"
285
+ └── delete_mailbox (address)
286
+ ```
package/GUIDE.zh-CN.md ADDED
@@ -0,0 +1,287 @@
1
+ # AI 使用指南:如何使用 TempMail MCP
2
+
3
+ > 本文档面向已接入 TempMail MCP 服务器的 **AI 代理**(Claude、GPT 等),解释每个可用工具的使用时机,并提供常见任务的决策树,可直接参考执行。
4
+
5
+ ---
6
+
7
+ ## 快速上手:三步模式
8
+
9
+ 几乎所有任务都遵循同一个三步模式:
10
+
11
+ ```
12
+ 1. create_mailbox → 获取一个临时邮箱地址
13
+ 2. [用该地址触发某个会发送邮件的操作]
14
+ 3. wait_for_email / get_verification_code → 获取结果
15
+ ```
16
+
17
+ 其余工具用于优化体验(选择合适的服务商、过滤、清理)。
18
+
19
+ ---
20
+
21
+ ## 工具速查表
22
+
23
+ | 工具 | 用途 | 关键参数 |
24
+ |------|---------|---------------|
25
+ | `list_providers` | 查看可用服务商 | — |
26
+ | `get_domains` | 获取可用域名 | `provider` |
27
+ | `create_mailbox` | 创建临时邮箱 | `provider`, `username`, `domain` |
28
+ | `get_messages` | 列出当前邮件 | `address` |
29
+ | `get_message` | 读取邮件完整内容 | `address`, `messageId` |
30
+ | `wait_for_email` | 阻塞等待邮件到达 | `address`, `subjectContains`, `fromContains`, `timeoutMs` |
31
+ | `get_verification_code` | 等待并自动提取验证码 | `address`, `subjectContains`, `fromContains`, `timeoutMs` |
32
+ | `list_mailboxes` | 列出所有已创建的邮箱 | — |
33
+ | `delete_mailbox` | 清理邮箱 | `address` |
34
+ | `auto_register` | 自动获取 API Key | `provider`(`"maildrop"` 或 `"mail.cx"`) |
35
+
36
+ ---
37
+
38
+ ## 服务商选择指南
39
+
40
+ ### 默认选择:`mail.tm`
41
+
42
+ 除非有特殊需求,默认使用 `mail.tm`。免费、无需 API Key、稳定可靠。
43
+
44
+ ### 何时使用其他服务商
45
+
46
+ | 需求 | 推荐服务商 |
47
+ |---|---|
48
+ | 无需配置,最快路径 | `mail.tm`(默认) |
49
+ | 需要指定用户名 | `guerrillamail`(支持自定义用户名,60 分钟过期) |
50
+ | 最简 API | `1secmail`(隐式邮箱,无需创建账号) |
51
+ | 自定义域名 | `catchmail`(基于 MX 记录)或 `mail.cx` |
52
+ | 长轮询(更快收到邮件) | `mail.cx`(服务端 25 秒长轮询) |
53
+ | 高频使用(300 次/天) | `maildrop`(需 API Key — 用 `auto_register` 获取) |
54
+ | 高频使用(500 次/天) | `mail.cx`(需 API Token — 用 `auto_register` 获取) |
55
+
56
+ ### 何时调用 `auto_register`
57
+
58
+ 以下情况调用 `auto_register`:
59
+ - 用户需要 `maildrop` 或 `mail.cx`,但未配置 API Key。
60
+ - `list_providers` 结果中缺少 `"maildrop"` 或 `"mail.cx"`。
61
+ - 用户明确要求"注册"或"获取 API Key"。
62
+
63
+ ```json
64
+ // 调用 auto_register — maildrop 约 2 秒,mail.cx 约 15-30 秒
65
+ { "provider": "maildrop" }
66
+ { "provider": "mail.cx", "tokenName": "my-project" }
67
+ ```
68
+
69
+ `auto_register` 后,该服务商在**当前会话中立即可用** — 无需重启或重新配置。
70
+
71
+ ---
72
+
73
+ ## 常见工作流
74
+
75
+ ### 工作流 1:网站注册 + 邮箱验证
76
+
77
+ 最常见的任务:在需要邮箱验证的网站上注册。
78
+
79
+ ```
80
+ 步骤 1:create_mailbox
81
+ → 返回:{ address: "abc123@somedomain.com", ... }
82
+
83
+ 步骤 2:[用户或你在网站上使用该邮箱地址注册]
84
+
85
+ 步骤 3:get_verification_code
86
+ → 等待验证邮件
87
+ → 自动提取验证码
88
+ → 返回:{ code: "829451", from: "noreply@example.com", ... }
89
+
90
+ 步骤 4:[在网站上输入验证码完成注册]
91
+
92
+ 步骤 5:delete_mailbox(可选清理)
93
+ ```
94
+
95
+ **提示:** 使用 `subjectContains` 过滤正确邮件:
96
+ - `"verification"` — 最常见
97
+ - `"confirm"` — 备选
98
+ - `"code"` — 另一种常见
99
+ - `"activate"` — 账号激活邮件
100
+ - `"验证"` — 中文邮件
101
+
102
+ ### 工作流 2:等待特定邮件
103
+
104
+ 如果需要特定的邮件(不仅仅是验证码):
105
+
106
+ ```
107
+ 步骤 1:create_mailbox
108
+ 步骤 2:[触发邮件 — 填写表单、请求密码重置等]
109
+ 步骤 3:wait_for_email
110
+ - 设置 subjectContains 按主题过滤
111
+ - 设置 fromContains 按发件人过滤
112
+ - 设置 timeoutMs 为 60000(60 秒)或更长
113
+ 步骤 4:get_message(如需完整正文、附件等)
114
+ 步骤 5:delete_mailbox(清理)
115
+ ```
116
+
117
+ ### 工作流 3:手动查看邮件
118
+
119
+ 如果只想查看邮箱内容:
120
+
121
+ ```
122
+ 步骤 1:create_mailbox
123
+ 步骤 2:get_messages → 查看所有邮件(仅摘要)
124
+ 步骤 3:get_message → 读取特定邮件的完整内容
125
+ ```
126
+
127
+ ### 工作流 4:启用所有服务商
128
+
129
+ 如果用户需要最大容量:
130
+
131
+ ```
132
+ 步骤 1:auto_register (provider: "maildrop") → 约 2 秒
133
+ 步骤 2:auto_register (provider: "mail.cx") → 约 15-30 秒
134
+ 步骤 3:list_providers → 现在显示全部 6 个服务商
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 重要细节
140
+
141
+ ### 邮箱状态
142
+
143
+ - 邮箱在**当前会话内存中跟踪**。MCP 服务器重启后,所有邮箱引用将丢失。
144
+ - 在调用 `get_messages`、`wait_for_email` 或 `get_verification_code` 之前,务必先调用 `create_mailbox`。
145
+ - 如果收到 "No mailbox found for address" 错误,请先调用 `create_mailbox`。
146
+
147
+ ### 超时
148
+
149
+ - `wait_for_email` 和 `get_verification_code` 的默认超时为 **60 秒**。
150
+ - 如果邮件可能延迟(发送方慢、网络问题),将 `timeoutMs` 增加到 `120000`(2 分钟)。
151
+ - 对于 `mail.cx`,服务端使用 25 秒长轮询,邮件到达更快。
152
+
153
+ ### 验证码提取
154
+
155
+ `get_verification_code` 使用模式匹配提取验证码:
156
+ - 查找关键词:`code`、`verification`、`verify`、`otp`、`pin`、`passcode`、`验证`、`認証`
157
+ - 提取这些关键词附近的 4-8 位数字或字母数字代码
158
+ - 回退到任何独立的 4-8 位数字
159
+
160
+ 如果提取失败(返回 `code: null`),调用 `get_message` 手动阅读邮件正文。
161
+
162
+ ### 错误处理
163
+
164
+ - 响应中 `isError: true` 表示工具调用失败。阅读 `text` 字段了解详情。
165
+ - 常见错误:邮箱未找到、等待邮件超时、服务商不可用。
166
+ - 服务商不可用时:使用 `auto_register` 或检查 `list_providers`。
167
+
168
+ ### 服务商配额
169
+
170
+ | 服务商 | 限制 | 超限行为 |
171
+ |---|---|---|
172
+ | Mail.tm | 8 QPS | 限流(429) |
173
+ | Guerrilla Mail | 无限制 | — |
174
+ | 1secmail | 无限制 | — |
175
+ | Catchmail | 1 req/s | 限流 |
176
+ | MailDrop | 300 次/天 | 429 错误 |
177
+ | Mail.cx | 500 次/天 | 429 错误 |
178
+
179
+ 如果达到配额限制,切换到其他服务商或使用 `auto_register` 获取新 Key。
180
+
181
+ ---
182
+
183
+ ## 响应格式
184
+
185
+ ### `create_mailbox` 响应
186
+
187
+ ```json
188
+ {
189
+ "success": true,
190
+ "address": "abc123@somedomain.com",
191
+ "provider": "mail.tm",
192
+ "createdAt": "2026-01-01T00:00:00.000Z",
193
+ "message": "Mailbox created. Use 'get_messages' to check for incoming emails..."
194
+ }
195
+ ```
196
+
197
+ ### `get_verification_code` 响应
198
+
199
+ ```json
200
+ {
201
+ "success": true,
202
+ "code": "829451",
203
+ "messageId": "msg_abc123",
204
+ "from": "noreply@example.com",
205
+ "subject": "Your verification code",
206
+ "date": "2026-01-01T00:00:00.000Z",
207
+ "bodyPreview": "Your verification code is 829451..."
208
+ }
209
+ ```
210
+
211
+ 无法提取验证码时:
212
+
213
+ ```json
214
+ {
215
+ "success": true,
216
+ "code": null,
217
+ "messageId": "msg_abc123",
218
+ ...
219
+ }
220
+ ```
221
+
222
+ ### `auto_register` 响应
223
+
224
+ ```json
225
+ {
226
+ "success": true,
227
+ "provider": "maildrop",
228
+ "apiKey": "md_abc123...",
229
+ "email": "tmp_xxx@maildrop.cc",
230
+ "registeredAt": "2026-01-01T00:00:00.000Z",
231
+ "instructions": "API key is now active for this session. To make it permanent, set:\n MAILDROP_API_KEY=md_abc123..."
232
+ }
233
+ ```
234
+
235
+ ---
236
+
237
+ ## 反模式:不应该做的事
238
+
239
+ 1. **不要在紧密循环中调用 `get_messages`。** 改用 `wait_for_email` 或 `get_verification_code` — 它们内部处理轮询,效率更高。
240
+
241
+ 2. **不要硬编码服务商名称。** 先调用 `list_providers` 查看可用服务商。
242
+
243
+ 3. **不要忘记传递 `address`。** 所有邮件读取工具都要求传递 `create_mailbox` 返回的确切地址。
244
+
245
+ 4. **不要忽略 `isError` 响应。** 如果工具返回 `isError: true`,阅读消息并调整策略。
246
+
247
+ 5. **不要为一个任务创建多个邮箱。** 一次注册流程一个邮箱就够了。
248
+
249
+ 6. **不要反复调用 `auto_register`。** 每次调用都会创建真实账号。每个服务商调用一次,保存 Key,然后复用。
250
+
251
+ ---
252
+
253
+ ## 决策树:该调用哪个工具
254
+
255
+ ```
256
+ 用户想要什么?
257
+
258
+ ├── "我需要一个临时邮箱"
259
+ │ └── create_mailbox(默认 provider: "mail.tm")
260
+
261
+ ├── "我在等验证码"
262
+ │ └── get_verification_code(address, subjectContains: "verification")
263
+
264
+ ├── "我在等一封特定邮件"
265
+ │ └── wait_for_email(address, subjectContains / fromContains)
266
+
267
+ ├── "查看邮箱里有什么"
268
+ │ └── get_messages(address)
269
+
270
+ ├── "读取某封邮件"
271
+ │ └── get_message(address, messageId)
272
+
273
+ ├── "需要 MailDrop / mail.cx 但没有 API Key"
274
+ │ └── auto_register(provider: "maildrop" 或 "mail.cx")
275
+
276
+ ├── "有哪些可用服务商?"
277
+ │ └── list_providers
278
+
279
+ ├── "可以用哪些域名?"
280
+ │ └── get_domains(provider)
281
+
282
+ ├── "查看我创建的所有邮箱"
283
+ │ └── list_mailboxes
284
+
285
+ └── "删除 / 清理邮箱"
286
+ └── delete_mailbox(address)
287
+ ```
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bencibr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.