vexp-mcp 3.2.5 → 3.3.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **The [Model Context Protocol](https://modelcontextprotocol.io) server behind [vexp](https://vexp.dev), the local-first context engine for AI coding agents.**
4
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.
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 (signatures, no bodies), 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
6
 
7
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
8
 
@@ -11,16 +11,16 @@
11
11
  | Tool | What it does |
12
12
  |---|---|
13
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 |
14
+ | `get_skeleton` | File structure (signatures, no bodies), for files the agent only needs to understand |
15
15
  | `verify_done` | Mechanical completion check: parse errors, broken imports, untouched dependents, impacted tests |
16
16
  | `expand_vexp_ref` | Full body of any referenced symbol, on demand |
17
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.
18
+ The catalog is kept deliberately small, because every listed schema rides along on every request your agent makes.
19
19
 
20
20
  ## Why teams use vexp
21
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.
22
+ - **Fable-5-level results from Opus 5. At half the token price.** On SWE-bench Pro, Claude Code running Opus 5 with vexp resolved 81.7% (597/731); Anthropic reports 80.3% for Fable 5 and 79.2% for Opus 5. Every session published at [vexp.dev/benchmark](https://vexp.dev/benchmark).
23
+ - **One call, not a repo crawl:** ranked files, line ranges and blast radius, so the agent stops rediscovering the codebase before every change.
24
24
  - **100% local.** Zero network calls, zero cloud indexing, works offline.
25
25
  - **14 agents, 34 languages**, one `vexp setup`.
26
26
 
@@ -65,7 +65,8 @@ export function dailyLimitError(marker) {
65
65
  `one will fail until the reset, and nothing is broken or misconfigured. ` +
66
66
  `Carry on with your own tools (file reads, search) and tell the user their ` +
67
67
  `vexp free daily limit is spent.\n\n` +
68
- `To lift the limit now, upgrade to Pro or Team: https://vexp.dev/#pricing`);
68
+ // "Raise", not "lift": every paid plan has a daily ceiling too.
69
+ `Paid plans raise the daily limit: https://vexp.dev/#pricing`);
69
70
  }
70
71
  /**
71
72
  * Client per comunicare con il vexp-core daemon via Unix socket / Named pipe.
@@ -120,7 +121,14 @@ export class DaemonClient {
120
121
  // the guard keeps the contract true for any other caller.
121
122
  if (readDailyLimitMarker(workspaceRoot))
122
123
  return;
123
- if (!fs.existsSync(path.join(workspaceRoot, ".vexp", "manifest.json")))
124
+ // Consent: this folder's own manifest, or, for a fresh git worktree, the
125
+ // set-up checkout it belongs to (its daemon indexes the worktree). Not on
126
+ // Windows: a daemon holds the worktree's index open past the session,
127
+ // and Windows then refuses the harness's `git worktree remove` (git
128
+ // unregisters the worktree and leaves the folder behind; reproduced on
129
+ // Windows 11, 2026-09-30).
130
+ if (!fs.existsSync(path.join(workspaceRoot, ".vexp", "manifest.json")) &&
131
+ !(process.platform !== "win32" && worktreeConsentSource(workspaceRoot)))
124
132
  return;
125
133
  // The daemon refuses the home directory itself; not asking spares the
126
134
  // spawn and the "daemon did not start" it would answer with.
@@ -584,6 +592,44 @@ export function isVexpStateHome(dir) {
584
592
  const a = path.resolve(dir);
585
593
  return process.platform === "win32" ? a.toLowerCase() === stateHome.toLowerCase() : a === stateHome;
586
594
  }
595
+ /**
596
+ * The main checkout a linked git worktree takes its consent from: set up with
597
+ * vexp (manifest.json or index.db in its .vexp/) and not the state home.
598
+ * null for anything that is not a linked worktree (a submodule is not).
599
+ *
600
+ * A fresh worktree has no .vexp/, so a worktree of a set-up repository got no
601
+ * daemon and no tools until someone ran `vexp index` in it (AppSumo report,
602
+ * 2026-09-30). Lockstep with vexp-core utils::worktree_consent_source /
603
+ * git_project_root.
604
+ */
605
+ export function worktreeConsentSource(dir) {
606
+ let content;
607
+ try {
608
+ if (!fs.statSync(path.join(dir, ".git")).isFile())
609
+ return null;
610
+ content = fs.readFileSync(path.join(dir, ".git"), "utf-8");
611
+ }
612
+ catch {
613
+ return null;
614
+ }
615
+ const gitdir = content
616
+ .split(/\r?\n/)
617
+ .map((l) => l.trim())
618
+ .find((l) => l.startsWith("gitdir:"))
619
+ ?.slice("gitdir:".length)
620
+ .trim()
621
+ .replace(/\\/g, "/");
622
+ const at = gitdir ? gitdir.indexOf("/.git/worktrees/") : -1;
623
+ if (!gitdir || at <= 0)
624
+ return null;
625
+ const main = path.resolve(dir, gitdir.slice(0, at));
626
+ if (isVexpStateHome(main))
627
+ return null;
628
+ const vexp = path.join(main, ".vexp");
629
+ return fs.existsSync(path.join(vexp, "manifest.json")) || fs.existsSync(path.join(vexp, "index.db"))
630
+ ? main
631
+ : null;
632
+ }
587
633
  /**
588
634
  * Walk up from cwd looking for .vexp/ or .git/ to find the workspace root.
589
635
  * Used when VEXP_WORKSPACE is not set (e.g., agent spawns MCP server
@@ -0,0 +1,44 @@
1
+ /**
2
+ * MCP tool annotations: what a client may assume about a tool before calling it.
3
+ *
4
+ * Without them a client has to assume the worst. Codex does: in its default
5
+ * `auto` mode a tool with no annotations counts as destructive and
6
+ * open-world, so every vexp call asked for permission, and under approval
7
+ * policy "never" without full access (`codex exec`) the call was refused
8
+ * outright - "MCP tool call requires approval, but approval policy is never"
9
+ * (rollout of 2026-09-08). Its rule, from codex-rs/core/src/mcp_tool_call.rs:
10
+ * readOnlyHint true (and destructiveHint not true) runs without asking;
11
+ * destructiveHint false AND openWorldHint false runs without asking; anything
12
+ * else asks.
13
+ *
14
+ * "Read-only" here means the tool changes nothing in the user's project or
15
+ * outside this machine. Every call still writes vexp's own bookkeeping
16
+ * (daily usage, the tool-call log, auto-captured notes) into `.vexp/`; that is
17
+ * the store the tool reads from, not the environment it works on, so it does
18
+ * not disqualify the hint. The Rust server (vexp-core mcp_stdio.rs) carries
19
+ * the same classification, tool by tool (vexp-cli/test/mcp-surface-lockstep).
20
+ */
21
+ export const READ_ONLY_TOOL = {
22
+ readOnlyHint: true,
23
+ destructiveHint: false,
24
+ idempotentHint: true,
25
+ openWorldHint: false,
26
+ };
27
+ /**
28
+ * Adds to what vexp itself keeps on this machine (a saved observation lands in
29
+ * the memory tables of `.vexp/`, a generated setup file is created only where
30
+ * none exists) and deletes nothing of the user's; nothing leaves the machine.
31
+ * Codex's `auto` mode runs these without asking; its opt-in `writes` mode
32
+ * asks, which is what that mode is for.
33
+ */
34
+ export const LOCAL_STORE_WRITE_TOOL = {
35
+ readOnlyHint: false,
36
+ destructiveHint: false,
37
+ idempotentHint: false,
38
+ openWorldHint: false,
39
+ };
40
+ /** {@link LOCAL_STORE_WRITE_TOOL}, and a second identical call changes nothing more. */
41
+ export const LOCAL_STORE_WRITE_IDEMPOTENT_TOOL = {
42
+ ...LOCAL_STORE_WRITE_TOOL,
43
+ idempotentHint: true,
44
+ };
@@ -1,10 +1,12 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  export const ExpandVexpRefSchema = z.object({
3
4
  hash: z.string().describe("The V-REF hash to expand (e.g., 'a1b2c3d4e5f6')"),
4
5
  });
5
6
  export const EXPAND_VEXP_REF_DEFINITION = {
6
7
  name: "expand_vexp_ref",
7
8
  description: "Expand a [V-REF:xxxx] placeholder from compressed v2 output to its full content.",
9
+ annotations: READ_ONLY_TOOL,
8
10
  inputSchema: {
9
11
  type: "object",
10
12
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { coerceArray, coerceBool, coerceNumber } from "./coerce.js";
3
4
  export const GetContextCapsuleSchema = z.object({
4
5
  query: z.string().describe("Description of the task or what you need context for"),
@@ -14,6 +15,7 @@ export const GET_CONTEXT_CAPSULE_DEFINITION = {
14
15
  "NOTE: For most tasks, prefer run_pipeline instead — it includes this capsule plus impact analysis " +
15
16
  "and memory in a single call with fewer tokens. " +
16
17
  "Use get_context_capsule only for quick, simple lookups where you don't need impact analysis or memory recall, or when you want a lighter, faster response.",
18
+ annotations: READ_ONLY_TOOL,
17
19
  inputSchema: {
18
20
  type: "object",
19
21
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { coerceBool, coerceNumber } from "./coerce.js";
3
4
  export const GetImpactGraphSchema = z.object({
4
5
  symbol_fqn: z.string().describe("Fully qualified name of the symbol (e.g. 'src/auth/auth.ts::validateToken')"),
@@ -14,6 +15,7 @@ export const GET_IMPACT_GRAPH_DEFINITION = {
14
15
  "(2) Before changing a public API — to find all call sites. " +
15
16
  "(3) When asked 'what uses X?' or 'what depends on X?'. " +
16
17
  "Requires the exact FQN from a previous get_context_capsule result (e.g. 'src/auth/auth.ts::validateToken').",
18
+ annotations: READ_ONLY_TOOL,
17
19
  inputSchema: {
18
20
  type: "object",
19
21
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { coerceArray, coerceBool, coerceNumber } from "./coerce.js";
3
4
  export const GetSessionContextSchema = z.object({
4
5
  include_previous: z.preprocess(coerceBool, z.boolean().optional().default(false)).describe("Include observations from previous sessions"),
@@ -12,6 +13,7 @@ export const GET_SESSION_CONTEXT_DEFINITION = {
12
13
  "what code was explored, decisions made, and insights discovered. " +
13
14
  "Use this to recall what you worked on earlier or in prior sessions. " +
14
15
  "Observations linked to code symbols are automatically marked stale when that code changes.",
16
+ annotations: READ_ONLY_TOOL,
15
17
  inputSchema: {
16
18
  type: "object",
17
19
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { coerceArray } from "./coerce.js";
3
4
  export const GetSkeletonSchema = z.object({
4
5
  files: z.preprocess(coerceArray, z.array(z.string())).describe("File paths to skeletonize (relative to repo root)"),
@@ -10,6 +11,7 @@ export const GET_SKELETON_DEFINITION = {
10
11
  description: "Structural view of files you need to UNDERSTAND but not edit (70-90% smaller than Read): " +
11
12
  "signatures, classes, types at detail minimal|standard|detailed. Use after run_pipeline to " +
12
13
  "drill into a file; use Read only for files you are about to edit.",
14
+ annotations: READ_ONLY_TOOL,
13
15
  inputSchema: {
14
16
  type: "object",
15
17
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { resolveTargeting } from "../daemon-client.js";
3
4
  export const IndexStatusSchema = z.object({});
4
5
  export const INDEX_STATUS_DEFINITION = {
@@ -6,6 +7,7 @@ export const INDEX_STATUS_DEFINITION = {
6
7
  description: "Get the current status of the vexp index, including indexed repos, node/edge counts, " +
7
8
  "cross-repo edges, daemon uptime, and indexing progress. " +
8
9
  "Use this to verify vexp is working correctly before making queries.",
10
+ annotations: READ_ONLY_TOOL,
9
11
  inputSchema: {
10
12
  type: "object",
11
13
  properties: {},
@@ -20,6 +22,16 @@ export async function handleIndexStatus(params, daemon) {
20
22
  const result = await daemon.call("index_status", {});
21
23
  return formatStatusAsText(result, targeting);
22
24
  }
25
+ /**
26
+ * The free tier's node cap left source files out: how many, and how large the
27
+ * whole project would be (the daemon's estimate, the same one `vexp index`
28
+ * prints). Without it an agent read "healthy" over a partial graph.
29
+ */
30
+ function nodeCapGap(cap) {
31
+ return (`- ${cap.skipped_files.toLocaleString("en-US")} of ${cap.total_files.toLocaleString("en-US")} source files are NOT indexed: ` +
32
+ `the node limit (${cap.limit.toLocaleString("en-US")}) was reached, and the whole project is about ${cap.estimated_nodes.toLocaleString("en-US")} nodes. ` +
33
+ "Their symbols and callers are invisible to impact, search and run_pipeline.");
34
+ }
23
35
  /** Normalize a workspace path for a tolerant equality check (case-insensitive,
24
36
  * trailing separators stripped) — just for the mismatch heuristic. */
25
37
  function normRoot(p) {
@@ -100,8 +112,8 @@ function formatStatusAsText(status, targeting) {
100
112
  // Coverage gaps (3.1). Files over max_file_size_kb were skipped with an
101
113
  // INFO log line and nothing else; this surface said HEALTHY over a graph
102
114
  // missing 21% of the bytes of a user's lib/ (tier-4 field report, 2026-08).
103
- if (status.coverage) {
104
- const c = status.coverage;
115
+ if (status.coverage || status.node_cap) {
116
+ const c = status.coverage ?? {};
105
117
  const gaps = [];
106
118
  if ((c.skipped_oversized ?? 0) > 0) {
107
119
  const ex = c.skipped_examples?.length ? ` — e.g. ${c.skipped_examples.join(", ")}` : "";
@@ -111,6 +123,8 @@ function formatStatusAsText(status, targeting) {
111
123
  if (c.unparsed_code_files?.length) {
112
124
  gaps.push(`- Unparsed file types (no parser yet): ${c.unparsed_code_files.map((u) => `${u.count} .${u.ext}`).join(", ")}`);
113
125
  }
126
+ if (status.node_cap)
127
+ gaps.push(nodeCapGap(status.node_cap));
114
128
  if (gaps.length > 0) {
115
129
  lines.push("## Coverage gaps");
116
130
  lines.push("");
@@ -126,7 +140,7 @@ function formatStatusAsText(status, targeting) {
126
140
  lines.push(`## Savings Ledger (last ${lg.period_days ?? 7} days)`);
127
141
  lines.push("");
128
142
  if ((lg.prompts_analyzed ?? 0) > 0) {
129
- lines.push(`- Activity: ${lg.prompts_analyzed} prompt(s) analyzed — ${lg.silences} silence(s) (task already oriented), ${lg.hints_served} orientation hint(s) served${(lg.held_out ?? 0) > 0 ? `, ${lg.held_out} held out (randomized measurement)` : ""}`);
143
+ lines.push(`- Activity: ${lg.prompts_analyzed} prompt(s) analyzed: ${lg.silences} silence(s) (task already oriented), ${lg.hints_served} orientation hint(s) served${(lg.held_out ?? 0) > 0 ? `, ${lg.held_out} held out (randomized measurement)` : ""}${(lg.late ?? 0) > 0 ? `, ${lg.late} finished after the hook's budget (never reached the agent)` : ""}`);
130
144
  }
131
145
  if ((lg.measured_calls ?? 0) > 0) {
132
146
  lines.push(`- Measured: ${lg.measured_calls} tool call(s), ~${(lg.measured_tokens_saved ?? 0).toLocaleString()} tokens saved (full-read baseline minus served)`);
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { LOCAL_STORE_WRITE_TOOL } from "./annotations.js";
2
3
  import { resolveTargeting } from "../daemon-client.js";
3
4
  import { coerceArray, coerceBool, coerceNumber } from "./coerce.js";
4
5
  export const RunPipelineSchema = z.object({
@@ -66,6 +67,9 @@ export const RUN_PIPELINE_DEFINITION = {
66
67
  "work (unfamiliar area, no file/symbol named in the task) or when you need impact " +
67
68
  "analysis. If the task already names the files to touch, skip this and use your " +
68
69
  "normal tools. Anchor the task on real identifiers or file paths.",
70
+ // Not read-only: `observation` and a `save_observation` step write to
71
+ // session memory, as save_observation itself does. Same as the Rust server.
72
+ annotations: LOCAL_STORE_WRITE_TOOL,
69
73
  inputSchema: {
70
74
  type: "object",
71
75
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { LOCAL_STORE_WRITE_TOOL } from "./annotations.js";
2
3
  import { coerceArray } from "./coerce.js";
3
4
  export const SaveObservationSchema = z.object({
4
5
  content: z.string().describe("The observation text (keep concise, 1-2 sentences)"),
@@ -13,6 +14,7 @@ export const SAVE_OBSERVATION_DEFINITION = {
13
14
  "pruned after session compression), manually saved observations are preserved permanently. " +
14
15
  "Optionally link to code symbols (FQNs) for automatic staleness tracking — " +
15
16
  "when linked code changes, the observation is flagged as stale.",
17
+ annotations: LOCAL_STORE_WRITE_TOOL,
16
18
  inputSchema: {
17
19
  type: "object",
18
20
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { coerceBool, coerceNumber } from "./coerce.js";
3
4
  export const SearchLogicFlowSchema = z.object({
4
5
  start: z.string().describe("FQN of the starting symbol"),
@@ -13,6 +14,7 @@ export const SEARCH_LOGIC_FLOW_DEFINITION = {
13
14
  "(2) To trace an indirect call chain (e.g. HTTP handler → DB query). " +
14
15
  "(3) To understand the execution path for a bug report or feature trace. " +
15
16
  "Both start and end must be exact FQNs from get_context_capsule or get_impact_graph results.",
17
+ annotations: READ_ONLY_TOOL,
16
18
  inputSchema: {
17
19
  type: "object",
18
20
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  import { coerceBool, coerceNumber } from "./coerce.js";
3
4
  export const SearchMemorySchema = z.object({
4
5
  query: z.string().describe("Search query for memories"),
@@ -14,6 +15,7 @@ export const SEARCH_MEMORY_DEFINITION = {
14
15
  "and code-graph proximity. Stale observations (linked to changed code) are " +
15
16
  "demoted but still included. Each result explains WHY it surfaced (transparency). " +
16
17
  "Use this to find past decisions, explored code paths, or previously encountered patterns.",
18
+ annotations: READ_ONLY_TOOL,
17
19
  inputSchema: {
18
20
  type: "object",
19
21
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { READ_ONLY_TOOL } from "./annotations.js";
2
3
  /**
3
4
  * The completion check, on the Node surface.
4
5
  *
@@ -25,6 +26,7 @@ export const VERIFY_DONE_DEFINITION = {
25
26
  "(file:line), and IMPACTED TESTS tied to your changes. Fix broken imports, visit each " +
26
27
  "dependent, then RUN the impacted tests - one passing run proves behavior; repeating this " +
27
28
  "check does not.",
29
+ annotations: READ_ONLY_TOOL,
28
30
  inputSchema: {
29
31
  type: "object",
30
32
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { LOCAL_STORE_WRITE_IDEMPOTENT_TOOL } from "./annotations.js";
2
3
  export const WorkspaceSetupSchema = z.object({
3
4
  workspace_root: z.string().optional().describe("Workspace root path (default: CWD)"),
4
5
  detect_agents: z.boolean().optional().default(true).describe("Auto-detect AI agents"),
@@ -8,6 +9,9 @@ export const WORKSPACE_SETUP_DEFINITION = {
8
9
  description: "Set up vexp for the current workspace. Generates configuration files, " +
9
10
  "detects AI coding agents (Claude Code, Cursor, Windsurf, Continue), " +
10
11
  "and provides setup instructions. Run this once when starting to work on a new project.",
12
+ // Creates CLAUDE.md and .vexp/.gitattributes only where there are none (an
13
+ // existing CLAUDE.md is returned for a manual merge): vexp-core's handler.
14
+ annotations: LOCAL_STORE_WRITE_IDEMPOTENT_TOOL,
11
15
  inputSchema: {
12
16
  type: "object",
13
17
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vexp-mcp",
3
- "version": "3.2.5",
3
+ "version": "3.3.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "vexp MCP server — AI context tools for coding agents",
6
6
  "type": "module",