proton-mail-bridge-client 2.7.0 → 2.7.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
@@ -339,6 +339,7 @@ First, enable **Split Addresses** in Proton Bridge and configure each address as
339
339
  - Actions: `mark_email_read`, `star_email`, `move_email`, `delete_email`, etc. — prefix the `emailId` with account slug if targeting a non-primary account
340
340
  - Drafts: `create_draft`, `get_draft`, `send_draft`, etc. — drafts live per account; prefix `draftId` to access non-primary drafts
341
341
  - Send: `send_email`, `reply_to_email`, `forward_email` — match the `from` address to route through the correct account's SMTP
342
+ - Sync and index maintenance: `sync_emails`, `sync_folders`, `run_background_sync`, `wait_for_mailbox_changes` — pass `account` (address or slug) to act on a non-primary account; without it they act on the primary account, and an unknown value is an error
342
343
 
343
344
  **Primary-only (for now):**
344
345
  - `list_remote_drafts` — shows the primary account's remote Proton Drafts folder only
@@ -609,6 +610,23 @@ Measured against a real Proton Bridge with a ~57,000-message mailbox (INBOX 29k,
609
610
 
610
611
  Bridge answers IMAP `SEARCH` itself, and its cost grows with folder size. That is why a live search is slower than the local index, and why narrowing the scope matters most.
611
612
 
613
+ **Local index: filters and thread tools**
614
+
615
+ Measured in October 2026 (v2.7.0) on a copy of the same ~57,000-message index. "Warm" is a second call; the first call after the index changes (a sync, or another process writing to it) builds a map of which thread every message belongs to, which takes about 0.5 s (0.8 s for follow-ups and the digest) and about 31 MB of memory.
616
+
617
+ | Call | Warm |
618
+ |---|---|
619
+ | filter by `subject` or `from` | ~20 ms |
620
+ | filter by `to` | ~40 ms |
621
+ | `get_threads` with `query`, `label` or `folder` | ~25 ms |
622
+ | `get_threads` without a filter | ~40 ms |
623
+ | `get_thread_by_id` | ~1 ms |
624
+ | `get_follow_up_candidates` | 20-40 ms |
625
+ | `get_inbox_digest` | ~80 ms |
626
+ | `get_actionable_threads` | 17-35 ms |
627
+ | `prepare_meeting_context` with `person` or `domain` | ~30 ms |
628
+ | `find_document_threads` | ~225 ms |
629
+
612
630
  **Make searches faster**
613
631
 
614
632
  - **Prefer `search_indexed_emails`** when the index is current (`get_index_status`, `sync_emails`). It does not touch Bridge at all.
@@ -651,6 +669,7 @@ To check a real Bridge yourself, run the read-only smoke test: `PROTONMAIL_USERN
651
669
  - `get_emails` and `search_emails` return a composite `emailId` — use it for all subsequent reads and actions.
652
670
  - `search_indexed_emails` supports `from:`, `to:`, `subject:`, `label:`, `domain:` shortcuts.
653
671
  - The local index lives at `PROTONMAIL_DATA_DIR/mail-index.sqlite`. Background sync and IMAP IDLE keep it warm.
672
+ - Filters on the local index ignore case and accents, and match spelling variants: `Müller` finds `Mueller`, `lodz` finds `Łódź`, `strasse` finds `Straße`. Live `search_emails` and `count_messages` go through Bridge: a query with umlauts or other non-ASCII letters also matches the spelled-out form (`Müller` finds `Mueller`), but a plain ASCII query is sent as typed, so `Mueller` does not find `Müller` there. Use `search_indexed_emails` for that.
654
673
  - Audit logs live at `PROTONMAIL_DATA_DIR/audit.log`.
655
674
  - Draft sync is best-effort — the local draft is always preserved even if remote sync fails.
656
675
  - System folders (INBOX, Sent, Trash, Spam, Archive, All Mail) are guarded against accidental deletion.
@@ -662,6 +681,9 @@ To check a real Bridge yourself, run the read-only smoke test: `PROTONMAIL_USERN
662
681
  **"Wrong password" or connection refused**
663
682
  Make sure you're using the **Bridge password**, not your Proton account password. Find it in the Bridge app under Account → Copy password. Bridge must be running before the MCP server or CLI can connect.
664
683
 
684
+ **Every tool answers "not configured"**
685
+ `PROTONMAIL_USERNAME` and `PROTONMAIL_PASSWORD` are not set for the server. Since 2.7.2 it still starts without them, lists its tools and answers each call with that message (it used to exit at once, which clients showed as "Connection closed"). Set both (the password is the Bridge password) and restart; `proton-mail-bridge-client setup-claude-desktop` does it for Claude Desktop. Any other configuration mistake, such as a bad port, still stops the server at start.
686
+
665
687
  **macOS native module crash after update**
666
688
  `better-sqlite3` is a native binary built for your machine. After a major Node.js upgrade or environment change, rebuild it:
667
689
  ```bash
package/dist/index.d.ts CHANGED
@@ -108,6 +108,9 @@ export declare function groupEmailIdsByAccount(accountManager: AccountManager, e
108
108
  export declare function prefixBulkResult(result: BulkOperationResult, slug: string | undefined): BulkOperationResult;
109
109
  export declare function prefixNotFound(excluded: BulkExcludedEmailId[], slug: string | undefined): BulkExcludedEmailId[];
110
110
  export declare function mergeBulkResults(results: BulkOperationResult[]): BulkOperationResult;
111
+ export declare class MissingCredentialsError extends Error {
112
+ constructor();
113
+ }
111
114
  export declare function buildConfigFromEnv(): ProtonMailConfig;
112
115
  export declare function createServer(config: ProtonMailConfig, options?: {
113
116
  startBackgroundSync?: boolean;
@@ -157,6 +160,8 @@ export declare function createServer(config: ProtonMailConfig, options?: {
157
160
  accountManager: AccountManager;
158
161
  };
159
162
  export declare function stopAllAccounts(bundles: Array<Pick<AccountBundle, "backgroundSyncService" | "deliveryQueueService" | "snoozeService" | "imapService" | "smtpService" | "localIndexService">>, timeoutMs?: number): Promise<void>;
163
+ export declare const NOT_CONFIGURED_MESSAGE: string;
164
+ export declare function createUnconfiguredServer(): Server;
160
165
  export declare function main(): Promise<void>;
161
166
  export {};
162
167
  //# sourceMappingURL=index.d.ts.map
@@ -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,iBAAiB,EAAuD,MAAM,mCAAmC,CAAC;AAC3H,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAA2H,iBAAiB,EAA+B,MAAM,mCAAmC,CAAC;AAC5N,OAAO,EAAmC,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,KAAK,EAMV,mBAAmB,EACnB,cAAc,EACd,WAAW,EAIX,WAAW,EAIX,gBAAgB,EAChB,cAAc,EAG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B,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,CASpF;AAsQD,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,cAGC;CACF;AAED,wBAAgB,kBAAkB,IAAI,gBAAgB,CAkGrD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyoJP;AAOD,wBAAsB,eAAe,CACnC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,uBAAuB,GAAG,sBAAsB,GAAG,eAAe,GAAG,aAAa,GAAG,aAAa,GAAG,mBAAmB,CAAC,CAAC,EAC7J,SAAS,SAAQ,GAChB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,eAAO,MAAM,sBAAsB,QAGiG,CAAC;AAIrI,wBAAgB,wBAAwB,IAAI,MAAM,CAQjD;AAaD,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAyE1C"}
package/dist/index.js CHANGED
@@ -1406,6 +1406,7 @@ const TOOLS = [
1406
1406
  properties: {
1407
1407
  query: { type: "string", description: "Free-text filter across subject, participants, and labels." },
1408
1408
  label: { type: "string", description: "Require a normalized label on the thread." },
1409
+ folder: { type: "string", description: "Only threads with a message in this folder, by its exact path as get_folders lists it (e.g. INBOX, Archive, Trash, Folders/Receipts). With several accounts it applies to each." },
1409
1410
  limit: { type: "number", description: "Maximum threads to return.", default: 100 },
1410
1411
  offset: { type: "number", description: "Skip this many threads (use nextOffset from the previous response to page).", default: 0 },
1411
1412
  },
@@ -1742,6 +1743,10 @@ const TOOLS = [
1742
1743
  },
1743
1744
  ];
1744
1745
  // Core tier: the 20 tools that cover ~80% of daily email use.
1746
+ function listedTools() {
1747
+ const tier = (process.env.PROTONMAIL_TOOL_TIER ?? "full").trim().toLowerCase();
1748
+ return tier === "core" ? [...TOOLS].filter((t) => CORE_TOOL_NAMES.has(t.name)) : [...TOOLS];
1749
+ }
1745
1750
  // Set PROTONMAIL_TOOL_TIER=core to expose only these — reduces context-window burn
1746
1751
  // significantly on every session. Default is "full" (all tools).
1747
1752
  export const CORE_TOOL_NAMES = new Set([
@@ -3585,11 +3590,20 @@ function parseAdditionalAccountsEnv(primary) {
3585
3590
  };
3586
3591
  });
3587
3592
  }
3593
+ // The one configuration error the server can still answer: without a login it cannot reach Bridge, but it can
3594
+ // list its tools and say what is missing (registries and MCP clients start servers without credentials to
3595
+ // inspect them, and "Connection closed" tells nobody anything).
3596
+ export class MissingCredentialsError extends Error {
3597
+ constructor() {
3598
+ super("Missing required environment variables or secret sources: PROTONMAIL_USERNAME and PROTONMAIL_PASSWORD.");
3599
+ this.name = "MissingCredentialsError";
3600
+ }
3601
+ }
3588
3602
  export function buildConfigFromEnv() {
3589
3603
  const username = readEnvValue("PROTONMAIL_USERNAME");
3590
3604
  const password = readEnvValue("PROTONMAIL_PASSWORD");
3591
3605
  if (!username || !password) {
3592
- throw new Error("Missing required environment variables or secret sources: PROTONMAIL_USERNAME and PROTONMAIL_PASSWORD.");
3606
+ throw new MissingCredentialsError();
3593
3607
  }
3594
3608
  validatePortEnv("PROTONMAIL_SMTP_PORT");
3595
3609
  const smtpPort = parseIntegerEnv("PROTONMAIL_SMTP_PORT", 1025, 1, 65_535);
@@ -3830,10 +3844,7 @@ export function createServer(config, options = {}) {
3830
3844
  resources: {},
3831
3845
  },
3832
3846
  });
3833
- server.setRequestHandler(ListToolsRequestSchema, async () => {
3834
- const tier = (process.env.PROTONMAIL_TOOL_TIER ?? "full").trim().toLowerCase();
3835
- return { tools: tier === "core" ? [...TOOLS].filter((t) => CORE_TOOL_NAMES.has(t.name)) : [...TOOLS] };
3836
- });
3847
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: listedTools() }));
3837
3848
  server.setRequestHandler(ListResourcesRequestSchema, async (request) => {
3838
3849
  const cursor = request.params?.cursor ? Number.parseInt(request.params.cursor, 10) : 0;
3839
3850
  // Fan out across every configured account and prefix non-primary ids exactly as the
@@ -6912,6 +6923,7 @@ export function createServer(config, options = {}) {
6912
6923
  const threadsInput = {
6913
6924
  query: optionalString(args, "query"),
6914
6925
  label: optionalString(args, "label"),
6926
+ folder: optionalString(args, "folder"),
6915
6927
  limit: optionalInteger(args.limit, 1, 1000),
6916
6928
  offset: optionalInteger(args.offset, 0, 1_000_000),
6917
6929
  };
@@ -7696,8 +7708,42 @@ export async function stopAllAccounts(bundles, timeoutMs = 3_000) {
7696
7708
  if (timer)
7697
7709
  clearTimeout(timer);
7698
7710
  }
7711
+ export const NOT_CONFIGURED_MESSAGE = "Proton Mail Bridge Client is not configured: PROTONMAIL_USERNAME and PROTONMAIL_PASSWORD are not set. " +
7712
+ "Set them to your Bridge login (the password is the one the Proton Mail Bridge app shows under your account, " +
7713
+ "not your Proton password) and restart the server. `proton-mail-bridge-client setup-claude-desktop` does this for Claude Desktop.";
7714
+ // Starts a server that lists its tools and answers every call with NOT_CONFIGURED_MESSAGE. It touches nothing:
7715
+ // no data directory, no Bridge connection, no background work.
7716
+ export function createUnconfiguredServer() {
7717
+ const server = new Server({ name: "proton-mail-bridge-client", version: PACKAGE_VERSION }, { capabilities: { tools: {} } });
7718
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: listedTools() }));
7719
+ server.setRequestHandler(CallToolRequestSchema, async () => ({
7720
+ isError: true,
7721
+ content: [{ type: "text", text: NOT_CONFIGURED_MESSAGE }],
7722
+ }));
7723
+ return server;
7724
+ }
7725
+ async function runUnconfigured() {
7726
+ logger.warn(NOT_CONFIGURED_MESSAGE, "MCPServer");
7727
+ const server = createUnconfiguredServer();
7728
+ const transport = new StdioServerTransport();
7729
+ await server.connect(transport);
7730
+ const leave = () => process.exit(0);
7731
+ process.on("SIGINT", leave);
7732
+ process.on("SIGTERM", leave);
7733
+ transport.onclose = leave;
7734
+ }
7699
7735
  export async function main() {
7700
- const config = buildConfigFromEnv();
7736
+ let config;
7737
+ try {
7738
+ config = buildConfigFromEnv();
7739
+ }
7740
+ catch (error) {
7741
+ if (error instanceof MissingCredentialsError) {
7742
+ await runUnconfigured();
7743
+ return;
7744
+ }
7745
+ throw error;
7746
+ }
7701
7747
  // Create the data directory explicitly with a restrictive mode as its very
7702
7748
  // first creation, before any service (draft store, template store, audit
7703
7749
  // log, local index, ...) does its own mkdir(dirname(...)) as a side effect