sublime-mcp 1.4.1 → 1.4.2
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/index.js +11 -1
- package/package.json +1 -1
- package/test_fallback_catalog.mjs +14 -0
package/index.js
CHANGED
|
@@ -20,7 +20,17 @@ function ok(data) {
|
|
|
20
20
|
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
// Version comes from package.json so the advertised MCP serverInfo cannot
|
|
24
|
+
// drift from the published package (it had already fallen behind at 1.4.0).
|
|
25
|
+
// package.json is BOM-prefixed here and JSON.parse rejects a leading BOM.
|
|
26
|
+
const VERSION = JSON.parse(
|
|
27
|
+
readFileSync(
|
|
28
|
+
join(dirname(fileURLToPath(import.meta.url)), 'package.json'),
|
|
29
|
+
'utf8',
|
|
30
|
+
).replace(/^\uFEFF/, ''),
|
|
31
|
+
).version;
|
|
32
|
+
|
|
33
|
+
const server = new McpServer({ name: 'sublime-mcp', version: VERSION });
|
|
24
34
|
server.setToolRequestHandlers();
|
|
25
35
|
|
|
26
36
|
// ── JSON Schema → Zod (shallow) for dynamic discovery ────────────────────────
|
package/package.json
CHANGED
|
@@ -94,6 +94,20 @@ async function main() {
|
|
|
94
94
|
const openFile = listed.tools.find(t => t.name === 'open_file');
|
|
95
95
|
assert.ok(openFile.inputSchema?.properties?.path, 'open_file lost its typed schema');
|
|
96
96
|
console.log('PASS: generated schemas reach the client');
|
|
97
|
+
|
|
98
|
+
// The server must report the published package version. This is also the
|
|
99
|
+
// check that catches index.js failing to even start: package.json here is
|
|
100
|
+
// BOM-prefixed, and JSON.parse rejects a leading BOM.
|
|
101
|
+
const pkg = JSON.parse(
|
|
102
|
+
readFileSync(new URL('./package.json', import.meta.url), 'utf8').replace(/^\uFEFF/, ''),
|
|
103
|
+
);
|
|
104
|
+
const reported = client.getServerVersion();
|
|
105
|
+
assert.equal(
|
|
106
|
+
reported?.version,
|
|
107
|
+
pkg.version,
|
|
108
|
+
`server reported version ${reported?.version}, package.json says ${pkg.version}`,
|
|
109
|
+
);
|
|
110
|
+
console.log('PASS: server reports the package.json version (%s)', pkg.version);
|
|
97
111
|
} finally {
|
|
98
112
|
await client.close();
|
|
99
113
|
server.close();
|