proton-mail-bridge-client 2.7.1 → 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 +3 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -681,6 +681,9 @@ To check a real Bridge yourself, run the read-only smoke test: `PROTONMAIL_USERN
|
|
|
681
681
|
**"Wrong password" or connection refused**
|
|
682
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.
|
|
683
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
|
+
|
|
684
687
|
**macOS native module crash after update**
|
|
685
688
|
`better-sqlite3` is a native binary built for your machine. After a major Node.js upgrade or environment change, rebuild it:
|
|
686
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,EAGf,MAAM,kBAAkB,CAAC;AA2B1B,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;
|
|
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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AAgB,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
|
@@ -1743,6 +1743,10 @@ const TOOLS = [
|
|
|
1743
1743
|
},
|
|
1744
1744
|
];
|
|
1745
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
|
+
}
|
|
1746
1750
|
// Set PROTONMAIL_TOOL_TIER=core to expose only these — reduces context-window burn
|
|
1747
1751
|
// significantly on every session. Default is "full" (all tools).
|
|
1748
1752
|
export const CORE_TOOL_NAMES = new Set([
|
|
@@ -3586,11 +3590,20 @@ function parseAdditionalAccountsEnv(primary) {
|
|
|
3586
3590
|
};
|
|
3587
3591
|
});
|
|
3588
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
|
+
}
|
|
3589
3602
|
export function buildConfigFromEnv() {
|
|
3590
3603
|
const username = readEnvValue("PROTONMAIL_USERNAME");
|
|
3591
3604
|
const password = readEnvValue("PROTONMAIL_PASSWORD");
|
|
3592
3605
|
if (!username || !password) {
|
|
3593
|
-
throw new
|
|
3606
|
+
throw new MissingCredentialsError();
|
|
3594
3607
|
}
|
|
3595
3608
|
validatePortEnv("PROTONMAIL_SMTP_PORT");
|
|
3596
3609
|
const smtpPort = parseIntegerEnv("PROTONMAIL_SMTP_PORT", 1025, 1, 65_535);
|
|
@@ -3831,10 +3844,7 @@ export function createServer(config, options = {}) {
|
|
|
3831
3844
|
resources: {},
|
|
3832
3845
|
},
|
|
3833
3846
|
});
|
|
3834
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
3835
|
-
const tier = (process.env.PROTONMAIL_TOOL_TIER ?? "full").trim().toLowerCase();
|
|
3836
|
-
return { tools: tier === "core" ? [...TOOLS].filter((t) => CORE_TOOL_NAMES.has(t.name)) : [...TOOLS] };
|
|
3837
|
-
});
|
|
3847
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: listedTools() }));
|
|
3838
3848
|
server.setRequestHandler(ListResourcesRequestSchema, async (request) => {
|
|
3839
3849
|
const cursor = request.params?.cursor ? Number.parseInt(request.params.cursor, 10) : 0;
|
|
3840
3850
|
// Fan out across every configured account and prefix non-primary ids exactly as the
|
|
@@ -7698,8 +7708,42 @@ export async function stopAllAccounts(bundles, timeoutMs = 3_000) {
|
|
|
7698
7708
|
if (timer)
|
|
7699
7709
|
clearTimeout(timer);
|
|
7700
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
|
+
}
|
|
7701
7735
|
export async function main() {
|
|
7702
|
-
|
|
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
|
+
}
|
|
7703
7747
|
// Create the data directory explicitly with a restrictive mode as its very
|
|
7704
7748
|
// first creation, before any service (draft store, template store, audit
|
|
7705
7749
|
// log, local index, ...) does its own mkdir(dirname(...)) as a side effect
|