gogcli-mcp-contacts 2.21.1 → 2.23.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 +119 -8
- package/manifest.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31430,6 +31430,13 @@ var TIMESTAMP_KEYS = /* @__PURE__ */ new Set([
|
|
|
31430
31430
|
// Calendar event start/end
|
|
31431
31431
|
"internalDate",
|
|
31432
31432
|
// Gmail, epoch milliseconds (authoritative)
|
|
31433
|
+
// gog >= 0.35.0 Gmail message AND thread listings. Already offset-bearing
|
|
31434
|
+
// (RFC3339 from internalDate), so it needs no offset repair — it is
|
|
31435
|
+
// allowlisted purely to gain a Display sibling, and to be re-rendered in
|
|
31436
|
+
// DISPLAY_TZ like every other instant. Separately sourced from the sibling
|
|
31437
|
+
// `date`, which is a naive re-format of the sender's Date header; the two may
|
|
31438
|
+
// legitimately disagree. See docs/timestamps.md.
|
|
31439
|
+
"internalDateIso",
|
|
31433
31440
|
"modifiedTime",
|
|
31434
31441
|
// Drive
|
|
31435
31442
|
"createdTime",
|
|
@@ -31659,8 +31666,8 @@ function formatOneAccountHealth(a, now) {
|
|
|
31659
31666
|
const age = ageInDays(a.created_at, now);
|
|
31660
31667
|
const ageStr = age === null ? "" : ` Authorized ${age.toFixed(1)} day(s) ago.`;
|
|
31661
31668
|
if (a.valid === false) {
|
|
31662
|
-
const
|
|
31663
|
-
return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${
|
|
31669
|
+
const cause2 = INVALID_GRANT_PATTERN.test(a.error ?? "") ? 'refresh token expired or revoked \u2014 commonly the 7-day limit on OAuth consent screens still in "Testing" mode' : a.error?.trim() || "unknown error";
|
|
31670
|
+
return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${cause2}.${ageStr} Re-authorize with gog_auth_add (browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless).`;
|
|
31664
31671
|
}
|
|
31665
31672
|
if (a.valid === true) {
|
|
31666
31673
|
let line = `\u2713 ${email3}: token valid.${ageStr}`;
|
|
@@ -31702,7 +31709,7 @@ function registerAuthToolsWith(server, defaultServices) {
|
|
|
31702
31709
|
}
|
|
31703
31710
|
});
|
|
31704
31711
|
server.registerTool("gog_auth_status", {
|
|
31705
|
-
description: "Show gogcli auth
|
|
31712
|
+
description: "Show gogcli auth CONFIGURATION: keyring backend, credential files, and auth setup. Despite the name this is not a health check \u2014 it reads local setup and does not contact Google, so it says nothing about whether an account can still authenticate. Use gog_auth_health for that.",
|
|
31706
31713
|
annotations: { readOnlyHint: true },
|
|
31707
31714
|
inputSchema: {}
|
|
31708
31715
|
}, async () => {
|
|
@@ -31713,7 +31720,7 @@ function registerAuthToolsWith(server, defaultServices) {
|
|
|
31713
31720
|
}
|
|
31714
31721
|
});
|
|
31715
31722
|
server.registerTool("gog_auth_health", {
|
|
31716
|
-
description: 'Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task.',
|
|
31723
|
+
description: 'Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task. On the hosted connector this is the ONLY check that measures Google: a connector showing "connected" or "refreshed" has verified the connector key that reaches the gog machine, and nothing else \u2014 the Google credential lives on that machine and can be dead while the connection looks perfectly healthy.',
|
|
31717
31724
|
annotations: { readOnlyHint: true },
|
|
31718
31725
|
inputSchema: {}
|
|
31719
31726
|
}, async () => {
|
|
@@ -31876,14 +31883,29 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
|
|
|
31876
31883
|
);
|
|
31877
31884
|
|
|
31878
31885
|
// ../gogcli-mcp/src/server.ts
|
|
31879
|
-
var VERSION = true ? "2.
|
|
31886
|
+
var VERSION = true ? "2.23.0" : "0.0.0";
|
|
31880
31887
|
|
|
31881
31888
|
// ../gogcli-mcp/src/auth-log.ts
|
|
31882
31889
|
var FAILURES = /* @__PURE__ */ new Set([
|
|
31883
31890
|
"token.mint-failed",
|
|
31884
31891
|
"grant.dead",
|
|
31885
31892
|
"replay.failed",
|
|
31886
|
-
"runner.auth-failed"
|
|
31893
|
+
"runner.auth-failed",
|
|
31894
|
+
"connect.key-rejected",
|
|
31895
|
+
// An enrolment that could not proceed is a failure even though nobody is at
|
|
31896
|
+
// fault: it is the only trace a half-enrolled connector leaves behind, and
|
|
31897
|
+
// the absence of exactly this record is why DEFECT 4 could not be explained.
|
|
31898
|
+
"connect.runner-unreachable",
|
|
31899
|
+
"connect.google-unhealthy",
|
|
31900
|
+
"refusal.google-unhealthy",
|
|
31901
|
+
// The loudest record on this branch, and the only one that means "we cannot
|
|
31902
|
+
// explain this". Google refused a real call while a live check of the same
|
|
31903
|
+
// credential, taken seconds later, succeeded — so neither the 7-day cliff nor
|
|
31904
|
+
// a revoked grant accounts for it. It is filed as a failure precisely because
|
|
31905
|
+
// it is the record nobody may scroll past: it is the only evidence that could
|
|
31906
|
+
// ever justify building something on the hosted path, and its absence over
|
|
31907
|
+
// time is what retires that theory for good.
|
|
31908
|
+
"refusal.google-ok"
|
|
31887
31909
|
]);
|
|
31888
31910
|
var PREFIX = "gog-auth ";
|
|
31889
31911
|
var TAG_CHARS = 12;
|
|
@@ -32030,10 +32052,39 @@ async function exchange(refreshToken, clientId, clientSecret) {
|
|
|
32030
32052
|
return { accessToken: body.access_token, expiresAt: Date.now() + expiresInMs };
|
|
32031
32053
|
}
|
|
32032
32054
|
|
|
32055
|
+
// ../gogcli-mcp/src/google-probe.ts
|
|
32056
|
+
var bool = (value) => typeof value === "boolean" ? value : void 0;
|
|
32057
|
+
var cause = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
32058
|
+
function readGoogleProbe(body) {
|
|
32059
|
+
const record2 = typeof body === "object" && body !== null ? body : {};
|
|
32060
|
+
const measured = bool(record2.measured);
|
|
32061
|
+
const reported = cause(record2.error);
|
|
32062
|
+
if (measured === false) {
|
|
32063
|
+
return {
|
|
32064
|
+
kind: "unmeasured",
|
|
32065
|
+
reason: reported ?? "the runner reported it could not measure the Google layer"
|
|
32066
|
+
};
|
|
32067
|
+
}
|
|
32068
|
+
if (measured === true) {
|
|
32069
|
+
if (bool(record2.ok) === true) return { kind: "ok" };
|
|
32070
|
+
return {
|
|
32071
|
+
kind: "unhealthy",
|
|
32072
|
+
reason: reported ?? "the runner reported the Google layer unhealthy with no cause"
|
|
32073
|
+
};
|
|
32074
|
+
}
|
|
32075
|
+
return {
|
|
32076
|
+
kind: "unmeasured",
|
|
32077
|
+
reason: reported ? `the runner did not report whether it measured the Google layer; it said: ${reported}` : "the runner did not report whether it measured the Google layer"
|
|
32078
|
+
};
|
|
32079
|
+
}
|
|
32080
|
+
|
|
32033
32081
|
// ../gogcli-mcp/src/connector-runtime.ts
|
|
32034
32082
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
32035
32083
|
var DEADLINE_GRACE_MS = 5e3;
|
|
32036
32084
|
var MIN_REPLAY_BUDGET_MS = 1e3;
|
|
32085
|
+
var REFUSAL_PROBE_TIMEOUT_MS = 4e3;
|
|
32086
|
+
var MIN_PROBE_BUDGET_MS = 1e3;
|
|
32087
|
+
var PROBE_INTERVAL_MS = 6e4;
|
|
32037
32088
|
var RUNNER_GOG_FAILED = 422;
|
|
32038
32089
|
var RUNNER_DRAINING = 503;
|
|
32039
32090
|
var RUNNER_BAD_REQUEST = 400;
|
|
@@ -32080,7 +32131,7 @@ function gogTarget(args) {
|
|
|
32080
32131
|
}
|
|
32081
32132
|
return { service };
|
|
32082
32133
|
}
|
|
32083
|
-
async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt) {
|
|
32134
|
+
async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt, probeGoogle) {
|
|
32084
32135
|
if (!(err instanceof GogFailedError)) return void 0;
|
|
32085
32136
|
const grantDead = REFRESH_TOKEN_DEAD_PATTERN.test(err.stderr);
|
|
32086
32137
|
if (!grantDead && !GOOGLE_TOKEN_REJECTED_PATTERN.test(err.stderr)) return void 0;
|
|
@@ -32095,6 +32146,7 @@ async function remintAfterGoogleRejection(err, used, args, readAccessToken, dead
|
|
|
32095
32146
|
return void 0;
|
|
32096
32147
|
}
|
|
32097
32148
|
if (!used) {
|
|
32149
|
+
await probeGoogle(where);
|
|
32098
32150
|
logAuthTransition("replay.declined", {
|
|
32099
32151
|
...where,
|
|
32100
32152
|
reason: "no access token was supplied with the call, so gog acted as the backend volume\u2019s own identity"
|
|
@@ -32142,6 +32194,64 @@ async function remintAfterGoogleRejection(err, used, args, readAccessToken, dead
|
|
|
32142
32194
|
return { token: fresh, budgetMs, invalidate: readAccessToken.invalidate, ...where };
|
|
32143
32195
|
}
|
|
32144
32196
|
function makeFlyExecutor(endpoint, key, readAccessToken) {
|
|
32197
|
+
let lastProbeAt = Number.NEGATIVE_INFINITY;
|
|
32198
|
+
const probeGoogleAfterRefusal = async (where, deadlineAt) => {
|
|
32199
|
+
const record2 = { ...where, endpoint };
|
|
32200
|
+
const now = Date.now();
|
|
32201
|
+
const remainingMs = deadlineAt - now;
|
|
32202
|
+
if (remainingMs < MIN_PROBE_BUDGET_MS) {
|
|
32203
|
+
logAuthTransition("refusal.google-unmeasured", {
|
|
32204
|
+
...record2,
|
|
32205
|
+
reason: `only ${remainingMs}ms of the call\u2019s deadline remained, so the Google layer was not measured rather than delay the caller\u2019s own error`
|
|
32206
|
+
});
|
|
32207
|
+
return;
|
|
32208
|
+
}
|
|
32209
|
+
if (now - lastProbeAt < PROBE_INTERVAL_MS) {
|
|
32210
|
+
logAuthTransition("refusal.google-unmeasured", {
|
|
32211
|
+
...record2,
|
|
32212
|
+
// "attempted", not "measured". `lastProbeAt` is stamped before the
|
|
32213
|
+
// fetch and is deliberately NOT reset when the probe comes back with no
|
|
32214
|
+
// verdict (a 404 from a runner too old to have the endpoint, a timeout,
|
|
32215
|
+
// a dead socket) — the backend cost this throttle exists to bound was
|
|
32216
|
+
// paid either way, and resetting it would let a retry loop storm a
|
|
32217
|
+
// runner that is already unwell. So the timestamp stays and the sentence
|
|
32218
|
+
// has to be the true one: on this branch a log line may not assert a
|
|
32219
|
+
// measurement that never happened, and the previous probe may well have
|
|
32220
|
+
// measured nothing at all.
|
|
32221
|
+
reason: "a Google probe was attempted recently, so another was not sent: this probe spawns gog on the backend and takes the keyring\u2019s exclusive lock"
|
|
32222
|
+
});
|
|
32223
|
+
return;
|
|
32224
|
+
}
|
|
32225
|
+
lastProbeAt = now;
|
|
32226
|
+
let event;
|
|
32227
|
+
let reason;
|
|
32228
|
+
try {
|
|
32229
|
+
const res = await fetch(`${endpoint}/health/google`, {
|
|
32230
|
+
headers: { Authorization: `Bearer ${key}` },
|
|
32231
|
+
// Never more than the probe's own budget, never more than the call has
|
|
32232
|
+
// left. `Math.min` rather than a plain constant because the second
|
|
32233
|
+
// bound is the caller's, and it outranks ours.
|
|
32234
|
+
signal: AbortSignal.timeout(Math.min(REFUSAL_PROBE_TIMEOUT_MS, remainingMs))
|
|
32235
|
+
});
|
|
32236
|
+
if (!res.ok) {
|
|
32237
|
+
event = "refusal.google-unmeasured";
|
|
32238
|
+
reason = `the runner did not answer the Google probe (HTTP ${res.status})`;
|
|
32239
|
+
} else {
|
|
32240
|
+
const verdict = readGoogleProbe(await res.json());
|
|
32241
|
+
if (verdict.kind === "ok") {
|
|
32242
|
+
event = "refusal.google-ok";
|
|
32243
|
+
reason = "Google refused this call, yet a live token check on the same volume succeeded \u2014 so a dead or expired refresh token does not explain this refusal";
|
|
32244
|
+
} else {
|
|
32245
|
+
event = verdict.kind === "unhealthy" ? "refusal.google-unhealthy" : "refusal.google-unmeasured";
|
|
32246
|
+
reason = verdict.reason;
|
|
32247
|
+
}
|
|
32248
|
+
}
|
|
32249
|
+
} catch (err) {
|
|
32250
|
+
event = "refusal.google-unmeasured";
|
|
32251
|
+
reason = err instanceof Error ? err.message : String(err);
|
|
32252
|
+
}
|
|
32253
|
+
logAuthTransition(event, { ...record2, reason });
|
|
32254
|
+
};
|
|
32145
32255
|
return async (args, opts) => {
|
|
32146
32256
|
const deadlineMs = (opts?.timeout ?? DEFAULT_TIMEOUT_MS) + DEADLINE_GRACE_MS;
|
|
32147
32257
|
const accessToken = await readAccessToken?.();
|
|
@@ -32154,7 +32264,8 @@ function makeFlyExecutor(endpoint, key, readAccessToken) {
|
|
|
32154
32264
|
accessToken,
|
|
32155
32265
|
args,
|
|
32156
32266
|
readAccessToken,
|
|
32157
|
-
deadlineAt
|
|
32267
|
+
deadlineAt,
|
|
32268
|
+
(where2) => probeGoogleAfterRefusal(where2, deadlineAt)
|
|
32158
32269
|
);
|
|
32159
32270
|
if (replay === void 0) throw err;
|
|
32160
32271
|
const where = { credential: replay.credential, service: replay.service, endpoint };
|
package/manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"manifest_version": "0.3",
|
|
4
4
|
"name": "gogcli-mcp-contacts",
|
|
5
5
|
"display_name": "gogcli (Contacts)",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.23.0",
|
|
7
7
|
"description": "Extended Google Contacts for Claude via gogcli — auth + Contacts + Workspace directory (People API)",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Chris Hall",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gogcli-mcp-contacts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"mcpName": "io.github.chrischall/gogcli-mcp-contacts",
|
|
5
5
|
"description": "Extended Google Contacts + People MCP server via gogcli — auth + Contacts + Workspace directory (People API)",
|
|
6
6
|
"author": "Claude Code (AI) <https://www.anthropic.com/claude>",
|