mcp-twake-mail 0.1.0 → 2.0.0

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 (86) hide show
  1. package/README.md +168 -74
  2. package/build/cli/commands/setup.js +54 -12
  3. package/build/cli/commands/setup.js.map +1 -1
  4. package/build/cli/prompts/setup-wizard.d.ts +33 -1
  5. package/build/cli/prompts/setup-wizard.js +134 -2
  6. package/build/cli/prompts/setup-wizard.js.map +1 -1
  7. package/build/cli/prompts/setup-wizard.test.d.ts +1 -0
  8. package/build/cli/prompts/setup-wizard.test.js +161 -0
  9. package/build/cli/prompts/setup-wizard.test.js.map +1 -0
  10. package/build/config/schema.d.ts +2 -0
  11. package/build/config/schema.js +3 -0
  12. package/build/config/schema.js.map +1 -1
  13. package/build/discovery/dns-srv.d.ts +18 -0
  14. package/build/discovery/dns-srv.js +60 -0
  15. package/build/discovery/dns-srv.js.map +1 -0
  16. package/build/discovery/dns-srv.test.d.ts +4 -0
  17. package/build/discovery/dns-srv.test.js +79 -0
  18. package/build/discovery/dns-srv.test.js.map +1 -0
  19. package/build/discovery/index.d.ts +9 -0
  20. package/build/discovery/index.js +13 -0
  21. package/build/discovery/index.js.map +1 -0
  22. package/build/discovery/oauth-discovery.d.ts +34 -0
  23. package/build/discovery/oauth-discovery.js +160 -0
  24. package/build/discovery/oauth-discovery.js.map +1 -0
  25. package/build/discovery/oauth-discovery.test.d.ts +1 -0
  26. package/build/discovery/oauth-discovery.test.js +198 -0
  27. package/build/discovery/oauth-discovery.test.js.map +1 -0
  28. package/build/discovery/orchestrator.d.ts +31 -0
  29. package/build/discovery/orchestrator.js +87 -0
  30. package/build/discovery/orchestrator.js.map +1 -0
  31. package/build/discovery/orchestrator.test.d.ts +4 -0
  32. package/build/discovery/orchestrator.test.js +242 -0
  33. package/build/discovery/orchestrator.test.js.map +1 -0
  34. package/build/discovery/types.d.ts +18 -0
  35. package/build/discovery/types.js +15 -0
  36. package/build/discovery/types.js.map +1 -0
  37. package/build/discovery/well-known.d.ts +21 -0
  38. package/build/discovery/well-known.js +52 -0
  39. package/build/discovery/well-known.js.map +1 -0
  40. package/build/discovery/well-known.test.d.ts +4 -0
  41. package/build/discovery/well-known.test.js +120 -0
  42. package/build/discovery/well-known.test.js.map +1 -0
  43. package/build/jmap/client.js +1 -1
  44. package/build/jmap/client.js.map +1 -1
  45. package/build/mcp/server.d.ts +5 -3
  46. package/build/mcp/server.js +11 -5
  47. package/build/mcp/server.js.map +1 -1
  48. package/build/mcp/tools/batch-operations.d.ts +10 -0
  49. package/build/mcp/tools/batch-operations.js +609 -0
  50. package/build/mcp/tools/batch-operations.js.map +1 -0
  51. package/build/mcp/tools/batch-operations.test.d.ts +1 -0
  52. package/build/mcp/tools/batch-operations.test.js +875 -0
  53. package/build/mcp/tools/batch-operations.test.js.map +1 -0
  54. package/build/mcp/tools/email-operations.js +355 -1
  55. package/build/mcp/tools/email-operations.js.map +1 -1
  56. package/build/mcp/tools/email-operations.test.js +5 -3
  57. package/build/mcp/tools/email-operations.test.js.map +1 -1
  58. package/build/mcp/tools/email-sending.d.ts +10 -1
  59. package/build/mcp/tools/email-sending.js +481 -14
  60. package/build/mcp/tools/email-sending.js.map +1 -1
  61. package/build/mcp/tools/index.d.ts +10 -1
  62. package/build/mcp/tools/index.js +7 -3
  63. package/build/mcp/tools/index.js.map +1 -1
  64. package/build/mcp/tools/mailbox.js +433 -1
  65. package/build/mcp/tools/mailbox.js.map +1 -1
  66. package/build/mcp/tools/mailbox.test.js +5 -2
  67. package/build/mcp/tools/mailbox.test.js.map +1 -1
  68. package/build/signature/converter.d.ts +2 -0
  69. package/build/signature/converter.js +23 -0
  70. package/build/signature/converter.js.map +1 -0
  71. package/build/signature/converter.test.d.ts +1 -0
  72. package/build/signature/converter.test.js +84 -0
  73. package/build/signature/converter.test.js.map +1 -0
  74. package/build/signature/index.d.ts +2 -0
  75. package/build/signature/index.js +3 -0
  76. package/build/signature/index.js.map +1 -0
  77. package/build/signature/loader.d.ts +6 -0
  78. package/build/signature/loader.js +31 -0
  79. package/build/signature/loader.js.map +1 -0
  80. package/build/signature/loader.test.d.ts +1 -0
  81. package/build/signature/loader.test.js +85 -0
  82. package/build/signature/loader.test.js.map +1 -0
  83. package/build/types/jmap.d.ts +23 -0
  84. package/docs/auto-discovery.md +210 -0
  85. package/docs/oidc-configuration.md +261 -0
  86. package/package.json +3 -1
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # mcp-twake-mail
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/mcp-twake-mail)](https://www.npmjs.com/package/mcp-twake-mail)
3
4
  [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE)
4
5
  [![Node.js >= 20](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
5
6
 
@@ -16,10 +17,14 @@ mcp-twake-mail is a Model Context Protocol (MCP) server that connects any MCP-co
16
17
  - Works with any MCP-compatible AI assistant
17
18
  - Full control over email data — read, write, send, and organize
18
19
  - Multiple authentication methods: Basic, Bearer token, or OIDC
20
+ - **Auto-discovery** — configure with just your email address
21
+ - **Email signatures** — automatic Markdown signature injection
19
22
  - Secure HTTPS-only connections
20
23
 
21
24
  ## Features
22
25
 
26
+ ### 29 MCP Tools
27
+
23
28
  **Email Read Tools:**
24
29
  - `list_emails` - List emails with filtering, search, and pagination
25
30
  - `get_email` - Get full email content including body and headers
@@ -29,24 +34,43 @@ mcp-twake-mail is a Model Context Protocol (MCP) server that connects any MCP-co
29
34
  **Email Compose Tools:**
30
35
  - `send_email` - Compose and send a new email (plain text and/or HTML)
31
36
  - `reply_email` - Reply to an email with proper threading (In-Reply-To, References)
37
+ - `forward_email` - Forward an email with attachments and personal note
32
38
  - `create_draft` - Create a draft email for later editing or sending
39
+ - `update_draft` - Update an existing draft (subject, body, recipients)
40
+ - `send_draft` - Send a previously saved draft
33
41
 
34
42
  **Email Management Tools:**
35
- - `mark_as_read` - Mark an email as read
36
- - `mark_as_unread` - Mark an email as unread
43
+ - `mark_as_read` / `mark_as_unread` - Mark email read status
37
44
  - `delete_email` - Move to trash or permanently delete
38
45
  - `move_email` - Move an email to a different mailbox
39
- - `add_label` - Add a label/mailbox to an email
40
- - `remove_label` - Remove a label/mailbox from an email
46
+ - `add_label` / `remove_label` - Add or remove labels/mailboxes
47
+
48
+ **Batch Operations (up to 50 emails at once):**
49
+ - `batch_mark_read` / `batch_mark_unread` - Mark multiple emails
50
+ - `batch_delete` - Delete multiple emails
51
+ - `batch_move` - Move multiple emails to a mailbox
52
+ - `batch_add_label` / `batch_remove_label` - Add/remove labels from multiple emails
41
53
 
42
54
  **Mailbox Tools:**
43
55
  - `list_mailboxes` - List all mailboxes (Inbox, Sent, Drafts, etc.)
56
+ - `get_mailbox` - Get mailbox details by ID
57
+ - `create_mailbox` - Create a new folder with optional nesting
58
+ - `rename_mailbox` - Rename an existing folder (system folders protected)
59
+ - `delete_mailbox` - Delete an empty folder with safety checks
44
60
 
45
61
  **Attachment Tools:**
46
62
  - `get_attachments` - List attachment metadata for an email
47
- - `download_attachment` - Download attachment content (auto-saves large files to disk)
63
+ - `download_attachment` - Download attachment content (auto-saves large files)
64
+
65
+ ### Advanced Features
48
66
 
49
- **Advanced Features:**
67
+ - **Auto-discovery** — Configure with just your email address (DNS SRV + .well-known/jmap)
68
+ - **Email signatures** — Markdown signature files automatically appended to emails
69
+ - **Default sender identity** — Configure default "from" address
70
+ - **Batch operations** — Process up to 50 emails in a single request
71
+ - **Draft workflow** — Create, update, and send drafts with atomic transitions
72
+ - **Folder management** — Create, rename, and delete custom folders
73
+ - **System folder protection** — Cannot modify Inbox, Sent, Drafts, Trash
50
74
  - OIDC authentication with PKCE (S256) for enterprise SSO
51
75
  - Automatic token refresh for OIDC sessions
52
76
  - Thread-based email grouping
@@ -66,6 +90,11 @@ mcp-twake-mail is a Model Context Protocol (MCP) server that connects any MCP-co
66
90
 
67
91
  ## Installation
68
92
 
93
+ **From npm (recommended):**
94
+ ```bash
95
+ npx mcp-twake-mail setup
96
+ ```
97
+
69
98
  **From source:**
70
99
  ```bash
71
100
  git clone https://github.com/linagora/mcp-twake-mail.git
@@ -83,55 +112,61 @@ npx mcp-twake-mail setup
83
112
  ```
84
113
 
85
114
  The wizard will:
86
- 1. Ask for your JMAP server session URL
115
+ 1. **Auto-discover** your JMAP server from your email address (or enter manually)
87
116
  2. Ask for your authentication method (Basic, Bearer, or OIDC)
88
117
  3. Collect the required credentials
89
- 4. Test the connection to your JMAP server
90
- 5. Generate and optionally write the configuration to your Claude Desktop config file
118
+ 4. **Configure default sender** and optional email signature
119
+ 5. Test the connection to your JMAP server
120
+ 6. Generate and optionally write the configuration to your Claude Desktop config file
121
+
122
+ ### Auto-Discovery Mode
123
+
124
+ The setup wizard supports **auto-discovery** — just provide your email address and the system will automatically find your JMAP server:
91
125
 
92
- Example session:
93
126
  ```
94
127
  === MCP Twake Mail Setup Wizard ===
95
128
 
96
- JMAP Session URL: https://jmap.example.com/jmap/session
129
+ Setup mode:
130
+ 1. Auto-discover from email address (Recommended)
131
+ 2. Manual configuration
132
+ Choose [1-2]: 1
97
133
 
98
- Authentication method:
99
- 1. Basic (username/password)
100
- 2. Bearer token (JWT)
101
- 3. OIDC (OpenID Connect)
102
- Choose [1-3]: 1
134
+ Email address: user@example.com
103
135
 
104
- Username: user@example.com
105
- Password: ********
136
+ Discovering JMAP server...
137
+ ✓ Found JMAP server: https://jmap.example.com/jmap/session
138
+ ✓ Found OIDC issuer: https://sso.example.com
106
139
 
107
- Testing connection...
108
- Connected! Account ID: abc123
140
+ Use discovered settings? [Y/n]: y
141
+ ```
109
142
 
110
- Server name for Claude config [twake-mail]: twake-mail
143
+ The auto-discovery uses:
144
+ - **DNS SRV** lookup: `_jmap._tcp.{domain}`
145
+ - **.well-known/jmap** endpoint
146
+ - **OAuth metadata** discovery for OIDC configuration
111
147
 
112
- --- Generated Claude Desktop Config ---
113
- {
114
- "mcpServers": {
115
- "twake-mail": {
116
- "command": "npx",
117
- "args": ["-y", "mcp-twake-mail"],
118
- "env": {
119
- "JMAP_SESSION_URL": "https://jmap.example.com/jmap/session",
120
- "JMAP_AUTH_METHOD": "basic",
121
- "JMAP_USERNAME": "user@example.com",
122
- "JMAP_PASSWORD": "********"
123
- }
124
- }
125
- }
126
- }
127
- ---------------------------------------
148
+ See [docs/auto-discovery.md](docs/auto-discovery.md) for details.
128
149
 
129
- Write to Claude Desktop config? [Y/n]: y
150
+ ### Email Signature Support
130
151
 
131
- Config written successfully!
132
- Restart Claude Desktop to load the new configuration.
152
+ Configure an optional Markdown signature file that will be automatically appended to all emails:
153
+
154
+ ```
155
+ Configure email signature file? [y/N]: y
156
+ Path to signature file (Markdown format): ~/.mcp-twake-mail/signature.md
157
+ ```
158
+
159
+ Example signature file (`~/.mcp-twake-mail/signature.md`):
160
+ ```markdown
161
+ **John Doe**
162
+ Software Engineer
163
+ [john.doe@example.com](mailto:john.doe@example.com)
133
164
  ```
134
165
 
166
+ The signature is automatically converted to HTML for rich emails and plain text for simple emails.
167
+
168
+ See [docs/signature.md](docs/signature.md) for details.
169
+
135
170
  ### CLI Commands
136
171
 
137
172
  | Command | Description |
@@ -173,9 +208,18 @@ For enterprise SSO with OpenID Connect (PKCE S256):
173
208
  | `JMAP_OIDC_ISSUER` | Yes | OIDC provider issuer URL | `https://sso.example.com` |
174
209
  | `JMAP_OIDC_CLIENT_ID` | Yes | OIDC client ID | `my-client-id` |
175
210
  | `JMAP_OIDC_SCOPE` | No | OIDC scopes | `openid profile email offline_access` |
176
- | `JMAP_OIDC_REDIRECT_URI` | No | Callback URI for OIDC flow | `http://localhost:5678/callback` |
211
+ | `JMAP_OIDC_REDIRECT_URI` | No | Callback URI for OIDC flow | `http://localhost:3000/callback` |
212
+
213
+ See [docs/oidc-configuration.md](docs/oidc-configuration.md) for detailed OIDC setup instructions.
214
+
215
+ #### Identity & Signature (Optional)
216
+
217
+ | Variable | Required | Description | Example |
218
+ |----------|----------|-------------|---------|
219
+ | `JMAP_DEFAULT_FROM` | No | Default sender email address | `user@example.com` |
220
+ | `JMAP_SIGNATURE_PATH` | No | Path to Markdown signature file | `~/.mcp-twake-mail/signature.md` |
177
221
 
178
- #### Optional
222
+ #### Other Options
179
223
 
180
224
  | Variable | Description | Default |
181
225
  |----------|-------------|---------|
@@ -196,14 +240,16 @@ Add the following to your Claude Desktop configuration file:
196
240
  ```json
197
241
  {
198
242
  "mcpServers": {
199
- "twake-mail": {
200
- "command": "node",
201
- "args": ["/path/to/mcp-twake-mail/build/index.js"],
243
+ "mcp-twake-mail": {
244
+ "command": "npx",
245
+ "args": ["-y", "mcp-twake-mail"],
202
246
  "env": {
203
247
  "JMAP_SESSION_URL": "https://jmap.example.com/jmap/session",
204
248
  "JMAP_AUTH_METHOD": "basic",
205
249
  "JMAP_USERNAME": "user@example.com",
206
- "JMAP_PASSWORD": "your-password"
250
+ "JMAP_PASSWORD": "your-password",
251
+ "JMAP_DEFAULT_FROM": "user@example.com",
252
+ "JMAP_SIGNATURE_PATH": "~/.mcp-twake-mail/signature.md"
207
253
  }
208
254
  }
209
255
  }
@@ -215,16 +261,17 @@ Add the following to your Claude Desktop configuration file:
215
261
  ```json
216
262
  {
217
263
  "mcpServers": {
218
- "twake-mail": {
219
- "command": "node",
220
- "args": ["/path/to/mcp-twake-mail/build/index.js"],
264
+ "mcp-twake-mail": {
265
+ "command": "npx",
266
+ "args": ["-y", "mcp-twake-mail"],
221
267
  "env": {
222
268
  "JMAP_SESSION_URL": "https://jmap.example.com/jmap/session",
223
269
  "JMAP_AUTH_METHOD": "oidc",
224
270
  "JMAP_OIDC_ISSUER": "https://sso.example.com",
225
271
  "JMAP_OIDC_CLIENT_ID": "my-client-id",
226
272
  "JMAP_OIDC_SCOPE": "openid profile email offline_access",
227
- "JMAP_OIDC_REDIRECT_URI": "http://localhost:5678/callback"
273
+ "JMAP_DEFAULT_FROM": "user@example.com",
274
+ "JMAP_SIGNATURE_PATH": "~/.mcp-twake-mail/signature.md"
228
275
  }
229
276
  }
230
277
  }
@@ -247,38 +294,73 @@ Once configured, you can ask Claude natural language questions about your email:
247
294
  **Email composition:**
248
295
  - "Send an email to pierre@example.com about the meeting tomorrow"
249
296
  - "Reply to this email thanking them for the information"
297
+ - "Forward this email to the team with a note"
250
298
  - "Create a draft email to the team about the project update"
251
299
 
300
+ **Draft management:**
301
+ - "Update the draft to change the subject line"
302
+ - "Add Marie to the CC list on that draft"
303
+ - "Send the draft I was working on"
304
+
252
305
  **Email management:**
253
306
  - "Mark this email as read"
254
307
  - "Move this email to the Archive folder"
255
308
  - "Delete all spam emails"
256
309
  - "Add the 'Important' label to this email"
257
310
 
311
+ **Batch operations:**
312
+ - "Mark all emails from last week as read"
313
+ - "Move all newsletters to the Archive folder"
314
+ - "Delete all emails older than 30 days in Trash"
315
+
316
+ **Folder management:**
317
+ - "Create a new folder called 'Projects'"
318
+ - "Rename the 'Old Stuff' folder to 'Archive 2025'"
319
+ - "Delete the empty 'Temp' folder"
320
+
258
321
  **Attachments:**
259
322
  - "What attachments are in this email?"
260
323
  - "Download the PDF attachment"
261
324
 
325
+ ## Documentation
326
+
327
+ - [Auto-Discovery](docs/auto-discovery.md) — How JMAP and OIDC auto-discovery works
328
+ - [Email Signatures](docs/signature.md) — Configure Markdown email signatures
329
+ - [OIDC Configuration](docs/oidc-configuration.md) — Detailed OIDC/OAuth setup guide
330
+
262
331
  ## Available Tools
263
332
 
264
- | Tool Name | Description |
265
- |-----------|-------------|
266
- | `list_emails` | List emails with optional filters (mailbox, limit, search) |
267
- | `get_email` | Get full email content by ID |
268
- | `search_emails` | Search emails by keywords |
269
- | `get_thread` | Get all emails in a thread |
270
- | `send_email` | Send a new email |
271
- | `reply_email` | Reply to an email with threading |
272
- | `create_draft` | Create a draft email |
273
- | `mark_as_read` | Mark email as read |
274
- | `mark_as_unread` | Mark email as unread |
275
- | `delete_email` | Delete or trash an email |
276
- | `move_email` | Move email to another mailbox |
277
- | `add_label` | Add mailbox/label to email |
278
- | `remove_label` | Remove mailbox/label from email |
279
- | `list_mailboxes` | List all mailboxes |
280
- | `get_attachments` | List attachment metadata |
281
- | `download_attachment` | Download attachment content |
333
+ | Tool Name | Description | Category |
334
+ |-----------|-------------|----------|
335
+ | `list_emails` | List emails with optional filters (mailbox, limit, search) | Read |
336
+ | `get_email` | Get full email content by ID | Read |
337
+ | `search_emails` | Search emails by keywords | Read |
338
+ | `get_thread` | Get all emails in a thread | Read |
339
+ | `send_email` | Send a new email | Compose |
340
+ | `reply_email` | Reply to an email with threading | Compose |
341
+ | `forward_email` | Forward an email with attachments | Compose |
342
+ | `create_draft` | Create a draft email | Compose |
343
+ | `update_draft` | Update an existing draft | Compose |
344
+ | `send_draft` | Send a saved draft | Compose |
345
+ | `mark_as_read` | Mark email as read | Manage |
346
+ | `mark_as_unread` | Mark email as unread | Manage |
347
+ | `delete_email` | Delete or trash an email | Manage |
348
+ | `move_email` | Move email to another mailbox | Manage |
349
+ | `add_label` | Add mailbox/label to email | Manage |
350
+ | `remove_label` | Remove mailbox/label from email | Manage |
351
+ | `batch_mark_read` | Mark multiple emails as read | Batch |
352
+ | `batch_mark_unread` | Mark multiple emails as unread | Batch |
353
+ | `batch_delete` | Delete multiple emails | Batch |
354
+ | `batch_move` | Move multiple emails | Batch |
355
+ | `batch_add_label` | Add label to multiple emails | Batch |
356
+ | `batch_remove_label` | Remove label from multiple emails | Batch |
357
+ | `list_mailboxes` | List all mailboxes | Mailbox |
358
+ | `get_mailbox` | Get mailbox details | Mailbox |
359
+ | `create_mailbox` | Create a new folder | Mailbox |
360
+ | `rename_mailbox` | Rename a folder | Mailbox |
361
+ | `delete_mailbox` | Delete an empty folder | Mailbox |
362
+ | `get_attachments` | List attachment metadata | Attachment |
363
+ | `download_attachment` | Download attachment content | Attachment |
282
364
 
283
365
  ## Development
284
366
 
@@ -287,7 +369,7 @@ git clone https://github.com/linagora/mcp-twake-mail.git
287
369
  cd mcp-twake-mail
288
370
  npm install
289
371
  npm run build # compile TypeScript
290
- npm test # run tests
372
+ npm test # run tests (704 tests)
291
373
  npm run dev # watch mode (auto-rebuild on file changes)
292
374
  ```
293
375
 
@@ -298,13 +380,15 @@ The server uses the MCP stdio transport and communicates via JSON-RPC on stdin/s
298
380
  mcp-twake-mail is built with a layered architecture:
299
381
 
300
382
  1. **Configuration Layer** - Zod-based environment variable validation with fail-fast behavior
301
- 2. **Logging Layer** - Pino logger configured for stderr output (prevents stdout contamination in MCP stdio transport)
383
+ 2. **Logging Layer** - Pino logger configured for stderr output (prevents stdout contamination)
302
384
  3. **Authentication Layer** - Multi-method auth support (Basic, Bearer, OIDC with PKCE)
303
385
  4. **Token Management** - Automatic token refresh for OIDC with secure token storage
304
- 5. **JMAP Client Layer** - Session management, request batching, blob download support
305
- 6. **Transformation Layer** - Email/Mailbox data transformation for AI-friendly output
306
- 7. **MCP Tool Layer** - 16 MCP tools exposing email functionality with tool annotations
307
- 8. **Entry Point** - MCP server initialization with stdio transport
386
+ 5. **Discovery Layer** - Auto-discovery via DNS SRV, .well-known/jmap, and OAuth metadata
387
+ 6. **JMAP Client Layer** - Session management, request batching, blob download support
388
+ 7. **Signature Layer** - Markdown-to-HTML conversion for email signatures
389
+ 8. **Transformation Layer** - Email/Mailbox data transformation for AI-friendly output
390
+ 9. **MCP Tool Layer** - 29 MCP tools exposing email functionality with tool annotations
391
+ 10. **Entry Point** - MCP server initialization with stdio transport
308
392
 
309
393
  **Key design decisions:**
310
394
  - ESM modules with `.js` import extensions (required by MCP SDK)
@@ -312,6 +396,16 @@ mcp-twake-mail is built with a layered architecture:
312
396
  - AI-friendly error formatting for troubleshooting
313
397
  - Large attachment handling (auto-save to disk for files > 750KB)
314
398
  - MCP tool annotations for AI clients (readOnlyHint, destructiveHint, idempotentHint)
399
+ - Batch operations with per-item success/failure reporting
400
+ - System folder protection for safe mailbox management
401
+
402
+ ## Version History
403
+
404
+ | Version | Release | Highlights |
405
+ |---------|---------|------------|
406
+ | v2.0 | 2026-01-31 | Draft management (update/send), Mailbox management (create/rename/delete), 29 tools total |
407
+ | v1.1 | 2026-01-31 | Email forwarding, Batch operations (6 tools) |
408
+ | v1.0 | 2026-01-30 | Initial release - 17 tools, 3 auth methods, auto-discovery, signatures |
315
409
 
316
410
  ## License
317
411
 
@@ -5,7 +5,7 @@
5
5
  import { homedir } from 'node:os';
6
6
  import { join } from 'node:path';
7
7
  import { readFile, writeFile, mkdir } from 'node:fs/promises';
8
- import { promptJmapUrl, promptAuthMethod, promptBasicAuth, promptBearerToken, promptOidcAuth, promptWriteConfig, promptServerName, } from '../prompts/setup-wizard.js';
8
+ import { promptJmapUrl, promptAuthMethod, promptBasicAuth, promptBearerToken, promptOidcAuth, promptWriteConfig, promptServerName, promptSetupMode, promptEmail, promptConfirmDiscovery, promptDefaultFrom, promptSignaturePath, } from '../prompts/setup-wizard.js';
9
9
  /**
10
10
  * Get Claude Desktop config file path based on platform.
11
11
  */
@@ -87,8 +87,39 @@ async function testConnection(env) {
87
87
  */
88
88
  export async function runSetup() {
89
89
  console.log('\n=== MCP Twake Mail Setup Wizard ===\n');
90
- // Step 1: JMAP URL
91
- const jmapUrl = await promptJmapUrl();
90
+ // Step 1: Choose setup mode
91
+ const mode = await promptSetupMode();
92
+ let jmapUrl;
93
+ const discoveredOidc = {};
94
+ if (mode === 'auto') {
95
+ // Auto-discovery flow
96
+ const email = await promptEmail();
97
+ console.log('\nDiscovering settings...');
98
+ try {
99
+ // Dynamic import to avoid loading discovery in non-auto mode
100
+ const { discoverFromEmail } = await import('../../discovery/index.js');
101
+ const result = await discoverFromEmail(email);
102
+ const confirmed = await promptConfirmDiscovery({
103
+ jmapUrl: result.jmap.sessionUrl,
104
+ oidcIssuer: result.oidc?.issuer,
105
+ });
106
+ jmapUrl = confirmed.jmapUrl;
107
+ if (confirmed.oidcIssuer) {
108
+ discoveredOidc.issuer = confirmed.oidcIssuer;
109
+ }
110
+ console.log(`\nUsing discovered settings for ${result.domain}\n`);
111
+ }
112
+ catch (error) {
113
+ console.error(`\nAuto-discovery failed: ${error instanceof Error ? error.message : String(error)}`);
114
+ console.log('Falling back to manual configuration...\n');
115
+ // Fall back to manual mode
116
+ jmapUrl = await promptJmapUrl();
117
+ }
118
+ }
119
+ else {
120
+ // Manual mode - existing flow
121
+ jmapUrl = await promptJmapUrl();
122
+ }
92
123
  // Step 2: Auth method
93
124
  const authMethod = await promptAuthMethod();
94
125
  // Step 3: Auth-specific prompts
@@ -105,13 +136,24 @@ export async function runSetup() {
105
136
  env.JMAP_BEARER_TOKEN = await promptBearerToken();
106
137
  }
107
138
  else if (authMethod === 'oidc') {
108
- const { issuer, clientId, scope, redirectUri } = await promptOidcAuth();
109
- env.JMAP_OIDC_ISSUER = issuer;
110
- env.JMAP_OIDC_CLIENT_ID = clientId;
111
- env.JMAP_OIDC_SCOPE = scope;
112
- env.JMAP_OIDC_REDIRECT_URI = redirectUri;
139
+ // Pre-fill discovered OIDC issuer if available
140
+ const oidcConfig = await promptOidcAuth(discoveredOidc.issuer);
141
+ env.JMAP_OIDC_ISSUER = oidcConfig.issuer;
142
+ env.JMAP_OIDC_CLIENT_ID = oidcConfig.clientId;
143
+ env.JMAP_OIDC_SCOPE = oidcConfig.scope;
144
+ env.JMAP_OIDC_REDIRECT_URI = oidcConfig.redirectUri;
145
+ }
146
+ // Step 4: Identity configuration (optional)
147
+ console.log('\n--- Identity Configuration ---');
148
+ const defaultFrom = await promptDefaultFrom();
149
+ if (defaultFrom) {
150
+ env.JMAP_DEFAULT_FROM = defaultFrom;
151
+ }
152
+ const signaturePath = await promptSignaturePath();
153
+ if (signaturePath) {
154
+ env.JMAP_SIGNATURE_PATH = signaturePath;
113
155
  }
114
- // Step 4: Test connection
156
+ // Step 5: Test connection
115
157
  console.log('\nTesting connection...');
116
158
  const testResult = await testConnection(env);
117
159
  if (!testResult.success) {
@@ -120,15 +162,15 @@ export async function runSetup() {
120
162
  process.exit(1);
121
163
  }
122
164
  console.log('\nConnection successful!\n');
123
- // Step 5: Server name for Claude config
165
+ // Step 6: Server name for Claude config
124
166
  const serverName = await promptServerName();
125
- // Step 6: Generate config
167
+ // Step 7: Generate config
126
168
  const config = generateClaudeConfig(serverName, env);
127
169
  const configJson = JSON.stringify(config, null, 2);
128
170
  console.log('\n--- Generated Claude Desktop Config ---');
129
171
  console.log(configJson);
130
172
  console.log('---------------------------------------\n');
131
- // Step 7: Optionally write to Claude Desktop config
173
+ // Step 8: Optionally write to Claude Desktop config
132
174
  const shouldWrite = await promptWriteConfig();
133
175
  if (shouldWrite) {
134
176
  const configPath = getClaudeConfigPath();
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/cli/commands/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,SAAS,mBAAmB;IAC1B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC9F,CAAC;SAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC/G,CAAC;IACD,8BAA8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,IAAI,EAAE,CAAC;oBAC/D,GAAG,MAAM,CAAC,UAAU;iBACrB;aACF,CAAC;YAEF,0BAA0B;YAC1B,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAEzD,sBAAsB;YACtB,MAAM,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAC5E,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QAC3E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACnG,OAAO,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;YACjG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;QACvF,OAAO,CAAC,GAAG,CAAC,KAAK,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
@@ -1,5 +1,26 @@
1
1
  /** Auth method choices for the wizard */
2
2
  export type AuthMethod = 'oidc' | 'basic' | 'bearer';
3
+ /** Setup mode: auto-discover or manual configuration */
4
+ export type SetupMode = 'auto' | 'manual';
5
+ /**
6
+ * Prompt for setup mode: auto-discover or manual configuration.
7
+ */
8
+ export declare function promptSetupMode(): Promise<SetupMode>;
9
+ /**
10
+ * Prompt for email address for auto-discovery.
11
+ */
12
+ export declare function promptEmail(): Promise<string>;
13
+ /**
14
+ * Prompt to confirm or edit discovered settings.
15
+ */
16
+ export declare function promptConfirmDiscovery(settings: {
17
+ jmapUrl: string;
18
+ oidcIssuer?: string;
19
+ }): Promise<{
20
+ confirmed: boolean;
21
+ jmapUrl: string;
22
+ oidcIssuer?: string;
23
+ }>;
3
24
  /**
4
25
  * Prompt for JMAP session URL with validation.
5
26
  */
@@ -22,7 +43,7 @@ export declare function promptBearerToken(): Promise<string>;
22
43
  /**
23
44
  * Prompt for OIDC configuration.
24
45
  */
25
- export declare function promptOidcAuth(): Promise<{
46
+ export declare function promptOidcAuth(defaultIssuer?: string): Promise<{
26
47
  issuer: string;
27
48
  clientId: string;
28
49
  scope: string;
@@ -36,3 +57,14 @@ export declare function promptWriteConfig(): Promise<boolean>;
36
57
  * Prompt for custom server name in Claude config.
37
58
  */
38
59
  export declare function promptServerName(): Promise<string>;
60
+ /**
61
+ * Prompt for default sender email address.
62
+ * Returns undefined if user skips configuration.
63
+ */
64
+ export declare function promptDefaultFrom(): Promise<string | undefined>;
65
+ /**
66
+ * Prompt for signature file path.
67
+ * Validates file exists and is readable.
68
+ * Returns undefined if user skips configuration.
69
+ */
70
+ export declare function promptSignaturePath(): Promise<string | undefined>;