proton-mail-bridge-client 2.1.0 → 2.1.2

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.
package/README.md CHANGED
@@ -264,6 +264,82 @@ Reload the Cline extension after saving. Proton Mail tools will appear in Cline'
264
264
 
265
265
  ---
266
266
 
267
+ ## Multi-account support (v2.1.0+)
268
+
269
+ Support multiple Proton Mail addresses configured in Bridge (using Bridge's **Split Addresses** feature). Each address gets its own isolated service stack, local index, and drafts storage.
270
+
271
+ ### Setup
272
+
273
+ First, enable **Split Addresses** in Proton Bridge and configure each address as a separate account. Bridge will generate a separate password for each address. Then set `PROTONMAIL_ACCOUNTS_JSON`:
274
+
275
+ ```json
276
+ {
277
+ "mcpServers": {
278
+ "proton-mail-bridge": {
279
+ "command": "proton-mail-bridge-mcp",
280
+ "env": {
281
+ "PROTONMAIL_USERNAME": "primary@proton.me",
282
+ "PROTONMAIL_PASSWORD": "primary-bridge-password",
283
+ "PROTONMAIL_IMAP_HOST": "127.0.0.1",
284
+ "PROTONMAIL_IMAP_PORT": "1143",
285
+ "PROTONMAIL_IMAP_SECURE": "false",
286
+ "PROTONMAIL_SMTP_HOST": "127.0.0.1",
287
+ "PROTONMAIL_SMTP_PORT": "1025",
288
+ "PROTONMAIL_ACCOUNTS_JSON": "[
289
+ { \"address\": \"primary@proton.me\", \"password\": \"primary-bridge-password\" },
290
+ { \"address\": \"alias@proton.me\", \"password\": \"alias-bridge-password\" },
291
+ { \"address\": \"business@custom.com\", \"password\": \"business-bridge-password\" }
292
+ ]"
293
+ }
294
+ }
295
+ }
296
+ }
297
+ ```
298
+
299
+ **Note:** The password is the **Bridge password for each address**, not your Proton account password. Bridge generates a unique password for each Split Address.
300
+
301
+ ### How it works
302
+
303
+ - **Primary account:** the first entry in `PROTONMAIL_ACCOUNTS_JSON` (or the main `PROTONMAIL_USERNAME`/`PROTONMAIL_PASSWORD` pair if not set). Email IDs from the primary account have no prefix.
304
+ - **Additional accounts:** each has an auto-generated slug (e.g., `alias`, `business`). Email IDs carry an account prefix: `alias::message-id`, `business::message-id`.
305
+ - **Sending:** `send_email`, `reply_to_email`, etc. route through the account matching the `from` address. If no account matches, the primary connection is used with a header override (for non-configured aliases).
306
+ - **Search and read:** all read tools (search, threads, analytics, digest) automatically fan out across all configured accounts and merge results, preserving the account prefix in returned IDs.
307
+
308
+ ### Tools across accounts
309
+
310
+ **Fan out across all accounts:**
311
+ - Search & read: `search_indexed_emails`, `get_emails`, `get_threads`, `get_thread_by_id`, `count_messages`, `get_labels`, `folder_stats`, `top_senders`, `get_contacts`, `get_volume_trends`, `get_email_analytics`, `get_email_stats`, `get_folders`
312
+ - Triage: `get_inbox_digest`, `get_follow_up_candidates`, `get_actionable_threads`, `find_document_threads`, `prepare_meeting_context`
313
+ - Diagnostics: `get_connection_status`, `get_runtime_status`, `run_doctor` (include an `accounts` array showing per-account status)
314
+
315
+ **Account-specific (prefix to target):**
316
+ - Actions: `mark_email_read`, `star_email`, `move_email`, `delete_email`, etc. — prefix the `emailId` with account slug if targeting a non-primary account
317
+ - Drafts: `create_draft`, `get_draft`, `send_draft`, etc. — drafts live per account; prefix `draftId` to access non-primary drafts
318
+ - Send: `send_email`, `reply_to_email`, `forward_email` — match the `from` address to route through the correct account's SMTP
319
+
320
+ **Primary-only (for now):**
321
+ - `list_drafts`, `list_remote_drafts` — show primary account drafts only
322
+ - Thread actions (`move_thread`, `delete_thread`, `flag_thread`) — operate on the account the thread ID's prefix names
323
+
324
+ ### Verify setup
325
+
326
+ Use `list_accounts` to check configured accounts and verify connection status:
327
+
328
+ ```bash
329
+ proton-mail-bridge-client list_accounts --json
330
+ ```
331
+
332
+ Output:
333
+ ```json
334
+ [
335
+ { "slug": "primary", "address": "primary@proton.me", "isPrimary": true, "index": "fresh", "imap": "ok", "smtp": "ok" },
336
+ { "slug": "alias", "address": "alias@proton.me", "isPrimary": false, "index": "fresh", "imap": "ok", "smtp": "ok" },
337
+ { "slug": "business", "address": "business@custom.com", "isPrimary": false, "index": "stale", "imap": "timeout", "smtp": "ok" }
338
+ ]
339
+ ```
340
+
341
+ ---
342
+
267
343
  ## Try it: example Claude prompts
268
344
 
269
345
  **Morning triage**
@@ -370,7 +446,13 @@ PROTONMAIL_ALLOW_REMOTE_DRAFT_SYNC='true'
370
446
  PROTONMAIL_ALLOWED_ACTIONS='mark_read,mark_unread,star,unstar,archive,trash,restore,move,delete'
371
447
  PROTONMAIL_CONFIRM_DESTRUCTIVE='false'
372
448
  PROTONMAIL_SEND_DELAY_SECONDS='0' # >0: send_email queues instead of sending immediately, cancelable via cancel_send. Only fires while this server stays running.
373
- PROTONMAIL_SIGNATURE='' # Plain text, appended to send_email/reply_to_email/reply_all_email/forward_email bodies (text + HTML), after your own text and before any quoted/forwarded content. Opt out per-message with appendSignature: false. Never applied to send_draft/schedule_draft — draft content is already finalized.
449
+ PROTONMAIL_SIGNATURE='' # Plain text, appended to send_email/reply_to_email/reply_all_email/forward_email bodies (text + HTML), after your own text and before any quoted/forwarded content. Every send now goes out multipart (a plain-text send auto-gets an html alternative too), so the signature always gets its HTML treatment, not just the text/plain part. Opt out per-message with appendSignature: false. Never applied to send_draft/schedule_draft — draft content is already finalized.
450
+ #
451
+ # Note: a signature configured inside Proton Mail itself (Settings → Identity and addressing)
452
+ # is only inserted by Proton's own web/app compose UI — it is NEVER applied to mail submitted
453
+ # over SMTP by an external client, including this one. There is no way to make Bridge apply it
454
+ # for you. Set PROTONMAIL_SIGNATURE above instead if you want a signature on messages this
455
+ # server sends.
374
456
 
375
457
  # Sync
376
458
  PROTONMAIL_AUTO_SYNC='true'
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,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1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkjIP;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAmE1C"}
package/dist/index.js CHANGED
@@ -420,7 +420,7 @@ const TOOLS = [
420
420
  },
421
421
  {
422
422
  name: "update_draft",
423
- description: "Update an existing locally saved draft's recipients, subject, body, or other fields. Use to edit a draft before sending. Only provided fields are updated — omitted fields retain their current values. After updating, call send_draft to send or sync_draft_to_remote to push to Proton Drafts.",
423
+ description: "Update an existing locally saved draft's recipients, subject, body, or other fields. Use to edit a draft before sending. Only provided fields are updated — omitted fields retain their current values. After updating, call send_draft to send or sync_draft_to_remote to push to Proton Drafts. The response's attachments are metadata only (filename/contentType/size, no base64 content) even if the draft has attachments from a previous call — use get_draft if you need the actual attachment bytes back.",
424
424
  annotations: { destructiveHint: false },
425
425
  inputSchema: {
426
426
  type: "object",
@@ -4119,7 +4119,14 @@ export function createServer(config, options = {}) {
4119
4119
  : undefined);
4120
4120
  return presentDraft(updateDraftBundle, remoteSync ? { ...synced.draft, remoteSync } : synced.draft);
4121
4121
  });
4122
- return createTextResult(result, false, [
4122
+ // update_draft is typically called repeatedly against the same draft to tweak
4123
+ // subject/body — the attachments usually aren't touched by this call at all, so
4124
+ // re-echoing their full base64 `content` (serialized twice by createTextResult,
4125
+ // same issue redactDraftAttachmentsForListing already fixed for list_drafts)
4126
+ // burns tokens on every single edit for a draft that has any attachment. The
4127
+ // caller already knows what it attached; get_draft remains full-content for the
4128
+ // "let me look at this draft" case, which is a single call rather than a loop.
4129
+ return createTextResult(redactDraftAttachmentsForListing(result), false, [
4123
4130
  draftSource(result),
4124
4131
  ...(result.remoteDraft?.emailId
4125
4132
  ? [