gogcli-mcp-calendar 4.3.0 → 4.5.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.
- package/dist/index.js +656 -59
- package/manifest.json +1 -1
- package/package.json +2 -2
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
|
|
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 (
|
|
34157
|
-
reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${
|
|
34158
|
-
return writeErrorResponse(request.id,
|
|
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,416 @@ 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
|
+
|
|
34558
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/server/canonical.js
|
|
34559
|
+
function canonicalJson(value) {
|
|
34560
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
34561
|
+
return JSON.stringify(value);
|
|
34562
|
+
if (value === void 0)
|
|
34563
|
+
return "null";
|
|
34564
|
+
if (typeof value === "number")
|
|
34565
|
+
return Number.isFinite(value) ? JSON.stringify(value) : `{"$num":"${String(value)}"}`;
|
|
34566
|
+
if (typeof value === "bigint")
|
|
34567
|
+
return `{"$bigint":"${value.toString()}"}`;
|
|
34568
|
+
if (typeof value === "function" || typeof value === "symbol") {
|
|
34569
|
+
throw new TypeError(`confirmation: cannot bind a ${typeof value} argument value.`);
|
|
34570
|
+
}
|
|
34571
|
+
if (Array.isArray(value))
|
|
34572
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
34573
|
+
if (value instanceof Date) {
|
|
34574
|
+
return `{"$date":${JSON.stringify(Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString())}}`;
|
|
34575
|
+
}
|
|
34576
|
+
if (ArrayBuffer.isView(value)) {
|
|
34577
|
+
const bytes = Buffer.from(value.buffer, value.byteOffset, value.byteLength);
|
|
34578
|
+
return `{"$bytes":${JSON.stringify(bytes.toString("base64"))}}`;
|
|
34579
|
+
}
|
|
34580
|
+
if (value instanceof ArrayBuffer)
|
|
34581
|
+
return `{"$bytes":${JSON.stringify(Buffer.from(value).toString("base64"))}}`;
|
|
34582
|
+
if (value instanceof Map) {
|
|
34583
|
+
const entries2 = [...value.entries()].map(([k, v]) => `[${canonicalJson(k)},${canonicalJson(v)}]`).sort();
|
|
34584
|
+
return `{"$map":[${entries2.join(",")}]}`;
|
|
34585
|
+
}
|
|
34586
|
+
if (value instanceof Set) {
|
|
34587
|
+
return `{"$set":[${[...value].map(canonicalJson).sort().join(",")}]}`;
|
|
34588
|
+
}
|
|
34589
|
+
const proto = Object.getPrototypeOf(value);
|
|
34590
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
34591
|
+
throw new TypeError("confirmation: cannot bind a non-plain object argument value (class instance).");
|
|
34592
|
+
}
|
|
34593
|
+
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
34594
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(escapeKey(k))}:${canonicalJson(v)}`).join(",")}}`;
|
|
34595
|
+
}
|
|
34596
|
+
function escapeKey(key) {
|
|
34597
|
+
return key.startsWith("$") ? `$${key}` : key;
|
|
34598
|
+
}
|
|
34599
|
+
|
|
34600
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/server/confirmation.js
|
|
34601
|
+
var DEFAULT_REQUEST_KEY = "confirmation";
|
|
34602
|
+
var DEFAULT_CONFIRMATION_LABEL = "Confirm this action should proceed.";
|
|
34603
|
+
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";
|
|
34604
|
+
var STATE_PREFIX = "mcpu.confirm.v1.";
|
|
34605
|
+
function bindingKey(binding) {
|
|
34606
|
+
if (binding.ttlSeconds !== void 0 && !(Number.isFinite(binding.ttlSeconds) && binding.ttlSeconds > 0)) {
|
|
34607
|
+
throw new RangeError("requireConfirmation: binding.ttlSeconds must be a finite number greater than 0.");
|
|
34608
|
+
}
|
|
34609
|
+
const key = typeof binding.key === "string" ? Buffer.from(binding.key, "utf8") : Buffer.from(binding.key);
|
|
34610
|
+
if (key.length < 32) {
|
|
34611
|
+
throw new RangeError("requireConfirmation: binding.key must be at least 32 bytes.");
|
|
34612
|
+
}
|
|
34613
|
+
return key;
|
|
34614
|
+
}
|
|
34615
|
+
function commitment(action, args) {
|
|
34616
|
+
return createHash("sha256").update(`${action}\0${canonicalJson(args)}`).digest("base64url");
|
|
34617
|
+
}
|
|
34618
|
+
function mintState(key, action, binding) {
|
|
34619
|
+
const exp = Math.floor(Date.now() / 1e3) + (binding.ttlSeconds ?? 600);
|
|
34620
|
+
const body = Buffer.from(JSON.stringify({ c: commitment(action, binding.args), exp })).toString("base64url");
|
|
34621
|
+
const mac3 = createHmac("sha256", key).update(`${STATE_PREFIX}${body}`).digest("base64url");
|
|
34622
|
+
return `${STATE_PREFIX}${body}.${mac3}`;
|
|
34623
|
+
}
|
|
34624
|
+
function verifyState(key, action, binding, state) {
|
|
34625
|
+
if (typeof state !== "string" || !state.startsWith(STATE_PREFIX))
|
|
34626
|
+
return false;
|
|
34627
|
+
const rest = state.slice(STATE_PREFIX.length);
|
|
34628
|
+
const dot = rest.indexOf(".");
|
|
34629
|
+
if (dot < 0)
|
|
34630
|
+
return false;
|
|
34631
|
+
const body = rest.slice(0, dot);
|
|
34632
|
+
const mac3 = Buffer.from(rest.slice(dot + 1), "base64url");
|
|
34633
|
+
const expected = createHmac("sha256", key).update(`${STATE_PREFIX}${body}`).digest();
|
|
34634
|
+
if (mac3.length !== expected.length || !timingSafeEqual(mac3, expected))
|
|
34635
|
+
return false;
|
|
34636
|
+
let payload;
|
|
34637
|
+
try {
|
|
34638
|
+
payload = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
34639
|
+
} catch {
|
|
34640
|
+
return false;
|
|
34641
|
+
}
|
|
34642
|
+
if (typeof payload.exp !== "number" || payload.exp * 1e3 <= Date.now())
|
|
34643
|
+
return false;
|
|
34644
|
+
const want = Buffer.from(commitment(action, binding.args));
|
|
34645
|
+
const got = Buffer.from(typeof payload.c === "string" ? payload.c : "");
|
|
34646
|
+
return got.length === want.length && timingSafeEqual(got, want);
|
|
34647
|
+
}
|
|
34648
|
+
function echoedState(ctx) {
|
|
34649
|
+
const accessor = ctx.mcpReq.requestState;
|
|
34650
|
+
return typeof accessor === "function" ? accessor() : void 0;
|
|
34651
|
+
}
|
|
34652
|
+
function requireConfirmation(ctx, options) {
|
|
34653
|
+
const requestKey = options.requestKey ?? DEFAULT_REQUEST_KEY;
|
|
34654
|
+
const key = options.binding ? bindingKey(options.binding) : void 0;
|
|
34655
|
+
const confirmationSchema = external_exports.object({
|
|
34656
|
+
confirmed: external_exports.boolean().describe(options.confirmationLabel ?? DEFAULT_CONFIRMATION_LABEL)
|
|
34657
|
+
});
|
|
34658
|
+
const ask = () => {
|
|
34659
|
+
const preview = {
|
|
34660
|
+
action: options.action,
|
|
34661
|
+
...options.details === void 0 ? {} : { details: options.details }
|
|
34662
|
+
};
|
|
34663
|
+
return inputRequired({
|
|
34664
|
+
inputRequests: {
|
|
34665
|
+
[requestKey]: inputRequired.elicit({
|
|
34666
|
+
message: `${options.message}
|
|
34667
|
+
${JSON.stringify(preview, null, 2)}`,
|
|
34668
|
+
requestedSchema: confirmationSchema
|
|
34669
|
+
})
|
|
34670
|
+
},
|
|
34671
|
+
...key && options.binding ? { requestState: mintState(key, options.action, options.binding) } : {}
|
|
34672
|
+
});
|
|
34673
|
+
};
|
|
34674
|
+
const response = inputResponse(ctx.mcpReq.inputResponses, requestKey);
|
|
34675
|
+
const accepted = acceptedContent(ctx.mcpReq.inputResponses, requestKey, confirmationSchema);
|
|
34676
|
+
if (response.kind === "missing") {
|
|
34677
|
+
if (callerAcceptsFormElicitation(ctx) === false) {
|
|
34678
|
+
return textResult({
|
|
34679
|
+
confirmed: false,
|
|
34680
|
+
dispatched: false,
|
|
34681
|
+
action: options.action,
|
|
34682
|
+
reason: "confirmation-unsupported",
|
|
34683
|
+
note: options.unsupportedNote ? `${UNSUPPORTED_NOTE}. ${options.unsupportedNote}` : `${UNSUPPORTED_NOTE}.`
|
|
34684
|
+
});
|
|
34685
|
+
}
|
|
34686
|
+
return ask();
|
|
34687
|
+
}
|
|
34688
|
+
if (response.kind === "elicit" && response.action === "accept" && accepted?.confirmed === true) {
|
|
34689
|
+
if (key && options.binding) {
|
|
34690
|
+
const state = echoedState(ctx);
|
|
34691
|
+
if (state === void 0 || state === null) {
|
|
34692
|
+
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.`);
|
|
34693
|
+
}
|
|
34694
|
+
if (!verifyState(key, options.action, options.binding, state))
|
|
34695
|
+
return ask();
|
|
34696
|
+
}
|
|
34697
|
+
return void 0;
|
|
34698
|
+
}
|
|
34699
|
+
return textResult({
|
|
34700
|
+
confirmed: false,
|
|
34701
|
+
cancelled: true,
|
|
34702
|
+
action: options.action,
|
|
34703
|
+
note: "Nothing was changed because the confirmation was declined, cancelled, or left unchecked."
|
|
34704
|
+
});
|
|
34705
|
+
}
|
|
34706
|
+
|
|
34707
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/server/confirm-token.js
|
|
34708
|
+
import { createHash as createHash2, createHmac as createHmac2, randomBytes, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
34709
|
+
function createSpentTokenStore() {
|
|
34710
|
+
const spent2 = /* @__PURE__ */ new Map();
|
|
34711
|
+
return {
|
|
34712
|
+
has: (nonce) => spent2.has(nonce),
|
|
34713
|
+
add: (nonce, exp) => {
|
|
34714
|
+
spent2.set(nonce, exp);
|
|
34715
|
+
},
|
|
34716
|
+
prune: (now) => {
|
|
34717
|
+
for (const [nonce, exp] of spent2)
|
|
34718
|
+
if (exp < now)
|
|
34719
|
+
spent2.delete(nonce);
|
|
34720
|
+
},
|
|
34721
|
+
clear: () => spent2.clear(),
|
|
34722
|
+
get size() {
|
|
34723
|
+
return spent2.size;
|
|
34724
|
+
}
|
|
34725
|
+
};
|
|
34726
|
+
}
|
|
34727
|
+
var PROCESS_SPENT = createSpentTokenStore();
|
|
34728
|
+
var PREFIX = "mcpu.token.v1.";
|
|
34729
|
+
var DEFAULT_TTL_SECONDS = 600;
|
|
34730
|
+
function tokenKey(key) {
|
|
34731
|
+
const bytes = typeof key === "string" ? Buffer.from(key, "utf8") : Buffer.from(key);
|
|
34732
|
+
if (bytes.length < 32)
|
|
34733
|
+
throw new RangeError("confirm token: key must be at least 32 bytes.");
|
|
34734
|
+
return bytes;
|
|
34735
|
+
}
|
|
34736
|
+
function ttlOf(ttlSeconds) {
|
|
34737
|
+
if (ttlSeconds === void 0)
|
|
34738
|
+
return DEFAULT_TTL_SECONDS;
|
|
34739
|
+
if (!(Number.isFinite(ttlSeconds) && ttlSeconds > 0)) {
|
|
34740
|
+
throw new RangeError("confirm token: ttlSeconds must be a finite number greater than 0.");
|
|
34741
|
+
}
|
|
34742
|
+
return ttlSeconds;
|
|
34743
|
+
}
|
|
34744
|
+
function sign(key, body) {
|
|
34745
|
+
return createHmac2("sha256", key).update(`${PREFIX}${body}`).digest();
|
|
34746
|
+
}
|
|
34747
|
+
function hashConfirmPayload(payload) {
|
|
34748
|
+
return createHash2("sha256").update(canonicalJson(payload)).digest("base64url");
|
|
34749
|
+
}
|
|
34750
|
+
function issueConfirmToken(key, binding, options = {}) {
|
|
34751
|
+
const k = tokenKey(key);
|
|
34752
|
+
const now = options.now ?? Date.now();
|
|
34753
|
+
const exp = now + ttlOf(options.ttlSeconds) * 1e3;
|
|
34754
|
+
const claims = {
|
|
34755
|
+
t: binding.tool,
|
|
34756
|
+
...binding.account === void 0 ? {} : { a: binding.account },
|
|
34757
|
+
g: binding.target,
|
|
34758
|
+
...binding.revision === void 0 ? {} : { r: binding.revision },
|
|
34759
|
+
h: binding.payloadHash,
|
|
34760
|
+
exp,
|
|
34761
|
+
n: randomBytes(16).toString("base64url")
|
|
34762
|
+
};
|
|
34763
|
+
const body = Buffer.from(JSON.stringify(claims), "utf8").toString("base64url");
|
|
34764
|
+
return { token: `${PREFIX}${body}.${sign(k, body).toString("base64url")}`, expiresAt: new Date(exp).toISOString() };
|
|
34765
|
+
}
|
|
34766
|
+
function parseClaims(body) {
|
|
34767
|
+
try {
|
|
34768
|
+
const claims = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
34769
|
+
return claims && typeof claims === "object" ? claims : void 0;
|
|
34770
|
+
} catch {
|
|
34771
|
+
return void 0;
|
|
34772
|
+
}
|
|
34773
|
+
}
|
|
34774
|
+
function verifyConfirmToken(key, token, binding, options = {}) {
|
|
34775
|
+
const k = tokenKey(key);
|
|
34776
|
+
const now = options.now ?? Date.now();
|
|
34777
|
+
const spent2 = options.spent ?? PROCESS_SPENT;
|
|
34778
|
+
spent2.prune(now);
|
|
34779
|
+
if (!token.startsWith(PREFIX))
|
|
34780
|
+
return { ok: false, error: "TOKEN_INVALID" };
|
|
34781
|
+
const rest = token.slice(PREFIX.length);
|
|
34782
|
+
const dot = rest.indexOf(".");
|
|
34783
|
+
const body = dot < 0 ? "" : rest.slice(0, dot);
|
|
34784
|
+
const mac3 = Buffer.from(dot < 0 ? "" : rest.slice(dot + 1), "base64url");
|
|
34785
|
+
const expected = sign(k, body);
|
|
34786
|
+
if (!body || mac3.length !== expected.length || !timingSafeEqual2(mac3, expected))
|
|
34787
|
+
return { ok: false, error: "TOKEN_INVALID" };
|
|
34788
|
+
const claims = parseClaims(body);
|
|
34789
|
+
if (!claims)
|
|
34790
|
+
return { ok: false, error: "TOKEN_INVALID" };
|
|
34791
|
+
if (claims.t !== binding.tool || claims.a !== binding.account || claims.g !== binding.target) {
|
|
34792
|
+
return { ok: false, error: "TOKEN_INVALID" };
|
|
34793
|
+
}
|
|
34794
|
+
if (spent2.has(claims.n))
|
|
34795
|
+
return { ok: false, error: "TOKEN_REUSED" };
|
|
34796
|
+
if (now > claims.exp)
|
|
34797
|
+
return { ok: false, error: "TOKEN_EXPIRED" };
|
|
34798
|
+
if (claims.r !== binding.revision)
|
|
34799
|
+
return { ok: false, error: "DRAFT_CHANGED", reason: "revision-changed" };
|
|
34800
|
+
if (claims.h !== binding.payloadHash)
|
|
34801
|
+
return { ok: false, error: "DRAFT_CHANGED", reason: "payload-changed" };
|
|
34802
|
+
spent2.add(claims.n, claims.exp);
|
|
34803
|
+
return { ok: true };
|
|
34804
|
+
}
|
|
34805
|
+
var CONFIRM_TOKEN_INSTRUCTION = "Show this preview to the user verbatim and proceed only after they explicitly approve in chat. Then call again with confirmToken.";
|
|
34806
|
+
var confirmTokenParam = external_exports.string().optional().describe(`ONLY for the two-step confirmation fallback (a client without MCP elicitation). 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.`);
|
|
34807
|
+
var TOKEN_ERROR_NOTE = {
|
|
34808
|
+
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.",
|
|
34809
|
+
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.",
|
|
34810
|
+
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."
|
|
34811
|
+
};
|
|
34812
|
+
var CHANGED_NOTE = {
|
|
34813
|
+
"revision-changed": "Nothing was sent or changed: the target was edited since the user approved it (its version rotated), so what would happen is not what they saw.",
|
|
34814
|
+
"payload-changed": "Nothing was sent or changed: what would happen no longer matches what the user approved."
|
|
34815
|
+
};
|
|
34816
|
+
function isToolResult(value) {
|
|
34817
|
+
return Array.isArray(value.content);
|
|
34818
|
+
}
|
|
34819
|
+
function rejection2(data) {
|
|
34820
|
+
return { ...textResult({ status: "confirmation-rejected", confirmed: false, dispatched: false, ...data }), isError: true };
|
|
34821
|
+
}
|
|
34822
|
+
async function tokenConfirmation(action, fb) {
|
|
34823
|
+
const subject = await fb.subject();
|
|
34824
|
+
if (isToolResult(subject))
|
|
34825
|
+
return subject;
|
|
34826
|
+
const binding = {
|
|
34827
|
+
tool: fb.tool,
|
|
34828
|
+
...fb.account === void 0 ? {} : { account: fb.account },
|
|
34829
|
+
target: subject.target,
|
|
34830
|
+
...subject.revision === void 0 ? {} : { revision: subject.revision },
|
|
34831
|
+
payloadHash: hashConfirmPayload(subject.payload)
|
|
34832
|
+
};
|
|
34833
|
+
const phaseOne = () => {
|
|
34834
|
+
const { token, expiresAt } = issueConfirmToken(fb.key, binding, { ttlSeconds: fb.ttlSeconds });
|
|
34835
|
+
return {
|
|
34836
|
+
action,
|
|
34837
|
+
preview: subject.preview,
|
|
34838
|
+
confirmToken: token,
|
|
34839
|
+
expiresAt,
|
|
34840
|
+
ttlSeconds: ttlOf(fb.ttlSeconds),
|
|
34841
|
+
instruction: fb.instruction ?? CONFIRM_TOKEN_INSTRUCTION
|
|
34842
|
+
};
|
|
34843
|
+
};
|
|
34844
|
+
if (!fb.confirmToken) {
|
|
34845
|
+
return textResult({ status: "confirmation-required", confirmed: false, dispatched: false, ...phaseOne() });
|
|
34846
|
+
}
|
|
34847
|
+
const verdict = verifyConfirmToken(fb.key, fb.confirmToken, binding, { spent: fb.spent });
|
|
34848
|
+
if (verdict.ok)
|
|
34849
|
+
return void 0;
|
|
34850
|
+
if (verdict.error === "DRAFT_CHANGED") {
|
|
34851
|
+
return rejection2({
|
|
34852
|
+
error: "DRAFT_CHANGED",
|
|
34853
|
+
reason: verdict.reason,
|
|
34854
|
+
note: `${CHANGED_NOTE[verdict.reason]} The current preview and a fresh confirmToken are below.`,
|
|
34855
|
+
...phaseOne()
|
|
34856
|
+
});
|
|
34857
|
+
}
|
|
34858
|
+
return rejection2({ error: verdict.error, action, note: TOKEN_ERROR_NOTE[verdict.error] });
|
|
34859
|
+
}
|
|
34860
|
+
async function requireConfirmationWithFallback(ctx, options) {
|
|
34861
|
+
const { tokenFallback, ...confirmation } = options;
|
|
34862
|
+
if (tokenFallback && callerAcceptsFormElicitation(ctx) === false) {
|
|
34863
|
+
return tokenConfirmation(options.action, tokenFallback);
|
|
34864
|
+
}
|
|
34865
|
+
return requireConfirmation(ctx, confirmation);
|
|
34866
|
+
}
|
|
34867
|
+
|
|
34868
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/server/confirm-env.js
|
|
34869
|
+
import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
|
|
34870
|
+
|
|
34871
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/config/index.js
|
|
34872
|
+
import { homedir } from "node:os";
|
|
34873
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
34874
|
+
var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
|
|
34875
|
+
function readEnvVar(key, opts = {}) {
|
|
34876
|
+
const env = opts.env ?? process.env;
|
|
34877
|
+
const raw = env[key];
|
|
34878
|
+
if (typeof raw === "string") {
|
|
34879
|
+
const trimmed = raw.trim();
|
|
34880
|
+
if (trimmed.length > 0 && trimmed !== "undefined" && trimmed !== "null" && !PLACEHOLDER_RE.test(trimmed)) {
|
|
34881
|
+
return trimmed;
|
|
34882
|
+
}
|
|
34883
|
+
}
|
|
34884
|
+
return opts.default;
|
|
34885
|
+
}
|
|
34886
|
+
var TRUE_TOKENS = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
34887
|
+
var FALSE_TOKENS = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
34888
|
+
function parseBoolEnv(key, opts = {}) {
|
|
34889
|
+
const fallback = opts.default ?? false;
|
|
34890
|
+
const raw = readEnvVar(key, { env: opts.env });
|
|
34891
|
+
if (raw === void 0)
|
|
34892
|
+
return fallback;
|
|
34893
|
+
const token = raw.toLowerCase();
|
|
34894
|
+
if (TRUE_TOKENS.has(token))
|
|
34895
|
+
return true;
|
|
34896
|
+
if (FALSE_TOKENS.has(token))
|
|
34897
|
+
return false;
|
|
34898
|
+
return fallback;
|
|
34899
|
+
}
|
|
34900
|
+
function expandPath(p) {
|
|
34901
|
+
let expanded = p;
|
|
34902
|
+
if (p === "~") {
|
|
34903
|
+
expanded = homedir();
|
|
34904
|
+
} else if (p.startsWith("~/")) {
|
|
34905
|
+
expanded = join(homedir(), p.slice(2));
|
|
34906
|
+
}
|
|
34907
|
+
return isAbsolute(expanded) ? expanded : resolve(expanded);
|
|
34908
|
+
}
|
|
34909
|
+
|
|
34910
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/server/confirm-env.js
|
|
34911
|
+
var MODES = /* @__PURE__ */ new Set(["ask-user", "auto", "refuse"]);
|
|
34912
|
+
var DEFAULT_TTL_SECONDS2 = 600;
|
|
34913
|
+
var warned = /* @__PURE__ */ new Set();
|
|
34914
|
+
function readConfirmMode(env = process.env) {
|
|
34915
|
+
const raw = readEnvVar("MCP_CONFIRM_MODE", { env })?.trim().toLowerCase();
|
|
34916
|
+
if (!raw)
|
|
34917
|
+
return "ask-user";
|
|
34918
|
+
if (MODES.has(raw))
|
|
34919
|
+
return raw;
|
|
34920
|
+
if (!warned.has(raw)) {
|
|
34921
|
+
warned.add(raw);
|
|
34922
|
+
process.stderr.write(`MCP_CONFIRM_MODE="${raw}" is not one of ask-user, auto, refuse; treating it as refuse.
|
|
34923
|
+
`);
|
|
34924
|
+
}
|
|
34925
|
+
return "refuse";
|
|
34926
|
+
}
|
|
34927
|
+
function confirmTtlFromEnv(env = process.env) {
|
|
34928
|
+
const raw = readEnvVar("MCP_CONFIRM_TTL_SECONDS", { env })?.trim();
|
|
34929
|
+
return raw && /^[1-9]\d*$/.test(raw) ? Number(raw) : DEFAULT_TTL_SECONDS2;
|
|
34930
|
+
}
|
|
34931
|
+
var processKey;
|
|
34932
|
+
function confirmKeyFromEnv(env = process.env) {
|
|
34933
|
+
const secret = readEnvVar("MCP_CONFIRM_SECRET", { env });
|
|
34934
|
+
if (secret)
|
|
34935
|
+
return createHash3("sha256").update(secret, "utf8").digest();
|
|
34936
|
+
processKey ??= randomBytes2(32);
|
|
34937
|
+
return processKey;
|
|
34938
|
+
}
|
|
34939
|
+
var CONFIRM_TOKEN_AUTO_INSTRUCTION = "Nothing has been done yet. Review this preview; if it is what was intended, call again with the same arguments plus confirmToken. (This server runs with MCP_CONFIRM_MODE=auto, so the user's approval in chat is not required.)";
|
|
34940
|
+
var REFUSE_HINT = "Set MCP_CONFIRM_MODE=ask-user on the server to allow two-step confirmation instead.";
|
|
34941
|
+
function confirmationFromEnv(options) {
|
|
34942
|
+
const { tool, account, confirmToken, subject, instruction, spent: spent2, env = process.env, ...confirmation } = options;
|
|
34943
|
+
const mode = readConfirmMode(env);
|
|
34944
|
+
if (mode === "refuse") {
|
|
34945
|
+
return {
|
|
34946
|
+
...confirmation,
|
|
34947
|
+
unsupportedNote: confirmation.unsupportedNote ? `${confirmation.unsupportedNote} ${REFUSE_HINT}` : REFUSE_HINT
|
|
34948
|
+
};
|
|
34949
|
+
}
|
|
34950
|
+
return {
|
|
34951
|
+
...confirmation,
|
|
34952
|
+
tokenFallback: {
|
|
34953
|
+
key: confirmKeyFromEnv(env),
|
|
34954
|
+
tool,
|
|
34955
|
+
...account === void 0 ? {} : { account },
|
|
34956
|
+
...confirmToken === void 0 ? {} : { confirmToken },
|
|
34957
|
+
subject,
|
|
34958
|
+
ttlSeconds: confirmTtlFromEnv(env),
|
|
34959
|
+
instruction: mode === "auto" ? CONFIRM_TOKEN_AUTO_INSTRUCTION : instruction ?? CONFIRM_TOKEN_INSTRUCTION,
|
|
34960
|
+
...spent2 === void 0 ? {} : { spent: spent2 }
|
|
34961
|
+
}
|
|
34962
|
+
};
|
|
34963
|
+
}
|
|
34964
|
+
|
|
34492
34965
|
// ../../node_modules/@chrischall/mcp-utils/dist/server/index.js
|
|
34493
34966
|
var SERVER_PROTOCOL_VERSIONS = Object.freeze([
|
|
34494
34967
|
"2026-07-28",
|
|
@@ -34664,45 +35137,6 @@ function runMcp(opts) {
|
|
|
34664
35137
|
return handle;
|
|
34665
35138
|
}
|
|
34666
35139
|
|
|
34667
|
-
// ../../node_modules/@chrischall/mcp-utils/dist/config/index.js
|
|
34668
|
-
import { homedir } from "node:os";
|
|
34669
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
34670
|
-
var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
|
|
34671
|
-
function readEnvVar(key, opts = {}) {
|
|
34672
|
-
const env = opts.env ?? process.env;
|
|
34673
|
-
const raw = env[key];
|
|
34674
|
-
if (typeof raw === "string") {
|
|
34675
|
-
const trimmed = raw.trim();
|
|
34676
|
-
if (trimmed.length > 0 && trimmed !== "undefined" && trimmed !== "null" && !PLACEHOLDER_RE.test(trimmed)) {
|
|
34677
|
-
return trimmed;
|
|
34678
|
-
}
|
|
34679
|
-
}
|
|
34680
|
-
return opts.default;
|
|
34681
|
-
}
|
|
34682
|
-
var TRUE_TOKENS = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
34683
|
-
var FALSE_TOKENS = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
34684
|
-
function parseBoolEnv(key, opts = {}) {
|
|
34685
|
-
const fallback = opts.default ?? false;
|
|
34686
|
-
const raw = readEnvVar(key, { env: opts.env });
|
|
34687
|
-
if (raw === void 0)
|
|
34688
|
-
return fallback;
|
|
34689
|
-
const token = raw.toLowerCase();
|
|
34690
|
-
if (TRUE_TOKENS.has(token))
|
|
34691
|
-
return true;
|
|
34692
|
-
if (FALSE_TOKENS.has(token))
|
|
34693
|
-
return false;
|
|
34694
|
-
return fallback;
|
|
34695
|
-
}
|
|
34696
|
-
function expandPath(p) {
|
|
34697
|
-
let expanded = p;
|
|
34698
|
-
if (p === "~") {
|
|
34699
|
-
expanded = homedir();
|
|
34700
|
-
} else if (p.startsWith("~/")) {
|
|
34701
|
-
expanded = join(homedir(), p.slice(2));
|
|
34702
|
-
}
|
|
34703
|
-
return isAbsolute(expanded) ? expanded : resolve(expanded);
|
|
34704
|
-
}
|
|
34705
|
-
|
|
34706
35140
|
// ../../node_modules/@chrischall/mcp-utils/dist/fs/confine.js
|
|
34707
35141
|
import { existsSync, realpathSync } from "node:fs";
|
|
34708
35142
|
import { dirname, isAbsolute as isAbsolute2, relative, resolve as resolve2, sep } from "node:path";
|
|
@@ -34784,9 +35218,9 @@ function offsetAt(instant, tz) {
|
|
|
34784
35218
|
const w = wallPartsIn(instant, tz);
|
|
34785
35219
|
const asUTC = Date.UTC(w.year, w.month - 1, w.day, w.hour, w.minute, w.second, instant.getUTCMilliseconds());
|
|
34786
35220
|
const minutes = Math.round((asUTC - instant.getTime()) / 6e4);
|
|
34787
|
-
const
|
|
35221
|
+
const sign2 = minutes < 0 ? "-" : "+";
|
|
34788
35222
|
const abs = Math.abs(minutes);
|
|
34789
|
-
return `${
|
|
35223
|
+
return `${sign2}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
|
|
34790
35224
|
}
|
|
34791
35225
|
function wallPartsIn(instant, tz) {
|
|
34792
35226
|
const parts = new Intl.DateTimeFormat("en-US", {
|
|
@@ -35600,6 +36034,43 @@ function formatAuthHealth(raw, now) {
|
|
|
35600
36034
|
return accounts.map((a) => formatOneAccountHealth(a, now)).join("\n\n");
|
|
35601
36035
|
}
|
|
35602
36036
|
|
|
36037
|
+
// ../gogcli-mcp/src/send-confirm-token.ts
|
|
36038
|
+
var spent = createSpentTokenStore();
|
|
36039
|
+
function confirmSpentStore() {
|
|
36040
|
+
return spent;
|
|
36041
|
+
}
|
|
36042
|
+
|
|
36043
|
+
// ../gogcli-mcp/src/dispatch-confirmation.ts
|
|
36044
|
+
var CONFIRM_ACTION_INSTRUCTION = CONFIRM_TOKEN_INSTRUCTION;
|
|
36045
|
+
var CONFIRM_FALLBACK_DESCRIPTION = ' If the client cannot show that prompt (no MCP elicitation, e.g. claude.ai), 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. Follow its instruction (by default: show the preview to the user verbatim and 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. A server set to MCP_CONFIRM_MODE=refuse refuses instead.';
|
|
36046
|
+
function gatedElsewhere(what, via, does, tool) {
|
|
36047
|
+
return `${what} ${does} and is not available through ${via}. Use ${tool}, which asks the user to confirm.`;
|
|
36048
|
+
}
|
|
36049
|
+
async function requireDispatchConfirmation(ctx, options) {
|
|
36050
|
+
const { action, fallback } = options;
|
|
36051
|
+
const confirmation = {
|
|
36052
|
+
action,
|
|
36053
|
+
message: options.message,
|
|
36054
|
+
details: options.details,
|
|
36055
|
+
confirmationLabel: options.confirmationLabel,
|
|
36056
|
+
...options.unsupportedNote ? { unsupportedNote: options.unsupportedNote } : {}
|
|
36057
|
+
};
|
|
36058
|
+
if (!fallback) return requireConfirmationWithFallback(ctx, confirmation);
|
|
36059
|
+
return requireConfirmationWithFallback(ctx, confirmationFromEnv({
|
|
36060
|
+
...confirmation,
|
|
36061
|
+
tool: fallback.tool,
|
|
36062
|
+
account: fallback.account ?? readEnvVar("GOG_ACCOUNT") ?? "",
|
|
36063
|
+
confirmToken: fallback.confirmToken,
|
|
36064
|
+
subject: fallback.subject,
|
|
36065
|
+
instruction: fallback.instruction ?? CONFIRM_ACTION_INSTRUCTION,
|
|
36066
|
+
spent: confirmSpentStore()
|
|
36067
|
+
}));
|
|
36068
|
+
}
|
|
36069
|
+
function resultText(result) {
|
|
36070
|
+
const first = result.content[0];
|
|
36071
|
+
return first && first.type === "text" && typeof first.text === "string" ? first.text : "{}";
|
|
36072
|
+
}
|
|
36073
|
+
|
|
35603
36074
|
// ../gogcli-mcp/src/tools/auth.ts
|
|
35604
36075
|
var AUTH_RUN_SUBCOMMANDS = ["list", "status", "services", "remove", "alias"];
|
|
35605
36076
|
function registerAuthToolsWith(server, defaultServices) {
|
|
@@ -35735,6 +36206,54 @@ function authToolsFor(defaultServices) {
|
|
|
35735
36206
|
}
|
|
35736
36207
|
|
|
35737
36208
|
// ../gogcli-mcp/src/tools/calendar.ts
|
|
36209
|
+
var CALENDAR_GATED = {
|
|
36210
|
+
create: "gog_calendar_create",
|
|
36211
|
+
add: "gog_calendar_create",
|
|
36212
|
+
new: "gog_calendar_create",
|
|
36213
|
+
update: "gog_calendar_update",
|
|
36214
|
+
edit: "gog_calendar_update",
|
|
36215
|
+
set: "gog_calendar_update",
|
|
36216
|
+
respond: "gog_calendar_respond",
|
|
36217
|
+
rsvp: "gog_calendar_respond",
|
|
36218
|
+
reply: "gog_calendar_respond"
|
|
36219
|
+
};
|
|
36220
|
+
function vetCalendarRun(subcommand, _args) {
|
|
36221
|
+
const sub = subcommand.toLowerCase();
|
|
36222
|
+
const tool = Object.hasOwn(CALENDAR_GATED, sub) ? CALENDAR_GATED[sub] : void 0;
|
|
36223
|
+
return tool ? gatedElsewhere(`gog calendar ${sub}`, "gog_calendar_run", "can change what guests see", tool) : void 0;
|
|
36224
|
+
}
|
|
36225
|
+
function parseAttendees(value) {
|
|
36226
|
+
if (!value) return [];
|
|
36227
|
+
return value.split(",").map((entry) => entry.split(";")).filter((parts) => !parts.slice(1).some((m) => m.trim().toLowerCase() === "resource")).map((parts) => parts[0].trim()).filter(Boolean);
|
|
36228
|
+
}
|
|
36229
|
+
function timeOf(t) {
|
|
36230
|
+
const v = t?.dateTime ?? t?.date;
|
|
36231
|
+
return typeof v === "string" ? v : void 0;
|
|
36232
|
+
}
|
|
36233
|
+
function eventSnapshot(raw) {
|
|
36234
|
+
let event;
|
|
36235
|
+
try {
|
|
36236
|
+
event = JSON.parse(raw)?.event;
|
|
36237
|
+
} catch {
|
|
36238
|
+
event = void 0;
|
|
36239
|
+
}
|
|
36240
|
+
const str = (v) => typeof v === "string" ? v : void 0;
|
|
36241
|
+
return {
|
|
36242
|
+
summary: str(event?.summary),
|
|
36243
|
+
start: timeOf(event?.start),
|
|
36244
|
+
end: timeOf(event?.end),
|
|
36245
|
+
organizer: str(event?.organizer?.email),
|
|
36246
|
+
// Guests are the OTHER people: not this account's own attendee row, not rooms.
|
|
36247
|
+
guests: (Array.isArray(event?.attendees) ? event.attendees : []).filter((a) => a.self !== true && a.resource !== true && typeof a.email === "string").map((a) => a.email),
|
|
36248
|
+
etag: str(event?.etag)
|
|
36249
|
+
};
|
|
36250
|
+
}
|
|
36251
|
+
async function readEvent(calendarId, eventId, account) {
|
|
36252
|
+
const got = await runOrDiagnose(["calendar", "event", pos(calendarId), pos(eventId)], { account });
|
|
36253
|
+
if (got.isError) return { error: got };
|
|
36254
|
+
return { event: eventSnapshot(resultText(got)) };
|
|
36255
|
+
}
|
|
36256
|
+
var CALENDAR_CONFIRM_LABEL = "Confirm that this change, which other people will see, should be made now.";
|
|
35738
36257
|
var reminderParams = {
|
|
35739
36258
|
reminders: external_exports.array(external_exports.string()).max(5).optional().describe(
|
|
35740
36259
|
`Reminders as method:duration, e.g. ["popup:30m", "email:1d"]. Method is popup or email; duration accepts m/h/d (max 40320 minutes = 4 weeks). Google allows at most 5. These REPLACE the event's reminders \u2014 on update, pass an EMPTY array to drop custom reminders and go back to the calendar's defaults. Cannot be combined with noReminders.`
|
|
@@ -35822,7 +36341,7 @@ function registerCalendarTools(server) {
|
|
|
35822
36341
|
return runOrDiagnose(args, { account });
|
|
35823
36342
|
});
|
|
35824
36343
|
server.registerTool("gog_calendar_create", {
|
|
35825
|
-
description: "Create a calendar event. Set withZoom=true to attach a Zoom meeting (requires Zoom S2S OAuth setup via gog_zoom_auth_setup; the join URL + meeting ID + passcode are appended to the event description \u2014 Google rejects native conference card writes from non-Workspace-Marketplace OAuth clients).",
|
|
36344
|
+
description: "Create a calendar event. Set withZoom=true to attach a Zoom meeting (requires Zoom S2S OAuth setup via gog_zoom_auth_setup; the join URL + meeting ID + passcode are appended to the event description \u2014 Google rejects native conference card writes from non-Workspace-Marketplace OAuth clients). With attendees, the event lands on other people's calendars (no invitation email is sent), so the MCP host is asked to show the user a confirmation prompt with the guests, time and details first; a guest-free event is created without asking." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
35826
36345
|
annotations: { destructiveHint: false },
|
|
35827
36346
|
inputSchema: external_exports.object({
|
|
35828
36347
|
calendarId: external_exports.string().describe('Calendar ID (use "primary" for the default calendar)'),
|
|
@@ -35836,9 +36355,10 @@ function registerCalendarTools(server) {
|
|
|
35836
36355
|
timezone: external_exports.string().optional().describe("IANA timezone metadata applied to from/to (e.g. America/New_York). Sets both start and end timezone unless start/end timezone are overridden."),
|
|
35837
36356
|
withZoom: external_exports.boolean().optional().describe("Create a Zoom video conference for this event (requires Zoom S2S OAuth setup)"),
|
|
35838
36357
|
...reminderParams,
|
|
35839
|
-
account: accountParam
|
|
36358
|
+
account: accountParam,
|
|
36359
|
+
confirmToken: confirmTokenParam
|
|
35840
36360
|
})
|
|
35841
|
-
}, async ({ calendarId, summary, from, to, description, location, attendees, allDay, timezone, withZoom, reminders, noReminders, account }) => {
|
|
36361
|
+
}, async ({ calendarId, summary, from, to, description, location, attendees, allDay, timezone, withZoom, reminders, noReminders, account, confirmToken }, ctx) => {
|
|
35842
36362
|
const args = ["calendar", "create", pos(calendarId), `--summary=${summary}`, `--from=${from}`, `--to=${to}`];
|
|
35843
36363
|
if (description) args.push(`--description=${description}`);
|
|
35844
36364
|
if (location) args.push(`--location=${location}`);
|
|
@@ -35847,10 +36367,28 @@ function registerCalendarTools(server) {
|
|
|
35847
36367
|
if (timezone) args.push(`--timezone=${timezone}`);
|
|
35848
36368
|
if (withZoom) args.push("--with-zoom");
|
|
35849
36369
|
pushReminderFlags(args, { reminders, noReminders });
|
|
36370
|
+
const guests = parseAttendees(attendees);
|
|
36371
|
+
if (guests.length > 0) {
|
|
36372
|
+
const event = { calendarId, summary, from, to, allDay: Boolean(allDay), timezone, location, description, guests, attendees, withZoom: Boolean(withZoom) };
|
|
36373
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
36374
|
+
action: "calendar.create",
|
|
36375
|
+
message: "Review and confirm this event, which will appear on the guests' calendars:",
|
|
36376
|
+
confirmationLabel: CALENDAR_CONFIRM_LABEL,
|
|
36377
|
+
details: event,
|
|
36378
|
+
unsupportedNote: "Create it without attendees instead; the user can add the guests in Google Calendar.",
|
|
36379
|
+
fallback: {
|
|
36380
|
+
tool: "gog_calendar_create",
|
|
36381
|
+
account,
|
|
36382
|
+
confirmToken,
|
|
36383
|
+
subject: () => ({ target: calendarId, payload: event, preview: event })
|
|
36384
|
+
}
|
|
36385
|
+
});
|
|
36386
|
+
if (confirmation) return confirmation;
|
|
36387
|
+
}
|
|
35850
36388
|
return runOrDiagnose(args, { account });
|
|
35851
36389
|
});
|
|
35852
36390
|
server.registerTool("gog_calendar_update", {
|
|
35853
|
-
description: "Update an existing calendar event. Zoom: withZoom adds a Zoom meeting, regenerateZoom replaces the existing one, removeZoom strips it. removeMeet clears the event's Google Meet conference data (e.g. before attaching another provider). Conference flags are independent \u2014 use one per call.",
|
|
36391
|
+
description: "Update an existing calendar event. Zoom: withZoom adds a Zoom meeting, regenerateZoom replaces the existing one, removeZoom strips it. removeMeet clears the event's Google Meet conference data (e.g. before attaching another provider). Conference flags are independent \u2014 use one per call. A change guests can see (time, title, place, description, attendees, attachments, conferencing) on an event that has guests \u2014 or gains them \u2014 reads the event and asks the MCP host to show the user a confirmation prompt with the event as it stands and the change; no invitation email is sent. Reminder-only changes and guest-free events are updated without asking." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
35854
36392
|
annotations: { destructiveHint: false },
|
|
35855
36393
|
inputSchema: external_exports.object({
|
|
35856
36394
|
calendarId: external_exports.string().describe("Calendar ID"),
|
|
@@ -35868,9 +36406,10 @@ function registerCalendarTools(server) {
|
|
|
35868
36406
|
removeZoom: external_exports.boolean().optional().describe("Remove the event's Zoom video conference"),
|
|
35869
36407
|
removeMeet: external_exports.boolean().optional().describe("Remove the event's Google Meet video conference (clears conference data only)"),
|
|
35870
36408
|
...reminderParams,
|
|
35871
|
-
account: accountParam
|
|
36409
|
+
account: accountParam,
|
|
36410
|
+
confirmToken: confirmTokenParam
|
|
35872
36411
|
})
|
|
35873
|
-
}, async ({ calendarId, eventId, summary, from, to, description, location, attendees, addAttendees, attachments, withZoom, regenerateZoom, removeZoom, removeMeet, reminders, noReminders, account }) => {
|
|
36412
|
+
}, async ({ calendarId, eventId, summary, from, to, description, location, attendees, addAttendees, attachments, withZoom, regenerateZoom, removeZoom, removeMeet, reminders, noReminders, account, confirmToken }, ctx) => {
|
|
35874
36413
|
const args = ["calendar", "update", pos(calendarId), pos(eventId)];
|
|
35875
36414
|
if (summary !== void 0) args.push(`--summary=${summary}`);
|
|
35876
36415
|
if (from !== void 0) args.push(`--from=${from}`);
|
|
@@ -35885,6 +36424,45 @@ function registerCalendarTools(server) {
|
|
|
35885
36424
|
if (removeZoom) args.push("--remove-zoom");
|
|
35886
36425
|
if (removeMeet) args.push("--remove-meet");
|
|
35887
36426
|
pushReminderFlags(args, { reminders, noReminders });
|
|
36427
|
+
const changes = Object.fromEntries(Object.entries({
|
|
36428
|
+
summary,
|
|
36429
|
+
from,
|
|
36430
|
+
to,
|
|
36431
|
+
description,
|
|
36432
|
+
location,
|
|
36433
|
+
attendees,
|
|
36434
|
+
addAttendees,
|
|
36435
|
+
attachments,
|
|
36436
|
+
withZoom,
|
|
36437
|
+
regenerateZoom,
|
|
36438
|
+
removeZoom,
|
|
36439
|
+
removeMeet
|
|
36440
|
+
}).filter(([, v]) => v !== void 0 && v !== false));
|
|
36441
|
+
if (Object.keys(changes).length > 0) {
|
|
36442
|
+
const read = await readEvent(calendarId, eventId, account);
|
|
36443
|
+
if (read.error) return read.error;
|
|
36444
|
+
const { etag, ...current } = read.event;
|
|
36445
|
+
const added = [...parseAttendees(attendees), ...parseAttendees(addAttendees)];
|
|
36446
|
+
if (current.guests.length > 0 || added.length > 0) {
|
|
36447
|
+
const view = { calendarId, eventId, current, changes };
|
|
36448
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
36449
|
+
action: "calendar.update",
|
|
36450
|
+
message: "Review and confirm this change to an event other people are on:",
|
|
36451
|
+
confirmationLabel: CALENDAR_CONFIRM_LABEL,
|
|
36452
|
+
details: view,
|
|
36453
|
+
unsupportedNote: "Ask the user to make this change in Google Calendar.",
|
|
36454
|
+
fallback: {
|
|
36455
|
+
tool: "gog_calendar_update",
|
|
36456
|
+
account,
|
|
36457
|
+
confirmToken,
|
|
36458
|
+
// The etag rotates on any edit, so an event changed elsewhere between
|
|
36459
|
+
// the two phases is DRAFT_CHANGED rather than edited over.
|
|
36460
|
+
subject: () => ({ target: `${calendarId}/${eventId}`, revision: etag, payload: view, preview: view })
|
|
36461
|
+
}
|
|
36462
|
+
});
|
|
36463
|
+
if (confirmation) return confirmation;
|
|
36464
|
+
}
|
|
36465
|
+
}
|
|
35888
36466
|
return runOrDiagnose(args, { account });
|
|
35889
36467
|
});
|
|
35890
36468
|
server.registerTool("gog_calendar_delete", {
|
|
@@ -35899,21 +36477,40 @@ function registerCalendarTools(server) {
|
|
|
35899
36477
|
return runOrDiagnose(["calendar", "delete", pos(calendarId), pos(eventId), "--force"], { account });
|
|
35900
36478
|
});
|
|
35901
36479
|
server.registerTool("gog_calendar_respond", {
|
|
35902
|
-
description: "Respond to a calendar event invitation.",
|
|
36480
|
+
description: "Respond to a calendar event invitation. The organizer sees the response, so this reads the event and asks the MCP host to show the user a confirmation prompt with the event, organizer, response and comment; nothing is recorded unless they accept." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
35903
36481
|
annotations: { destructiveHint: true },
|
|
35904
36482
|
inputSchema: external_exports.object({
|
|
35905
36483
|
calendarId: external_exports.string().describe("Calendar ID"),
|
|
35906
36484
|
eventId: external_exports.string().describe("Event ID"),
|
|
35907
36485
|
status: external_exports.enum(["accepted", "declined", "tentative"]).describe("Response status"),
|
|
35908
36486
|
comment: external_exports.string().optional().describe("Optional comment to include with response"),
|
|
35909
|
-
account: accountParam
|
|
36487
|
+
account: accountParam,
|
|
36488
|
+
confirmToken: confirmTokenParam
|
|
35910
36489
|
})
|
|
35911
|
-
}, async ({ calendarId, eventId, status, comment, account }) => {
|
|
36490
|
+
}, async ({ calendarId, eventId, status, comment, account, confirmToken }, ctx) => {
|
|
35912
36491
|
const args = ["calendar", "respond", pos(calendarId), pos(eventId), `--status=${status}`];
|
|
35913
36492
|
if (comment) args.push(`--comment=${comment}`);
|
|
36493
|
+
const read = await readEvent(calendarId, eventId, account);
|
|
36494
|
+
if (read.error) return read.error;
|
|
36495
|
+
const { etag, ...event } = read.event;
|
|
36496
|
+
const view = { calendarId, eventId, event, response: status, ...comment ? { comment } : {} };
|
|
36497
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
36498
|
+
action: "calendar.respond",
|
|
36499
|
+
message: "Review and confirm this response, which the organizer will see:",
|
|
36500
|
+
confirmationLabel: "Confirm that this response should be recorded now.",
|
|
36501
|
+
details: view,
|
|
36502
|
+
unsupportedNote: "Ask the user to respond from Google Calendar.",
|
|
36503
|
+
fallback: {
|
|
36504
|
+
tool: "gog_calendar_respond",
|
|
36505
|
+
account,
|
|
36506
|
+
confirmToken,
|
|
36507
|
+
subject: () => ({ target: `${calendarId}/${eventId}`, revision: etag, payload: view, preview: view })
|
|
36508
|
+
}
|
|
36509
|
+
});
|
|
36510
|
+
if (confirmation) return confirmation;
|
|
35914
36511
|
return runOrDiagnose(args, { account });
|
|
35915
36512
|
});
|
|
35916
|
-
registerRunTool(server, { service: "calendar", examples: '"calendars", "freebusy"' });
|
|
36513
|
+
registerRunTool(server, { service: "calendar", examples: '"calendars", "freebusy"', vet: vetCalendarRun });
|
|
35917
36514
|
}
|
|
35918
36515
|
|
|
35919
36516
|
// ../gogcli-mcp/src/attachments.ts
|
|
@@ -35957,7 +36554,7 @@ var replySchema = {
|
|
|
35957
36554
|
signatureFile: external_exports.string().optional().describe("Append a local signature file (plain text or HTML), read on the gog server"),
|
|
35958
36555
|
account: accountParam
|
|
35959
36556
|
};
|
|
35960
|
-
var sendReplySchema = external_exports.object(replySchema);
|
|
36557
|
+
var sendReplySchema = external_exports.object({ ...replySchema, confirmToken: confirmTokenParam });
|
|
35961
36558
|
|
|
35962
36559
|
// ../gogcli-mcp/src/tools/sheets.ts
|
|
35963
36560
|
var cellValueParam = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()]);
|
|
@@ -35969,7 +36566,7 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
|
|
|
35969
36566
|
);
|
|
35970
36567
|
|
|
35971
36568
|
// ../gogcli-mcp/src/server.ts
|
|
35972
|
-
var VERSION = true ? "4.
|
|
36569
|
+
var VERSION = true ? "4.5.0" : "0.0.0";
|
|
35973
36570
|
|
|
35974
36571
|
// ../gogcli-mcp/src/bootstrap-auth.ts
|
|
35975
36572
|
import { join as join5 } from "node:path";
|
|
@@ -36006,12 +36603,12 @@ async function bootstrapGogAuth(env = process.env, options = {}) {
|
|
|
36006
36603
|
const [clientId, clientSecret, refreshToken, account] = values;
|
|
36007
36604
|
const { spawner } = options;
|
|
36008
36605
|
try {
|
|
36009
|
-
const { createHash } = await import("node:crypto");
|
|
36606
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
36010
36607
|
const { mkdir, readFile, writeFile, chmod } = await import("node:fs/promises");
|
|
36011
36608
|
const home = options.home ?? (await import("node:os")).homedir();
|
|
36012
36609
|
const dir = join5(home, ".gogcli-mcp");
|
|
36013
36610
|
const marker = join5(dir, AUTH_BOOTSTRAP_MARKER);
|
|
36014
|
-
const fingerprint =
|
|
36611
|
+
const fingerprint = createHash4("sha256").update(values.join("\0")).digest("hex");
|
|
36015
36612
|
const previous = await readFile(marker, "utf8").catch(() => void 0);
|
|
36016
36613
|
if (previous === fingerprint && await accountListed(account, spawner)) return "present";
|
|
36017
36614
|
await run(
|
package/manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"manifest_version": "0.3",
|
|
4
4
|
"name": "gogcli-mcp-calendar",
|
|
5
5
|
"display_name": "gogcli (Calendar)",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.5.0",
|
|
7
7
|
"description": "Extended Google Calendar for Claude via gogcli — auth + Calendar events + Meet space management",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Chris Hall",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gogcli-mcp-calendar",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"mcpName": "io.github.chrischall/gogcli-mcp-calendar",
|
|
5
5
|
"description": "Extended Google Calendar + Meet MCP server via gogcli — auth + Calendar events + Meet space management",
|
|
6
6
|
"author": "Claude Code (AI) <https://www.anthropic.com/claude>",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test:coverage": "vitest run --coverage"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@chrischall/mcp-utils": "^2.
|
|
27
|
+
"@chrischall/mcp-utils": "^2.6.0",
|
|
28
28
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
29
29
|
"zod": "^4.6.1"
|
|
30
30
|
},
|