vexp-mcp 2.6.3 → 3.0.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/README.md +31 -0
- package/dist/index.js +81 -16
- package/dist/tools/get-skeleton.js +17 -13
- package/dist/tools/verify-done.js +55 -0
- package/package.json +28 -2
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# vexp-mcp — MCP Server for AI Coding Agents (Claude Code, Cursor, Codex)
|
|
2
|
+
|
|
3
|
+
**The [Model Context Protocol](https://modelcontextprotocol.io) server behind [vexp](https://vexp.dev), the local-first context engine for AI coding agents.**
|
|
4
|
+
|
|
5
|
+
`vexp-mcp` exposes your codebase's dependency graph to any MCP-capable agent — Claude Code, Cursor, Windsurf, OpenAI Codex, Zed, Cline and more — as a small, deliberately slim set of tools. Ranked pivot files with line ranges and blast radius in one call, compact file skeletons at 70–90% token savings, and a mechanical completion check when the agent says it's done. Everything runs on your machine: no cloud indexing, no API key, and your source never leaves your laptop.
|
|
6
|
+
|
|
7
|
+
> **You normally don't install this package directly.** Install [`vexp-cli`](https://www.npmjs.com/package/vexp-cli) (or the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=vexp.vexp-vscode)) and run `vexp setup` — it wires this server into every agent it detects.
|
|
8
|
+
|
|
9
|
+
## Tools your agent gets
|
|
10
|
+
|
|
11
|
+
| Tool | What it does |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `run_pipeline` | Ranked pivot files + line ranges + blast radius for a task, in one call |
|
|
14
|
+
| `get_skeleton` | File structure at 70–90% token savings, for files the agent only needs to understand |
|
|
15
|
+
| `verify_done` | Mechanical completion check: parse errors, broken imports, untouched dependents, impacted tests |
|
|
16
|
+
| `expand_vexp_ref` | Full body of any referenced symbol, on demand |
|
|
17
|
+
|
|
18
|
+
The catalog is kept deliberately small — 3.0 trimmed it to roughly a third of its former token footprint — because every listed schema rides along on every request your agent makes.
|
|
19
|
+
|
|
20
|
+
## Why teams use vexp
|
|
21
|
+
|
|
22
|
+
- **Sessions cost less, measured.** vexp 3.0 was tuned on full agent sessions paired against the same agent without vexp: more tasks resolved, 13% less context replay, 8% lower session cost — 20% lower on long sessions.
|
|
23
|
+
- **87% fewer tokens per call** than reading whole files, on real usage.
|
|
24
|
+
- **100% local.** Zero network calls, zero cloud indexing, works offline.
|
|
25
|
+
- **14 agents, 34 languages**, one `vexp setup`.
|
|
26
|
+
|
|
27
|
+
→ [vexp.dev](https://vexp.dev) · [Docs](https://vexp.dev/docs) · [`vexp-cli` on npm](https://www.npmjs.com/package/vexp-cli)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<sub><strong>Keywords:</strong> MCP server · Model Context Protocol · AI coding agent · Claude Code MCP · Cursor MCP · code context · token savings · dependency graph · tree-sitter · local-first · code verification</sub>
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { SEARCH_MEMORY_DEFINITION, handleSearchMemory, } from "./tools/search-me
|
|
|
19
19
|
import { SAVE_OBSERVATION_DEFINITION, handleSaveObservation, } from "./tools/save-observation.js";
|
|
20
20
|
import { RUN_PIPELINE_DEFINITION, handleRunPipeline, } from "./tools/run-pipeline.js";
|
|
21
21
|
import { EXPAND_VEXP_REF_DEFINITION, handleExpandVexpRef, } from "./tools/expand-vexp-ref.js";
|
|
22
|
+
import { VERIFY_DONE_DEFINITION, handleVerifyDone, } from "./tools/verify-done.js";
|
|
22
23
|
const ALL_TOOL_DEFINITIONS = [
|
|
23
24
|
RUN_PIPELINE_DEFINITION,
|
|
24
25
|
GET_CONTEXT_CAPSULE_DEFINITION,
|
|
@@ -31,6 +32,7 @@ const ALL_TOOL_DEFINITIONS = [
|
|
|
31
32
|
SEARCH_MEMORY_DEFINITION,
|
|
32
33
|
SAVE_OBSERVATION_DEFINITION,
|
|
33
34
|
EXPAND_VEXP_REF_DEFINITION,
|
|
35
|
+
VERIFY_DONE_DEFINITION,
|
|
34
36
|
];
|
|
35
37
|
/**
|
|
36
38
|
* Minimal tool surface exposed to agents when VEXP_ALL_TOOLS is not set.
|
|
@@ -53,6 +55,7 @@ const ESSENTIAL_TOOL_DEFINITIONS = [
|
|
|
53
55
|
GET_SKELETON_DEFINITION,
|
|
54
56
|
INDEX_STATUS_DEFINITION,
|
|
55
57
|
EXPAND_VEXP_REF_DEFINITION,
|
|
58
|
+
VERIFY_DONE_DEFINITION,
|
|
56
59
|
];
|
|
57
60
|
/**
|
|
58
61
|
* Default surface (2.3.3): the two tools an agent needs up front. Every
|
|
@@ -69,9 +72,67 @@ const ESSENTIAL_TOOL_DEFINITIONS = [
|
|
|
69
72
|
* keep working whether or not it is listed.
|
|
70
73
|
* VEXP_ALL_TOOLS=1 restores the full surface.
|
|
71
74
|
*/
|
|
75
|
+
/**
|
|
76
|
+
* Trim a definition down to what `tools/list` has to carry.
|
|
77
|
+
*
|
|
78
|
+
* The advertised catalog is resident in the agent's context on EVERY turn; a
|
|
79
|
+
* call happens at most once. Measured on a 13-instance bench run: 41.6 API
|
|
80
|
+
* turns per session against a 65,521-token transcript, and this surface's
|
|
81
|
+
* three listed schemas were ~1,078 tokens of that, re-sent every turn. The
|
|
82
|
+
* models called them 5 times in ~10,000 tool calls.
|
|
83
|
+
*
|
|
84
|
+
* So the listing keeps the decision rule (when to call me) and drops the
|
|
85
|
+
* explanation plus every advanced parameter no model has been observed to
|
|
86
|
+
* set. Dispatch and Zod validation still use the full definitions: this
|
|
87
|
+
* narrows the shop window, not the shop.
|
|
88
|
+
*/
|
|
89
|
+
const LISTING_OVERRIDES = {
|
|
90
|
+
run_pipeline: {
|
|
91
|
+
description: "Ranked pivot files with line ranges plus blast radius for this repo, in one call. " +
|
|
92
|
+
"Use at task start when the task does NOT already name the files to touch; skip it when it does.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
task: { type: "string", description: "The task, anchored on real identifiers or paths" },
|
|
97
|
+
preset: { type: "string", enum: ["auto", "explore", "modify", "debug", "refactor"] },
|
|
98
|
+
},
|
|
99
|
+
required: ["task"],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
get_skeleton: {
|
|
103
|
+
description: "File structure (signatures, classes, types) at ~85% fewer tokens than Read. " +
|
|
104
|
+
"For files you need to understand, not edit.",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {
|
|
108
|
+
files: { type: "array", items: { type: "string" } },
|
|
109
|
+
detail: { type: "string", enum: ["minimal", "standard", "detailed"] },
|
|
110
|
+
},
|
|
111
|
+
required: ["files"],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
verify_done: {
|
|
115
|
+
// The one tool bench models actually reached for. Trimmed, not gutted:
|
|
116
|
+
// its description is what earns the call.
|
|
117
|
+
description: "Call BEFORE declaring a multi-file task complete: returns files that no longer parse, " +
|
|
118
|
+
"imports of names that no longer exist, dependents you left untouched (file:line), and " +
|
|
119
|
+
"the impacted tests. Run those tests. No parameters.",
|
|
120
|
+
inputSchema: { type: "object", properties: {} },
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
export function slimForListing(def) {
|
|
124
|
+
const o = LISTING_OVERRIDES[def.name];
|
|
125
|
+
return o ? { ...def, description: o.description, inputSchema: o.inputSchema } : def;
|
|
126
|
+
}
|
|
72
127
|
const MINIMAL_TOOL_DEFINITIONS = [
|
|
73
128
|
RUN_PIPELINE_DEFINITION,
|
|
74
129
|
GET_SKELETON_DEFINITION,
|
|
130
|
+
// Listed, not optional: the CLAUDE.md vexp writes into every project tells
|
|
131
|
+
// the agent to call this before declaring a multi-file task complete. An
|
|
132
|
+
// instruction that names a tool the agent cannot see is worse than no
|
|
133
|
+
// instruction. The Rust server has always listed it; this surface did not
|
|
134
|
+
// even implement it, and a user found that out for us.
|
|
135
|
+
VERIFY_DONE_DEFINITION,
|
|
75
136
|
];
|
|
76
137
|
function allToolsEnabled() {
|
|
77
138
|
const v = process.env.VEXP_ALL_TOOLS;
|
|
@@ -86,24 +147,26 @@ function allToolsEnabled() {
|
|
|
86
147
|
// ~/.vexp/daemons.json on all platforms, which is the authoritative
|
|
87
148
|
// lookup when an agent spawns the MCP server from an unrelated cwd.
|
|
88
149
|
export function createMcpServer(daemon) {
|
|
89
|
-
const server = new Server({ name: "vexp-mcp", version: "1.0.0" }, { capabilities: { tools: {
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
150
|
+
const server = new Server({ name: "vexp-mcp", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
151
|
+
// This surface used to publish expand_vexp_ref mid-session, the first time a
|
|
152
|
+
// response carried a [V-REF:...] placeholder, via tools/list_changed. It was
|
|
153
|
+
// meant to save the schema's weight until the tool became relevant. The
|
|
154
|
+
// arithmetic says it did the opposite.
|
|
155
|
+
//
|
|
156
|
+
// The tools array is the FIRST thing in the request, so it is the prefix of
|
|
157
|
+
// the prompt cache. Changing it mid-session invalidates the cache for tools,
|
|
158
|
+
// system and every message after them: the whole ~23,000-token prefix is
|
|
159
|
+
// re-created at the 1.25x write price. Carrying the schema instead costs
|
|
160
|
+
// ~60 tokens on each remaining turn at the 0.1x cache-read price — roughly
|
|
161
|
+
// 1,200 tokens over a typical tail. Publishing the change is ~24x worse
|
|
162
|
+
// than never hiding the tool.
|
|
163
|
+
//
|
|
164
|
+
// So the listing is now static, and the in-band fallback every V-REF
|
|
165
|
+
// response already carries ("or Read the file") covers the rest.
|
|
101
166
|
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
102
167
|
tools: allToolsEnabled()
|
|
103
168
|
? ALL_TOOL_DEFINITIONS
|
|
104
|
-
:
|
|
105
|
-
? [...MINIMAL_TOOL_DEFINITIONS, EXPAND_VEXP_REF_DEFINITION]
|
|
106
|
-
: MINIMAL_TOOL_DEFINITIONS,
|
|
169
|
+
: MINIMAL_TOOL_DEFINITIONS.map(slimForListing),
|
|
107
170
|
}));
|
|
108
171
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
109
172
|
const { name, arguments: args } = req.params;
|
|
@@ -125,6 +188,9 @@ export function createMcpServer(daemon) {
|
|
|
125
188
|
case "index_status":
|
|
126
189
|
text = await handleIndexStatus(args, daemon);
|
|
127
190
|
break;
|
|
191
|
+
case "verify_done":
|
|
192
|
+
text = await handleVerifyDone(args, daemon);
|
|
193
|
+
break;
|
|
128
194
|
case "workspace_setup":
|
|
129
195
|
text = await handleWorkspaceSetup(args, daemon);
|
|
130
196
|
break;
|
|
@@ -149,7 +215,6 @@ export function createMcpServer(daemon) {
|
|
|
149
215
|
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
150
216
|
};
|
|
151
217
|
}
|
|
152
|
-
noteVref(text);
|
|
153
218
|
return {
|
|
154
219
|
content: [{ type: "text", text }],
|
|
155
220
|
};
|
|
@@ -56,21 +56,25 @@ function formatSkeletonsAsText(nodes) {
|
|
|
56
56
|
lines.push(`# File Skeletons`);
|
|
57
57
|
lines.push(`> ${byFile.size} file(s), ${nodes.length} symbol(s)`);
|
|
58
58
|
lines.push("");
|
|
59
|
+
// One heading and one fence per FILE, not per symbol.
|
|
60
|
+
//
|
|
61
|
+
// This emitted six lines of chrome around every symbol — a heading, the
|
|
62
|
+
// fully-qualified name, a blank line, two fence markers and another blank.
|
|
63
|
+
// On a file with four hundred symbols that is two thousand four hundred
|
|
64
|
+
// lines of decoration wrapped around the thing we are here to make smaller.
|
|
65
|
+
// The same mistake sat in the CLI, where a header box per symbol made a
|
|
66
|
+
// Rust skeleton LARGER than the file it summarised.
|
|
67
|
+
//
|
|
68
|
+
// Nothing is lost: the file path is the heading, the symbol name is the
|
|
69
|
+
// first line of its own skeleton, and the per-symbol reduction percentage
|
|
70
|
+
// is arithmetic the reader did not ask for.
|
|
59
71
|
for (const [filePath, fileNodes] of byFile) {
|
|
60
|
-
lines.push(`## \`${filePath}
|
|
72
|
+
lines.push(`## \`${filePath}\` — ${fileNodes.length} symbol(s)`);
|
|
73
|
+
lines.push("");
|
|
74
|
+
lines.push("```");
|
|
75
|
+
lines.push(fileNodes.map((n) => n.skeleton).join("\n\n"));
|
|
76
|
+
lines.push("```");
|
|
61
77
|
lines.push("");
|
|
62
|
-
for (const n of fileNodes) {
|
|
63
|
-
const reduction = n.token_reduction_pct > 0
|
|
64
|
-
? ` *(${n.token_reduction_pct.toFixed(0)}% token reduction)*`
|
|
65
|
-
: "";
|
|
66
|
-
lines.push(`### ${n.node}${reduction}`);
|
|
67
|
-
lines.push(`*\`${n.fqn}\`*`);
|
|
68
|
-
lines.push("");
|
|
69
|
-
lines.push("```");
|
|
70
|
-
lines.push(n.skeleton);
|
|
71
|
-
lines.push("```");
|
|
72
|
-
lines.push("");
|
|
73
|
-
}
|
|
74
78
|
}
|
|
75
79
|
return lines.join("\n");
|
|
76
80
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The completion check, on the Node surface.
|
|
4
|
+
*
|
|
5
|
+
* It existed in the Rust MCP and in the daemon (`verify_done` socket op) and
|
|
6
|
+
* nowhere in this server — while the `CLAUDE.md` vexp writes into every
|
|
7
|
+
* project instructs the agent to call it before declaring a multi-file task
|
|
8
|
+
* complete. An agent configured through the Node bundle was being told to use
|
|
9
|
+
* a tool that did not exist, and reported it (2026-08-21).
|
|
10
|
+
*
|
|
11
|
+
* The daemon does all the work; this is a dispatch.
|
|
12
|
+
*/
|
|
13
|
+
export const VerifyDoneSchema = z.object({
|
|
14
|
+
task_text: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("The task as it was given to you. Optional: with it, the check also " +
|
|
18
|
+
"verifies the instructions were followed and reports scope drift."),
|
|
19
|
+
});
|
|
20
|
+
export const VERIFY_DONE_DEFINITION = {
|
|
21
|
+
name: "verify_done",
|
|
22
|
+
description: "Mechanical completion check for the CURRENT working tree - call BEFORE declaring a multi-file " +
|
|
23
|
+
"task complete. Returns: touched files that no longer parse, imports of names that no longer " +
|
|
24
|
+
"exist (partial renames), dependents referencing symbols you changed but left untouched " +
|
|
25
|
+
"(file:line), and IMPACTED TESTS tied to your changes. Fix broken imports, visit each " +
|
|
26
|
+
"dependent, then RUN the impacted tests - one passing run proves behavior; repeating this " +
|
|
27
|
+
"check does not.",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
task_text: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "The task as it was given to you. Optional: enables the instruction and scope checks.",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: [],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export async function handleVerifyDone(params, daemon) {
|
|
40
|
+
const validated = VerifyDoneSchema.parse(params ?? {});
|
|
41
|
+
const result = await daemon.call("verify_done", validated);
|
|
42
|
+
// The daemon returns its own rendered report when it has one; anything else
|
|
43
|
+
// is passed through as JSON rather than swallowed, so a shape change shows
|
|
44
|
+
// up as odd output instead of silence.
|
|
45
|
+
if (typeof result === "string")
|
|
46
|
+
return result;
|
|
47
|
+
const rendered = result?.output;
|
|
48
|
+
if (typeof rendered === "string")
|
|
49
|
+
return rendered;
|
|
50
|
+
// Without the indentation: measured over 32 real vexp tool responses from
|
|
51
|
+
// the campaign, 76.1k tokens of indented JSON is 50.6k compact — the same
|
|
52
|
+
// answer, a third less to read. Whitespace is for humans, and no human reads
|
|
53
|
+
// a tool result.
|
|
54
|
+
return JSON.stringify(result);
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vexp-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "vexp MCP server — AI context tools for coding agents",
|
|
6
6
|
"type": "module",
|
|
@@ -32,5 +32,31 @@
|
|
|
32
32
|
"@types/uuid": "^9.0.7",
|
|
33
33
|
"typescript": "^5.4.0",
|
|
34
34
|
"tsx": "^4.7.0"
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"mcp",
|
|
38
|
+
"mcp-server",
|
|
39
|
+
"model-context-protocol",
|
|
40
|
+
"ai-context",
|
|
41
|
+
"context-engine",
|
|
42
|
+
"code-context",
|
|
43
|
+
"claude-code",
|
|
44
|
+
"claude",
|
|
45
|
+
"cursor",
|
|
46
|
+
"windsurf",
|
|
47
|
+
"codex",
|
|
48
|
+
"zed",
|
|
49
|
+
"cline",
|
|
50
|
+
"save-tokens",
|
|
51
|
+
"token-optimization",
|
|
52
|
+
"code-intelligence",
|
|
53
|
+
"dependency-graph",
|
|
54
|
+
"tree-sitter",
|
|
55
|
+
"code-verification",
|
|
56
|
+
"ai-agent",
|
|
57
|
+
"coding-agent",
|
|
58
|
+
"local-first",
|
|
59
|
+
"offline",
|
|
60
|
+
"privacy"
|
|
61
|
+
]
|
|
36
62
|
}
|