proton-mail-bridge-client 2.13.1 → 2.15.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 (139) hide show
  1. package/README.md +66 -11
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +19 -4
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config-env.d.ts +21 -0
  6. package/dist/config-env.d.ts.map +1 -0
  7. package/dist/config-env.js +327 -0
  8. package/dist/config-env.js.map +1 -0
  9. package/dist/index.d.ts +17 -118
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +135 -7914
  12. package/dist/index.js.map +1 -1
  13. package/dist/package-info.d.ts +2 -0
  14. package/dist/package-info.d.ts.map +1 -0
  15. package/dist/package-info.js +6 -0
  16. package/dist/package-info.js.map +1 -0
  17. package/dist/scripts/install-claude-desktop.d.ts +1 -0
  18. package/dist/scripts/install-claude-desktop.d.ts.map +1 -1
  19. package/dist/scripts/install-claude-desktop.js +33 -10
  20. package/dist/scripts/install-claude-desktop.js.map +1 -1
  21. package/dist/services/account-manager.d.ts +7 -0
  22. package/dist/services/account-manager.d.ts.map +1 -1
  23. package/dist/services/account-manager.js +92 -1
  24. package/dist/services/account-manager.js.map +1 -1
  25. package/dist/services/autoresponder-service.d.ts +199 -0
  26. package/dist/services/autoresponder-service.d.ts.map +1 -0
  27. package/dist/services/autoresponder-service.js +569 -0
  28. package/dist/services/autoresponder-service.js.map +1 -0
  29. package/dist/services/background-sync-service.d.ts +4 -1
  30. package/dist/services/background-sync-service.d.ts.map +1 -1
  31. package/dist/services/background-sync-service.js +13 -0
  32. package/dist/services/background-sync-service.js.map +1 -1
  33. package/dist/services/rules-service.d.ts +174 -0
  34. package/dist/services/rules-service.d.ts.map +1 -0
  35. package/dist/services/rules-service.js +450 -0
  36. package/dist/services/rules-service.js.map +1 -0
  37. package/dist/services/simple-imap-service.d.ts +1 -0
  38. package/dist/services/simple-imap-service.d.ts.map +1 -1
  39. package/dist/services/simple-imap-service.js +22 -0
  40. package/dist/services/simple-imap-service.js.map +1 -1
  41. package/dist/services/smtp-service.d.ts +3 -0
  42. package/dist/services/smtp-service.d.ts.map +1 -1
  43. package/dist/services/smtp-service.js +14 -2
  44. package/dist/services/smtp-service.js.map +1 -1
  45. package/dist/tools/actions.d.ts +51 -0
  46. package/dist/tools/actions.d.ts.map +1 -0
  47. package/dist/tools/actions.js +323 -0
  48. package/dist/tools/actions.js.map +1 -0
  49. package/dist/tools/args.d.ts +22 -0
  50. package/dist/tools/args.d.ts.map +1 -0
  51. package/dist/tools/args.js +159 -0
  52. package/dist/tools/args.js.map +1 -0
  53. package/dist/tools/attachments.d.ts +4 -0
  54. package/dist/tools/attachments.d.ts.map +1 -0
  55. package/dist/tools/attachments.js +126 -0
  56. package/dist/tools/attachments.js.map +1 -0
  57. package/dist/tools/audit.d.ts +7 -0
  58. package/dist/tools/audit.d.ts.map +1 -0
  59. package/dist/tools/audit.js +112 -0
  60. package/dist/tools/audit.js.map +1 -0
  61. package/dist/tools/bulk.d.ts +19 -0
  62. package/dist/tools/bulk.d.ts.map +1 -0
  63. package/dist/tools/bulk.js +162 -0
  64. package/dist/tools/bulk.js.map +1 -0
  65. package/dist/tools/compose.d.ts +39 -0
  66. package/dist/tools/compose.d.ts.map +1 -0
  67. package/dist/tools/compose.js +300 -0
  68. package/dist/tools/compose.js.map +1 -0
  69. package/dist/tools/context.d.ts +78 -0
  70. package/dist/tools/context.d.ts.map +1 -0
  71. package/dist/tools/context.js +219 -0
  72. package/dist/tools/context.js.map +1 -0
  73. package/dist/tools/definitions.d.ts +3888 -0
  74. package/dist/tools/definitions.d.ts.map +1 -0
  75. package/dist/tools/definitions.js +2013 -0
  76. package/dist/tools/definitions.js.map +1 -0
  77. package/dist/tools/diagnostics.d.ts +4 -0
  78. package/dist/tools/diagnostics.d.ts.map +1 -0
  79. package/dist/tools/diagnostics.js +481 -0
  80. package/dist/tools/diagnostics.js.map +1 -0
  81. package/dist/tools/drafts-support.d.ts +46 -0
  82. package/dist/tools/drafts-support.d.ts.map +1 -0
  83. package/dist/tools/drafts-support.js +162 -0
  84. package/dist/tools/drafts-support.js.map +1 -0
  85. package/dist/tools/drafts.d.ts +4 -0
  86. package/dist/tools/drafts.d.ts.map +1 -0
  87. package/dist/tools/drafts.js +873 -0
  88. package/dist/tools/drafts.js.map +1 -0
  89. package/dist/tools/folders.d.ts +4 -0
  90. package/dist/tools/folders.d.ts.map +1 -0
  91. package/dist/tools/folders.js +209 -0
  92. package/dist/tools/folders.js.map +1 -0
  93. package/dist/tools/index-refresh.d.ts +54 -0
  94. package/dist/tools/index-refresh.d.ts.map +1 -0
  95. package/dist/tools/index-refresh.js +134 -0
  96. package/dist/tools/index-refresh.js.map +1 -0
  97. package/dist/tools/merge.d.ts +28 -0
  98. package/dist/tools/merge.d.ts.map +1 -0
  99. package/dist/tools/merge.js +207 -0
  100. package/dist/tools/merge.js.map +1 -0
  101. package/dist/tools/message-actions.d.ts +4 -0
  102. package/dist/tools/message-actions.d.ts.map +1 -0
  103. package/dist/tools/message-actions.js +636 -0
  104. package/dist/tools/message-actions.js.map +1 -0
  105. package/dist/tools/reading.d.ts +4 -0
  106. package/dist/tools/reading.d.ts.map +1 -0
  107. package/dist/tools/reading.js +934 -0
  108. package/dist/tools/reading.js.map +1 -0
  109. package/dist/tools/resources.d.ts +42 -0
  110. package/dist/tools/resources.d.ts.map +1 -0
  111. package/dist/tools/resources.js +182 -0
  112. package/dist/tools/resources.js.map +1 -0
  113. package/dist/tools/results.d.ts +25 -0
  114. package/dist/tools/results.d.ts.map +1 -0
  115. package/dist/tools/results.js +50 -0
  116. package/dist/tools/results.js.map +1 -0
  117. package/dist/tools/rules-runner.d.ts +40 -0
  118. package/dist/tools/rules-runner.d.ts.map +1 -0
  119. package/dist/tools/rules-runner.js +221 -0
  120. package/dist/tools/rules-runner.js.map +1 -0
  121. package/dist/tools/rules.d.ts +4 -0
  122. package/dist/tools/rules.d.ts.map +1 -0
  123. package/dist/tools/rules.js +128 -0
  124. package/dist/tools/rules.js.map +1 -0
  125. package/dist/tools/sending.d.ts +4 -0
  126. package/dist/tools/sending.d.ts.map +1 -0
  127. package/dist/tools/sending.js +624 -0
  128. package/dist/tools/sending.js.map +1 -0
  129. package/dist/tools/templates-and-reminders.d.ts +4 -0
  130. package/dist/tools/templates-and-reminders.d.ts.map +1 -0
  131. package/dist/tools/templates-and-reminders.js +249 -0
  132. package/dist/tools/templates-and-reminders.js.map +1 -0
  133. package/dist/types/index.d.ts +2 -0
  134. package/dist/types/index.d.ts.map +1 -1
  135. package/dist/utils/bridge-version.d.ts +8 -0
  136. package/dist/utils/bridge-version.d.ts.map +1 -0
  137. package/dist/utils/bridge-version.js +20 -0
  138. package/dist/utils/bridge-version.js.map +1 -0
  139. package/package.json +1 -1
package/README.md CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  ---
26
26
 
27
- Give Claude Desktop (or Cline, or any MCP client) full access to your Proton Mail inbox: read, search, send, draft, triage threads, manage folders, save attachments, and more — 100 MCP tools in total. Most of the same capabilities are also available as a full CLI for scripting, cron, and piped automation — no Claude required.
27
+ Give Claude Desktop (or Cline, or any MCP client) full access to your Proton Mail inbox: read, search, send, draft, triage threads, manage folders, save attachments, and more — 108 MCP tools in total. Most of the same capabilities are also available as a full CLI for scripting, cron, and piped automation — no Claude required.
28
28
 
29
29
  > **Using Proton Drive too?** See [**proton-drive-mcp**](https://github.com/googlarz/proton-drive-mcp), the companion MCP server and CLI for Proton Drive (upload, download, share and manage your encrypted files from Claude). Run both side by side to handle mail and files in one conversation, for example save an attachment from here, then upload it to Drive. More in [Related projects](#related-projects).
30
30
 
@@ -44,16 +44,20 @@ Give Claude Desktop (or Cline, or any MCP client) full access to your Proton Mai
44
44
  - "Find the last email from `alice@example.com` and draft a reply for me to review." (nothing is sent until you say so)
45
45
  - "Which of my emails have attachments from this month?"
46
46
  - "Show me my drafts and tighten the oldest one."
47
- 5. **Optional:** `PROTONMAIL_READ_ONLY=true` to browse without being able to change anything, `PROTONMAIL_TOOL_TIER=core` for a smaller tool set (25 instead of 100), and more accounts under [Multi-account support](#multi-account-support-v210). More recipes below in [Try it](#try-it-example-claude-prompts).
47
+ 5. **Optional:** `PROTONMAIL_READ_ONLY=true` to browse without being able to change anything, `PROTONMAIL_TOOL_TIER=core` for a smaller tool set (25 instead of 108), and more accounts under [Multi-account support](#multi-account-support-v210). More recipes below in [Try it](#try-it-example-claude-prompts).
48
48
 
49
49
  ---
50
50
 
51
51
  ## What you get
52
52
 
53
- - **Claude reads and manages your Proton Mail** — triage, reply, draft, archive, search, move, batch-act on threads, pull attachments
54
- - **Full CLI** — a dedicated command for every one of the 100 tools (plus a generic `tool <name>` passthrough), scriptable and pipeable, works in cron and shell scripts
55
- - **Fast local search** — full-text search across your inbox without hitting IMAP on every query
56
- - **Safety controls** — read-only mode, send gate, destructive-action confirmation, per-action allowlist
53
+ - **Claude reads and manages your Proton Mail** — triage, reply, draft, archive, search, move, batch-act on threads, pull attachments (PDF text and pictures included), answer calendar invitations
54
+ - **Safety you choose** — `PROTONMAIL_MODE` presets (`read-only`, `drafts`, `assisted`, `full`), a send gate, confirmation for destructive actions, a per-action allowlist, and a [threat model](docs/threat-model.md) that says what is and is not covered
55
+ - **Several addresses at once** — each Proton login (or each address Bridge exposes) is its own isolated account with its own index, drafts and settings
56
+ - **Fast local search** — full-text search across your inbox from a local index that keeps its read state in step with the server
57
+ - **Rules that suggest themselves** — a scan proposes filters and cleanup from your own mail, applies them to existing mail after a preview, and can forward by condition; see [Mailbox rules](#mailbox-rules-suggestions-filters-cleanup-forwarding)
58
+ - **Automatic reply, per address, with rules** — off by default, with a preview of what it would do, draft-for-approval mode and working-hours; see [Autoresponder](#autoresponder-automatic-reply-per-address) (Proton's own auto-reply may be all you need)
59
+ - **Full CLI** — a dedicated command for every one of the 108 tools (plus a generic `tool <name>` passthrough), scriptable and pipeable; `doctor` checks every account and `report` prints a diagnostic summary for a bug report
60
+ - **Runs where you do** — Claude Desktop bundle, npm, Homebrew, or a [Docker image](#running-in-docker-headless-machines) for a headless machine
57
61
  - **Privacy-native** — no third-party email service involved; your mail stays on your machine
58
62
 
59
63
  **How this relates to Proton Bridge.** This is a layer on top of [Proton Mail Bridge](https://proton.me/mail/bridge), not a replacement for it. Bridge is Proton's official, local IMAP/SMTP gateway and the only supported way to reach a Proton mailbox from other software; this project talks to it. Bridge's own `--cli` mode manages Bridge itself (signing in, account details and the Bridge password, ports and other settings), it is not a mail client. Proton does not publish a terminal mail client, so reading, searching, drafting and sending from Claude or a script is what this adds on top, together with the safety controls above. Bridge has to be running and signed in.
@@ -293,14 +297,65 @@ Reload the Cline extension after saving. Proton Mail tools will appear in Cline'
293
297
  For a server with no desktop, next to a headless Bridge. The image installs the published npm package and is published for each release to `ghcr.io/googlarz/proton-mail-bridge-client` (`:<version>` and `:latest`, linux/amd64 and linux/arm64). To build it yourself from this repo:
294
298
 
295
299
  ```bash
296
- docker build -f docker/Dockerfile --build-arg VERSION=2.13.1 -t proton-mail-bridge-client .
300
+ docker build -f docker/Dockerfile --build-arg VERSION=2.15.0 -t proton-mail-bridge-client .
297
301
  docker run -i --rm --network host \
298
302
  -e PROTONMAIL_USERNAME=you@proton.me -e PROTONMAIL_PASSWORD_FILE=/run/secrets/bridge \
299
303
  -v /path/to/bridge-password:/run/secrets/bridge:ro -v bridge-client-data:/data \
300
304
  proton-mail-bridge-client
301
305
  ```
302
306
 
303
- `docker run -i` speaks MCP over stdio. The container must reach Bridge's IMAP and SMTP ports (`--network host`, or `--network container:<bridge>` to share Bridge's network). The CLI is in the same image: add `--entrypoint proton-mail-bridge-client` and a command such as `doctor`. If Bridge is reached by a host name (for example `host.docker.internal` or another container), its self-signed certificate fails verification: export it from Bridge and point `PROTONMAIL_TLS_CA_FILE` at it, or list the name in `PROTONMAIL_TLS_INSECURE_HOSTS`. The server has no network transport of its own; reaching it from a remote client needs your own wrapper. The image was checked to build, report its version, run as a non-root user and answer an MCP `initialize`; it has not been run against a real Bridge.
307
+ `docker run -i` speaks MCP over stdio. The container must reach Bridge's IMAP and SMTP ports (`--network host`, or `--network container:<bridge>` to share Bridge's network). The CLI is in the same image: add `--entrypoint proton-mail-bridge-client` and a command such as `doctor`. If Bridge is reached by a host name (for example `host.docker.internal` or another container), its self-signed certificate fails verification: export it from Bridge and point `PROTONMAIL_TLS_CA_FILE` at it, or list the name in `PROTONMAIL_TLS_INSECURE_HOSTS`. The server has no network transport of its own; reaching it from a remote client needs your own wrapper. The image was checked to build, report its version, run as a non-root user and answer an MCP `initialize`, and (by a tester, against a real Bridge) to pass `doctor`, list folders, sync and exit cleanly, with `--network container:<bridge>` or with Bridge reached by host name using `PROTONMAIL_TLS_CA_FILE` or `PROTONMAIL_TLS_INSECURE_HOSTS`.
308
+
309
+ ## Autoresponder (automatic reply per address)
310
+
311
+ **Proton Mail has its own auto-reply** (Settings → Filters / Forward and auto-reply; Proton lists it on its paid plans). It runs inside Proton, works while your computer is off, and applies to the whole account unless you write a filter. If that is enough, use it and leave this one off: enabling both would send each sender two replies. This one adds what a filter cannot do from a chat, and it only runs while this server runs.
312
+
313
+ An automatic reply for one address, plus a note that address appends to what it sends. **Off by default**, and it can send mail without asking each time, so it is held to stricter rules than a normal send:
314
+
315
+ - **Who gets a reply.** Only a person (not a list, not automatic mail, not a `no-reply`/`mailer-daemon` sender) who wrote to this address (To or Cc), after the rule was switched on and inside its dates, and whom you have not already answered since. One reply per sender per `replyEveryDays` days (default 7), at most `dailyLimit` a day (default 50). A reply is recorded before it is sent, so a failure never becomes a second one.
316
+ - **When.** After a background sync has indexed new mail, so only while this server runs with `PROTONMAIL_AUTO_SYNC` on; with several clients open, the instance holding the sync lock does it. `outsideHours` (with a `timezone`) limits it to when you are not at work.
317
+ - **What it does.** `mode: "send"` sends; `mode: "draft"` leaves a draft in your drafts for you to review and send. If the server may not send (`PROTONMAIL_MODE=drafts`, `ALLOW_SEND` off, or outbound mail confined to yourself), a reply becomes a draft by itself; if it may not write drafts either (read-only), it is refused.
318
+ - **Rules**, first match wins: by sender (`boss@example.com`, `*@client.example`), words in the subject, and whether you have written to the sender before (`known: "yes"/"no"`). Each gives `reply`, `draft` or `skip`, optionally with its own text. Mail that matches none gets the default reply.
319
+ - **Text.** Placeholders `{senderFirstName}`, `{senderName}`, `{senderAddress}`, `{subject}`, `{startsAt}`, `{endsAt}`.
320
+ - **Safety headers.** `Auto-Submitted: auto-replied`, `Precedence: bulk`, `X-Auto-Response-Suppress: All`; the reply threads under the message it answers.
321
+ - **Control.** Switching it on needs `confirmed: true` when `PROTONMAIL_CONFIRM_DESTRUCTIVE` is on and the server can send. Switching it off is always allowed, in every mode.
322
+
323
+ ```text
324
+ preview_autoresponder account=work@example.com days=3 # what it WOULD do with recent mail; changes nothing
325
+ set_autoresponder account=work@example.com enabled=true confirmed=true
326
+ body="Hi {senderFirstName}, I am away until {endsAt} and will answer then."
327
+ endsAt=2027-01-04 timezone=Europe/Warsaw outgoingNote="I am away until 4 January."
328
+ rules=[{"name":"boss","from":["boss@example.com"],"action":"reply","body":"Urgent? Call my mobile."},
329
+ {"name":"clients","from":["*@client.example"],"action":"draft"},
330
+ {"known":"no","subjectContains":["unsubscribe"],"action":"skip"}]
331
+ get_autoresponder account=work@example.com # state, counts, who wrote, why mail was skipped, the log
332
+ ```
333
+
334
+ `outgoingNote` is appended, after the signature, to every mail sent from that address while the rule is active (a send with `appendSignature: false` opts out). On the command line: `set-autoresponder`, `autoresponder` and `preview-autoresponder`. The rule, the log and the memory of who was answered live in `autoresponder.json` in the account's data directory; every account (every address Bridge exposes) has its own.
335
+
336
+ ## Mailbox rules (suggestions, filters, cleanup, forwarding)
337
+
338
+ Proton's own filters act on **new** mail, the free plan has one custom filter, and auto-delete of Trash and Spam is a paid feature with a fixed 30 days (see Proton's pages on [filters](https://proton.me/support/email-inbox-filters) and [auto-delete](https://proton.me/support/auto-delete-unwanted-messages)). These rules work alongside them: on mail that is already there, with a preview, and with a scan that suggests rules instead of waiting for you to write them. They run on this server, so they only act while it runs.
339
+
340
+ **Scan, then decide.** `suggest_rules` looks through the mail in the local index and proposes, with the evidence for each: newsletters and other automatic mail you never open (archive and mark as read; or move to Trash when old), people whose mail you always file in the same folder, and an old Trash or Spam that was never emptied. Each says how risky it is (`low`: only moves and marks; `recoverable`: moves to Trash; `permanent`: deletes). **Nothing changes** until you accept one with `set_rule proposalId=...`; `delete_rule` on a proposal dismisses it for good.
341
+
342
+ **A rule** is `when` (sender or `*@domain`, words in the subject, folder, `olderThanDays`, `hasAttachment`, `automated`, `unread`) and `actions` (`markRead`, `label`, `archive`, `moveTo`, `trash`, `delete`, `forwardTo`). A rule needs a real condition, so it cannot touch a whole folder.
343
+
344
+ - **By itself, on new mail**, after each background sync: mark read, label, archive, move, forward. Only mail that arrived after the rule was switched on, once per message.
345
+ - **Only when you ask:** a rule that trashes or deletes never runs by itself. `apply_rules` runs the rules on mail already in the index and is a **preview unless `dryRun: false`**; deleting for good also needs `confirmed: true`. Every action goes through the same permissions as the other tools (`PROTONMAIL_MODE`, allowed actions), and a disallowed one is refused before anything is touched.
346
+ - **Forwarding** (`actions.forwardTo`, up to 3 addresses, optional `forwardNote`) sends mail out on its own, so it is held to the rules of a send: sending must be allowed, the recipients must be allowed (not with `PROTONMAIL_RESTRICT_OUTBOUND_TO_SELF`), switching it on needs `confirmed: true` when `PROTONMAIL_CONFIRM_DESTRUCTIVE` is on, and the rule needs a condition on the sender, the subject or an attachment. It forwards mail that arrives after the rule is switched on, once per message, at most 50 a day, with the original attachments, and by default only mail from people (not lists or automatic mail). The copy carries `Auto-Submitted: auto-generated` and `X-Forwarded-By`.
347
+
348
+ ```text
349
+ suggest_rules days=90 # proposals, with evidence; nothing is changed
350
+ set_rule proposalId=p-1a2b3c4d5e # accept one
351
+ set_rule name="Clients to Projects" when={"from":["*@client.example"]} actions={"moveTo":"Projects","markRead":false}
352
+ set_rule name="Boss to phone" when={"from":["boss@example.com"]} actions={"forwardTo":["me@elsewhere.example"]} confirmed=true
353
+ apply_rules # preview of what the rules would do to existing mail
354
+ apply_rules dryRun=false limit=100
355
+ get_rules # rules, waiting proposals, what the rules did lately
356
+ ```
357
+
358
+ The scan and `apply_rules` work from the local index (by default INBOX and Sent; run `sync_emails` for other folders), so check that it is fresh. Rules, proposals and the log live in `rules.json` in the account's data directory; each account has its own.
304
359
 
305
360
  ## Multi-account support (v2.1.0+)
306
361
 
@@ -441,7 +496,7 @@ All commands support `--json` for machine-readable output, and any MCP tool is d
441
496
 
442
497
  `<command> --help` prints that command's usage without running it. Flags accept `--flag value` or `--flag=value` (a value starting with `--` needs the `=` form, or must come after a bare `--`); unknown flags are an error. Exit codes: `0` success, `1` failure (including a failed `doctor` or `connection-status` check, or a failed item in a `batch`/`bulk-*` run), `2` usage error.
443
498
 
444
- **Full command reference: [docs/cli.md](docs/cli.md)** (a named command for every one of the 100 tools, across read, triage, compose, mailbox actions, folders, drafts, templates, analytics, and diagnostics).
499
+ **Full command reference: [docs/cli.md](docs/cli.md)** (a named command for every one of the 108 tools, across read, triage, compose, mailbox actions, folders, drafts, templates, analytics, and diagnostics).
445
500
 
446
501
  ---
447
502
 
@@ -463,7 +518,7 @@ A mode is a floor: the individual flags below can make things stricter (`PROTONM
463
518
  All flags work in both the MCP server and CLI:
464
519
 
465
520
  ```bash
466
- PROTONMAIL_TOOL_TIER=core # expose 25 core tools instead of all 100 — saves context window
521
+ PROTONMAIL_TOOL_TIER=core # expose 25 core tools instead of all 108 — saves context window
467
522
  PROTONMAIL_READ_ONLY=true # disable all write operations
468
523
  PROTONMAIL_ALLOW_SEND=false # disable SMTP sends only (other writes still work)
469
524
  PROTONMAIL_CONFIRM_DESTRUCTIVE=true # require confirmed:true on send, reply, forward, delete
@@ -686,7 +741,7 @@ Measured in October 2026 (v2.7.0) on a copy of the same ~57,000-message index. "
686
741
  - Defaults are bounded: `search_emails`/`search_indexed_emails` return 50 (pass `limit` for more), `list_drafts` 20, `list_scheduled_sends` 50 newest first. Each reports `hasMore`; page with `offset`.
687
742
  - Draft and queued-message bodies are shortened to a preview in list and update responses (`bodyTruncated`, `bodyLength`); use `get_draft` for one full draft. Attachment content is never inlined in a listing.
688
743
  - Large attachments: set `PROTONMAIL_ALLOW_FILE_DOWNLOAD_DIR` and pass `saveTo`, rather than raising `PROTONMAIL_MAX_INLINE_KB`.
689
- - **`PROTONMAIL_TOOL_TIER=core`** exposes 25 tools instead of 100: about 7k tokens of tool definitions instead of about 21k (roughly 67% less; the earlier measurement with a reference tokenizer, 7k against 20k for 96 tools, scaled by the 3.7% the four newest tool definitions add), paid on every conversation that loads the server.
744
+ - **`PROTONMAIL_TOOL_TIER=core`** exposes 25 tools instead of 108: about 7k tokens of tool definitions instead of about 21k (roughly 67% less; the earlier measurement with a reference tokenizer, 7k against 20k for 96 tools, scaled by the 3.7% the four newest tool definitions add), paid on every conversation that loads the server.
690
745
  - Repeating an `update_draft` that changes nothing on a draft whose remote copy is already in sync does no store write and no IMAP upload. (A draft whose last sync failed, or that was edited with `syncToRemote:false`, still syncs.)
691
746
 
692
747
  **Working with drafts**
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAaA,OAAO,KAAK,EAAgB,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAoB1F,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAiBD,qBAAa,aAAc,SAAQ,KAAK;CAAG;AAM3C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAuD1D;AA0ID,UAAU,WAAW;IACnB,KAAK,EAAE,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,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,EA2E/C,CAAC;AA2EF,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAoP1C;AA4ED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGzD"}
package/dist/cli.js CHANGED
@@ -9,11 +9,12 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
9
9
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
10
10
  import { buildConfigFromEnv, createServer, withAudit } from "./index.js";
11
11
  import { isMainModule } from "./is-main.js";
12
- import { isLikelyAuthenticationError, isLikelyConnectionError, isLikelyTlsMismatchError, SimpleIMAPService } from "./services/simple-imap-service.js";
12
+ import { isLikelyAuthenticationError, isLikelyCertificateError, isLikelyConnectionError, isLikelyTlsMismatchError, SimpleIMAPService } from "./services/simple-imap-service.js";
13
13
  import { ensureDestructiveConfirmed, ensureEmailActionAllowed, ensureMailboxWriteAllowed, sanitizeRuntimeConfig } from "./utils/runtime-policy.js";
14
14
  import { isValidEmail, parseEmails } from "./utils/helpers.js";
15
15
  import { checkForUpdate } from "./utils/update-check.js";
16
16
  import { healthProblems } from "./utils/health.js";
17
+ import { bridgeVersionNote } from "./utils/bridge-version.js";
17
18
  import { buildSchedule, defaultSchedulerSystem, findStableAlias, parseTimeOfDay, SCHEDULER_SYSTEMS } from "./utils/schedule-templates.js";
18
19
  import { getClaudeDesktopInstallStatus } from "./scripts/check-claude-desktop.js";
19
20
  import { installClaudeDesktopConfig } from "./scripts/install-claude-desktop.js";
@@ -162,7 +163,7 @@ function printHelp() {
162
163
  " watch Wait for mailbox changes via IMAP IDLE (--timeout)",
163
164
  " clear-cache Clear in-memory MCP server caches",
164
165
  " get-logs Return recent in-memory MCP server logs",
165
- " notify Daemon: watch INBOX and send a system notification on new mail (--folder --timeout)",
166
+ " notify Daemon: watch INBOX and send a system notification on new mail and when the connection to Bridge breaks or comes back (--folder --timeout)",
166
167
  " drafts List local drafts",
167
168
  " remote-drafts List drafts in the Proton Drafts mailbox",
168
169
  " draft-create Create a draft (--to --subject --body or stdin)",
@@ -765,6 +766,9 @@ export function diagnoseConnectionFailure(reason) {
765
766
  suggestion: "PROTONMAIL_PASSWORD must be the Bridge password (Bridge app -> account -> Mailbox details), not your Proton account password.",
766
767
  };
767
768
  }
769
+ if (isLikelyCertificateError(reason)) {
770
+ return { cause: "certificate_untrusted", suggestion: "Bridge's certificate is not trusted. Bridge presents a self-signed certificate made for localhost, which is accepted for 127.0.0.1, localhost and ::1. For another host name (another container, another machine) set PROTONMAIL_TLS_CA_FILE to Bridge's exported certificate, or list the host in PROTONMAIL_TLS_INSECURE_HOSTS." };
771
+ }
768
772
  if (isLikelyTlsMismatchError(reason)) {
769
773
  return {
770
774
  cause: "tls_mismatch",
@@ -801,6 +805,7 @@ async function runDoctor(parsed) {
801
805
  slug: bundle.account.slug,
802
806
  account: bundle.config.smtp.username,
803
807
  ok: imapOk && smtpOk,
808
+ ...(bridgeVersionNote(bundle.imapService.getServerInfo()) ? { bridgeNote: bridgeVersionNote(bundle.imapService.getServerInfo()) } : {}),
804
809
  imapOk,
805
810
  smtpOk,
806
811
  folderCount,
@@ -911,7 +916,7 @@ async function runReport() {
911
916
  userSet: bundle.config.smtp.secureExplicit === true,
912
917
  check: smtp,
913
918
  },
914
- bridge: bundle.imapService.getServerInfo(),
919
+ bridge: { ...bundle.imapService.getServerInfo(), note: bridgeVersionNote(bundle.imapService.getServerInfo()) },
915
920
  folderCount,
916
921
  index: { storedMessageCount: index.storedMessageCount, updatedAt: index.updatedAt, isStale: index.isStale },
917
922
  // Folder names can be as private as an address: only how many are synced.
@@ -1744,7 +1749,9 @@ async function runNotify(parsed) {
1744
1749
  process.stdout.write(JSON.stringify({ event: "problem", cause: health.cause, message: health.notice.body }) + "\n");
1745
1750
  }
1746
1751
  // Simple backoff before retrying; a rejected login will not fix itself in seconds.
1747
- await new Promise((resolve) => { setTimeout(resolve, health.cause === "authentication_failed" ? 120_000 : 15_000).unref(); });
1752
+ // Not unref'd: this wait is what keeps the daemon alive between attempts, and the notice that the connection works
1753
+ // again can only come from a process that is still running.
1754
+ await new Promise((resolve) => { setTimeout(resolve, health.cause === "authentication_failed" ? 120_000 : 15_000); });
1748
1755
  }
1749
1756
  }
1750
1757
  try {
@@ -1992,6 +1999,14 @@ export const TOOL_ONLY_COMMANDS = [
1992
1999
  { command: "cancel-snooze", tool: "cancel_snooze", positionals: ["id"], help: "Wake a snoozed email immediately" },
1993
2000
  { command: "list-snoozed", tool: "list_snoozed", positionals: [], help: "List snoozed emails (rediscover an id for cancel-snooze)" },
1994
2001
  { command: "create-template", tool: "create_template", positionals: ["name", "subject", "body"], help: "Save a reusable email template" },
2002
+ { command: "preview-autoresponder", tool: "preview_autoresponder", positionals: [], help: "Show what the automatic reply would do with recent mail, without doing it (--account, --days)" },
2003
+ { command: "suggest-rules", tool: "suggest_rules", positionals: [], help: "Scan the mail in the index and propose rules (--account, --days, --minMessages); changes nothing" },
2004
+ { command: "rules", tool: "get_rules", positionals: [], help: "Show the mailbox rules, the proposals waiting and what the rules did (--account)" },
2005
+ { command: "set-rule", tool: "set_rule", positionals: [], help: "Create, change or accept a proposal as a rule (--proposalId, --id, --name, --enabled, --when, --actions, --confirmed)" },
2006
+ { command: "delete-rule", tool: "delete_rule", positionals: ["id"], help: "Delete a rule, or dismiss a proposal" },
2007
+ { command: "apply-rules", tool: "apply_rules", positionals: [], help: "Run the rules on mail already in the index; a preview unless --dryRun false (--ruleId, --limit, --confirmed)" },
2008
+ { command: "autoresponder", tool: "get_autoresponder", positionals: [], help: "Show the automatic reply of an address (--account)" },
2009
+ { command: "set-autoresponder", tool: "set_autoresponder", positionals: [], help: "Set up or switch off the automatic reply of an address (--enabled, --body, --subject, --startsAt, --endsAt, --outgoingNote, --mode, --timezone, --rules, --confirmed)" },
1995
2010
  { command: "list-templates", tool: "list_templates", positionals: [], help: "List saved email templates" },
1996
2011
  { command: "get-template", tool: "get_template", positionals: ["id"], help: "Get a saved template by id" },
1997
2012
  { command: "delete-template", tool: "delete_template", positionals: ["id"], help: "Delete a saved template" },