vexp-mcp 3.1.0 → 3.1.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/dist/daemon-client.js +7 -2
- package/dist/index.js +88 -0
- package/dist/tools/get-skeleton.js +1 -1
- package/package.json +1 -1
package/dist/daemon-client.js
CHANGED
|
@@ -483,10 +483,15 @@ function discoverWorkspaceRoot() {
|
|
|
483
483
|
break;
|
|
484
484
|
current = parent;
|
|
485
485
|
}
|
|
486
|
-
// Pass 2: nearest ancestor with a bare .vexp/ (workspace mid-first-index)
|
|
486
|
+
// Pass 2: nearest ancestor with a bare .vexp/ (workspace mid-first-index)
|
|
487
|
+
// — except the home/VEXP_HOME directory, whose .vexp is vexp's own STATE
|
|
488
|
+
// dir: treating it as a workspace let an agent that spawns servers from
|
|
489
|
+
// the home dir target the whole home (field report, 2026-09-02). Lockstep
|
|
490
|
+
// with vexp-core utils::discover_workspace_root.
|
|
491
|
+
const stateHome = path.resolve(process.env.VEXP_HOME && path.isAbsolute(process.env.VEXP_HOME) ? process.env.VEXP_HOME : os.homedir());
|
|
487
492
|
current = cwd;
|
|
488
493
|
while (true) {
|
|
489
|
-
if (fs.existsSync(path.join(current, ".vexp")))
|
|
494
|
+
if (fs.existsSync(path.join(current, ".vexp")) && path.resolve(current) !== stateHome)
|
|
490
495
|
return current;
|
|
491
496
|
const parent = path.dirname(current);
|
|
492
497
|
if (parent === current)
|
package/dist/index.js
CHANGED
|
@@ -146,6 +146,57 @@ function allToolsEnabled() {
|
|
|
146
146
|
// discoverWorkspaceRoot). The Rust daemon registers itself in
|
|
147
147
|
// ~/.vexp/daemons.json on all platforms, which is the authoritative
|
|
148
148
|
// lookup when an agent spawns the MCP server from an unrelated cwd.
|
|
149
|
+
/**
|
|
150
|
+
* This MCP server's own version, from the package.json that ships it.
|
|
151
|
+
*
|
|
152
|
+
* Resolved from `process.argv[1]` rather than `__dirname`/`import.meta.url`,
|
|
153
|
+
* because the same source runs three ways: as the bundled CJS
|
|
154
|
+
* `vexp-cli/mcp/mcp-server.cjs`, as the copy in `vexp-vscode/dist/`, and from
|
|
155
|
+
* `src/` in development. In all three, the package.json one or two levels up
|
|
156
|
+
* from the entry script is the version the user installed.
|
|
157
|
+
*/
|
|
158
|
+
function mcpServerVersion() {
|
|
159
|
+
const entry = process.argv[1];
|
|
160
|
+
if (!entry)
|
|
161
|
+
return undefined;
|
|
162
|
+
const dir = path.dirname(path.resolve(entry));
|
|
163
|
+
for (const candidate of [
|
|
164
|
+
path.join(dir, "..", "package.json"),
|
|
165
|
+
path.join(dir, "..", "..", "package.json"),
|
|
166
|
+
]) {
|
|
167
|
+
try {
|
|
168
|
+
const pkg = JSON.parse(fs.readFileSync(candidate, "utf-8"));
|
|
169
|
+
if (typeof pkg.version === "string")
|
|
170
|
+
return pkg.version;
|
|
171
|
+
}
|
|
172
|
+
catch { /* keep looking */ }
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Is `recorded` strictly older than `mine`? Third copy of the comparison in
|
|
178
|
+
* vexp-cli/src/mcp-supervisor.ts (which carries the tests) and
|
|
179
|
+
* vexp-vscode/src/daemon-manager.ts. Unknown or unparseable never counts as
|
|
180
|
+
* older here: this one only decides whether to print a warning, and a wrong
|
|
181
|
+
* warning about your own build is worse than none.
|
|
182
|
+
*/
|
|
183
|
+
function isOlderVersion(mine, other) {
|
|
184
|
+
if (mine === other)
|
|
185
|
+
return false;
|
|
186
|
+
const parts = (v) => {
|
|
187
|
+
const nums = v.split("-")[0].split(".").map((n) => Number.parseInt(n, 10));
|
|
188
|
+
return nums.length === 3 && nums.every((n) => Number.isFinite(n)) ? nums : null;
|
|
189
|
+
};
|
|
190
|
+
const a = parts(mine);
|
|
191
|
+
const b = parts(other);
|
|
192
|
+
if (!a || !b)
|
|
193
|
+
return false;
|
|
194
|
+
for (let i = 0; i < 3; i++) {
|
|
195
|
+
if (a[i] !== b[i])
|
|
196
|
+
return a[i] < b[i];
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
149
200
|
export function createMcpServer(daemon) {
|
|
150
201
|
const server = new Server({ name: "vexp-mcp", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
151
202
|
// This surface used to publish expand_vexp_ref mid-session, the first time a
|
|
@@ -168,6 +219,42 @@ export function createMcpServer(daemon) {
|
|
|
168
219
|
? ALL_TOOL_DEFINITIONS
|
|
169
220
|
: MINIMAL_TOOL_DEFINITIONS.map(slimForListing),
|
|
170
221
|
}));
|
|
222
|
+
// ── Am I the build the user thinks they are talking to? ──────────────
|
|
223
|
+
//
|
|
224
|
+
// An MCP server is a long-lived detached process. Upgrading the CLI does
|
|
225
|
+
// not replace it, so agents can be served an old build indefinitely while
|
|
226
|
+
// `vexp --version` in a terminal reports the new one — a tester's agents
|
|
227
|
+
// ran two minor versions behind for as long as it took him to run doctor,
|
|
228
|
+
// and nothing in the MCP path itself said so (tier-4 field report,
|
|
229
|
+
// 2026-09-05). doctor already reports it, but an agent driving vexp purely
|
|
230
|
+
// through MCP never runs doctor and cannot know to ask.
|
|
231
|
+
//
|
|
232
|
+
// The daemon is spawned from the INSTALLED binary, so its version is the
|
|
233
|
+
// installed version: if this process is older than the daemon it is
|
|
234
|
+
// talking to, this process is the stale one. Checked once — a stale server
|
|
235
|
+
// stays stale for its lifetime — and prefixed to every tool result,
|
|
236
|
+
// because a warning the agent has to go looking for is the warning it does
|
|
237
|
+
// not see.
|
|
238
|
+
let staleBanner = null;
|
|
239
|
+
async function staleBuildNotice() {
|
|
240
|
+
if (staleBanner !== null)
|
|
241
|
+
return staleBanner;
|
|
242
|
+
staleBanner = "";
|
|
243
|
+
try {
|
|
244
|
+
const mine = mcpServerVersion();
|
|
245
|
+
if (!mine)
|
|
246
|
+
return staleBanner;
|
|
247
|
+
const status = (await daemon.call("index_status", {}));
|
|
248
|
+
const engine = typeof status?.engine_version === "string" ? status.engine_version : undefined;
|
|
249
|
+
if (engine && isOlderVersion(mine, engine)) {
|
|
250
|
+
staleBanner =
|
|
251
|
+
`> this MCP server is v${mine} but the installed vexp is v${engine} — you are being served ` +
|
|
252
|
+
`the OLD build; restart the MCP client, or run 'vexp setup' in the workspace root to replace it\n\n`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch { /* no daemon, older daemon, no engine_version: say nothing */ }
|
|
256
|
+
return staleBanner;
|
|
257
|
+
}
|
|
171
258
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
172
259
|
const { name, arguments: args } = req.params;
|
|
173
260
|
try {
|
|
@@ -215,6 +302,7 @@ export function createMcpServer(daemon) {
|
|
|
215
302
|
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
216
303
|
};
|
|
217
304
|
}
|
|
305
|
+
text = (await staleBuildNotice()) + text;
|
|
218
306
|
return {
|
|
219
307
|
content: [{ type: "text", text }],
|
|
220
308
|
};
|
|
@@ -23,7 +23,7 @@ export const GET_SKELETON_DEFINITION = {
|
|
|
23
23
|
enum: ["minimal", "standard", "detailed"],
|
|
24
24
|
description: "Skeleton detail level (default: standard)",
|
|
25
25
|
},
|
|
26
|
-
repo: { type: "string", description: "Repo alias (
|
|
26
|
+
repo: { type: "string", description: "Repo alias, as run_pipeline reports it (repo: <alias>). Without it: an absolute path pins its repo; a relative path is looked up in the primary, then in every connected repo" },
|
|
27
27
|
},
|
|
28
28
|
required: ["files"],
|
|
29
29
|
},
|