proton-mail-bridge-client 2.17.6 → 2.18.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.
- package/README.md +23 -14
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +18 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/scripts/bridge-self-test.d.ts +25 -0
- package/dist/scripts/bridge-self-test.d.ts.map +1 -0
- package/dist/scripts/bridge-self-test.js +92 -0
- package/dist/scripts/bridge-self-test.js.map +1 -0
- package/dist/scripts/install-claude-desktop.d.ts +3 -1
- package/dist/scripts/install-claude-desktop.d.ts.map +1 -1
- package/dist/scripts/install-claude-desktop.js +3 -3
- package/dist/scripts/install-claude-desktop.js.map +1 -1
- package/dist/scripts/setup-claude-desktop.d.ts +6 -1
- package/dist/scripts/setup-claude-desktop.d.ts.map +1 -1
- package/dist/scripts/setup-claude-desktop.js +12 -13
- package/dist/scripts/setup-claude-desktop.js.map +1 -1
- package/dist/services/simple-imap-service.d.ts +3 -0
- package/dist/services/simple-imap-service.d.ts.map +1 -1
- package/dist/services/simple-imap-service.js +16 -2
- package/dist/services/simple-imap-service.js.map +1 -1
- package/dist/services/triage-plan-service.d.ts +2 -0
- package/dist/services/triage-plan-service.d.ts.map +1 -1
- package/dist/services/triage-plan-service.js +5 -1
- package/dist/services/triage-plan-service.js.map +1 -1
- package/dist/tools/definitions.d.ts +24 -0
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +62 -4
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/rules-runner.d.ts.map +1 -1
- package/dist/tools/rules-runner.js +12 -2
- package/dist/tools/rules-runner.js.map +1 -1
- package/dist/tools/triage.d.ts.map +1 -1
- package/dist/tools/triage.js +27 -1
- package/dist/tools/triage.js.map +1 -1
- package/dist/utils/atomic-write.d.ts +2 -1
- package/dist/utils/atomic-write.d.ts.map +1 -1
- package/dist/utils/atomic-write.js +23 -2
- package/dist/utils/atomic-write.js.map +1 -1
- package/dist/utils/mail-prompts.d.ts +2 -1
- package/dist/utils/mail-prompts.d.ts.map +1 -1
- package/dist/utils/mail-prompts.js +4 -2
- package/dist/utils/mail-prompts.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
| |_) | |_) | | | || || | | | \| | | |\/| | / _ \ | || |
|
|
5
5
|
| __/| _ <| |_| || || |_| | |\ | | | | |/ ___ \ | || |___
|
|
6
6
|
|_| |_| \_\\___/ |_| \___/|_| \_| |_| |_/_/ \_\___|_____|
|
|
7
|
-
Bridge Client ·
|
|
7
|
+
Bridge Client · MCP + CLI for Proton Mail, with safety modes
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
<div align="center">
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://www.npmjs.com/package/proton-mail-bridge-client)
|
|
13
13
|
[](https://github.com/googlarz/proton-mail-bridge-client/actions/workflows/ci.yml)
|
|
14
14
|
[](LICENSE)
|
|
15
|
-
[](https://nodejs.org)
|
|
16
16
|
[](https://www.typescriptlang.org)
|
|
17
17
|
[](https://modelcontextprotocol.io)
|
|
18
18
|
[](https://github.com/googlarz/proton-mail-bridge-client)
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Let Claude Desktop (or Cline, or any MCP client) work with your Proton Mail, with you in control of what it may do. The server can be set to **read-only** or **drafts** mode, where nothing is sent, moved or deleted. Sending and deleting can be set to wait for your approval: `assisted` mode asks for `confirmed: true`, and `PROTONMAIL_APPROVAL=elicit|require` makes the server ask **you** through the client instead of trusting the model. Every change can be recorded in a hash-chained, tamper-evident audit log. The server talks only to Proton Bridge on `127.0.0.1` and keeps its index on your disk; the mail text the AI model reads goes to the model provider unless the model runs locally (see [fully local](docs/fully-local.md)). The [threat model](docs/threat-model.md) says what is and is not covered. The same tools are also available as a full CLI for scripting, cron and piped automation, with no Claude required. A daily brief of new mail and threads waiting on you can be shown as a notification each morning: see [scheduled digest](docs/cli.md#scheduled-digest).
|
|
28
|
+
|
|
29
|
+
> **Know the default:** with `PROTONMAIL_MODE` unset the server runs in `full` mode (sending allowed, no approval), but a **new** `setup-claude-desktop` install writes `PROTONMAIL_MODE=drafts` (Claude can read and write drafts, not send; moves and permanent delete are off in its action list). Re-running setup on an existing install keeps its mode. To allow sending set `PROTONMAIL_MODE=full`; for read-only use `read-only` (see [Safety controls](#one-switch-protonmail_mode)). Approval by elicitation depends on the client supporting it; only `require` fails closed.
|
|
28
30
|
|
|
29
31
|
> **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
32
|
|
|
@@ -36,7 +38,7 @@ Give Claude Desktop (or Cline, or any MCP client) full access to your Proton Mai
|
|
|
36
38
|
|
|
37
39
|
1. **Install and sign in to [Proton Mail Bridge](https://proton.me/mail/bridge)**, and leave it running. In the Bridge app, open your account and copy the **Bridge password** (it is not your Proton password).
|
|
38
40
|
2. **Connect Claude Desktop**, either way (quit Claude Desktop completely first, so it does not overwrite the config on exit):
|
|
39
|
-
- **Bundle** (needs Node.js
|
|
41
|
+
- **Bundle** (needs Node.js 22 or later on the machine): download the `proton-mail-bridge-client-<your-os>.mcpb` for macOS (`darwin-arm64` Apple silicon, `darwin-x64` Intel), Linux (`linux-x64`, `linux-arm64`) or Windows (`win32-x64`) from the [latest release](https://github.com/googlarz/proton-mail-bridge-client/releases/latest) and open it. Claude Desktop asks for your Proton address and the Bridge password, plus optional settings (Bridge IMAP/SMTP host and port, read-only, allow sending, signature, extra accounts, data and download folders, tool tier); the defaults match a standard Bridge install.
|
|
40
42
|
- **npm:** `npm install -g proton-mail-bridge-client`, then `proton-mail-bridge-client setup-claude-desktop` (it checks your Bridge ports and writes the config). Fully quit and reopen Claude Desktop afterwards.
|
|
41
43
|
3. **Check it works:** run `proton-mail-bridge-client doctor`, or ask Claude "run the Proton Mail doctor".
|
|
42
44
|
4. **Try these prompts:**
|
|
@@ -45,19 +47,22 @@ Give Claude Desktop (or Cline, or any MCP client) full access to your Proton Mai
|
|
|
45
47
|
- "Which of my emails have attachments from this month?"
|
|
46
48
|
- "Show me my drafts and tighten the oldest one."
|
|
47
49
|
5. **Not sure about handing over control?** Start with `PROTONMAIL_MODE=drafts`: Claude can read, search and prepare drafts, but nothing is sent or deleted until you change the mode. The server also tells the client how to behave (ids, accounts, never obeying instructions found inside a message).
|
|
48
|
-
6. **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
|
|
50
|
+
6. **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 128), and more accounts under [Multi-account support](#multi-account-support-v210). More recipes below in [Try it](#try-it-example-claude-prompts).
|
|
49
51
|
|
|
50
52
|
---
|
|
51
53
|
|
|
52
54
|
## What you get
|
|
53
55
|
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
+
- **Read-only or drafts first** — `PROTONMAIL_MODE` presets (`read-only`, `drafts`, `assisted`, `full`) decide how much the assistant may do; other flags can only tighten a preset, never loosen it
|
|
57
|
+
- **Your approval, not the model's** — with `PROTONMAIL_APPROVAL`, sends and deletes need your answer through the client (MCP elicitation); a mail that tells the model to "pass confirmed" cannot give it. A mail firewall flags text that reads like an instruction to an AI
|
|
58
|
+
- **Tamper-evident audit log** — tool calls that change something are hash-chained in `audit.log`; `verify_audit_log` detects edited, deleted or reordered entries (it is evidence, not a defence against someone with the same file access; see [Audit log](#audit-log-tamper-evident))
|
|
59
|
+
- **Local only** — Proton Mail, Proton Bridge, this server, your AI client; no third-party relay, and the search index, drafts and audit log live in your data directory
|
|
60
|
+
- **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, all within the mode you chose
|
|
56
61
|
- **Several addresses at once** — each Proton login (or each address Bridge exposes) is its own isolated account with its own index, drafts and settings
|
|
57
62
|
- **Fast local search** — full-text search across your inbox from a local index that keeps its read state in step with the server
|
|
58
63
|
- **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)
|
|
59
64
|
- **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)
|
|
60
|
-
- **Full CLI** — a dedicated command for every one of the
|
|
65
|
+
- **Full CLI** — a dedicated command for every one of the 128 MCP tools (plus a generic `tool <name>` passthrough), scriptable and pipeable; `doctor` checks every account and `report` prints a diagnostic summary for a bug report
|
|
61
66
|
- **Runs where you do** — Claude Desktop bundle, npm, Homebrew, or a [Docker image](#running-in-docker-headless-machines) for a headless machine
|
|
62
67
|
- **Privacy-native** — no third-party email service involved; your mail stays on your machine
|
|
63
68
|
|
|
@@ -82,7 +87,7 @@ Download: [proton.me/mail/bridge](https://proton.me/mail/bridge)
|
|
|
82
87
|
|
|
83
88
|
> **Bridge password vs Proton password:** Proton Bridge generates a separate local password that is *not* your Proton account password. Find it inside the Bridge app under **Account → Copy password** (or similar — exact label varies by Bridge version). You'll need this for setup.
|
|
84
89
|
|
|
85
|
-
**2. Node.js
|
|
90
|
+
**2. Node.js 22 or later** — `node --version` to check.
|
|
86
91
|
|
|
87
92
|
**3. Your Bridge credentials** — from the Bridge app:
|
|
88
93
|
- IMAP host/port (default: `127.0.0.1:1143`)
|
|
@@ -135,6 +140,7 @@ The wizard:
|
|
|
135
140
|
- checks your local Bridge ports
|
|
136
141
|
- asks for your Bridge username and Bridge password
|
|
137
142
|
- writes the Claude Desktop MCP config entry
|
|
143
|
+
- makes one read-only check against Bridge ("Bridge reachable, signed in as ..., INBOX has N messages", or the likeliest cause if it fails) and lists what to try first; `--no-check` skips the check
|
|
138
144
|
|
|
139
145
|
The runtime is installed into a staging directory first, checked (Node starts, `better-sqlite3` opens a database, `dist` imports, version matches) and only then swapped in; the previous runtime stays next to it as `<runtime dir>.previous`, and a failed install leaves the working one untouched. The config is merged, not replaced: existing `env` keys you added by hand are kept, and the config is rewritten atomically (the newest 5 `.bak-*` copies are kept). Passwords are never printed. Run `npm run check:claude-desktop` to verify an install; it exits non-zero when the command, the runtime or the database module is broken.
|
|
140
146
|
|
|
@@ -295,10 +301,12 @@ Reload the Cline extension after saving. Proton Mail tools will appear in Cline'
|
|
|
295
301
|
|
|
296
302
|
## Running in Docker (headless machines)
|
|
297
303
|
|
|
304
|
+
> **Home server or NAS?** A [step-by-step recipe with a Compose file](docs/headless-docker.md) (untested end to end) shows Bridge without a GUI next to this server. **No cloud model at all?** See [fully local use](docs/fully-local.md) (experimental).
|
|
305
|
+
|
|
298
306
|
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:
|
|
299
307
|
|
|
300
308
|
```bash
|
|
301
|
-
docker build -f docker/Dockerfile --build-arg VERSION=2.
|
|
309
|
+
docker build -f docker/Dockerfile --build-arg VERSION=2.18.0 -t proton-mail-bridge-client .
|
|
302
310
|
docker run -i --rm --network host \
|
|
303
311
|
-e PROTONMAIL_USERNAME=you@proton.me -e PROTONMAIL_PASSWORD_FILE=/run/secrets/bridge \
|
|
304
312
|
-v /path/to/bridge-password:/run/secrets/bridge:ro -v bridge-client-data:/data \
|
|
@@ -650,7 +658,7 @@ All commands support `--json` for machine-readable output, and any MCP tool is d
|
|
|
650
658
|
|
|
651
659
|
`<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.
|
|
652
660
|
|
|
653
|
-
**Full command reference: [docs/cli.md](docs/cli.md)** (a named command for every one of the
|
|
661
|
+
**Full command reference: [docs/cli.md](docs/cli.md)** (a named command for every one of the 128 tools, across read, triage, compose, mailbox actions, folders, drafts, templates, analytics, and diagnostics).
|
|
654
662
|
|
|
655
663
|
---
|
|
656
664
|
|
|
@@ -672,7 +680,7 @@ A mode is a floor: the individual flags below can make things stricter (`PROTONM
|
|
|
672
680
|
All flags work in both the MCP server and CLI:
|
|
673
681
|
|
|
674
682
|
```bash
|
|
675
|
-
PROTONMAIL_TOOL_TIER=core # expose 25 core tools instead of all
|
|
683
|
+
PROTONMAIL_TOOL_TIER=core # expose 25 core tools instead of all 128 — saves context window
|
|
676
684
|
PROTONMAIL_READ_ONLY=true # disable all write operations
|
|
677
685
|
PROTONMAIL_ALLOW_SEND=false # disable SMTP sends only (other writes still work)
|
|
678
686
|
PROTONMAIL_CONFIRM_DESTRUCTIVE=true # require confirmed:true on send, reply, forward, delete
|
|
@@ -716,7 +724,8 @@ PROTONMAIL_PASSWORD_COMMAND='pass proton/password'
|
|
|
716
724
|
PROTONMAIL_DATA_DIR="$HOME/.proton-mail-bridge-client"
|
|
717
725
|
|
|
718
726
|
# Tools
|
|
719
|
-
PROTONMAIL_TOOL_TIER='full' # 'core' exposes 25 essential tools, incl. draft review/edit and list_accounts (saves context window); 'full' exposes all
|
|
727
|
+
PROTONMAIL_TOOL_TIER='full' # 'core' exposes 25 essential tools, incl. draft review/edit and list_accounts (saves context window); 'full' exposes all 128
|
|
728
|
+
PROTONMAIL_TOOLSET='full' # 'full' (all tools), 'core' (the same 25 as TOOL_TIER=core) or 'reader' (read-only tools only, nothing that writes or sends); hides tools and refuses calls to them, never widens PROTONMAIL_MODE; wins over TOOL_TIER; invalid -> full
|
|
720
729
|
|
|
721
730
|
# Safety
|
|
722
731
|
PROTONMAIL_READ_ONLY='false'
|
|
@@ -912,7 +921,7 @@ Measured in October 2026 (v2.7.0) on a copy of the same ~57,000-message index. "
|
|
|
912
921
|
- 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.
|
|
913
922
|
- Large attachments: set `PROTONMAIL_ALLOW_FILE_DOWNLOAD_DIR` and pass `saveTo`, rather than raising `PROTONMAIL_MAX_INLINE_KB`. **Do not point `PROTONMAIL_ALLOW_FILE_DOWNLOAD_DIR` at a broad directory such as `$HOME`:** `save_attachment` could then overwrite shell startup files, LaunchAgents or `~/.claude/settings.json`. The server refuses destinations inside any account's data directory (its `attachments` folder excepted) and the trusted CA file (`save_attachment(s)`, `export_email`), even when the download directory contains them, but it protects nothing else. This was already true before 2.17.
|
|
914
923
|
- Office files are read in a small pool: at most 2 documents at a time, up to 16 waiting (further ones fail with a `busy` error), each worker memory-limited and each job stopped after 10 seconds from its start.
|
|
915
|
-
- **`PROTONMAIL_TOOL_TIER=core`** exposes 25 tools instead of
|
|
924
|
+
- **`PROTONMAIL_TOOL_TIER=core`** exposes 25 tools instead of 128: about 7k tokens of tool definitions instead of about 21k (measured with 116 tools, before the eleven tools of 2.17 were added and not re-measured; the full set now costs somewhat more) (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.
|
|
916
925
|
- 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.)
|
|
917
926
|
|
|
918
927
|
**Working with drafts**
|
package/dist/cli.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare function completionCommands(): Array<{
|
|
|
25
25
|
export declare function completionScript(shell: string): string;
|
|
26
26
|
export declare function commandHelpText(command: string): string | undefined;
|
|
27
27
|
export declare function toolResultExitCode(toolName: string, result: Record<string, unknown>): number;
|
|
28
|
+
export declare function cliServerEnv(base?: NodeJS.ProcessEnv): Record<string, string>;
|
|
28
29
|
export declare function diagnoseConnectionFailure(reason: unknown): {
|
|
29
30
|
cause: string;
|
|
30
31
|
suggestion: string;
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAA+B,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAuBzG,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;AA8ID,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAOD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAyErD,CAAC;AAoBF,eAAO,MAAM,iBAAiB,YAAI,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAGlE,wBAAgB,kBAAkB,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAQlG;AAID,wBAAgB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AAiB,OAAQ,MAAM,KAAG,MAAwB,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,aAAa,IAAI,OAAO,CAAC;IACzB,sFAAsF;IACtF,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAyBD,wBAAsB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAE,aAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAuDlH;AAgBD,wBAAsB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAE,aAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAalH;AA6CD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IAIb,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,EA+F/C,CAAC;AA+EF,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAgQ1C;AA+ED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGzD"}
|
package/dist/cli.js
CHANGED
|
@@ -39,7 +39,7 @@ async function getPkgVersion() {
|
|
|
39
39
|
// boolean regardless of what follows it, so the next token is correctly left as a positional.
|
|
40
40
|
const BOOLEAN_FLAGS = new Set([
|
|
41
41
|
"all", "checkConnections", "confirmed", "dry-run", "full", "help", "html", "json", "live",
|
|
42
|
-
"no-attachment-text", "permanent", "read", "reply-all", "sent", "starred", "sync", "unread",
|
|
42
|
+
"no-attachment-text", "no-check", "permanent", "read", "reply-all", "sent", "starred", "sync", "unread",
|
|
43
43
|
"unread-only", "unstar", "unstarred", "version", "wait",
|
|
44
44
|
]);
|
|
45
45
|
// A command-line mistake (unknown flag, malformed number, repeated flag, missing filter):
|
|
@@ -243,8 +243,8 @@ export const COMMAND_SPECS = {
|
|
|
243
243
|
schedule: { usage: "schedule [--job digest|brief] [--at HH:MM] [--system launchd|systemd|cron|schtasks] [--output <file>] [--password-file <file>]", description: "Print the scheduler definition that runs `digest` (or `brief`, as a notification) every day, with the commands to switch it on (installs nothing)", flags: ["job", "at", "system", "output", "password-file"] },
|
|
244
244
|
help: { usage: "help [command]", description: "Show the command list, or the help for one command", flags: [] },
|
|
245
245
|
version: { usage: "version [--check]", description: "Print the version and exit; --check also asks the npm registry whether a newer release exists", flags: ["check"] },
|
|
246
|
-
"setup-claude-desktop": { usage: "setup-claude-desktop", description: "Run the Claude Desktop setup wizard (works from any install)", flags: [] },
|
|
247
|
-
claude: { usage: "claude <setup|install|check|update|doctor>", description: "Claude Desktop integration: setup wizard, install or update the runtime, check status (update is an alias for install, doctor for check)", flags: [] },
|
|
246
|
+
"setup-claude-desktop": { usage: "setup-claude-desktop [--no-check]", description: "Run the Claude Desktop setup wizard (works from any install); afterwards it makes a read-only check of your mailbox unless --no-check is given", flags: ["no-check"] },
|
|
247
|
+
claude: { usage: "claude <setup|install|check|update|doctor> [--no-check]", description: "Claude Desktop integration: setup wizard, install or update the runtime, check status (update is an alias for install, doctor for check); --no-check skips the wizard's mailbox check", flags: ["no-check"] },
|
|
248
248
|
status: { usage: "status", description: "Show local config, index, runtime, and Claude Desktop status", flags: [] },
|
|
249
249
|
doctor: { usage: "doctor [--account <slug|address>] [--check-updates]", description: "Verify IMAP, SMTP, and Claude Desktop wiring for every account, or one (exits 1 when the check fails); --check-updates also asks the npm registry for a newer release", flags: ["account", "check-updates"] },
|
|
250
250
|
"connection-status": { usage: "connection-status", description: "Show live IMAP/SMTP connectivity state (exits 1 when either is unreachable)", flags: [] },
|
|
@@ -589,15 +589,22 @@ export function toolResultExitCode(toolName, result) {
|
|
|
589
589
|
}
|
|
590
590
|
return 0;
|
|
591
591
|
}
|
|
592
|
+
// Tool profiles (PROTONMAIL_TOOLSET, PROTONMAIL_TOOL_TIER) are for MCP clients. The CLI's own server always uses the full
|
|
593
|
+
// toolset, so a profile set in the shell for Claude Desktop does not make CLI commands fail.
|
|
594
|
+
export function cliServerEnv(base = process.env) {
|
|
595
|
+
return {
|
|
596
|
+
...Object.fromEntries(Object.entries(base).filter((entry) => typeof entry[1] === "string")),
|
|
597
|
+
PROTONMAIL_TOOLSET: "full",
|
|
598
|
+
PROTONMAIL_TOOL_TIER: "full",
|
|
599
|
+
// The CLI reports a failed tool on stderr with its own exit codes; MCP clients get an isError result instead.
|
|
600
|
+
PROTONMAIL_TOOL_ERRORS: "protocol",
|
|
601
|
+
};
|
|
602
|
+
}
|
|
592
603
|
async function withMcpClient(run) {
|
|
593
604
|
const transport = new StdioClientTransport({
|
|
594
605
|
command: process.execPath,
|
|
595
606
|
args: [cliEntryPath()],
|
|
596
|
-
env:
|
|
597
|
-
...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
|
|
598
|
-
// The CLI reports a failed tool on stderr with its own exit codes; MCP clients get an isError result instead.
|
|
599
|
-
PROTONMAIL_TOOL_ERRORS: "protocol",
|
|
600
|
-
},
|
|
607
|
+
env: cliServerEnv(),
|
|
601
608
|
stderr: "ignore",
|
|
602
609
|
});
|
|
603
610
|
const client = new Client({
|
|
@@ -2206,6 +2213,7 @@ export const TOOL_ONLY_COMMANDS = [
|
|
|
2206
2213
|
{ 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)" },
|
|
2207
2214
|
{ command: "plan-inbox", tool: "plan_inbox", positionals: [], help: "Prepare a batch of mailbox changes to approve at once (--args '{\"scan\":true,\"limit\":30}')" },
|
|
2208
2215
|
{ command: "approve-plan", tool: "approve_plan", positionals: ["planId"], help: "Apply a plan from plan-inbox (--args '{\"exclude\":[3]}')" },
|
|
2216
|
+
{ command: "plans", tool: "list_plans", positionals: [], help: "Stored plans: status, age, items, whether undo data is held, the cap and the slots left (--account)" },
|
|
2209
2217
|
{ command: "undo-plan", tool: "undo_plan", positionals: ["planId"], help: "Put back what an approved plan changed" },
|
|
2210
2218
|
{ command: "define-category", tool: "define_category", positionals: ["name"], help: "Define or change an inbox category of your own (--args '{\"keywords\":[\"invoice\"],\"label\":\"Receipts\"}'; '{\"starter\":true}' for the starter set)" },
|
|
2211
2219
|
{ command: "categories", tool: "list_categories", positionals: [], help: "Your inbox categories and what corrections taught them (--account)" },
|
|
@@ -2306,7 +2314,7 @@ async function runToolOnlyCommand(entry, parsed) {
|
|
|
2306
2314
|
async function runClaude(parsed) {
|
|
2307
2315
|
switch (parsed.subcommand) {
|
|
2308
2316
|
case "setup":
|
|
2309
|
-
await runClaudeDesktopSetupWizard();
|
|
2317
|
+
await runClaudeDesktopSetupWizard({ skipCheck: isTruthyFlag(parsed.flags["no-check"]), diagnose: diagnoseConnectionFailure });
|
|
2310
2318
|
return;
|
|
2311
2319
|
case "install":
|
|
2312
2320
|
case "update": {
|
|
@@ -2373,7 +2381,7 @@ export async function main() {
|
|
|
2373
2381
|
return;
|
|
2374
2382
|
}
|
|
2375
2383
|
case "setup-claude-desktop":
|
|
2376
|
-
await runClaudeDesktopSetupWizard();
|
|
2384
|
+
await runClaudeDesktopSetupWizard({ skipCheck: isTruthyFlag(parsed.flags["no-check"]), diagnose: diagnoseConnectionFailure });
|
|
2377
2385
|
return;
|
|
2378
2386
|
case "status":
|
|
2379
2387
|
await runStatus(parsed);
|