kibi-mcp 3.6.0 → 3.6.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.
@@ -51,7 +51,7 @@ export function registerConfiguredTools(server, runtime, registerTool) {
51
51
  });
52
52
  register({
53
53
  name: "kb_search",
54
- execute: async (context, args) => runtime.handleKbSearch(prologFor(context), args),
54
+ execute: async (context, args) => runtime.handleKbSearch(prologFor(context), args, context),
55
55
  });
56
56
  register({
57
57
  name: "kb_status",
@@ -126,12 +126,13 @@ export function registerConfiguredTools(server, runtime, registerTool) {
126
126
  // Without a registered kb_job_status nothing could poll the receipt,
127
127
  // so async falls back to a synchronous check.
128
128
  if (asyncMode !== true || !enabledOptionalTools().has("kb_job_status")) {
129
- return runtime.handleKbCheck(prologFor(context), args);
129
+ return runtime.handleKbCheck(prologFor(context), args, context);
130
130
  }
131
131
  // Long-KB full checks can exceed the tool timeout. Detach into a job
132
132
  // and return the kibi.job.v1 receipt immediately; the agent polls
133
- // kb_job_status for the terminal state and full result.
134
- return startJob("kb_check", () => runtime.handleKbCheck(prologFor(context), checkArgs));
133
+ // kb_job_status for the terminal state and full result. The job
134
+ // outlives the request, so it gets its own signal.
135
+ return startJob("kb_check", () => runtime.handleKbCheck(prologFor(context), checkArgs, { ...context, signal: new AbortController().signal }));
135
136
  },
136
137
  });
137
138
  register({
@@ -338,11 +338,13 @@ runtime = DEFAULT_TOOLS_RUNTIME, spec, annotations, outputSchema) {
338
338
  ...result,
339
339
  content,
340
340
  structuredContent: envelope,
341
+ ...(envelope.status === "error" ? { isError: true } : {}),
341
342
  };
342
343
  }
343
344
  return {
344
345
  content: [{ type: "text", text: JSON.stringify(envelope) }],
345
346
  structuredContent: envelope,
347
+ ...(envelope.status === "error" ? { isError: true } : {}),
346
348
  };
347
349
  }
348
350
  catch (error) {
@@ -2,15 +2,21 @@ import { checkSpec } from "kibi-runtime";
2
2
  import { resolveWorkspaceRoot } from "../workspace.js";
3
3
  /**
4
4
  * Handle kb_check tool calls - run validation rules on the KB
5
- * Reuses validation logic from CLI check command
5
+ * Reuses validation logic from CLI check command.
6
+ *
7
+ * The MCP runtime's operation context carries the branch attachment (the
8
+ * Git branch, or a KIBI_BRANCH override), so an uncompiled branch store is
9
+ * reported once as branch-store-not-compiled, as in the CLI; it also carries
10
+ * the host fs/git ports, signal and clock.
6
11
  */
7
- // implements REQ-002
8
- export async function handleKbCheck(prolog, args) {
9
- const workspaceRoot = args.workspaceRoot ?? resolveWorkspaceRoot();
12
+ // implements REQ-002, REQ-cli-status-pre-first-sync
13
+ export async function handleKbCheck(prolog, args, context) {
14
+ const workspaceRoot = args.workspaceRoot ?? context?.workspaceRoot ?? resolveWorkspaceRoot();
10
15
  return checkSpec.execute({ ...args }, {
16
+ ...(context ?? {}),
11
17
  workspaceRoot,
12
- signal: new AbortController().signal,
13
- clock: () => new Date(),
18
+ signal: context?.signal ?? new AbortController().signal,
19
+ clock: context?.clock ?? (() => new Date()),
14
20
  prolog: {
15
21
  query: (goal) => prolog.query(goal),
16
22
  nextSolution: async () => null,
@@ -1,6 +1,8 @@
1
1
  import { searchSpec } from "kibi-runtime";
2
2
  import { createDiscoveryContext } from "./discovery-adapter.js";
3
- export async function handleKbSearch(prolog, args) {
3
+ export async function handleKbSearch(prolog, args, context) {
4
4
  // implements REQ-kibi-operation-interface-parity, REQ-mcp-search-discovery
5
- return searchSpec.execute(args, createDiscoveryContext(prolog));
5
+ // The runtime context carries the branch attachment the answer layer
6
+ // names as the branch it answered from.
7
+ return searchSpec.execute(args, createDiscoveryContext(prolog, context));
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-mcp",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "mcpName": "io.github.Looted/kibi-mcp",
5
5
  "dependencies": {
6
6
  "@modelcontextprotocol/sdk": "^1.32.1",
@@ -10,8 +10,8 @@
10
10
  "fast-glob": "^3.2.12",
11
11
  "gray-matter": "^4.0.3",
12
12
  "js-yaml": "^4.1.0",
13
- "kibi-runtime": "^2.13.0",
14
- "kibi-core": "^0.18.0",
13
+ "kibi-runtime": "^2.13.2",
14
+ "kibi-core": "^0.18.2",
15
15
  "zod": "^4.3.6"
16
16
  },
17
17
  "type": "module",