engine-dj-mcp 0.9.0 → 0.9.1
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/server.js +17 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/server.ts
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -18,6 +18,21 @@ import { listLibraries } from "./tools/libraries.js";
|
|
|
18
18
|
import { refreshIndex } from "./tools/refresh.js";
|
|
19
19
|
import { err, isEngineError, libraryNeedsRecovery } from "./errors.js";
|
|
20
20
|
const RO = { readOnlyHint: true, destructiveHint: false, idempotentHint: true };
|
|
21
|
+
/**
|
|
22
|
+
* name/version reported to every client on initialize. Read from
|
|
23
|
+
* package.json rather than typed here, so the two cannot re-diverge the way
|
|
24
|
+
* they already have once (this constructor shipped 0.1.0 while package.json
|
|
25
|
+
* said 0.9.0).
|
|
26
|
+
*
|
|
27
|
+
* Resolved via import.meta.url, one directory up from this module, not by
|
|
28
|
+
* relative path from cwd: this runs under `npx` from an arbitrary working
|
|
29
|
+
* directory, and package.json sits next to dist/ (this module's compiled
|
|
30
|
+
* location) in both the repo (src/../package.json) and the installed
|
|
31
|
+
* layout (dist/../package.json) -- package.json is always included in the
|
|
32
|
+
* published tarball regardless of the "files" field, so this path exists
|
|
33
|
+
* in both places even though "files" lists only "dist".
|
|
34
|
+
*/
|
|
35
|
+
const PACKAGE_INFO = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
21
36
|
/**
|
|
22
37
|
* Appended to every tool description that takes a `library`. The argument's
|
|
23
38
|
* own schema description (see library-select.ts) is the authoritative text;
|
|
@@ -59,7 +74,7 @@ export function findHotJournalCandidate(roots) {
|
|
|
59
74
|
return null;
|
|
60
75
|
}
|
|
61
76
|
export async function createServer(opts = {}) {
|
|
62
|
-
const server = new McpServer({ name:
|
|
77
|
+
const server = new McpServer({ name: PACKAGE_INFO.name, version: PACKAGE_INFO.version });
|
|
63
78
|
const libs = discoverLibraries(opts.roots);
|
|
64
79
|
// Shared by every tool for the "no primary library" case, so refresh_index
|
|
65
80
|
// cannot end up as the one call site that still flattens a hot journal
|