mcp-google-multi 6.0.0-alpha.48 → 6.0.0-alpha.49
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/dist/accounts.d.ts +7 -0
- package/dist/accounts.js +14 -0
- package/dist/registry.d.ts +7 -0
- package/dist/registry.js +27 -1
- package/dist/tools/account-wizard.js +9 -0
- package/package.json +1 -1
package/dist/accounts.d.ts
CHANGED
|
@@ -48,6 +48,13 @@ export declare function unknownAliasMessage(aliases: readonly string[], selector
|
|
|
48
48
|
export declare function accountAliasSchemaFor(aliases: readonly string[]): z.ZodType<string>;
|
|
49
49
|
/** Shared, load-time snapshot used by every tool's `account` field. */
|
|
50
50
|
export declare const accountAliasSchema: z.ZodType<string>;
|
|
51
|
+
/** Live account argument: validates at PARSE time against the accessor's
|
|
52
|
+
* CURRENT aliases, so an alias added mid-session (account_add, or a tenant
|
|
53
|
+
* alias link) is immediately valid on already-registered tools — a baked
|
|
54
|
+
* z.enum freezes the boot-time set until restart. An empty set stays
|
|
55
|
+
* permissive (same empty-safe rule as above); dispatch still resolves the
|
|
56
|
+
* alias against the live registry. */
|
|
57
|
+
export declare function accountArgLive(aliases: () => readonly string[]): z.ZodType<string>;
|
|
51
58
|
/**
|
|
52
59
|
* BR-4: the stdio/http SERVER never boots with an empty registry — a fresh user
|
|
53
60
|
* bootstraps via env / `migrate-config` / `account import` / `auth` first. The
|
package/dist/accounts.js
CHANGED
|
@@ -302,6 +302,20 @@ export function accountAliasSchemaFor(aliases) {
|
|
|
302
302
|
}
|
|
303
303
|
/** Shared, load-time snapshot used by every tool's `account` field. */
|
|
304
304
|
export const accountAliasSchema = accountAliasSchemaFor(ACCOUNTS);
|
|
305
|
+
/** Live account argument: validates at PARSE time against the accessor's
|
|
306
|
+
* CURRENT aliases, so an alias added mid-session (account_add, or a tenant
|
|
307
|
+
* alias link) is immediately valid on already-registered tools — a baked
|
|
308
|
+
* z.enum freezes the boot-time set until restart. An empty set stays
|
|
309
|
+
* permissive (same empty-safe rule as above); dispatch still resolves the
|
|
310
|
+
* alias against the live registry. */
|
|
311
|
+
export function accountArgLive(aliases) {
|
|
312
|
+
return z.string().superRefine((value, ctx) => {
|
|
313
|
+
const current = aliases();
|
|
314
|
+
if (current.length > 0 && !current.includes(value)) {
|
|
315
|
+
ctx.addIssue({ code: 'custom', message: unknownAliasMessage(current) });
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
305
319
|
/**
|
|
306
320
|
* BR-4: the stdio/http SERVER never boots with an empty registry — a fresh user
|
|
307
321
|
* bootstraps via env / `migrate-config` / `account import` / `auth` first. The
|
package/dist/registry.d.ts
CHANGED
|
@@ -123,4 +123,11 @@ export declare class ToolRegistry {
|
|
|
123
123
|
};
|
|
124
124
|
installListHandler(): void;
|
|
125
125
|
private toToolJson;
|
|
126
|
+
/** Advertise the CURRENT alias enum on every tools/list: account validation
|
|
127
|
+
* is (or is becoming) live, so a cached boot-time enum would go stale the
|
|
128
|
+
* moment account_add lands mid-session. The structural schema stays cached;
|
|
129
|
+
* only the account property's values are refreshed per call. Skipped for
|
|
130
|
+
* the subject-taking account tools (their `account` is the OPERAND, e.g. a
|
|
131
|
+
* brand-new alias name, not an identity to enumerate). */
|
|
132
|
+
private withLiveAccountEnum;
|
|
126
133
|
}
|
package/dist/registry.js
CHANGED
|
@@ -451,9 +451,35 @@ export class ToolRegistry {
|
|
|
451
451
|
return {
|
|
452
452
|
name: tool.name,
|
|
453
453
|
description: tool.description,
|
|
454
|
-
inputSchema,
|
|
454
|
+
inputSchema: this.withLiveAccountEnum(tool, inputSchema),
|
|
455
455
|
annotations: tool.annotations,
|
|
456
456
|
...(tool.clientMeta ? { _meta: tool.clientMeta } : {}),
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
+
/** Advertise the CURRENT alias enum on every tools/list: account validation
|
|
460
|
+
* is (or is becoming) live, so a cached boot-time enum would go stale the
|
|
461
|
+
* moment account_add lands mid-session. The structural schema stays cached;
|
|
462
|
+
* only the account property's values are refreshed per call. Skipped for
|
|
463
|
+
* the subject-taking account tools (their `account` is the OPERAND, e.g. a
|
|
464
|
+
* brand-new alias name, not an identity to enumerate). */
|
|
465
|
+
withLiveAccountEnum(tool, schema) {
|
|
466
|
+
if (DEFAULT_ACCOUNT_EXCLUDE.has(tool.name))
|
|
467
|
+
return schema;
|
|
468
|
+
const s = schema;
|
|
469
|
+
const account = s?.properties?.account;
|
|
470
|
+
if (!account)
|
|
471
|
+
return schema;
|
|
472
|
+
const aliases = this.accounts().aliases;
|
|
473
|
+
if (aliases.length === 0)
|
|
474
|
+
return schema;
|
|
475
|
+
if (Array.isArray(account.anyOf)) {
|
|
476
|
+
// fan-out union: refresh the enum branch ('*' + aliases), keep the CSV branch
|
|
477
|
+
const hasEnumBranch = account.anyOf.some((b) => Array.isArray(b.enum));
|
|
478
|
+
if (!hasEnumBranch)
|
|
479
|
+
return schema;
|
|
480
|
+
const anyOf = account.anyOf.map((b) => (Array.isArray(b.enum) ? { ...b, enum: ['*', ...aliases] } : b));
|
|
481
|
+
return { ...s, properties: { ...s.properties, account: { ...account, anyOf } } };
|
|
482
|
+
}
|
|
483
|
+
return { ...s, properties: { ...s.properties, account: { ...account, enum: [...aliases] } } };
|
|
484
|
+
}
|
|
459
485
|
}
|
|
@@ -297,6 +297,15 @@ export function registerAccountWizardTools(registry, server) {
|
|
|
297
297
|
// S2: atomic write + make the alias callable without a restart (BR3).
|
|
298
298
|
writeAccountRow(validated.alias, validated.email, validated.bundles, validated.admin);
|
|
299
299
|
invalidateAccountSet();
|
|
300
|
+
// Live account args validate against the refreshed registry already;
|
|
301
|
+
// the list_changed nudge makes clients re-fetch tools/list, where the
|
|
302
|
+
// advertised account enums are rebuilt from the live set.
|
|
303
|
+
try {
|
|
304
|
+
server.sendToolListChanged();
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
// a client that cannot receive notifications loses nothing but the nudge
|
|
308
|
+
}
|
|
300
309
|
// S3 + S4: consent + validate.
|
|
301
310
|
const consent = await runConsent(server, validated.alias);
|
|
302
311
|
if (consent.ok === 'pending')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-google-multi",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.49",
|
|
4
4
|
"mcpName": "io.github.bakissation/mcp-google-multi",
|
|
5
5
|
"description": "Local MCP server for Google Workspace (Gmail, Drive, Calendar, Sheets, Docs, Contacts, Tasks, Meet, Search Console, +Forms/Chat/Admin) across multiple accounts — OAuth-only, encrypted token storage, deny-by-default writes.",
|
|
6
6
|
"type": "module",
|