@wrongstack/codebase-index-mcp 1.0.17 → 1.0.24

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/adapter.d.ts CHANGED
@@ -14,9 +14,9 @@ interface SymbolGraphArgs extends GraphBaseArgs {
14
14
  }
15
15
  export interface CodebaseIndexMcpDependencies {
16
16
  executeTool?: (tool: Tool, args: Record<string, unknown>, context: Context, signal: AbortSignal) => Promise<unknown>;
17
- packageGraph?: (args: GraphBaseArgs) => Promise<unknown>;
18
- fileGraph?: (args: FileGraphArgs) => Promise<unknown>;
19
- symbolGraph?: (args: SymbolGraphArgs) => Promise<unknown>;
17
+ packageGraph?: (args: GraphBaseArgs, signal?: AbortSignal) => Promise<unknown>;
18
+ fileGraph?: (args: FileGraphArgs, signal?: AbortSignal) => Promise<unknown>;
19
+ symbolGraph?: (args: SymbolGraphArgs, signal?: AbortSignal) => Promise<unknown>;
20
20
  }
21
21
  export interface CodebaseIndexMcpToolHostOptions extends CodebaseIndexMcpPolicyOptions {
22
22
  indexDir?: string | undefined;
package/dist/cli.d.ts CHANGED
@@ -11,5 +11,7 @@ export interface ParsedArgs {
11
11
  }
12
12
  export declare function printHelp(stdout: NodeJS.WriteStream): void;
13
13
  export declare function parseArgs(argv: readonly string[], env?: NodeJS.ProcessEnv): ParsedArgs;
14
+ /** Resolve the checkout whose source files and local index are served. */
15
+ export declare function resolveIndexProjectRoot(projectRoot: string): string;
14
16
  export declare function main(argv?: string[]): Promise<number>;
15
17
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.js CHANGED
@@ -4,7 +4,6 @@
4
4
  import { realpathSync } from "node:fs";
5
5
  import * as path from "node:path";
6
6
  import { fileURLToPath as fileURLToPath2 } from "node:url";
7
- import { canonicalProjectRoot } from "@wrongstack/core/utils";
8
7
  import { serveHttp, serveStdio } from "@wrongstack/mcp";
9
8
  import {
10
9
  checkCodebaseIndexServerHealth,
@@ -178,7 +177,7 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
178
177
  listTools() {
179
178
  return selected.map(toolDescriptor);
180
179
  },
181
- async callTool(name, args) {
180
+ async callTool(name, args, callOptions) {
182
181
  if (!allowed.has(name)) {
183
182
  return {
184
183
  content: `Tool "${name}" is not exposed by this Codebase Index MCP server`,
@@ -188,6 +187,7 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
188
187
  const toolName = name;
189
188
  const validationError = validateArgs(toolName, args);
190
189
  if (validationError) return { content: validationError, isError: true };
190
+ const signal = callOptions?.signal ?? new AbortController().signal;
191
191
  try {
192
192
  const builtin = BUILTIN_TOOLS[toolName];
193
193
  if (builtin) {
@@ -198,7 +198,7 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
198
198
  return { content: errors.join("\n"), isError: true };
199
199
  }
200
200
  }
201
- const content = await executeTool(builtin, args, context, new AbortController().signal);
201
+ const content = await executeTool(builtin, args, context, signal);
202
202
  return { content, isError: isDegradedFailure(content) };
203
203
  }
204
204
  const base = {
@@ -206,16 +206,22 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
206
206
  ...opts.indexDir ? { indexDir: opts.indexDir } : {}
207
207
  };
208
208
  if (toolName === "codebase_package_graph") {
209
- return { content: await getPackageGraph(base), isError: false };
209
+ return { content: await getPackageGraph(base, signal), isError: false };
210
210
  }
211
211
  if (toolName === "codebase_file_graph") {
212
212
  return {
213
- content: await getFileGraph({ ...base, packageFilter: String(args["package"]).trim() }),
213
+ content: await getFileGraph(
214
+ { ...base, packageFilter: String(args["package"]).trim() },
215
+ signal
216
+ ),
214
217
  isError: false
215
218
  };
216
219
  }
217
220
  return {
218
- content: await getSymbolGraph({ ...base, fileFilter: String(args["file"]).trim() }),
221
+ content: await getSymbolGraph(
222
+ { ...base, fileFilter: String(args["file"]).trim() },
223
+ signal
224
+ ),
219
225
  isError: false
220
226
  };
221
227
  } catch (error) {
@@ -288,7 +294,7 @@ function parseArgs(argv, env = process.env) {
288
294
  const arg = argv[index];
289
295
  const value = () => {
290
296
  const next = argv[index + 1];
291
- if (next === void 0 || next.startsWith("--")) {
297
+ if (next === void 0 || next.startsWith("-")) {
292
298
  warn("mcp_cli_flag_missing_value", `${arg} expects a value; ignoring it.`);
293
299
  return void 0;
294
300
  }
@@ -353,6 +359,14 @@ function parseArgs(argv, env = process.env) {
353
359
  }
354
360
  return parsed;
355
361
  }
362
+ function resolveIndexProjectRoot(projectRoot) {
363
+ const resolved = path.resolve(projectRoot);
364
+ try {
365
+ return realpathSync(resolved);
366
+ } catch {
367
+ return resolved;
368
+ }
369
+ }
356
370
  function availabilityError(availability) {
357
371
  if (availability.kind === "available") return null;
358
372
  if (availability.kind === "inline-requested") {
@@ -375,7 +389,7 @@ async function main(argv = process.argv.slice(2)) {
375
389
  printHelp(process.stderr);
376
390
  return 2;
377
391
  }
378
- const projectRoot = canonicalProjectRoot(args.projectRoot);
392
+ const projectRoot = resolveIndexProjectRoot(args.projectRoot);
379
393
  const availability = resolveProjectIndexDaemonAvailability(projectRoot, args.indexDir);
380
394
  const unavailable = availabilityError(availability);
381
395
  if (unavailable) {
@@ -477,6 +491,7 @@ if (isMainModule()) {
477
491
  export {
478
492
  main,
479
493
  parseArgs,
480
- printHelp
494
+ printHelp,
495
+ resolveIndexProjectRoot
481
496
  };
482
497
  //# sourceMappingURL=cli.js.map
package/dist/index.js CHANGED
@@ -163,7 +163,7 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
163
163
  listTools() {
164
164
  return selected.map(toolDescriptor);
165
165
  },
166
- async callTool(name, args) {
166
+ async callTool(name, args, callOptions) {
167
167
  if (!allowed.has(name)) {
168
168
  return {
169
169
  content: `Tool "${name}" is not exposed by this Codebase Index MCP server`,
@@ -173,6 +173,7 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
173
173
  const toolName = name;
174
174
  const validationError = validateArgs(toolName, args);
175
175
  if (validationError) return { content: validationError, isError: true };
176
+ const signal = callOptions?.signal ?? new AbortController().signal;
176
177
  try {
177
178
  const builtin = BUILTIN_TOOLS[toolName];
178
179
  if (builtin) {
@@ -183,7 +184,7 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
183
184
  return { content: errors.join("\n"), isError: true };
184
185
  }
185
186
  }
186
- const content = await executeTool(builtin, args, context, new AbortController().signal);
187
+ const content = await executeTool(builtin, args, context, signal);
187
188
  return { content, isError: isDegradedFailure(content) };
188
189
  }
189
190
  const base = {
@@ -191,16 +192,22 @@ function createCodebaseIndexMcpToolHost(projectRoot, opts = {}) {
191
192
  ...opts.indexDir ? { indexDir: opts.indexDir } : {}
192
193
  };
193
194
  if (toolName === "codebase_package_graph") {
194
- return { content: await getPackageGraph(base), isError: false };
195
+ return { content: await getPackageGraph(base, signal), isError: false };
195
196
  }
196
197
  if (toolName === "codebase_file_graph") {
197
198
  return {
198
- content: await getFileGraph({ ...base, packageFilter: String(args["package"]).trim() }),
199
+ content: await getFileGraph(
200
+ { ...base, packageFilter: String(args["package"]).trim() },
201
+ signal
202
+ ),
199
203
  isError: false
200
204
  };
201
205
  }
202
206
  return {
203
- content: await getSymbolGraph({ ...base, fileFilter: String(args["file"]).trim() }),
207
+ content: await getSymbolGraph(
208
+ { ...base, fileFilter: String(args["file"]).trim() },
209
+ signal
210
+ ),
204
211
  isError: false
205
212
  };
206
213
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/codebase-index-mcp",
3
- "version": "1.0.17",
3
+ "version": "1.0.24",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack Codebase Index as an MCP server, backed by the existing project-scoped IPC daemon.",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "!dist/**/*.map"
32
32
  ],
33
33
  "dependencies": {
34
- "@wrongstack/core": "1.0.17",
35
- "@wrongstack/mcp": "1.0.17",
36
- "@wrongstack/tools": "1.0.17"
34
+ "@wrongstack/core": "1.0.24",
35
+ "@wrongstack/mcp": "1.0.24",
36
+ "@wrongstack/tools": "1.0.24"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26.5.1",