gogcli-mcp-drive 4.3.0 → 4.4.0

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.
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "metadata": {
9
9
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
10
- "version": "4.3.0"
10
+ "version": "4.4.0"
11
11
  },
12
12
  "plugins": [
13
13
  {
@@ -15,7 +15,7 @@
15
15
  "displayName": "gogcli (Drive)",
16
16
  "source": "./",
17
17
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
18
- "version": "4.3.0",
18
+ "version": "4.4.0",
19
19
  "author": {
20
20
  "name": "Chris Hall"
21
21
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gogcli-mcp-drive",
3
3
  "displayName": "gogcli (Drive)",
4
- "version": "4.3.0",
4
+ "version": "4.4.0",
5
5
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
6
6
  "author": {
7
7
  "name": "Chris Hall",
package/dist/index.js CHANGED
@@ -37,6 +37,33 @@ var storage2 = new AsyncLocalStorage2();
37
37
  function withCallerCapabilities(capabilities, fn) {
38
38
  return capabilities ? storage2.run(capabilities, fn) : fn();
39
39
  }
40
+ function currentCallerCapabilities() {
41
+ return storage2.getStore();
42
+ }
43
+ var ENVELOPE_CAPABILITIES_KEY = "io.modelcontextprotocol/clientCapabilities";
44
+ var ELICITATION_MODES = ["form", "url"];
45
+ function isRecord(value) {
46
+ return typeof value === "object" && value !== null && !Array.isArray(value);
47
+ }
48
+ function callerCapabilities(ctx) {
49
+ const envelope = isRecord(ctx) && isRecord(ctx.mcpReq) ? ctx.mcpReq.envelope : void 0;
50
+ if (isRecord(envelope)) {
51
+ const declared = envelope[ENVELOPE_CAPABILITIES_KEY];
52
+ if (isRecord(declared))
53
+ return declared;
54
+ }
55
+ return currentCallerCapabilities();
56
+ }
57
+ function callerAcceptsFormElicitation(ctx) {
58
+ const capabilities = callerCapabilities(ctx);
59
+ if (!capabilities)
60
+ return void 0;
61
+ const elicitation = capabilities.elicitation;
62
+ if (!isRecord(elicitation))
63
+ return false;
64
+ const namedModes = ELICITATION_MODES.filter((mode) => mode in elicitation);
65
+ return namedModes.length === 0 || namedModes.includes("form");
66
+ }
40
67
 
41
68
  // ../../node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
42
69
  var __create = Object.create;
@@ -24101,6 +24128,37 @@ var inputRequired = Object.assign(buildInputRequired, {
24101
24128
  return { method: "roots/list" };
24102
24129
  }
24103
24130
  });
24131
+ function acceptedContent(responses, key, schema) {
24132
+ const view = inputResponse(responses, key);
24133
+ if (view.kind !== "elicit" || view.action !== "accept" || view.content === void 0) return void 0;
24134
+ if (schema === void 0) return view.content;
24135
+ const outcome = schema["~standard"].validate(view.content);
24136
+ if (outcome instanceof Promise) throw new TypeError("acceptedContent(responses, key, schema) requires a synchronously-validating schema");
24137
+ return outcome.issues === void 0 ? outcome.value : void 0;
24138
+ }
24139
+ function inputResponse(responses, key) {
24140
+ if (responses === void 0 || typeof responses !== "object" || responses === null) return { kind: "missing" };
24141
+ const entry = responses[key];
24142
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return { kind: "missing" };
24143
+ const candidate = entry;
24144
+ if (candidate["action"] === "accept" || candidate["action"] === "decline" || candidate["action"] === "cancel") {
24145
+ const content = candidate["content"];
24146
+ return {
24147
+ kind: "elicit",
24148
+ action: candidate["action"],
24149
+ ...content !== null && typeof content === "object" && !Array.isArray(content) && { content }
24150
+ };
24151
+ }
24152
+ if (Array.isArray(candidate["roots"])) return {
24153
+ kind: "roots",
24154
+ roots: candidate["roots"]
24155
+ };
24156
+ if (typeof candidate["role"] === "string" && candidate["content"] !== void 0) return {
24157
+ kind: "sampling",
24158
+ result: candidate
24159
+ };
24160
+ return { kind: "missing" };
24161
+ }
24104
24162
  var REQUEST_STATE_ONLY_LEG_PACING_MS = 250;
24105
24163
  function inputRequiredRoundsExceededMessage(method, maxRounds) {
24106
24164
  return `Multi-round-trip request '${method}' still required input after ${maxRounds} rounds (inputRequired.maxRounds)`;
@@ -34148,14 +34206,14 @@ function serveStdio(factory, options = {}) {
34148
34206
  return false;
34149
34207
  };
34150
34208
  const answerLegacyRejection = (request, reason, requestedVersion) => {
34151
- const rejection2 = modernOnlyStrictRejection({
34209
+ const rejection3 = modernOnlyStrictRejection({
34152
34210
  kind: "legacy",
34153
34211
  reason,
34154
34212
  ...requestedVersion !== void 0 && { requestedVersion }
34155
34213
  }, SUPPORTED_MODERN_PROTOCOL_VERSIONS);
34156
- if (rejection2 === void 0) return Promise.resolve();
34157
- reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${rejection2.cell}): ${rejection2.message}`));
34158
- return writeErrorResponse(request.id, rejection2.code, rejection2.message, rejection2.data);
34214
+ if (rejection3 === void 0) return Promise.resolve();
34215
+ reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${rejection3.cell}): ${rejection3.message}`));
34216
+ return writeErrorResponse(request.id, rejection3.code, rejection3.message, rejection3.data);
34159
34217
  };
34160
34218
  const onInstanceClosed = (channel) => {
34161
34219
  if (closing || channel === discarding) return;
@@ -34479,6 +34537,11 @@ function walk(value, keep, drop) {
34479
34537
  }
34480
34538
 
34481
34539
  // ../../node_modules/@chrischall/mcp-utils/dist/response/index.js
34540
+ function textResult(data) {
34541
+ return {
34542
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
34543
+ };
34544
+ }
34482
34545
  function rawTextResult(text) {
34483
34546
  return { content: [{ type: "text", text }] };
34484
34547
  }
@@ -34489,6 +34552,154 @@ function errorResult(message) {
34489
34552
  };
34490
34553
  }
34491
34554
 
34555
+ // ../../node_modules/@chrischall/mcp-utils/dist/server/confirmation.js
34556
+ import { createHash, createHmac, timingSafeEqual } from "node:crypto";
34557
+ var DEFAULT_REQUEST_KEY = "confirmation";
34558
+ var DEFAULT_CONFIRMATION_LABEL = "Confirm this action should proceed.";
34559
+ var UNSUPPORTED_NOTE = "Nothing was done because this client cannot show a confirmation prompt (it declares no MCP elicitation capability), and this action is never taken without one";
34560
+ var STATE_PREFIX = "mcpu.confirm.v1.";
34561
+ function canonicalJson(value) {
34562
+ if (value === null || typeof value === "string" || typeof value === "boolean")
34563
+ return JSON.stringify(value);
34564
+ if (value === void 0)
34565
+ return "null";
34566
+ if (typeof value === "number")
34567
+ return Number.isFinite(value) ? JSON.stringify(value) : `{"$num":"${String(value)}"}`;
34568
+ if (typeof value === "bigint")
34569
+ return `{"$bigint":"${value.toString()}"}`;
34570
+ if (typeof value === "function" || typeof value === "symbol") {
34571
+ throw new TypeError(`requireConfirmation: cannot bind a ${typeof value} argument value.`);
34572
+ }
34573
+ if (Array.isArray(value))
34574
+ return `[${value.map(canonicalJson).join(",")}]`;
34575
+ if (value instanceof Date) {
34576
+ return `{"$date":${JSON.stringify(Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString())}}`;
34577
+ }
34578
+ if (ArrayBuffer.isView(value)) {
34579
+ const bytes = Buffer.from(value.buffer, value.byteOffset, value.byteLength);
34580
+ return `{"$bytes":${JSON.stringify(bytes.toString("base64"))}}`;
34581
+ }
34582
+ if (value instanceof ArrayBuffer)
34583
+ return `{"$bytes":${JSON.stringify(Buffer.from(value).toString("base64"))}}`;
34584
+ if (value instanceof Map) {
34585
+ const entries2 = [...value.entries()].map(([k, v]) => `[${canonicalJson(k)},${canonicalJson(v)}]`).sort();
34586
+ return `{"$map":[${entries2.join(",")}]}`;
34587
+ }
34588
+ if (value instanceof Set) {
34589
+ return `{"$set":[${[...value].map(canonicalJson).sort().join(",")}]}`;
34590
+ }
34591
+ const proto = Object.getPrototypeOf(value);
34592
+ if (proto !== Object.prototype && proto !== null) {
34593
+ throw new TypeError("requireConfirmation: cannot bind a non-plain object argument value (class instance).");
34594
+ }
34595
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
34596
+ return `{${entries.map(([k, v]) => `${JSON.stringify(escapeKey(k))}:${canonicalJson(v)}`).join(",")}}`;
34597
+ }
34598
+ function escapeKey(key) {
34599
+ return key.startsWith("$") ? `$${key}` : key;
34600
+ }
34601
+ function bindingKey(binding) {
34602
+ if (binding.ttlSeconds !== void 0 && !(Number.isFinite(binding.ttlSeconds) && binding.ttlSeconds > 0)) {
34603
+ throw new RangeError("requireConfirmation: binding.ttlSeconds must be a finite number greater than 0.");
34604
+ }
34605
+ const key = typeof binding.key === "string" ? Buffer.from(binding.key, "utf8") : Buffer.from(binding.key);
34606
+ if (key.length < 32) {
34607
+ throw new RangeError("requireConfirmation: binding.key must be at least 32 bytes.");
34608
+ }
34609
+ return key;
34610
+ }
34611
+ function commitment(action, args) {
34612
+ return createHash("sha256").update(`${action}\0${canonicalJson(args)}`).digest("base64url");
34613
+ }
34614
+ function mintState(key, action, binding) {
34615
+ const exp = Math.floor(Date.now() / 1e3) + (binding.ttlSeconds ?? 600);
34616
+ const body = Buffer.from(JSON.stringify({ c: commitment(action, binding.args), exp })).toString("base64url");
34617
+ const mac3 = createHmac("sha256", key).update(`${STATE_PREFIX}${body}`).digest("base64url");
34618
+ return `${STATE_PREFIX}${body}.${mac3}`;
34619
+ }
34620
+ function verifyState(key, action, binding, state) {
34621
+ if (typeof state !== "string" || !state.startsWith(STATE_PREFIX))
34622
+ return false;
34623
+ const rest = state.slice(STATE_PREFIX.length);
34624
+ const dot = rest.indexOf(".");
34625
+ if (dot < 0)
34626
+ return false;
34627
+ const body = rest.slice(0, dot);
34628
+ const mac3 = Buffer.from(rest.slice(dot + 1), "base64url");
34629
+ const expected = createHmac("sha256", key).update(`${STATE_PREFIX}${body}`).digest();
34630
+ if (mac3.length !== expected.length || !timingSafeEqual(mac3, expected))
34631
+ return false;
34632
+ let payload;
34633
+ try {
34634
+ payload = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
34635
+ } catch {
34636
+ return false;
34637
+ }
34638
+ if (typeof payload.exp !== "number" || payload.exp * 1e3 <= Date.now())
34639
+ return false;
34640
+ const want = Buffer.from(commitment(action, binding.args));
34641
+ const got = Buffer.from(typeof payload.c === "string" ? payload.c : "");
34642
+ return got.length === want.length && timingSafeEqual(got, want);
34643
+ }
34644
+ function echoedState(ctx) {
34645
+ const accessor = ctx.mcpReq.requestState;
34646
+ return typeof accessor === "function" ? accessor() : void 0;
34647
+ }
34648
+ function requireConfirmation(ctx, options) {
34649
+ const requestKey = options.requestKey ?? DEFAULT_REQUEST_KEY;
34650
+ const key = options.binding ? bindingKey(options.binding) : void 0;
34651
+ const confirmationSchema = external_exports.object({
34652
+ confirmed: external_exports.boolean().describe(options.confirmationLabel ?? DEFAULT_CONFIRMATION_LABEL)
34653
+ });
34654
+ const ask = () => {
34655
+ const preview = {
34656
+ action: options.action,
34657
+ ...options.details === void 0 ? {} : { details: options.details }
34658
+ };
34659
+ return inputRequired({
34660
+ inputRequests: {
34661
+ [requestKey]: inputRequired.elicit({
34662
+ message: `${options.message}
34663
+ ${JSON.stringify(preview, null, 2)}`,
34664
+ requestedSchema: confirmationSchema
34665
+ })
34666
+ },
34667
+ ...key && options.binding ? { requestState: mintState(key, options.action, options.binding) } : {}
34668
+ });
34669
+ };
34670
+ const response = inputResponse(ctx.mcpReq.inputResponses, requestKey);
34671
+ const accepted = acceptedContent(ctx.mcpReq.inputResponses, requestKey, confirmationSchema);
34672
+ if (response.kind === "missing") {
34673
+ if (callerAcceptsFormElicitation(ctx) === false) {
34674
+ return textResult({
34675
+ confirmed: false,
34676
+ dispatched: false,
34677
+ action: options.action,
34678
+ reason: "confirmation-unsupported",
34679
+ note: options.unsupportedNote ? `${UNSUPPORTED_NOTE}. ${options.unsupportedNote}` : `${UNSUPPORTED_NOTE}.`
34680
+ });
34681
+ }
34682
+ return ask();
34683
+ }
34684
+ if (response.kind === "elicit" && response.action === "accept" && accepted?.confirmed === true) {
34685
+ if (key && options.binding) {
34686
+ const state = echoedState(ctx);
34687
+ if (state === void 0 || state === null) {
34688
+ return errorResult(`Confirmation for ${options.action} was accepted, but the retry carried no requestState, so it cannot be checked against the prompt that was shown. Nothing was done. The likely cause is that the MCP client or host does not round-trip requestState (it must echo the requestState from the input_required result back on the retry); asking again would loop.`);
34689
+ }
34690
+ if (!verifyState(key, options.action, options.binding, state))
34691
+ return ask();
34692
+ }
34693
+ return void 0;
34694
+ }
34695
+ return textResult({
34696
+ confirmed: false,
34697
+ cancelled: true,
34698
+ action: options.action,
34699
+ note: "Nothing was changed because the confirmation was declined, cancelled, or left unchecked."
34700
+ });
34701
+ }
34702
+
34492
34703
  // ../../node_modules/@chrischall/mcp-utils/dist/server/index.js
34493
34704
  var SERVER_PROTOCOL_VERSIONS = Object.freeze([
34494
34705
  "2026-07-28",
@@ -34784,9 +34995,9 @@ function offsetAt(instant, tz) {
34784
34995
  const w = wallPartsIn(instant, tz);
34785
34996
  const asUTC = Date.UTC(w.year, w.month - 1, w.day, w.hour, w.minute, w.second, instant.getUTCMilliseconds());
34786
34997
  const minutes = Math.round((asUTC - instant.getTime()) / 6e4);
34787
- const sign = minutes < 0 ? "-" : "+";
34998
+ const sign2 = minutes < 0 ? "-" : "+";
34788
34999
  const abs = Math.abs(minutes);
34789
- return `${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
35000
+ return `${sign2}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
34790
35001
  }
34791
35002
  function wallPartsIn(instant, tz) {
34792
35003
  const parts = new Intl.DateTimeFormat("en-US", {
@@ -35582,6 +35793,174 @@ function formatAuthHealth(raw, now) {
35582
35793
  return accounts.map((a) => formatOneAccountHealth(a, now)).join("\n\n");
35583
35794
  }
35584
35795
 
35796
+ // ../gogcli-mcp/src/send-confirm-token.ts
35797
+ import { createHash as createHash2, createHmac as createHmac2, randomBytes, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
35798
+ var CONFIRM_TOKEN_TTL_DEFAULT_SECONDS = 600;
35799
+ var PREFIX = "gct1";
35800
+ var secret;
35801
+ var spent = /* @__PURE__ */ new Map();
35802
+ function sendConfirmFallbackEnabled() {
35803
+ return readEnvVar("GOG_SEND_CONFIRM_FALLBACK")?.trim().toLowerCase() === "token";
35804
+ }
35805
+ function confirmTokenTtlSeconds() {
35806
+ const raw = readEnvVar("GOG_CONFIRM_TTL_SECONDS")?.trim();
35807
+ if (raw && /^\d+$/.test(raw)) {
35808
+ const n = Number(raw);
35809
+ if (n > 0) return n;
35810
+ }
35811
+ return CONFIRM_TOKEN_TTL_DEFAULT_SECONDS;
35812
+ }
35813
+ function hmacKey() {
35814
+ if (!secret) {
35815
+ const configured = readEnvVar("GOG_CONFIRM_SECRET");
35816
+ secret = configured ? Buffer.from(configured, "utf8") : randomBytes(32);
35817
+ }
35818
+ return secret;
35819
+ }
35820
+ function canonicalize(value) {
35821
+ if (Array.isArray(value)) return value.map(canonicalize);
35822
+ if (value && typeof value === "object") {
35823
+ const out = {};
35824
+ for (const key of Object.keys(value).sort()) {
35825
+ const v = value[key];
35826
+ if (v !== void 0) out[key] = canonicalize(v);
35827
+ }
35828
+ return out;
35829
+ }
35830
+ return value;
35831
+ }
35832
+ function hashSendPayload(payload) {
35833
+ return createHash2("sha256").update(JSON.stringify(canonicalize(payload))).digest("hex");
35834
+ }
35835
+ function sign(body) {
35836
+ return createHmac2("sha256", hmacKey()).update(`${PREFIX}.${body}`).digest("base64url");
35837
+ }
35838
+ function issueConfirmToken(binding, now = Date.now()) {
35839
+ const exp = now + confirmTokenTtlSeconds() * 1e3;
35840
+ const claims = {
35841
+ t: binding.tool,
35842
+ a: binding.account,
35843
+ g: binding.target,
35844
+ ...binding.revision === void 0 ? {} : { r: binding.revision },
35845
+ h: binding.payloadHash,
35846
+ iat: now,
35847
+ exp,
35848
+ n: randomBytes(16).toString("base64url")
35849
+ };
35850
+ const body = Buffer.from(JSON.stringify(claims), "utf8").toString("base64url");
35851
+ return { token: `${PREFIX}.${body}.${sign(body)}`, expiresAt: new Date(exp).toISOString() };
35852
+ }
35853
+ function signatureMatches(body, sig) {
35854
+ const expected = Buffer.from(sign(body), "utf8");
35855
+ const actual = Buffer.from(sig, "utf8");
35856
+ return expected.length === actual.length && timingSafeEqual2(expected, actual);
35857
+ }
35858
+ function parseClaims(body) {
35859
+ try {
35860
+ return JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
35861
+ } catch {
35862
+ return void 0;
35863
+ }
35864
+ }
35865
+ function verifyConfirmToken(token, binding, now = Date.now()) {
35866
+ for (const [nonce, exp] of spent) if (exp < now) spent.delete(nonce);
35867
+ const parts = token.split(".");
35868
+ if (parts.length !== 3 || parts[0] !== PREFIX || !parts[1] || !parts[2]) return { ok: false, error: "TOKEN_INVALID" };
35869
+ const [, body, sig] = parts;
35870
+ if (!signatureMatches(body, sig)) return { ok: false, error: "TOKEN_INVALID" };
35871
+ const claims = parseClaims(body);
35872
+ if (!claims) return { ok: false, error: "TOKEN_INVALID" };
35873
+ if (claims.t !== binding.tool || claims.a !== binding.account || claims.g !== binding.target) {
35874
+ return { ok: false, error: "TOKEN_INVALID" };
35875
+ }
35876
+ if (spent.has(claims.n)) return { ok: false, error: "TOKEN_REUSED" };
35877
+ if (now > claims.exp) return { ok: false, error: "TOKEN_EXPIRED" };
35878
+ if (claims.r !== binding.revision) return { ok: false, error: "DRAFT_CHANGED", reason: "message-id-rotated" };
35879
+ if (claims.h !== binding.payloadHash) return { ok: false, error: "DRAFT_CHANGED", reason: "payload-changed" };
35880
+ spent.set(claims.n, claims.exp);
35881
+ return { ok: true };
35882
+ }
35883
+
35884
+ // ../gogcli-mcp/src/dispatch-confirmation.ts
35885
+ var CONFIRM_ACTION_INSTRUCTION = "Show this preview to the user verbatim and proceed only after they explicitly approve in chat. Then call again with confirmToken.";
35886
+ var FALLBACK_HINT = "Or set GOG_SEND_CONFIRM_FALLBACK=token to enable two-step confirmation.";
35887
+ var CONFIRM_FALLBACK_DESCRIPTION = ' If the client cannot show that prompt (no MCP elicitation, e.g. claude.ai) and the server sets GOG_SEND_CONFIRM_FALLBACK=token, a two-step flow applies instead: call WITHOUT confirmToken and nothing is sent or changed \u2014 the result has status "confirmation-required", the full preview and a confirmToken. Show that preview to the user verbatim; only after they explicitly approve it in chat, call again with the SAME arguments plus confirmToken. The tool re-reads what it would act on and refuses (DRAFT_CHANGED, with a fresh preview and token) if it changed; TOKEN_EXPIRED / TOKEN_REUSED / TOKEN_INVALID also do nothing.';
35888
+ var confirmTokenParam = external_exports.string().optional().describe(
35889
+ `ONLY for the two-step fallback (client without MCP elicitation, server with GOG_SEND_CONFIRM_FALLBACK=token). The confirmToken from this same tool's phase-1 "confirmation-required" response, passed back ONLY after the user has seen that preview and explicitly approved it in chat \u2014 never on the first call, never invented, never reused. Call again with the same arguments. Ignored when the client supports elicitation.`
35890
+ );
35891
+ var TOKEN_ERROR_NOTE = {
35892
+ TOKEN_EXPIRED: "Nothing was sent or changed: the confirmToken expired. Call again WITHOUT confirmToken for a fresh preview, and ask the user to approve it again.",
35893
+ TOKEN_REUSED: "Nothing was sent or changed by this call: this confirmToken was already used, and one approval acts once. If doing it again is really intended, call again WITHOUT confirmToken and get a new approval.",
35894
+ TOKEN_INVALID: "Nothing was sent or changed: this confirmToken was not issued by this server for this tool, account and target (or the server has restarted since). Call again WITHOUT confirmToken for a fresh preview and approval."
35895
+ };
35896
+ var DRAFT_CHANGED_NOTE = {
35897
+ "message-id-rotated": "Nothing was sent or changed: the target was edited since the user approved it (a draft's messageId or an event's version rotated), so what would happen is not what they saw.",
35898
+ "payload-changed": "Nothing was sent or changed: what would happen no longer matches what the user approved."
35899
+ };
35900
+ function isToolResult(value) {
35901
+ return Array.isArray(value.content);
35902
+ }
35903
+ function rejection2(data) {
35904
+ return { ...textResult({ status: "confirmation-rejected", confirmed: false, dispatched: false, ...data }), isError: true };
35905
+ }
35906
+ async function tokenConfirmation(op, fallback) {
35907
+ const subject = await fallback.subject();
35908
+ if (isToolResult(subject)) return subject;
35909
+ const binding = {
35910
+ tool: fallback.tool,
35911
+ account: fallback.account ?? readEnvVar("GOG_ACCOUNT") ?? "",
35912
+ target: subject.target,
35913
+ ...subject.revision === void 0 ? {} : { revision: subject.revision },
35914
+ payloadHash: hashSendPayload(subject.payload)
35915
+ };
35916
+ const phaseOne = () => {
35917
+ const { token, expiresAt } = issueConfirmToken(binding);
35918
+ return {
35919
+ action: op,
35920
+ preview: subject.preview,
35921
+ confirmToken: token,
35922
+ expiresAt,
35923
+ ttlSeconds: confirmTokenTtlSeconds(),
35924
+ instruction: fallback.instruction ?? CONFIRM_ACTION_INSTRUCTION
35925
+ };
35926
+ };
35927
+ if (!fallback.confirmToken) {
35928
+ return textResult({ status: "confirmation-required", confirmed: false, dispatched: false, ...phaseOne() });
35929
+ }
35930
+ const verdict = verifyConfirmToken(fallback.confirmToken, binding);
35931
+ if (verdict.ok) return void 0;
35932
+ if (verdict.error === "DRAFT_CHANGED") {
35933
+ return rejection2({
35934
+ error: "DRAFT_CHANGED",
35935
+ reason: verdict.reason,
35936
+ note: `${DRAFT_CHANGED_NOTE[verdict.reason]} The current preview and a fresh confirmToken are below.`,
35937
+ ...phaseOne()
35938
+ });
35939
+ }
35940
+ return rejection2({ error: verdict.error, action: op, note: TOKEN_ERROR_NOTE[verdict.error] });
35941
+ }
35942
+ function gatedElsewhere(what, via, does, tool) {
35943
+ return `${what} ${does} and is not available through ${via}. Use ${tool}, which asks the user to confirm.`;
35944
+ }
35945
+ async function requireDispatchConfirmation(ctx, options) {
35946
+ const { action, fallback } = options;
35947
+ if (fallback && callerAcceptsFormElicitation(ctx) === false && sendConfirmFallbackEnabled()) {
35948
+ return tokenConfirmation(action, fallback);
35949
+ }
35950
+ const note = fallback ? [options.unsupportedNote, FALLBACK_HINT].filter(Boolean).join(" ") : options.unsupportedNote;
35951
+ return requireConfirmation(ctx, {
35952
+ action,
35953
+ message: options.message,
35954
+ details: options.details,
35955
+ confirmationLabel: options.confirmationLabel,
35956
+ ...note ? { unsupportedNote: note } : {}
35957
+ });
35958
+ }
35959
+ function resultText(result) {
35960
+ const first = result.content[0];
35961
+ return first && first.type === "text" && typeof first.text === "string" ? first.text : "{}";
35962
+ }
35963
+
35585
35964
  // ../gogcli-mcp/src/tools/auth.ts
35586
35965
  var AUTH_RUN_SUBCOMMANDS = ["list", "status", "services", "remove", "alias"];
35587
35966
  function registerAuthToolsWith(server, defaultServices) {
@@ -35782,7 +36161,18 @@ function inlineFileArg(flag, attachment, opts = {}) {
35782
36161
  }
35783
36162
 
35784
36163
  // ../gogcli-mcp/src/tools/drive.ts
36164
+ function vetDriveRun(subcommand, _args) {
36165
+ return subcommand.toLowerCase() === "share" ? gatedElsewhere("gog drive share", "gog_drive_run", "grants access to a file", "gog_drive_share") : void 0;
36166
+ }
35785
36167
  var GOOGLE_DOC_MIME = "application/vnd.google-apps.document";
36168
+ function shareTargetMeta(raw) {
36169
+ try {
36170
+ const { name, mimeType } = fileMeta(raw);
36171
+ return { name, mimeType };
36172
+ } catch {
36173
+ return {};
36174
+ }
36175
+ }
35786
36176
  function fileMeta(raw) {
35787
36177
  const parsed = JSON.parse(raw);
35788
36178
  const f = parsed.file ?? parsed;
@@ -35905,7 +36295,7 @@ function registerDriveTools(server) {
35905
36295
  return runOrDiagnose(args, { account });
35906
36296
  });
35907
36297
  server.registerTool("gog_drive_share", {
35908
- description: "Share a Google Drive file or folder.",
36298
+ description: "Share a Google Drive file or folder. Granting access is the risk even though no email is sent (gog does not notify by default), so this reads the file and asks the MCP host to show the user a confirmation prompt naming it, who gets access and with what role; nothing is shared unless they accept." + CONFIRM_FALLBACK_DESCRIPTION,
35909
36299
  annotations: { destructiveHint: true },
35910
36300
  inputSchema: external_exports.object({
35911
36301
  fileId: external_exports.string().describe("File or folder ID"),
@@ -35913,9 +36303,35 @@ function registerDriveTools(server) {
35913
36303
  email: external_exports.string().optional().describe("User email (required when to=user)"),
35914
36304
  domain: external_exports.string().optional().describe("Domain (required when to=domain)"),
35915
36305
  role: external_exports.enum(["reader", "writer"]).optional().describe("Permission role (default: reader)"),
35916
- account: accountParam
36306
+ account: accountParam,
36307
+ confirmToken: confirmTokenParam
35917
36308
  })
35918
- }, async ({ fileId, to, email: email3, domain: domain2, role, account }) => {
36309
+ }, async ({ fileId, to, email: email3, domain: domain2, role, account, confirmToken }, ctx) => {
36310
+ const got = await runOrDiagnose(["drive", "get", pos(fileId)], { account });
36311
+ if (got.isError) return got;
36312
+ const file2 = { id: fileId, ...shareTargetMeta(resultText(got)) };
36313
+ const grant = {
36314
+ file: file2,
36315
+ to,
36316
+ ...email3 ? { email: email3 } : {},
36317
+ ...domain2 ? { domain: domain2 } : {},
36318
+ role: role ?? "reader",
36319
+ publicLink: to === "anyone"
36320
+ };
36321
+ const confirmation = await requireDispatchConfirmation(ctx, {
36322
+ action: "drive.share",
36323
+ message: to === "anyone" ? "Review and confirm making this file available to ANYONE with the link:" : "Review and confirm this Drive share:",
36324
+ confirmationLabel: "Confirm that this access should be granted now.",
36325
+ details: grant,
36326
+ unsupportedNote: "Ask the user to share it themselves from Google Drive.",
36327
+ fallback: {
36328
+ tool: "gog_drive_share",
36329
+ account,
36330
+ confirmToken,
36331
+ subject: () => ({ target: fileId, payload: grant, preview: grant })
36332
+ }
36333
+ });
36334
+ if (confirmation) return confirmation;
35919
36335
  const args = ["drive", "share", pos(fileId), `--to=${to}`];
35920
36336
  if (email3) args.push(`--email=${email3}`);
35921
36337
  if (domain2) args.push(`--domain=${domain2}`);
@@ -36028,7 +36444,7 @@ function registerDriveTools(server) {
36028
36444
  return diagnose(err);
36029
36445
  }
36030
36446
  });
36031
- registerRunTool(server, { service: "drive", examples: '"copy", "download", "permissions"' });
36447
+ registerRunTool(server, { service: "drive", examples: '"copy", "download", "permissions"', vet: vetDriveRun });
36032
36448
  }
36033
36449
 
36034
36450
  // ../gogcli-mcp/src/tools/gmail.ts
@@ -36052,7 +36468,7 @@ var replySchema = {
36052
36468
  signatureFile: external_exports.string().optional().describe("Append a local signature file (plain text or HTML), read on the gog server"),
36053
36469
  account: accountParam
36054
36470
  };
36055
- var sendReplySchema = external_exports.object(replySchema);
36471
+ var sendReplySchema = external_exports.object({ ...replySchema, confirmToken: confirmTokenParam });
36056
36472
 
36057
36473
  // ../gogcli-mcp/src/tools/sheets.ts
36058
36474
  var cellValueParam = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()]);
@@ -36064,7 +36480,7 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
36064
36480
  );
36065
36481
 
36066
36482
  // ../gogcli-mcp/src/server.ts
36067
- var VERSION = true ? "4.3.0" : "0.0.0";
36483
+ var VERSION = true ? "4.4.0" : "0.0.0";
36068
36484
 
36069
36485
  // ../gogcli-mcp/src/bootstrap-auth.ts
36070
36486
  import { join as join5 } from "node:path";
@@ -36101,12 +36517,12 @@ async function bootstrapGogAuth(env = process.env, options = {}) {
36101
36517
  const [clientId, clientSecret, refreshToken, account] = values;
36102
36518
  const { spawner } = options;
36103
36519
  try {
36104
- const { createHash } = await import("node:crypto");
36520
+ const { createHash: createHash3 } = await import("node:crypto");
36105
36521
  const { mkdir, readFile, writeFile, chmod } = await import("node:fs/promises");
36106
36522
  const home = options.home ?? (await import("node:os")).homedir();
36107
36523
  const dir = join5(home, ".gogcli-mcp");
36108
36524
  const marker = join5(dir, AUTH_BOOTSTRAP_MARKER);
36109
- const fingerprint = createHash("sha256").update(values.join("\0")).digest("hex");
36525
+ const fingerprint = createHash3("sha256").update(values.join("\0")).digest("hex");
36110
36526
  const previous = await readFile(marker, "utf8").catch(() => void 0);
36111
36527
  if (previous === fingerprint && await accountListed(account, spawner)) return "present";
36112
36528
  await run(
package/manifest.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "manifest_version": "0.3",
4
4
  "name": "gogcli-mcp-drive",
5
5
  "display_name": "gogcli (Drive)",
6
- "version": "4.3.0",
6
+ "version": "4.4.0",
7
7
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
8
8
  "author": {
9
9
  "name": "Chris Hall",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gogcli-mcp-drive",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "mcpName": "io.github.chrischall/gogcli-mcp-drive",
5
5
  "description": "Extended Google Drive MCP server via gogcli — auth + full Drive support (upload/download/permissions/comments/shared drives)",
6
6
  "author": "Claude Code (AI) <https://www.anthropic.com/claude>",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "source": "github",
8
8
  "subfolder": "packages/gogcli-mcp-drive"
9
9
  },
10
- "version": "4.3.0",
10
+ "version": "4.4.0",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "gogcli-mcp-drive",
15
- "version": "4.3.0",
15
+ "version": "4.4.0",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  },