suppa-mcp-2 1.7.1 → 1.9.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/README.md CHANGED
@@ -104,6 +104,34 @@ Then run **`suppa_login`** once per tenant to authenticate.
104
104
 
105
105
  ---
106
106
 
107
+ ## Which version is running (and is it current)
108
+
109
+ An MCP client keeps whatever build it started with — an `npx` cache or a
110
+ `node_modules` copy — for the whole session. Publishing a fix changes nothing
111
+ for that session, so "the fix isn't working" and "I'm running last week's
112
+ server" look identical from the inside. Two mechanisms keep them apart:
113
+
114
+ - **`suppa_version`** — read-only, asks the npm registry live, and reports the
115
+ running version, the published one, and the upgrade command. Ask it first
116
+ whenever a tool or behaviour you expect is missing. `suppa_health_check` also
117
+ carries `version` in every report, so a bug report names its build without
118
+ anyone remembering to ask.
119
+ - **An automatic notice.** The server checks the registry in the background
120
+ (detached, cached for 6h, 4s timeout, silent when offline — startup never
121
+ waits). If the running build is behind, the next session's instructions open
122
+ with an `OUTDATED` banner telling the agent to say so in its first reply, and
123
+ to restart the client after updating.
124
+
125
+ Upgrading: `npm i -g suppa-mcp-2@latest`, or pin `suppa-mcp-2@latest` in the
126
+ client's MCP config — then **restart the client**. Without the restart the old
127
+ process, and its old code, keep serving the session.
128
+
129
+ On the source side, the version is stated in `package.json` **only**.
130
+ `scripts/check-version-literals.mjs` runs inside `npm test` (and so inside
131
+ `prepublishOnly`) and fails the build if a version string is typed into `src/`:
132
+ the handshake once announced a hardcoded `1.6.1` for every release after it,
133
+ which made the one diagnostic question unanswerable.
134
+
107
135
  ## Agent workflow
108
136
 
109
137
  When an AI agent connects, the server provides built-in instructions describing the correct workflow. Auth first, then discover schema before reading or writing data:
@@ -176,7 +204,9 @@ work normally. Erasing data for good is an admin action in the platform's own UI
176
204
  | `suppa_list_tenants` | List known tenants + which is active / authenticated |
177
205
  | `suppa_logout` | Remove stored credentials for a tenant |
178
206
  | `suppa_diagnostics` | Validate the whole multi-tenant setup |
179
- | `suppa_health_check` | Config + upstream connectivity check |
207
+ | `suppa_health_check` | Config + upstream connectivity check (reports `version`) |
208
+ | `suppa_version` | Running build vs newest published, and how to upgrade |
209
+ | `suppa_validate_entity_code` | Run the schema gate over an app repo before calling entity code done |
180
210
 
181
211
  ### Tasks
182
212
 
package/dist/server.js CHANGED
@@ -6,14 +6,12 @@
6
6
  * server `instructions` string verbatim, and OWNS all confirm-gating (the tool
7
7
  * modules mutate unconditionally, exactly like the Python tool functions).
8
8
  */
9
- import { readFileSync } from "node:fs";
10
- import { dirname, join } from "node:path";
11
- import { fileURLToPath } from "node:url";
12
9
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
13
10
  import { z } from "zod";
14
11
  import * as tasks from "./tools/tasks.js";
15
12
  import * as docs from "./tools/docs.js";
16
13
  import * as entity from "./tools/entity.js";
14
+ import * as entityCode from "./tools/entityCode.js";
17
15
  import * as files from "./tools/files.js";
18
16
  import * as forms from "./tools/forms.js";
19
17
  import * as migrate from "./tools/migrate.js";
@@ -22,24 +20,8 @@ import * as automation from "./tools/automation.js";
22
20
  import * as auth from "./auth.js";
23
21
  import * as tenants from "./tenants.js";
24
22
  import { confirmRequired, jsonResponse } from "./utils.js";
25
- /**
26
- * The running package's version, read from its own package.json rather than
27
- * typed in. A hand-maintained literal here reported 1.6.1 for every release
28
- * after it, which is exactly the wrong answer to "which version is my client
29
- * actually running?" — the question you ask when a fix appears not to have
30
- * landed. Handshake-only, so a failure to read it must never take the server
31
- * down.
32
- */
33
- export const PACKAGE_VERSION = (() => {
34
- try {
35
- const here = dirname(fileURLToPath(import.meta.url));
36
- // dist/server.js -> ../package.json; src/server.ts (tests) -> ../package.json
37
- return JSON.parse(readFileSync(join(here, "..", "package.json"), "utf-8")).version ?? "unknown";
38
- }
39
- catch {
40
- return "unknown";
41
- }
42
- })();
23
+ import { PACKAGE_NAME, PACKAGE_VERSION, knownLatest, isOutdated, refreshLatestVersion, refreshLatestVersionInBackground, upgradeNotice, } from "./version.js";
24
+ export { PACKAGE_VERSION };
43
25
  // ---------------------------------------------------------------------------
44
26
  // Tool-behavior hints (MCP spec): clients use these for auto-approval policies.
45
27
  // _READ touches nothing; _ADD only creates new data; _MUT changes or removes
@@ -292,8 +274,7 @@ These four rules are house rules of this platform. They OVERRIDE the platform's
292
274
  2. ENUM MEMBER KEYS ARE PascalCase — \`NotFilled = 'Not filled'\`. The stored value is the string on the right and need not match the key.
293
275
  3. NEVER WRITE A FIELD OPTION AT ITS DEFAULT. canGroup, canSort, showInTable, editFromTable and canFilter are already true; readOnly and searchable are already false. Write one ONLY where the field departs from that (usually just \`searchable: true\`). A field with all seven spelled out is wrong even though it works.
294
276
  4. @Enum/@MultiEnum TAKE THE GLOBAL NAME ONLY WHEN THE ENUM IS GLOBAL — shared by another entity, or referenced from a seed record. Otherwise omit the first argument entirely: \`@Enum(StatusEnum, StatusTitles, { … })\`, and the decorator derives <ClassName>.<propertyName>. A field's own \`key: 'Entity.field'\` is the rename key, NOT a reference, and does not make the enum global.
295
- Before reporting the file done, run the gate — it fails (exit 1) on every one of the four:
296
- node node_modules/suppa-mcp-2/skills/suppa-entity-code/scripts/validate-suppa-schema.mjs <app-root>
277
+ Before reporting the file done, run the gate: call suppa_validate_entity_code(path=<app-root>). It fails on every one of the four and names file:line. passed=false means fix and re-run, not \"note and move on\". (Same checker on the command line: node node_modules/suppa-mcp-2/skills/suppa-entity-code/scripts/validate-suppa-schema.mjs <app-root>.)
297
278
 
298
279
  ATTACHMENTS (files on a record)
299
280
  - A record can carry files only if its entity has a 'file' or 'multi-file' field; check with suppa_describe_entity and add one with suppa_add_field if it has none.
@@ -335,7 +316,11 @@ export function buildServer() {
335
316
  // Reset so repeated buildServer() calls (e.g. in tests) do not double-count.
336
317
  TOOL_NAMES.length = 0;
337
318
  PROMPT_NAMES.length = 0;
338
- const server = new McpServer({ name: "suppa-2.0", version: PACKAGE_VERSION }, { instructions: INSTRUCTIONS });
319
+ // Detached, cached, TTL-limited: this session's instructions carry whatever
320
+ // the last check found, and this call keeps the answer fresh for the next
321
+ // one. Startup must never wait on the network.
322
+ refreshLatestVersionInBackground();
323
+ const server = new McpServer({ name: "suppa-2.0", version: PACKAGE_VERSION }, { instructions: INSTRUCTIONS + upgradeNotice() });
339
324
  const reg = (name, cfg, handler) => {
340
325
  server.registerTool(name, {
341
326
  description: cfg.description,
@@ -2182,6 +2167,68 @@ export function buildServer() {
2182
2167
  description: "List known Suppa tenants — which one is active and whether each is authenticated.",
2183
2168
  annotations: _READ,
2184
2169
  }, async () => text(tenants.listTenants()));
2170
+ reg("suppa_validate_entity_code", {
2171
+ description: "Run the schema gate over an application repo's *.entity.ts / *.seed.ts / module files.\n\n" +
2172
+ " CALL THIS BEFORE REPORTING ANY ENTITY OR SEED FILE DONE. It is the same checker the\n" +
2173
+ " bundled suppa-entity-code skill names as its close-out gate, and it catches what tsc\n" +
2174
+ " cannot: an unregistered entity class (no table is ever created for it), a JS value in\n" +
2175
+ " 'default' where a SQL string is required, a relation without a thunk, seed records that\n" +
2176
+ " duplicate on every restart — plus the four house rules, which fail the gate:\n" +
2177
+ " * a relation property must be typed to match its decorator (Target / Target[], and\n" +
2178
+ " optional when the relation is nullable) — never 'any';\n" +
2179
+ " * enum member keys are PascalCase;\n" +
2180
+ " * no field option may be written at its default (canGroup/canSort/showInTable/\n" +
2181
+ " editFromTable/canFilter are already true, readOnly/searchable already false);\n" +
2182
+ " * @Enum/@MultiEnum take a global name ONLY when the enum is shared or seed-referenced.\n" +
2183
+ ' Pass the app ROOT, not one file: several rules read the whole repo ("nothing references\n' +
2184
+ " this enum name\" cannot be judged from a single file).\n" +
2185
+ " passed=false means fix and re-run — it is not advisory.",
2186
+ inputSchema: {
2187
+ path: z
2188
+ .string()
2189
+ .describe("ABSOLUTE path to the application repo root (preferred), or to one *.entity.ts / *.seed.ts file."),
2190
+ strict: z
2191
+ .boolean()
2192
+ .default(true)
2193
+ .describe("true (default): the four house rules fail the gate. false: they are reported as advisory — " +
2194
+ "for a legacy repo you are not cleaning up in this pass, never for a file you just wrote."),
2195
+ },
2196
+ annotations: _READ,
2197
+ }, async (a) => text(await entityCode.validateEntityCode(a.path, a.strict)));
2198
+ reg("suppa_version", {
2199
+ description: "Which suppa-mcp-2 build this session is actually running, and whether a newer one is\n" +
2200
+ " published. Ask this FIRST whenever a fix, tool or behaviour you were told exists is\n" +
2201
+ " missing or behaves the old way: an MCP client keeps whatever version it started with\n" +
2202
+ " (npx cache / node_modules) for the whole session, so a release changes nothing until\n" +
2203
+ " the client is restarted on the new package. Reports running, latest, whether an\n" +
2204
+ " upgrade is available, and the command to run.",
2205
+ annotations: _READ,
2206
+ }, async () => {
2207
+ // Force a live lookup: this tool is the one place staleness must be
2208
+ // answered from the registry, not from a cache that may predate a release.
2209
+ const latest = await refreshLatestVersion(true);
2210
+ const outdated = isOutdated();
2211
+ return text(jsonResponse({
2212
+ package: PACKAGE_NAME,
2213
+ running: PACKAGE_VERSION,
2214
+ latest: latest ?? knownLatest(),
2215
+ up_to_date: latest ? !outdated : null,
2216
+ checked: latest !== null,
2217
+ upgrade: outdated
2218
+ ? {
2219
+ command: `npm i -g ${PACKAGE_NAME}@latest`,
2220
+ then: "RESTART the MCP client — a running server keeps its old code for the whole session.",
2221
+ note: "If the client launches this server via npx, pin @latest in its MCP config; npx " +
2222
+ "reuses a cached copy otherwise.",
2223
+ }
2224
+ : null,
2225
+ note: latest === null
2226
+ ? "The npm registry could not be reached, so 'latest' is the last value this machine cached (or null). The running version is exact."
2227
+ : outdated
2228
+ ? `Running ${PACKAGE_VERSION}; ${latest} is published. Tell the user, and treat any behaviour that contradicts newer docs as this build's behaviour.`
2229
+ : "This is the newest published build.",
2230
+ }));
2231
+ });
2185
2232
  reg("suppa_logout", {
2186
2233
  description: "Remove stored keychain credentials for a tenant (default: the active one).\n\n" +
2187
2234
  " APPROVAL GATE: without confirm=true this returns a confirmation request and\n" +
@@ -2342,6 +2389,12 @@ async function healthCheck(deep = true) {
2342
2389
  const token = ctx.getToken();
2343
2390
  const body = {
2344
2391
  service: "suppa-mcp",
2392
+ // Every health report names the build it came from: a bug report or a
2393
+ // "that fix isn't working" carries its version without anyone remembering
2394
+ // to ask. `outdated` is from the cached registry check (suppa_version
2395
+ // re-checks live).
2396
+ version: PACKAGE_VERSION,
2397
+ outdated: isOutdated() ? { latest: knownLatest(), action: "restart the client on the new package" } : false,
2345
2398
  tenant: ctx.host,
2346
2399
  base_url: ctx.baseUrl,
2347
2400
  token_configured: Boolean(token),
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The entity-code gate, as a tool.
3
+ *
4
+ * The rules for writing *.entity.ts live in three places of decreasing reach:
5
+ * the bundled skill (an agent may never open it), the server instructions (read,
6
+ * but advice), and the validator (decisive — and skipped, because running it
7
+ * means shelling out to a path the agent has to work out). Entities kept
8
+ * shipping with every default option restated and a global enum name on a local
9
+ * enum, all of which the validator catches.
10
+ *
11
+ * So the gate becomes a tool call. Same checker as
12
+ * skills/suppa-entity-code/scripts/validate-suppa-schema.mjs — loaded from the
13
+ * installed package, never reimplemented — reporting the same codes.
14
+ */
15
+ import { existsSync, statSync } from "node:fs";
16
+ import { dirname, isAbsolute, join, resolve } from "node:path";
17
+ import { fileURLToPath, pathToFileURL } from "node:url";
18
+ import { jsonResponse } from "../utils.js";
19
+ /** Where the bundled skill sits, from dist/tools/ or src/tools/ alike. */
20
+ function validatorPath() {
21
+ const here = dirname(fileURLToPath(import.meta.url));
22
+ for (const root of [join(here, "..", ".."), join(here, "..", "..", "..")]) {
23
+ const p = join(root, "skills", "suppa-entity-code", "scripts", "validate-suppa-schema.mjs");
24
+ if (existsSync(p))
25
+ return p;
26
+ }
27
+ return null;
28
+ }
29
+ /**
30
+ * Run the schema gate over an application repo (or a single file).
31
+ *
32
+ * `path` is an app root — the whole repo is walked, which is also what lets the
33
+ * unreferenced-enum-name rule speak, since it argues from absence and needs to
34
+ * see every file that could hold a reference.
35
+ */
36
+ export async function validateEntityCode(path, strict = true) {
37
+ const target = String(path ?? "").trim();
38
+ if (!target) {
39
+ return jsonResponse({
40
+ error: "path is required — give the application repo's root (preferred: the whole repo is checked, " +
41
+ "and the enum-name rule needs that) or one *.entity.ts / *.seed.ts file.",
42
+ });
43
+ }
44
+ if (!isAbsolute(target)) {
45
+ return jsonResponse({ error: `path must be absolute, got '${target}'.` });
46
+ }
47
+ if (!existsSync(target)) {
48
+ return jsonResponse({ error: `path not found: ${target}` });
49
+ }
50
+ const script = validatorPath();
51
+ if (!script) {
52
+ return jsonResponse({
53
+ error: "The bundled validator is missing from this installation " +
54
+ "(skills/suppa-entity-code/scripts/validate-suppa-schema.mjs). Reinstall suppa-mcp-2.",
55
+ });
56
+ }
57
+ let mod;
58
+ try {
59
+ mod = await import(pathToFileURL(script).href);
60
+ }
61
+ catch (e) {
62
+ return jsonResponse({
63
+ error: `Could not load the validator: ${e instanceof Error ? e.message : String(e)}`,
64
+ });
65
+ }
66
+ const isDir = (() => {
67
+ try {
68
+ return statSync(target).isDirectory();
69
+ }
70
+ catch {
71
+ return false;
72
+ }
73
+ })();
74
+ let files;
75
+ let rootDir = null;
76
+ if (isDir) {
77
+ rootDir = resolve(target);
78
+ files = mod.discoverFiles(rootDir);
79
+ if (!files.length) {
80
+ return jsonResponse({
81
+ error: `No schema files under ${target}. Expected *.entity.ts, *.seed.ts, or a .ts file ` +
82
+ "containing EntityModule.forFeature — nothing was analyzed, so nothing was verified.",
83
+ });
84
+ }
85
+ }
86
+ else {
87
+ files = [resolve(target)];
88
+ }
89
+ let res;
90
+ try {
91
+ res = mod.validateSchema({ files, rootDir });
92
+ }
93
+ catch (e) {
94
+ // A missing/unusable TypeScript in the target repo is the caller's to fix.
95
+ return jsonResponse({
96
+ error: e?.message ?? String(e),
97
+ hint: e?.code === "SUPPA_VALIDATOR_ENV"
98
+ ? "Run `npm install` in the application repo (the checker parses with ITS typescript), or `npm i -D typescript@5`."
99
+ : undefined,
100
+ });
101
+ }
102
+ // Same split the CLI blocks on: errors always, authoring-rule warnings under
103
+ // strict, and W613 only when the whole repo was walked (it argues from
104
+ // absence). Advisory warnings never block.
105
+ const ruleCodes = mod.RULE_WARNINGS ?? [];
106
+ const needsWholeRepo = mod.RULE_WARNINGS_NEEDING_WHOLE_REPO ?? [];
107
+ const blocks = (f) => strict && ruleCodes.includes(f.code) && (rootDir !== null || !needsWholeRepo.includes(f.code));
108
+ const shape = (f) => ({
109
+ file: f.file,
110
+ line: f.line,
111
+ col: f.col,
112
+ code: f.code,
113
+ message: f.message,
114
+ });
115
+ const violations = res.findings.filter(blocks).map(shape);
116
+ const errors = res.errors.map(shape);
117
+ const advisory = res.warnings.filter((f) => !blocks(f)).map(shape);
118
+ const passed = errors.length + violations.length === 0;
119
+ return jsonResponse({
120
+ passed,
121
+ checked: { path: target, files: files.length, whole_repo: rootDir !== null, strict },
122
+ errors,
123
+ rule_violations: violations,
124
+ advisory_warnings: advisory,
125
+ note: passed
126
+ ? advisory.length
127
+ ? "Gate passed. The advisory warnings say what could NOT be checked (content delivered by reference, a missing tsconfig) — read them before trusting a clean run."
128
+ : "Gate passed."
129
+ : "Gate FAILED — do not report the file done. Fix every entry in errors and rule_violations, then re-run. " +
130
+ "rule_violations are the house rules: relation typing, PascalCase enum keys, no option written at its " +
131
+ "default, and no global enum name on a local enum.",
132
+ });
133
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Which version is running, and is it the current one.
3
+ *
4
+ * Two failures this module exists to make impossible to miss:
5
+ *
6
+ * 1. A version typed into the source. The MCP handshake announced a literal
7
+ * "1.6.1" for every release after it, so a client running the fix and a
8
+ * client running six releases behind reported the same string — the one
9
+ * question you ask when a fix appears not to have landed had a useless
10
+ * answer. PACKAGE_VERSION reads package.json; the release gate
11
+ * (scripts/check-version-literals.mjs) refuses any other spelling in src/.
12
+ *
13
+ * 2. An old version installed. A client pins whatever npx cached or
14
+ * node_modules holds; publishing a fix changes nothing until that client is
15
+ * restarted with the new package, and NOTHING in the session says so. The
16
+ * check below compares the running version against the registry and puts the
17
+ * answer where an agent cannot miss it: the server instructions, and the
18
+ * suppa_version tool.
19
+ *
20
+ * The registry lookup never blocks and never throws: it runs detached from
21
+ * startup, writes a cache, and the next session reads it. A machine with no
22
+ * network keeps working and simply never reports an upgrade.
23
+ */
24
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
25
+ import { dirname, join } from "node:path";
26
+ import { fileURLToPath } from "node:url";
27
+ import { homeDir } from "./registry.js";
28
+ /** The running package's own version, from its package.json. Never a literal. */
29
+ export const PACKAGE_VERSION = readOwnVersion();
30
+ function readOwnVersion() {
31
+ // dist/version.js -> ../package.json; src/version.ts (tests) -> ../package.json
32
+ const here = dirname(fileURLToPath(import.meta.url));
33
+ for (const candidate of [join(here, "..", "package.json"), join(here, "..", "..", "package.json")]) {
34
+ try {
35
+ const pkg = JSON.parse(readFileSync(candidate, "utf-8"));
36
+ if (pkg?.name === "suppa-mcp-2" && typeof pkg.version === "string")
37
+ return pkg.version;
38
+ }
39
+ catch {
40
+ /* try the next candidate */
41
+ }
42
+ }
43
+ return "unknown";
44
+ }
45
+ export const PACKAGE_NAME = "suppa-mcp-2";
46
+ const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
47
+ /** How long a registry answer is trusted before it is fetched again. */
48
+ const CACHE_TTL_MS = 6 * 60 * 60 * 1000;
49
+ function cachePath() {
50
+ return join(homeDir(), "version-check.json");
51
+ }
52
+ function readCache() {
53
+ try {
54
+ const data = JSON.parse(readFileSync(cachePath(), "utf-8"));
55
+ if (typeof data?.latest === "string" && typeof data?.checked_at === "number")
56
+ return data;
57
+ }
58
+ catch {
59
+ /* absent or unreadable — treat as "never checked" */
60
+ }
61
+ return null;
62
+ }
63
+ function writeCache(cache) {
64
+ try {
65
+ mkdirSync(homeDir(), { recursive: true });
66
+ // Same write-then-rename the tenant registry uses: two servers starting at
67
+ // once must never read a half-written file.
68
+ const tmp = `${cachePath()}.${process.pid}.tmp`;
69
+ writeFileSync(tmp, `${JSON.stringify(cache, null, 2)}\n`, "utf-8");
70
+ renameSync(tmp, cachePath());
71
+ }
72
+ catch {
73
+ /* a cache that cannot be written just means the next session re-checks */
74
+ }
75
+ }
76
+ /** -1 / 0 / 1 by semver precedence; prerelease tags are ignored (we publish none). */
77
+ export function compareVersions(a, b) {
78
+ const parse = (v) => String(v)
79
+ .replace(/^v/, "")
80
+ .split("-")[0]
81
+ .split(".")
82
+ .map((n) => Number.parseInt(n, 10) || 0);
83
+ const [x, y] = [parse(a), parse(b)];
84
+ for (let i = 0; i < Math.max(x.length, y.length); i++) {
85
+ const d = (x[i] ?? 0) - (y[i] ?? 0);
86
+ if (d !== 0)
87
+ return d < 0 ? -1 : 1;
88
+ }
89
+ return 0;
90
+ }
91
+ /** The newest version this machine has ever seen, or null if it never looked. */
92
+ export function knownLatest() {
93
+ return readCache()?.latest ?? null;
94
+ }
95
+ /** Is the running build behind the newest version we know of? */
96
+ export function isOutdated() {
97
+ const latest = knownLatest();
98
+ if (!latest || PACKAGE_VERSION === "unknown")
99
+ return false;
100
+ return compareVersions(PACKAGE_VERSION, latest) < 0;
101
+ }
102
+ /**
103
+ * Ask the registry for the latest version, at most once per TTL, and cache it.
104
+ * Detached on purpose — the caller never awaits it, so a slow or blocked
105
+ * registry cannot delay a single tool call.
106
+ */
107
+ export async function refreshLatestVersion(force = false) {
108
+ const cached = readCache();
109
+ if (!force && cached && Date.now() - cached.checked_at < CACHE_TTL_MS)
110
+ return cached.latest;
111
+ try {
112
+ const controller = new AbortController();
113
+ const timer = setTimeout(() => controller.abort(), 4000);
114
+ const res = await fetch(REGISTRY_URL, {
115
+ signal: controller.signal,
116
+ headers: { accept: "application/vnd.npm.install-v1+json, application/json" },
117
+ });
118
+ clearTimeout(timer);
119
+ if (!res.ok)
120
+ return cached?.latest ?? null;
121
+ const body = (await res.json());
122
+ if (typeof body?.version !== "string")
123
+ return cached?.latest ?? null;
124
+ writeCache({ latest: body.version, checked_at: Date.now() });
125
+ return body.version;
126
+ }
127
+ catch {
128
+ // Offline, blocked, or slow. The running version is still perfectly usable.
129
+ return cached?.latest ?? null;
130
+ }
131
+ }
132
+ /** Fire the check without awaiting it, swallowing everything. */
133
+ export function refreshLatestVersionInBackground() {
134
+ void refreshLatestVersion().catch(() => undefined);
135
+ }
136
+ /**
137
+ * The line that goes into the server instructions when the running build is
138
+ * behind — empty otherwise, so a current install carries no noise.
139
+ */
140
+ export function upgradeNotice() {
141
+ if (!isOutdated())
142
+ return "";
143
+ return (`\n\nVERSION — YOU ARE RUNNING AN OUTDATED suppa-mcp-2 (${PACKAGE_VERSION}; ${knownLatest()} is published).\n` +
144
+ "Everything below describes THIS build, and fixes released since it are absent — behaviour you " +
145
+ "were told is fixed may not be. Before doing anything else, tell the user, in your first reply, " +
146
+ `that suppa-mcp-2 ${knownLatest()} is available and that the MCP client must be restarted after ` +
147
+ "updating (a running server keeps its old code for the whole session). Upgrade with " +
148
+ `\`npm i -g ${PACKAGE_NAME}@latest\` or by pinning @latest in the client's MCP config; ` +
149
+ "confirm with suppa_version.");
150
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suppa-mcp-2",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "rebuild": "npm run clean && npm run build",
23
23
  "start": "node dist/bin.js",
24
24
  "dev": "tsc --watch",
25
- "test": "vitest run",
25
+ "test": "node scripts/check-version-literals.mjs && vitest run",
26
26
  "test:watch": "vitest",
27
27
  "prepublishOnly": "npm run build && npm test",
28
28
  "inspect": "npx @modelcontextprotocol/inspector node dist/bin.js"