mcp-probe-kit 3.0.12 → 3.0.13

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
@@ -316,10 +316,10 @@ No installation needed, use the latest version directly.
316
316
  }
317
317
  ```
318
318
 
319
- ### Method 2: Global Installation
320
-
321
- ```bash
322
- npm install -g mcp-probe-kit
319
+ ### Method 2: Global Installation
320
+
321
+ ```bash
322
+ npm install -g mcp-probe-kit
323
323
  ```
324
324
 
325
325
  Use in config file:
@@ -330,12 +330,44 @@ Use in config file:
330
330
  "command": "mcp-probe-kit"
331
331
  }
332
332
  }
333
- }
334
- ```
335
-
336
- ### Restart Client
337
-
338
- After configuration, **completely quit and reopen** your MCP client.
333
+ }
334
+ ```
335
+
336
+ ### Windows Notes for Graph Tools
337
+
338
+ Applies to `code_insight`, `start_feature`, `start_bugfix`, and `init_project_context`.
339
+
340
+ - The GitNexus bridge uses `npx -y gitnexus@latest mcp` by default.
341
+ - On Windows, the first cold start can take 20+ seconds because `npx` may check/download packages.
342
+ - Some GitNexus dependencies use `tree-sitter-*` native modules. If your machine lacks Visual Studio Build Tools, the first install may fail with errors like `gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use`.
343
+
344
+ Recommended on Windows:
345
+
346
+ 1. Install Visual Studio Build Tools with the C++ workload if you use graph-aware tools regularly.
347
+ 2. Prefer stable local/global CLI usage for GitNexus when your MCP client supports `env`.
348
+ 3. Increase GitNexus connect/call timeouts on slower or first-run environments.
349
+
350
+ Example config using a preinstalled `gitnexus` CLI:
351
+
352
+ ```json
353
+ {
354
+ "mcpServers": {
355
+ "mcp-probe-kit": {
356
+ "command": "mcp-probe-kit",
357
+ "env": {
358
+ "MCP_GITNEXUS_COMMAND": "gitnexus",
359
+ "MCP_GITNEXUS_ARGS": "mcp",
360
+ "MCP_GITNEXUS_CONNECT_TIMEOUT_MS": "30000",
361
+ "MCP_GITNEXUS_TIMEOUT_MS": "45000"
362
+ }
363
+ }
364
+ }
365
+ }
366
+ ```
367
+
368
+ ### Restart Client
369
+
370
+ After configuration, **completely quit and reopen** your MCP client.
339
371
 
340
372
  **👉 [Detailed Installation Guide](https://mcp-probe-kit.bytezonex.com/pages/getting-started.html)**
341
373
 
@@ -426,17 +458,41 @@ npx -y mcp-probe-kit@latest 2>&1 | tee ./mcp-probe-kit.log
426
458
  3. Confirm JSON format is correct, no syntax errors
427
459
  4. Check client developer tools or logs for error messages
428
460
 
429
- ### Q3: How to update to latest version?
430
-
431
- **npx method (Recommended):**
432
- Use `@latest` tag in config, automatically uses latest version.
433
-
434
- **Global installation method:**
435
- ```bash
436
- npm update -g mcp-probe-kit
437
- ```
461
+ ### Q3: How to update to latest version?
462
+
463
+ **npx method (Recommended):**
464
+ Use `@latest` tag in config, automatically uses latest version.
438
465
 
439
- **👉 [More FAQ](https://mcp-probe-kit.bytezonex.com/pages/getting-started.html)**
466
+ **Global installation method:**
467
+ ```bash
468
+ npm update -g mcp-probe-kit
469
+ ```
470
+
471
+ ### Q4: Why are graph-aware tools slow or timing out on Windows the first time?
472
+
473
+ This usually affects `code_insight`, `start_feature`, `start_bugfix`, and `init_project_context`.
474
+
475
+ Common causes:
476
+
477
+ 1. `npx -y gitnexus@latest mcp` performs a cold start and may spend 20+ seconds checking/downloading packages.
478
+ 2. GitNexus may need native `tree-sitter-*` modules, which can require Visual Studio Build Tools on Windows.
479
+
480
+ If you see logs like:
481
+
482
+ ```text
483
+ gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
484
+ gyp ERR! find VS - missing any VC++ toolset
485
+ ```
486
+
487
+ Try this:
488
+
489
+ 1. Install Visual Studio Build Tools with the C++ workload.
490
+ 2. Retry once after dependencies finish installing.
491
+ 3. If your client supports `env`, switch the bridge to a preinstalled `gitnexus` CLI and raise:
492
+ `MCP_GITNEXUS_CONNECT_TIMEOUT_MS`
493
+ `MCP_GITNEXUS_TIMEOUT_MS`
494
+
495
+ **👉 [More FAQ](https://mcp-probe-kit.bytezonex.com/pages/getting-started.html)**
440
496
 
441
497
  ---
442
498
 
@@ -3,7 +3,7 @@ import * as os from "node:os";
3
3
  import * as path from "node:path";
4
4
  import spawn from "cross-spawn";
5
5
  import { afterEach, describe, expect, test } from "vitest";
6
- import { prepareBridgeWorkspace, resolveExecutableCommand, resolveSpawnCommand } from "../gitnexus-bridge.js";
6
+ import { prepareBridgeWorkspace, resolveExecutableCommand, resolveGitNexusBridgeCommand, resolveSpawnCommand, rerankQueryStructuredContent, } from "../gitnexus-bridge.js";
7
7
  const tempRoots = [];
8
8
  afterEach(() => {
9
9
  while (tempRoots.length > 0) {
@@ -51,6 +51,42 @@ describe("gitnexus-bridge workspace preparation", () => {
51
51
  expect(wrapped.command.toLowerCase()).toContain("npx");
52
52
  expect(wrapped.args).toEqual(["-y", "gitnexus@latest", "mcp"]);
53
53
  });
54
+ test("优先使用本地 gitnexus CLI 启动 bridge", () => {
55
+ const root = makeTempDir("gitnexus-cli-");
56
+ const executable = path.join(root, "gitnexus.cmd");
57
+ fs.writeFileSync(executable, "@echo off\r\necho gitnexus %*\r\n", "utf-8");
58
+ const resolved = resolveGitNexusBridgeCommand({
59
+ PATH: root,
60
+ PATHEXT: ".CMD;.EXE;.BAT",
61
+ }, "win32");
62
+ expect(resolved.strategy).toBe("local");
63
+ expect(resolved.command).toBe(executable);
64
+ expect(resolved.args).toEqual(["mcp"]);
65
+ });
66
+ test("显式 MCP_GITNEXUS_COMMAND 配置优先于本地 CLI 自动发现", () => {
67
+ const resolved = resolveGitNexusBridgeCommand({
68
+ MCP_GITNEXUS_COMMAND: "npx",
69
+ MCP_GITNEXUS_ARGS: "-y gitnexus@1.4.1 mcp",
70
+ PATH: "",
71
+ }, "win32");
72
+ expect(resolved.strategy).toBe("env");
73
+ expect(resolved.command.toLowerCase()).toContain("npx");
74
+ expect(resolved.args).toEqual(["-y", "gitnexus@1.4.1", "mcp"]);
75
+ });
76
+ test("query 结果会按关键词对流程做轻量重排", () => {
77
+ const reranked = rerankQueryStructuredContent({
78
+ processes: [
79
+ { heuristicLabel: "Main -> Sleep", priority: 0.12, summary: "background idle loop" },
80
+ { heuristicLabel: "Login -> GenerateToken", priority: 0.08, filePath: "src/auth/login.ts" },
81
+ ],
82
+ }, {
83
+ query: "login authentication user signin auth",
84
+ goal: "理解登录流程",
85
+ });
86
+ expect(reranked.changed).toBe(true);
87
+ expect(reranked.structuredContent.processes[0].heuristicLabel).toBe("Login -> GenerateToken");
88
+ expect(reranked.note).toMatch(/Top matches/i);
89
+ });
54
90
  test.runIf(process.platform === "win32")("Windows 下带空格路径的 cmd 可执行文件可以真实启动", async () => {
55
91
  const root = makeTempDir("gitnexus-space-");
56
92
  const executable = path.join(root, "Program Files", "tool.cmd");
@@ -1,9 +1,24 @@
1
1
  export type CodeInsightMode = "auto" | "query" | "context" | "impact";
2
2
  export type CodeInsightDirection = "upstream" | "downstream";
3
+ export type GitNexusLaunchStrategy = "local" | "npx" | "env";
4
+ export interface CodeInsightCandidate {
5
+ uid?: string;
6
+ name?: string;
7
+ file_path?: string;
8
+ kind?: string;
9
+ [key: string]: unknown;
10
+ }
11
+ export interface CodeInsightAmbiguity {
12
+ tool: string;
13
+ message?: string;
14
+ candidates: CodeInsightCandidate[];
15
+ }
3
16
  export interface CodeInsightRequest {
4
17
  mode?: CodeInsightMode;
5
18
  query?: string;
6
19
  target?: string;
20
+ uid?: string;
21
+ filePath?: string;
7
22
  repo?: string;
8
23
  projectRoot?: string;
9
24
  goal?: string;
@@ -11,6 +26,7 @@ export interface CodeInsightRequest {
11
26
  direction?: CodeInsightDirection;
12
27
  maxDepth?: number;
13
28
  includeTests?: boolean;
29
+ includeContent?: boolean;
14
30
  signal?: AbortSignal;
15
31
  }
16
32
  export interface CodeInsightExecution {
@@ -20,6 +36,7 @@ export interface CodeInsightExecution {
20
36
  args: Record<string, unknown>;
21
37
  text?: string;
22
38
  structuredContent?: unknown;
39
+ status?: string;
23
40
  error?: string;
24
41
  }
25
42
  export interface CodeInsightBridgeResult {
@@ -33,6 +50,8 @@ export interface CodeInsightBridgeResult {
33
50
  executions: CodeInsightExecution[];
34
51
  warnings: string[];
35
52
  repo?: string;
53
+ launcherStrategy: GitNexusLaunchStrategy;
54
+ ambiguities: CodeInsightAmbiguity[];
36
55
  workspaceMode: "direct" | "temp-repo";
37
56
  sourceRoot: string;
38
57
  analysisRoot: string;
@@ -48,11 +67,25 @@ export interface EmbeddedGraphContext {
48
67
  mode: "query" | "context" | "impact";
49
68
  highlights: string[];
50
69
  }
51
- export declare function resolveExecutableCommand(command: string, platform?: NodeJS.Platform): string;
52
- export declare function resolveSpawnCommand(command: string, args: string[], platform?: NodeJS.Platform): {
70
+ export declare function resolveGitNexusBridgeCommand(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): {
71
+ command: string;
72
+ args: string[];
73
+ strategy: GitNexusLaunchStrategy;
74
+ };
75
+ export declare function resolveExecutableCommand(command: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string;
76
+ export declare function resolveSpawnCommand(command: string, args: string[], platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): {
53
77
  command: string;
54
78
  args: string[];
55
79
  };
80
+ export declare function rerankQueryStructuredContent(structuredContent: unknown, hints: {
81
+ query?: string;
82
+ goal?: string;
83
+ taskContext?: string;
84
+ }): {
85
+ structuredContent: unknown;
86
+ changed: boolean;
87
+ note?: string;
88
+ };
56
89
  export interface BridgeWorkspace {
57
90
  workspaceMode: "direct" | "temp-repo";
58
91
  sourceRoot: string;