@vorim/mcp-server 1.1.6 → 1.1.7
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/build/index.js +22 -7
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -40,14 +40,22 @@ if (!API_KEY) {
|
|
|
40
40
|
process.exit(1);
|
|
41
41
|
}
|
|
42
42
|
// ─── HTTP Client ──────────────────────────────────────────────────────────
|
|
43
|
-
// Read the package version once so the User-Agent string and the
|
|
44
|
-
// server's advertised version stay in sync with package.json.
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
43
|
+
// Read the package version once so the User-Agent string and the
|
|
44
|
+
// MCP server's advertised version stay in sync with package.json.
|
|
45
|
+
//
|
|
46
|
+
// Caveats:
|
|
47
|
+
// 1. Bundlers (esbuild / webpack) that inline the source can break
|
|
48
|
+
// the readFileSync path because import.meta.url no longer points
|
|
49
|
+
// at the npm install layout. The fallback constant below is the
|
|
50
|
+
// last-known version and MUST be bumped in lockstep with
|
|
51
|
+
// package.json — there is NO CI assertion enforcing this today.
|
|
52
|
+
// 2. If readFileSync succeeds but JSON.parse fails (corrupt file),
|
|
53
|
+
// we log a warning so operators see the silent drift rather
|
|
54
|
+
// than discovering it via a User-Agent grep weeks later.
|
|
48
55
|
import { readFileSync } from "node:fs";
|
|
49
56
|
import { fileURLToPath } from "node:url";
|
|
50
57
|
import { dirname, join } from "node:path";
|
|
58
|
+
const MCP_VERSION_FALLBACK = "1.1.7";
|
|
51
59
|
function readMcpVersion() {
|
|
52
60
|
try {
|
|
53
61
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -55,9 +63,16 @@ function readMcpVersion() {
|
|
|
55
63
|
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
56
64
|
if (typeof pkg.version === "string")
|
|
57
65
|
return pkg.version;
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
console.warn(`[vorim-mcp-server] package.json missing version field — using fallback ${MCP_VERSION_FALLBACK}`);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
// eslint-disable-next-line no-console
|
|
71
|
+
console.warn(`[vorim-mcp-server] could not read package.json (${err.message ?? err}) — ` +
|
|
72
|
+
`using fallback ${MCP_VERSION_FALLBACK}. If this is a bundled build, bump ` +
|
|
73
|
+
`MCP_VERSION_FALLBACK in lockstep with the published package.`);
|
|
58
74
|
}
|
|
59
|
-
|
|
60
|
-
return "1.1.6"; // hardcoded fallback; bump alongside package.json
|
|
75
|
+
return MCP_VERSION_FALLBACK;
|
|
61
76
|
}
|
|
62
77
|
const MCP_VERSION = readMcpVersion();
|
|
63
78
|
/**
|
package/package.json
CHANGED