mcp-google-multi 6.0.0-alpha.41 → 6.0.0-alpha.42
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/client.d.ts +23 -2
- package/dist/client.js +0 -0
- package/dist/identity.js +14 -5
- package/dist/token-store.d.ts +17 -0
- package/dist/token-store.js +0 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
import { OAuth2Client } from 'googleapis-common';
|
|
2
|
-
import type { Account } from './accounts.js';
|
|
3
|
-
|
|
2
|
+
import type { Account, AccountSet } from './accounts.js';
|
|
3
|
+
import type { TokenData } from './types.js';
|
|
4
|
+
export interface GetClientDeps {
|
|
5
|
+
/** Live account view — read at call time, never a captured snapshot. */
|
|
6
|
+
accounts: () => AccountSet;
|
|
7
|
+
readToken: (alias: string) => TokenData | null;
|
|
8
|
+
updateToken: (alias: string, updates: object) => void;
|
|
9
|
+
/** Cross-process staleness probe (single-owner global registry only). */
|
|
10
|
+
refreshIfStale?: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** Test-only visibility into the dedupe map. */
|
|
13
|
+
export declare function __inflightSizeForTest(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Per-context client factory: `contextKey` namespaces the single-flight map
|
|
16
|
+
* (one lane per tenant), `deps` carry that context's account view and token
|
|
17
|
+
* custody. The free core builds exactly one, bound to the global registry.
|
|
18
|
+
*/
|
|
19
|
+
export declare function makeGetClient(contextKey: string, deps: GetClientDeps): (account: Account) => Promise<OAuth2Client>;
|
|
20
|
+
/** The single-owner client, bound to the global registry + token store. The
|
|
21
|
+
* operator surfaces that never carry a tenant (api-probe, executor and
|
|
22
|
+
* escape-hatch `deps.getClientFn ?? getClient` defaults, stdio dispatch)
|
|
23
|
+
* resolve through this. */
|
|
24
|
+
export declare const getClient: (account: Account) => Promise<OAuth2Client>;
|
package/dist/client.js
CHANGED
|
Binary file
|
package/dist/identity.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { getAccountSet } from './accounts.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getAccountSet, getTokenDir, refreshAccountSetIfStale } from './accounts.js';
|
|
2
|
+
import { makeGetClient } from './client.js';
|
|
3
|
+
import { createTokenStore } from './token-store.js';
|
|
4
4
|
import { resolvePolicy } from './write-control.js';
|
|
5
5
|
export function buildIdentityContext(env = process.env, opts = {}) {
|
|
6
|
+
// Real closures over the single-owner state (the SAME factories EE
|
|
7
|
+
// instantiates per tenant), bound here to the global registry + token dir —
|
|
8
|
+
// behavior-identical to the module-level functions for the free core.
|
|
9
|
+
const tokenStore = createTokenStore(getTokenDir());
|
|
6
10
|
return {
|
|
7
11
|
subject: 'owner',
|
|
8
12
|
// Live getter: the seam must always see the current registry, never a
|
|
@@ -13,7 +17,12 @@ export function buildIdentityContext(env = process.env, opts = {}) {
|
|
|
13
17
|
// The dispatch transport rides into the resolved policy as a reserved seam
|
|
14
18
|
// (cc-write-control B14); it does not change any write-control verdict.
|
|
15
19
|
policy: resolvePolicy(env, { transport: opts.transport }),
|
|
16
|
-
getClient,
|
|
17
|
-
|
|
20
|
+
getClient: makeGetClient('owner', {
|
|
21
|
+
accounts: getAccountSet,
|
|
22
|
+
readToken: tokenStore.readToken,
|
|
23
|
+
updateToken: tokenStore.updateToken,
|
|
24
|
+
refreshIfStale: refreshAccountSetIfStale,
|
|
25
|
+
}),
|
|
26
|
+
tokenStore,
|
|
18
27
|
};
|
|
19
28
|
}
|
package/dist/token-store.d.ts
CHANGED
|
@@ -7,3 +7,20 @@ export declare function readToken(alias: string): TokenData | null;
|
|
|
7
7
|
export declare function writeToken(alias: string, data: object): void;
|
|
8
8
|
export declare function updateToken(alias: string, updates: object): void;
|
|
9
9
|
export declare function hasToken(alias: string): boolean;
|
|
10
|
+
export interface TokenStore {
|
|
11
|
+
readToken(alias: string): TokenData | null;
|
|
12
|
+
writeToken(alias: string, data: object): void;
|
|
13
|
+
updateToken(alias: string, updates: object): void;
|
|
14
|
+
hasToken(alias: string): boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Context-scoped token store: `.enc` files live under `dir`, ciphertext keyed
|
|
18
|
+
* by `tenantId` when present (HKDF v2 envelope; omitted = the single-owner v1
|
|
19
|
+
* envelope). Same lock + atomic-write + error contract as the module-level
|
|
20
|
+
* functions: readToken returns null ONLY when the file is missing and throws
|
|
21
|
+
* on a decrypt failure.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createTokenStore(dir: string, opts?: {
|
|
24
|
+
tenantId?: string;
|
|
25
|
+
resolveKey?: () => string;
|
|
26
|
+
}): TokenStore;
|
package/dist/token-store.js
CHANGED
|
Binary file
|
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.42",
|
|
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",
|