mcp-google-multi 6.0.0-beta.2 → 6.0.0-beta.4
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 +5 -5
- package/dist/accounts.d.ts +20 -4
- package/dist/accounts.js +68 -44
- package/dist/api-probe.d.ts +5 -0
- package/dist/api-probe.js +20 -15
- package/dist/arg-normalize.js +19 -38
- package/dist/arg-strict.d.ts +7 -0
- package/dist/arg-strict.js +38 -28
- package/dist/auth.d.ts +5 -4
- package/dist/auth.js +16 -23
- package/dist/boot-gates.d.ts +26 -0
- package/dist/boot-gates.js +36 -0
- package/dist/cimd-cache.d.ts +38 -0
- package/dist/cimd-cache.js +111 -0
- package/dist/client-config.d.ts +2 -2
- package/dist/client-config.js +8 -14
- package/dist/client.d.ts +32 -2
- package/dist/client.js +0 -0
- package/dist/compose.d.ts +18 -0
- package/dist/compose.js +109 -0
- package/dist/config-file.d.ts +13 -0
- package/dist/config-file.js +41 -10
- package/dist/discover.js +7 -10
- package/dist/discovery-client.d.ts +3 -0
- package/dist/discovery-client.js +36 -32
- package/dist/doctor.d.ts +9 -5
- package/dist/doctor.js +119 -29
- package/dist/env-load.js +2 -5
- package/dist/executor.d.ts +3 -0
- package/dist/executor.js +6 -6
- package/dist/fanout.d.ts +9 -1
- package/dist/fanout.js +47 -22
- package/dist/fs-atomic.d.ts +8 -0
- package/dist/fs-atomic.js +216 -29
- package/dist/hint-provider.d.ts +129 -0
- package/dist/hint-provider.js +58 -0
- package/dist/http-config.d.ts +2 -2
- package/dist/http-config.js +3 -7
- package/dist/http-transport.d.ts +67 -9
- package/dist/http-transport.js +318 -52
- package/dist/identity.d.ts +6 -3
- package/dist/identity.js +24 -8
- package/dist/index.js +76 -160
- package/dist/master-key.d.ts +3 -3
- package/dist/master-key.js +16 -19
- package/dist/mcp-token.d.ts +126 -19
- package/dist/mcp-token.js +557 -76
- package/dist/metrics-cli.d.ts +1 -1
- package/dist/metrics-cli.js +1 -1
- package/dist/metrics-tap.js +2 -5
- package/dist/migrate-config.d.ts +1 -2
- package/dist/migrate-config.js +5 -7
- package/dist/net-tuning.js +2 -4
- package/dist/oauth-as.d.ts +104 -4
- package/dist/oauth-as.js +368 -114
- package/dist/oauth-consent.d.ts +10 -0
- package/dist/oauth-consent.js +20 -10
- package/dist/outbound-allowlist.js +9 -11
- package/dist/reauth-hint.d.ts +1 -1
- package/dist/reauth-hint.js +11 -10
- package/dist/registry-transfer.d.ts +5 -0
- package/dist/registry-transfer.js +63 -11
- package/dist/registry.d.ts +13 -4
- package/dist/registry.js +100 -72
- package/dist/scope-catalog.d.ts +16 -0
- package/dist/scope-catalog.js +40 -13
- package/dist/scope-observability.d.ts +10 -9
- package/dist/scope-observability.js +34 -24
- package/dist/services.d.ts +18 -10
- package/dist/services.js +61 -22
- package/dist/ssrf-guard.d.ts +23 -9
- package/dist/ssrf-guard.js +106 -78
- package/dist/tenant-purge.d.ts +26 -0
- package/dist/tenant-purge.js +65 -0
- package/dist/token-store.d.ts +20 -2
- package/dist/token-store.js +0 -0
- package/dist/tools/_coerce.d.ts +4 -4
- package/dist/tools/_errors.d.ts +3 -0
- package/dist/tools/_errors.js +72 -60
- package/dist/tools/_local-files.d.ts +9 -0
- package/dist/tools/_local-files.js +22 -8
- package/dist/tools/account-wizard.d.ts +13 -3
- package/dist/tools/account-wizard.js +107 -56
- package/dist/tools/accounts-tool.d.ts +8 -1
- package/dist/tools/accounts-tool.js +35 -19
- package/dist/tools/admin.d.ts +10 -1
- package/dist/tools/admin.js +14 -11
- package/dist/tools/analytics.d.ts +10 -1
- package/dist/tools/analytics.js +14 -10
- package/dist/tools/calendar.d.ts +2 -1
- package/dist/tools/calendar.js +19 -18
- package/dist/tools/chat.d.ts +10 -1
- package/dist/tools/chat.js +12 -8
- package/dist/tools/contacts.d.ts +2 -1
- package/dist/tools/contacts.js +22 -19
- package/dist/tools/docs.d.ts +2 -1
- package/dist/tools/docs.js +35 -36
- package/dist/tools/drive.d.ts +2 -1
- package/dist/tools/drive.js +80 -74
- package/dist/tools/forms.d.ts +10 -1
- package/dist/tools/forms.js +18 -12
- package/dist/tools/generated/_shared.d.ts +2 -1
- package/dist/tools/generated/_shared.js +7 -3
- package/dist/tools/generated/admin.d.ts +2 -1
- package/dist/tools/generated/admin.js +265 -265
- package/dist/tools/generated/analytics.d.ts +2 -1
- package/dist/tools/generated/analytics.js +125 -125
- package/dist/tools/generated/appsmarket.d.ts +2 -1
- package/dist/tools/generated/appsmarket.js +5 -5
- package/dist/tools/generated/calendar.d.ts +2 -1
- package/dist/tools/generated/calendar.js +55 -55
- package/dist/tools/generated/chat.d.ts +2 -1
- package/dist/tools/generated/chat.js +95 -95
- package/dist/tools/generated/classroom.d.ts +2 -1
- package/dist/tools/generated/classroom.js +209 -209
- package/dist/tools/generated/cloudidentity.d.ts +2 -1
- package/dist/tools/generated/cloudidentity.js +133 -133
- package/dist/tools/generated/cloudsearch.d.ts +2 -1
- package/dist/tools/generated/cloudsearch.js +99 -99
- package/dist/tools/generated/contacts.d.ts +2 -1
- package/dist/tools/generated/contacts.js +29 -29
- package/dist/tools/generated/drive.d.ts +2 -1
- package/dist/tools/generated/drive.js +71 -71
- package/dist/tools/generated/driveactivity.d.ts +2 -1
- package/dist/tools/generated/driveactivity.js +3 -3
- package/dist/tools/generated/drivelabels.d.ts +2 -1
- package/dist/tools/generated/drivelabels.js +53 -53
- package/dist/tools/generated/forms.d.ts +2 -1
- package/dist/tools/generated/forms.js +7 -7
- package/dist/tools/generated/gmail.d.ts +2 -1
- package/dist/tools/generated/gmail.js +117 -117
- package/dist/tools/generated/groupsmigration.d.ts +2 -1
- package/dist/tools/generated/groupsmigration.js +3 -3
- package/dist/tools/generated/groupssettings.d.ts +2 -1
- package/dist/tools/generated/groupssettings.js +7 -7
- package/dist/tools/generated/index.d.ts +2 -1
- package/dist/tools/generated/keep.d.ts +2 -1
- package/dist/tools/generated/keep.js +15 -15
- package/dist/tools/generated/licensing.d.ts +2 -1
- package/dist/tools/generated/licensing.js +15 -15
- package/dist/tools/generated/meet.d.ts +2 -1
- package/dist/tools/generated/meet.js +27 -27
- package/dist/tools/generated/postmaster.d.ts +2 -1
- package/dist/tools/generated/postmaster.js +9 -9
- package/dist/tools/generated/reseller.d.ts +2 -1
- package/dist/tools/generated/reseller.js +35 -35
- package/dist/tools/generated/script.d.ts +2 -1
- package/dist/tools/generated/script.js +33 -33
- package/dist/tools/generated/searchconsole.d.ts +2 -1
- package/dist/tools/generated/searchconsole.js +3 -3
- package/dist/tools/generated/sheets.d.ts +2 -1
- package/dist/tools/generated/sheets.js +15 -15
- package/dist/tools/generated/tasks.d.ts +2 -1
- package/dist/tools/generated/tasks.js +5 -5
- package/dist/tools/generated/vault.d.ts +2 -1
- package/dist/tools/generated/vault.js +67 -67
- package/dist/tools/generated/workspaceevents.d.ts +2 -1
- package/dist/tools/generated/workspaceevents.js +31 -31
- package/dist/tools/gmail-mime.d.ts +1 -1
- package/dist/tools/gmail-mime.js +7 -12
- package/dist/tools/gmail.d.ts +4 -3
- package/dist/tools/gmail.js +67 -69
- package/dist/tools/google-api.d.ts +2 -3
- package/dist/tools/google-api.js +34 -22
- package/dist/tools/meet.d.ts +10 -1
- package/dist/tools/meet.js +12 -9
- package/dist/tools/searchconsole.d.ts +2 -1
- package/dist/tools/searchconsole.js +16 -13
- package/dist/tools/sheets.d.ts +2 -1
- package/dist/tools/sheets.js +35 -32
- package/dist/tools/slides.d.ts +10 -1
- package/dist/tools/slides.js +16 -10
- package/dist/tools/tasks.d.ts +2 -1
- package/dist/tools/tasks.js +18 -15
- package/dist/trim.d.ts +5 -0
- package/dist/trim.js +19 -0
- package/dist/usage-metrics.d.ts +23 -0
- package/dist/usage-metrics.js +67 -56
- package/dist/write-control.d.ts +4 -8
- package/dist/write-control.js +13 -6
- package/package.json +47 -21
package/dist/mcp-token.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const ACCESS_TTL_DEFAULT = 600;
|
|
2
2
|
export declare const STATE_TTL_DEFAULT = 600;
|
|
3
3
|
export declare const CODE_TTL_DEFAULT = 60;
|
|
4
|
-
export declare const REPLAY_CAP_DEFAULT =
|
|
4
|
+
export declare const REPLAY_CAP_DEFAULT = 100000;
|
|
5
5
|
/** Derive the HS256 secret (32 bytes) from the provisioned MCP_JWT_KEY string. */
|
|
6
6
|
export declare function jwtSecretFrom(jwtKey: string): Uint8Array;
|
|
7
7
|
export interface AccessTokenParams {
|
|
@@ -9,6 +9,7 @@ export interface AccessTokenParams {
|
|
|
9
9
|
secret: Uint8Array;
|
|
10
10
|
ttlSec?: number;
|
|
11
11
|
iat: number;
|
|
12
|
+
sub: string;
|
|
12
13
|
}
|
|
13
14
|
export declare function signAccessToken(p: AccessTokenParams): Promise<string>;
|
|
14
15
|
export interface AccessClaims {
|
|
@@ -19,63 +20,169 @@ export interface AccessClaims {
|
|
|
19
20
|
/** Verify an access token for `/mcp`. Throws on bad sig / aud / iss / exp. */
|
|
20
21
|
export declare function verifyAccessToken(token: string, base: string, secret: Uint8Array): Promise<AccessClaims>;
|
|
21
22
|
export interface StatePayload {
|
|
22
|
-
flow: 'owner_gate' | 'alias_reauth';
|
|
23
|
+
flow: 'owner_gate' | 'alias_reauth' | 'alias_add';
|
|
23
24
|
client_id: string;
|
|
24
25
|
redirect_uri: string;
|
|
25
26
|
code_challenge: string;
|
|
26
27
|
client_state?: string;
|
|
27
28
|
resource: string;
|
|
28
29
|
alias?: string;
|
|
30
|
+
/** alias_add only: the tenant the new alias binds under. Signed server-side
|
|
31
|
+
* at mint time — never caller-supplied at /authorize or /callback. */
|
|
32
|
+
tenantId?: string;
|
|
33
|
+
/** alias_add only: scope bundles chosen when the link was minted. */
|
|
34
|
+
bundles?: string[];
|
|
35
|
+
/** alias_add only: an opaque value the minting caller chose, signed like
|
|
36
|
+
* tenantId and handed back to its binder (e.g. a server-side link record). */
|
|
37
|
+
nonce?: string;
|
|
38
|
+
/** owner_gate only: base64url sha256 of the browser-binding cookie the
|
|
39
|
+
* Google redirect set; /callback refuses a browser that lacks it. */
|
|
40
|
+
bind?: string;
|
|
29
41
|
}
|
|
30
42
|
export interface CodePayload {
|
|
31
43
|
redirect_uri: string;
|
|
32
44
|
code_challenge: string;
|
|
33
45
|
resource: string;
|
|
34
|
-
sub:
|
|
46
|
+
sub: string;
|
|
35
47
|
}
|
|
36
48
|
export declare function signState(payload: StatePayload, base: string, secret: Uint8Array, iat: number, ttlSec?: number): Promise<string>;
|
|
37
|
-
export declare function verifyState(token: string, base: string, secret: Uint8Array): Promise<StatePayload & {
|
|
49
|
+
export declare function verifyState(token: string, base: string, secret: Uint8Array, nowSec?: number): Promise<StatePayload & {
|
|
38
50
|
jti: string;
|
|
51
|
+
exp: number;
|
|
39
52
|
}>;
|
|
53
|
+
/** A re-auth link is handed out in a tool error, so it has to survive until
|
|
54
|
+
* the user clicks it; an hour, not the 10-minute state TTL. */
|
|
55
|
+
export declare const REAUTH_LINK_TTL_SEC = 3600;
|
|
56
|
+
/** Query string of a server-issued alias_reauth link: the alias, an expiry and
|
|
57
|
+
* an HMAC over both. Synchronous, so the error hints that carry it stay so. */
|
|
58
|
+
export declare function signReauthLink(base: string, secret: Uint8Array, alias: string, nowSec: number): string;
|
|
59
|
+
/** The alias a link was issued for, or null when it is missing, forged or expired. */
|
|
60
|
+
export declare function verifyReauthLink(base: string, secret: Uint8Array, params: {
|
|
61
|
+
alias: string;
|
|
62
|
+
exp: string;
|
|
63
|
+
sig: string;
|
|
64
|
+
}, nowSec: number): string | null;
|
|
40
65
|
/** A pending-authorization artifact for the DCR consent interstitial (same
|
|
41
66
|
* shape as `state`, distinct purpose so the two can't be confused). */
|
|
42
67
|
export declare function signPending(payload: StatePayload, base: string, secret: Uint8Array, iat: number, ttlSec?: number): Promise<string>;
|
|
43
|
-
export declare function verifyPending(token: string, base: string, secret: Uint8Array): Promise<StatePayload & {
|
|
68
|
+
export declare function verifyPending(token: string, base: string, secret: Uint8Array, nowSec?: number): Promise<StatePayload & {
|
|
44
69
|
jti: string;
|
|
70
|
+
exp: number;
|
|
45
71
|
}>;
|
|
46
72
|
export declare function signAuthzCode(payload: CodePayload, base: string, secret: Uint8Array, iat: number, ttlSec?: number): Promise<string>;
|
|
47
|
-
export declare function verifyAuthzCode(token: string, base: string, secret: Uint8Array): Promise<CodePayload & {
|
|
73
|
+
export declare function verifyAuthzCode(token: string, base: string, secret: Uint8Array, nowSec?: number): Promise<CodePayload & {
|
|
48
74
|
jti: string;
|
|
75
|
+
exp: number;
|
|
49
76
|
}>;
|
|
77
|
+
/** `full`: there is no room without forgetting a jti that is still live. */
|
|
78
|
+
export type ReplaySpend = 'ok' | 'replay' | 'full';
|
|
50
79
|
export declare class ReplayGuard {
|
|
51
80
|
private readonly cap;
|
|
52
81
|
private readonly seen;
|
|
82
|
+
private earliest;
|
|
83
|
+
private sweptAt;
|
|
53
84
|
constructor(cap?: number);
|
|
54
|
-
/**
|
|
85
|
+
/** Hold a slot for an artifact about to be handed out, so its spend can
|
|
86
|
+
* never meet a full guard. The flood then lands where the artifact is
|
|
87
|
+
* minted, and refusing there loses nothing. */
|
|
88
|
+
reserve(jti: string, ttlMs: number, nowMs: number): 'ok' | 'full';
|
|
89
|
+
/** Record a jti as spent. A full guard refuses instead of evicting a live
|
|
90
|
+
* jti: a flood of spends would otherwise make a spent artifact usable again,
|
|
91
|
+
* such as a callback the browser binding refused. `artifactExpMs`
|
|
92
|
+
* keeps the record alive as long as the artifact itself, even when the clock
|
|
93
|
+
* stepped back between its signing and this spend. */
|
|
94
|
+
spend(jti: string, ttlMs: number, nowMs: number, artifactExpMs?: number): ReplaySpend;
|
|
95
|
+
/** Undo a spend whose next step could not go ahead. The slot stays held, so
|
|
96
|
+
* nothing is forgotten, and the artifact can be spent once more. */
|
|
97
|
+
unspend(jti: string): void;
|
|
98
|
+
/** `spend` as a boolean: false for a replay and for a full guard alike. */
|
|
55
99
|
consume(jti: string, ttlMs: number, nowMs: number): boolean;
|
|
56
100
|
get size(): number;
|
|
57
|
-
private
|
|
101
|
+
private record;
|
|
102
|
+
private room;
|
|
58
103
|
}
|
|
104
|
+
/** An earlier release's record, keyed by its live token. */
|
|
59
105
|
export interface RefreshRecord {
|
|
60
|
-
sub:
|
|
106
|
+
sub: string;
|
|
61
107
|
issuedAt: number;
|
|
62
108
|
family: string;
|
|
63
109
|
}
|
|
64
110
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
111
|
+
* The family tag of a refresh token this `masterKey`'s store minted, or null
|
|
112
|
+
* for anything else. Derives the key once; the returned function does no I/O,
|
|
113
|
+
* so a host can key a pre-auth rate limit on it.
|
|
114
|
+
*/
|
|
115
|
+
export declare function refreshFamilyTagger(masterKey: string): (token: string) => string | null;
|
|
116
|
+
/** Boot check for a refresh store file: returns when it is absent or this
|
|
117
|
+
* release can read it; throws when it does not decrypt under `masterKey`
|
|
118
|
+
* (E_REFRESH_STORE_UNREADABLE) or a newer release wrote it
|
|
119
|
+
* (E_REFRESH_STORE_FORMAT). */
|
|
120
|
+
export declare function assertRefreshStoreReadable(file: string, masterKey: string): void;
|
|
121
|
+
export interface RefreshStoreOptions {
|
|
122
|
+
/** Absolute family lifetime in seconds, counted from the sign-in. Unset: unlimited. */
|
|
123
|
+
maxAgeSec?: number;
|
|
124
|
+
/** Idle lifetime in seconds, counted from the last issue or rotation. Unset: unlimited. */
|
|
125
|
+
idleSec?: number;
|
|
126
|
+
/** Max live refresh-token families per subject (both formats). Unset:
|
|
127
|
+
* unlimited (default; the single-owner server passes none). When issuing a
|
|
128
|
+
* new family would put a subject over this, that subject's own
|
|
129
|
+
* least-recently-used family is dropped (by its last issue or rotation
|
|
130
|
+
* time) until it fits; a dropped family behaves exactly like a revoked
|
|
131
|
+
* one. Only the subject signing in ever triggers it, and only its own
|
|
132
|
+
* families are ever touched. */
|
|
133
|
+
maxFamiliesPerSub?: number;
|
|
134
|
+
/** Server-side log for a revoked, dropped or expired family. Never given a token or a subject. */
|
|
135
|
+
log?: (line: string) => void;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Persisted (encrypted under MASTER_KEY) refresh-token store. Rotates on every
|
|
139
|
+
* use, and a token carries its family and generation under a MAC, so
|
|
140
|
+
* presenting any generation the family has rotated past is REUSE: the family
|
|
141
|
+
* is revoked for the rest of its life. The store keeps one
|
|
142
|
+
* record per family, whatever its rotation count. Every read-modify-write goes
|
|
143
|
+
* through a file lock so concurrent stdio+HTTP processes can't lost-update or
|
|
144
|
+
* double-spend. See docs/internals.md.
|
|
70
145
|
*/
|
|
71
146
|
export declare class RefreshStore {
|
|
72
147
|
private readonly path;
|
|
73
148
|
private readonly masterKey;
|
|
74
|
-
|
|
149
|
+
private readonly log;
|
|
150
|
+
private readonly maxAgeMs;
|
|
151
|
+
private readonly idleMs;
|
|
152
|
+
private readonly maxFamiliesPerSub;
|
|
153
|
+
private macKey;
|
|
154
|
+
private legacyEmpty;
|
|
155
|
+
constructor(path: string, masterKey: string, options?: RefreshStoreOptions);
|
|
156
|
+
private get timed();
|
|
157
|
+
private live;
|
|
158
|
+
/** Drop expired sessions in both formats; the count of those dropped. */
|
|
159
|
+
private prune;
|
|
160
|
+
/** A session written while the clock ran ahead would otherwise outlive its
|
|
161
|
+
* limit by the size of the jump. */
|
|
162
|
+
private clamp;
|
|
163
|
+
private key;
|
|
164
|
+
/** With `nowMs` (every issue and rotation), also clamps and prunes. */
|
|
75
165
|
private load;
|
|
76
166
|
private save;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
167
|
+
private emit;
|
|
168
|
+
private enforceFamilyCap;
|
|
169
|
+
private newFamilyId;
|
|
170
|
+
issue(nowMs: number, sub: string): string;
|
|
171
|
+
/** Rotate a presented refresh token; null if it is unknown, malformed, or
|
|
172
|
+
* rotated away (reuse => the family is revoked). The record's sub is copied
|
|
173
|
+
* forward and returned so the caller can mint the matching access token
|
|
174
|
+
* without trusting anything client-supplied.
|
|
175
|
+
*
|
|
176
|
+
* `accept` (optional) is called inside the store lock, before any mutation,
|
|
177
|
+
* with the record's sub. false: every session of that sub is dropped and
|
|
178
|
+
* null returned. A throw: nothing is written and the error propagates, so
|
|
179
|
+
* the presented token stays valid. Absent: unchanged. */
|
|
180
|
+
rotate(oldToken: string, nowMs: number, accept?: (sub: string) => boolean): {
|
|
181
|
+
token: string;
|
|
182
|
+
sub: string;
|
|
183
|
+
} | null;
|
|
184
|
+
/** Drop every session minted under `sub`, in both formats (linear scan under
|
|
185
|
+
* the store lock); the save then drops the earlier-release spent entries of
|
|
186
|
+
* the families that died with them. Returns the number of sessions dropped. */
|
|
187
|
+
purgeTenant(sub: string): number;
|
|
81
188
|
}
|