gogcli-mcp-calendar 4.4.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 +289 -197
- package/manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -34554,10 +34554,8 @@ function errorResult(message) {
|
|
|
34554
34554
|
|
|
34555
34555
|
// ../../node_modules/@chrischall/mcp-utils/dist/server/confirmation.js
|
|
34556
34556
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
34557
|
-
|
|
34558
|
-
|
|
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.";
|
|
34557
|
+
|
|
34558
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/server/canonical.js
|
|
34561
34559
|
function canonicalJson(value) {
|
|
34562
34560
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
34563
34561
|
return JSON.stringify(value);
|
|
@@ -34568,7 +34566,7 @@ function canonicalJson(value) {
|
|
|
34568
34566
|
if (typeof value === "bigint")
|
|
34569
34567
|
return `{"$bigint":"${value.toString()}"}`;
|
|
34570
34568
|
if (typeof value === "function" || typeof value === "symbol") {
|
|
34571
|
-
throw new TypeError(`
|
|
34569
|
+
throw new TypeError(`confirmation: cannot bind a ${typeof value} argument value.`);
|
|
34572
34570
|
}
|
|
34573
34571
|
if (Array.isArray(value))
|
|
34574
34572
|
return `[${value.map(canonicalJson).join(",")}]`;
|
|
@@ -34590,7 +34588,7 @@ function canonicalJson(value) {
|
|
|
34590
34588
|
}
|
|
34591
34589
|
const proto = Object.getPrototypeOf(value);
|
|
34592
34590
|
if (proto !== Object.prototype && proto !== null) {
|
|
34593
|
-
throw new TypeError("
|
|
34591
|
+
throw new TypeError("confirmation: cannot bind a non-plain object argument value (class instance).");
|
|
34594
34592
|
}
|
|
34595
34593
|
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
34596
34594
|
return `{${entries.map(([k, v]) => `${JSON.stringify(escapeKey(k))}:${canonicalJson(v)}`).join(",")}}`;
|
|
@@ -34598,6 +34596,12 @@ function canonicalJson(value) {
|
|
|
34598
34596
|
function escapeKey(key) {
|
|
34599
34597
|
return key.startsWith("$") ? `$${key}` : key;
|
|
34600
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.";
|
|
34601
34605
|
function bindingKey(binding) {
|
|
34602
34606
|
if (binding.ttlSeconds !== void 0 && !(Number.isFinite(binding.ttlSeconds) && binding.ttlSeconds > 0)) {
|
|
34603
34607
|
throw new RangeError("requireConfirmation: binding.ttlSeconds must be a finite number greater than 0.");
|
|
@@ -34700,6 +34704,264 @@ ${JSON.stringify(preview, null, 2)}`,
|
|
|
34700
34704
|
});
|
|
34701
34705
|
}
|
|
34702
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
|
+
|
|
34703
34965
|
// ../../node_modules/@chrischall/mcp-utils/dist/server/index.js
|
|
34704
34966
|
var SERVER_PROTOCOL_VERSIONS = Object.freeze([
|
|
34705
34967
|
"2026-07-28",
|
|
@@ -34875,45 +35137,6 @@ function runMcp(opts) {
|
|
|
34875
35137
|
return handle;
|
|
34876
35138
|
}
|
|
34877
35139
|
|
|
34878
|
-
// ../../node_modules/@chrischall/mcp-utils/dist/config/index.js
|
|
34879
|
-
import { homedir } from "node:os";
|
|
34880
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
34881
|
-
var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
|
|
34882
|
-
function readEnvVar(key, opts = {}) {
|
|
34883
|
-
const env = opts.env ?? process.env;
|
|
34884
|
-
const raw = env[key];
|
|
34885
|
-
if (typeof raw === "string") {
|
|
34886
|
-
const trimmed = raw.trim();
|
|
34887
|
-
if (trimmed.length > 0 && trimmed !== "undefined" && trimmed !== "null" && !PLACEHOLDER_RE.test(trimmed)) {
|
|
34888
|
-
return trimmed;
|
|
34889
|
-
}
|
|
34890
|
-
}
|
|
34891
|
-
return opts.default;
|
|
34892
|
-
}
|
|
34893
|
-
var TRUE_TOKENS = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
34894
|
-
var FALSE_TOKENS = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
34895
|
-
function parseBoolEnv(key, opts = {}) {
|
|
34896
|
-
const fallback = opts.default ?? false;
|
|
34897
|
-
const raw = readEnvVar(key, { env: opts.env });
|
|
34898
|
-
if (raw === void 0)
|
|
34899
|
-
return fallback;
|
|
34900
|
-
const token = raw.toLowerCase();
|
|
34901
|
-
if (TRUE_TOKENS.has(token))
|
|
34902
|
-
return true;
|
|
34903
|
-
if (FALSE_TOKENS.has(token))
|
|
34904
|
-
return false;
|
|
34905
|
-
return fallback;
|
|
34906
|
-
}
|
|
34907
|
-
function expandPath(p) {
|
|
34908
|
-
let expanded = p;
|
|
34909
|
-
if (p === "~") {
|
|
34910
|
-
expanded = homedir();
|
|
34911
|
-
} else if (p.startsWith("~/")) {
|
|
34912
|
-
expanded = join(homedir(), p.slice(2));
|
|
34913
|
-
}
|
|
34914
|
-
return isAbsolute(expanded) ? expanded : resolve(expanded);
|
|
34915
|
-
}
|
|
34916
|
-
|
|
34917
35140
|
// ../../node_modules/@chrischall/mcp-utils/dist/fs/confine.js
|
|
34918
35141
|
import { existsSync, realpathSync } from "node:fs";
|
|
34919
35142
|
import { dirname, isAbsolute as isAbsolute2, relative, resolve as resolve2, sep } from "node:path";
|
|
@@ -35812,167 +36035,36 @@ function formatAuthHealth(raw, now) {
|
|
|
35812
36035
|
}
|
|
35813
36036
|
|
|
35814
36037
|
// ../gogcli-mcp/src/send-confirm-token.ts
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
var secret;
|
|
35819
|
-
var spent = /* @__PURE__ */ new Map();
|
|
35820
|
-
function sendConfirmFallbackEnabled() {
|
|
35821
|
-
return readEnvVar("GOG_SEND_CONFIRM_FALLBACK")?.trim().toLowerCase() === "token";
|
|
35822
|
-
}
|
|
35823
|
-
function confirmTokenTtlSeconds() {
|
|
35824
|
-
const raw = readEnvVar("GOG_CONFIRM_TTL_SECONDS")?.trim();
|
|
35825
|
-
if (raw && /^\d+$/.test(raw)) {
|
|
35826
|
-
const n = Number(raw);
|
|
35827
|
-
if (n > 0) return n;
|
|
35828
|
-
}
|
|
35829
|
-
return CONFIRM_TOKEN_TTL_DEFAULT_SECONDS;
|
|
35830
|
-
}
|
|
35831
|
-
function hmacKey() {
|
|
35832
|
-
if (!secret) {
|
|
35833
|
-
const configured = readEnvVar("GOG_CONFIRM_SECRET");
|
|
35834
|
-
secret = configured ? Buffer.from(configured, "utf8") : randomBytes(32);
|
|
35835
|
-
}
|
|
35836
|
-
return secret;
|
|
35837
|
-
}
|
|
35838
|
-
function canonicalize(value) {
|
|
35839
|
-
if (Array.isArray(value)) return value.map(canonicalize);
|
|
35840
|
-
if (value && typeof value === "object") {
|
|
35841
|
-
const out = {};
|
|
35842
|
-
for (const key of Object.keys(value).sort()) {
|
|
35843
|
-
const v = value[key];
|
|
35844
|
-
if (v !== void 0) out[key] = canonicalize(v);
|
|
35845
|
-
}
|
|
35846
|
-
return out;
|
|
35847
|
-
}
|
|
35848
|
-
return value;
|
|
35849
|
-
}
|
|
35850
|
-
function hashSendPayload(payload) {
|
|
35851
|
-
return createHash2("sha256").update(JSON.stringify(canonicalize(payload))).digest("hex");
|
|
35852
|
-
}
|
|
35853
|
-
function sign(body) {
|
|
35854
|
-
return createHmac2("sha256", hmacKey()).update(`${PREFIX}.${body}`).digest("base64url");
|
|
35855
|
-
}
|
|
35856
|
-
function issueConfirmToken(binding, now = Date.now()) {
|
|
35857
|
-
const exp = now + confirmTokenTtlSeconds() * 1e3;
|
|
35858
|
-
const claims = {
|
|
35859
|
-
t: binding.tool,
|
|
35860
|
-
a: binding.account,
|
|
35861
|
-
g: binding.target,
|
|
35862
|
-
...binding.revision === void 0 ? {} : { r: binding.revision },
|
|
35863
|
-
h: binding.payloadHash,
|
|
35864
|
-
iat: now,
|
|
35865
|
-
exp,
|
|
35866
|
-
n: randomBytes(16).toString("base64url")
|
|
35867
|
-
};
|
|
35868
|
-
const body = Buffer.from(JSON.stringify(claims), "utf8").toString("base64url");
|
|
35869
|
-
return { token: `${PREFIX}.${body}.${sign(body)}`, expiresAt: new Date(exp).toISOString() };
|
|
35870
|
-
}
|
|
35871
|
-
function signatureMatches(body, sig) {
|
|
35872
|
-
const expected = Buffer.from(sign(body), "utf8");
|
|
35873
|
-
const actual = Buffer.from(sig, "utf8");
|
|
35874
|
-
return expected.length === actual.length && timingSafeEqual2(expected, actual);
|
|
35875
|
-
}
|
|
35876
|
-
function parseClaims(body) {
|
|
35877
|
-
try {
|
|
35878
|
-
return JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
35879
|
-
} catch {
|
|
35880
|
-
return void 0;
|
|
35881
|
-
}
|
|
35882
|
-
}
|
|
35883
|
-
function verifyConfirmToken(token, binding, now = Date.now()) {
|
|
35884
|
-
for (const [nonce, exp] of spent) if (exp < now) spent.delete(nonce);
|
|
35885
|
-
const parts = token.split(".");
|
|
35886
|
-
if (parts.length !== 3 || parts[0] !== PREFIX || !parts[1] || !parts[2]) return { ok: false, error: "TOKEN_INVALID" };
|
|
35887
|
-
const [, body, sig] = parts;
|
|
35888
|
-
if (!signatureMatches(body, sig)) return { ok: false, error: "TOKEN_INVALID" };
|
|
35889
|
-
const claims = parseClaims(body);
|
|
35890
|
-
if (!claims) return { ok: false, error: "TOKEN_INVALID" };
|
|
35891
|
-
if (claims.t !== binding.tool || claims.a !== binding.account || claims.g !== binding.target) {
|
|
35892
|
-
return { ok: false, error: "TOKEN_INVALID" };
|
|
35893
|
-
}
|
|
35894
|
-
if (spent.has(claims.n)) return { ok: false, error: "TOKEN_REUSED" };
|
|
35895
|
-
if (now > claims.exp) return { ok: false, error: "TOKEN_EXPIRED" };
|
|
35896
|
-
if (claims.r !== binding.revision) return { ok: false, error: "DRAFT_CHANGED", reason: "message-id-rotated" };
|
|
35897
|
-
if (claims.h !== binding.payloadHash) return { ok: false, error: "DRAFT_CHANGED", reason: "payload-changed" };
|
|
35898
|
-
spent.set(claims.n, claims.exp);
|
|
35899
|
-
return { ok: true };
|
|
36038
|
+
var spent = createSpentTokenStore();
|
|
36039
|
+
function confirmSpentStore() {
|
|
36040
|
+
return spent;
|
|
35900
36041
|
}
|
|
35901
36042
|
|
|
35902
36043
|
// ../gogcli-mcp/src/dispatch-confirmation.ts
|
|
35903
|
-
var CONFIRM_ACTION_INSTRUCTION =
|
|
35904
|
-
var
|
|
35905
|
-
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.';
|
|
35906
|
-
var confirmTokenParam = external_exports.string().optional().describe(
|
|
35907
|
-
`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.`
|
|
35908
|
-
);
|
|
35909
|
-
var TOKEN_ERROR_NOTE = {
|
|
35910
|
-
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.",
|
|
35911
|
-
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.",
|
|
35912
|
-
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."
|
|
35913
|
-
};
|
|
35914
|
-
var DRAFT_CHANGED_NOTE = {
|
|
35915
|
-
"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.",
|
|
35916
|
-
"payload-changed": "Nothing was sent or changed: what would happen no longer matches what the user approved."
|
|
35917
|
-
};
|
|
35918
|
-
function isToolResult(value) {
|
|
35919
|
-
return Array.isArray(value.content);
|
|
35920
|
-
}
|
|
35921
|
-
function rejection2(data) {
|
|
35922
|
-
return { ...textResult({ status: "confirmation-rejected", confirmed: false, dispatched: false, ...data }), isError: true };
|
|
35923
|
-
}
|
|
35924
|
-
async function tokenConfirmation(op, fallback) {
|
|
35925
|
-
const subject = await fallback.subject();
|
|
35926
|
-
if (isToolResult(subject)) return subject;
|
|
35927
|
-
const binding = {
|
|
35928
|
-
tool: fallback.tool,
|
|
35929
|
-
account: fallback.account ?? readEnvVar("GOG_ACCOUNT") ?? "",
|
|
35930
|
-
target: subject.target,
|
|
35931
|
-
...subject.revision === void 0 ? {} : { revision: subject.revision },
|
|
35932
|
-
payloadHash: hashSendPayload(subject.payload)
|
|
35933
|
-
};
|
|
35934
|
-
const phaseOne = () => {
|
|
35935
|
-
const { token, expiresAt } = issueConfirmToken(binding);
|
|
35936
|
-
return {
|
|
35937
|
-
action: op,
|
|
35938
|
-
preview: subject.preview,
|
|
35939
|
-
confirmToken: token,
|
|
35940
|
-
expiresAt,
|
|
35941
|
-
ttlSeconds: confirmTokenTtlSeconds(),
|
|
35942
|
-
instruction: fallback.instruction ?? CONFIRM_ACTION_INSTRUCTION
|
|
35943
|
-
};
|
|
35944
|
-
};
|
|
35945
|
-
if (!fallback.confirmToken) {
|
|
35946
|
-
return textResult({ status: "confirmation-required", confirmed: false, dispatched: false, ...phaseOne() });
|
|
35947
|
-
}
|
|
35948
|
-
const verdict = verifyConfirmToken(fallback.confirmToken, binding);
|
|
35949
|
-
if (verdict.ok) return void 0;
|
|
35950
|
-
if (verdict.error === "DRAFT_CHANGED") {
|
|
35951
|
-
return rejection2({
|
|
35952
|
-
error: "DRAFT_CHANGED",
|
|
35953
|
-
reason: verdict.reason,
|
|
35954
|
-
note: `${DRAFT_CHANGED_NOTE[verdict.reason]} The current preview and a fresh confirmToken are below.`,
|
|
35955
|
-
...phaseOne()
|
|
35956
|
-
});
|
|
35957
|
-
}
|
|
35958
|
-
return rejection2({ error: verdict.error, action: op, note: TOKEN_ERROR_NOTE[verdict.error] });
|
|
35959
|
-
}
|
|
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.';
|
|
35960
36046
|
function gatedElsewhere(what, via, does, tool) {
|
|
35961
36047
|
return `${what} ${does} and is not available through ${via}. Use ${tool}, which asks the user to confirm.`;
|
|
35962
36048
|
}
|
|
35963
36049
|
async function requireDispatchConfirmation(ctx, options) {
|
|
35964
36050
|
const { action, fallback } = options;
|
|
35965
|
-
|
|
35966
|
-
return tokenConfirmation(action, fallback);
|
|
35967
|
-
}
|
|
35968
|
-
const note = fallback ? [options.unsupportedNote, FALLBACK_HINT].filter(Boolean).join(" ") : options.unsupportedNote;
|
|
35969
|
-
return requireConfirmation(ctx, {
|
|
36051
|
+
const confirmation = {
|
|
35970
36052
|
action,
|
|
35971
36053
|
message: options.message,
|
|
35972
36054
|
details: options.details,
|
|
35973
36055
|
confirmationLabel: options.confirmationLabel,
|
|
35974
|
-
...
|
|
35975
|
-
}
|
|
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
|
+
}));
|
|
35976
36068
|
}
|
|
35977
36069
|
function resultText(result) {
|
|
35978
36070
|
const first = result.content[0];
|
|
@@ -36474,7 +36566,7 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
|
|
|
36474
36566
|
);
|
|
36475
36567
|
|
|
36476
36568
|
// ../gogcli-mcp/src/server.ts
|
|
36477
|
-
var VERSION = true ? "4.
|
|
36569
|
+
var VERSION = true ? "4.5.0" : "0.0.0";
|
|
36478
36570
|
|
|
36479
36571
|
// ../gogcli-mcp/src/bootstrap-auth.ts
|
|
36480
36572
|
import { join as join5 } from "node:path";
|
|
@@ -36511,12 +36603,12 @@ async function bootstrapGogAuth(env = process.env, options = {}) {
|
|
|
36511
36603
|
const [clientId, clientSecret, refreshToken, account] = values;
|
|
36512
36604
|
const { spawner } = options;
|
|
36513
36605
|
try {
|
|
36514
|
-
const { createHash:
|
|
36606
|
+
const { createHash: createHash4 } = await import("node:crypto");
|
|
36515
36607
|
const { mkdir, readFile, writeFile, chmod } = await import("node:fs/promises");
|
|
36516
36608
|
const home = options.home ?? (await import("node:os")).homedir();
|
|
36517
36609
|
const dir = join5(home, ".gogcli-mcp");
|
|
36518
36610
|
const marker = join5(dir, AUTH_BOOTSTRAP_MARKER);
|
|
36519
|
-
const fingerprint =
|
|
36611
|
+
const fingerprint = createHash4("sha256").update(values.join("\0")).digest("hex");
|
|
36520
36612
|
const previous = await readFile(marker, "utf8").catch(() => void 0);
|
|
36521
36613
|
if (previous === fingerprint && await accountListed(account, spawner)) return "present";
|
|
36522
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
|
},
|