mindgraph-mcp 0.13.2 → 0.13.4

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.
Files changed (3) hide show
  1. package/dist/cli.js +43 -31
  2. package/dist/index.js +34 -24
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -312,19 +312,12 @@ async function handlePlan(client2, args) {
312
312
  return ok(await client2.execution({ action: "complete", task_uid, agent_id }));
313
313
  case "fail_execution":
314
314
  return ok(await client2.execution({ action: "fail", task_uid, agent_id }));
315
- // Governance
316
- case "create_policy":
317
- return ok(
318
- await client2.governance({ action: "create_policy", label, summary, props, agent_id })
319
- );
320
- case "request_approval":
321
- return ok(
322
- await client2.governance({ action: "request_approval", label, summary, props, agent_id })
323
- );
324
- case "resolve_approval":
325
- return ok(
326
- await client2.governance({ action: "resolve_approval", task_uid, props, agent_id })
327
- );
315
+ // Governance — read-only from MCP by design (C33). The write actions were
316
+ // removed rather than repaired: `resolve_approval` here also sent
317
+ // `task_uid` where the server requires `approval_uid`, and never sent
318
+ // `approved` at all, so the server's `unwrap_or(false)` would have silently
319
+ // DENIED every approval an agent tried to resolve. Wiring that correctly
320
+ // would have meant building a working self-approval path — the hole itself.
328
321
  case "get_pending":
329
322
  return ok(await client2.governance({ action: "get_pending", agent_id }));
330
323
  // Procedures (merged from mindgraph_action)
@@ -592,6 +585,15 @@ async function handleIngest(client2, args) {
592
585
  agent_id
593
586
  } = args;
594
587
  const src = source_uri ?? source;
588
+ const targetsOntology = Array.isArray(layers) && layers.includes("ontology");
589
+ const cognitiveLayers = targetsOntology ? layers.filter((layer) => layer !== "ontology") : layers;
590
+ if (targetsOntology && !ontology_schema_id) {
591
+ return err(
592
+ "layers included 'ontology' but no ontology_schema_id was supplied. Typed Layer-7 extraction is driven by ontology_schema_id, not by the layers list \u2014 pass the schema id, or drop 'ontology' from layers."
593
+ );
594
+ }
595
+ const forwardedLayers = Array.isArray(cognitiveLayers) && cognitiveLayers.length === 0 ? void 0 : cognitiveLayers;
596
+ const ontologyOnly = targetsOntology && forwardedLayers === void 0;
595
597
  switch (action) {
596
598
  case "chunk":
597
599
  if (!content) return err("content is required for chunk ingestion");
@@ -601,7 +603,9 @@ async function handleIngest(client2, args) {
601
603
  label: title,
602
604
  document_uid,
603
605
  chunk_index,
604
- layers,
606
+ // `/ingest/chunk` runs its ontology pass inline from
607
+ // ontology_schema_id alone and has no ontology_only switch.
608
+ layers: forwardedLayers,
605
609
  agent_id,
606
610
  ontology_schema_id
607
611
  })
@@ -615,8 +619,9 @@ async function handleIngest(client2, args) {
615
619
  source_uri: src,
616
620
  content_type,
617
621
  document_type,
618
- layers,
622
+ layers: forwardedLayers,
619
623
  ontology_schema_id,
624
+ ...ontologyOnly ? { ontology_only: true } : {},
620
625
  participants,
621
626
  occurred_at,
622
627
  context,
@@ -631,8 +636,9 @@ async function handleIngest(client2, args) {
631
636
  await client2.ingestSession({
632
637
  content,
633
638
  title,
634
- layers,
639
+ layers: forwardedLayers,
635
640
  ontology_schema_id,
641
+ ...ontologyOnly ? { ontology_only: true } : {},
636
642
  participants,
637
643
  occurred_at,
638
644
  context,
@@ -1033,7 +1039,7 @@ var init_tools = __esm({
1033
1039
  },
1034
1040
  {
1035
1041
  name: "mindgraph_plan",
1036
- description: "Agent-level task management, governance, and procedural knowledge. Use 'create_plan'/'create_task'/'add_step' for task breakdowns, 'update_status' for progress, 'get_plan' to review. Use 'create_flow'/'add_procedure_step'/'add_affordance'/'add_control' for workflows and procedures. Use 'assess_risk'/'get_assessments' for risk analysis. Use 'create_policy'/'request_approval'/'resolve_approval'/'get_pending' for governance. Prefer mindgraph_commit for user goals/projects; use this for agent-managed execution.",
1042
+ description: "Agent-level task management, governance, and procedural knowledge. Use 'create_plan'/'create_task'/'add_step' for task breakdowns, 'update_status' for progress, 'get_plan' to review. Use 'create_flow'/'add_procedure_step'/'add_affordance'/'add_control' for workflows and procedures. Use 'assess_risk'/'get_assessments' for risk analysis. Use 'get_pending' to read the governance approval queue \u2014 approvals are granted by a person in the MindGraph dashboard, never from here, so wait for one rather than trying to clear it. Prefer mindgraph_commit for user goals/projects; use this for agent-managed execution.",
1037
1043
  inputSchema: {
1038
1044
  type: "object",
1039
1045
  properties: {
@@ -1048,9 +1054,13 @@ var init_tools = __esm({
1048
1054
  "start_execution",
1049
1055
  "complete_execution",
1050
1056
  "fail_execution",
1051
- "create_policy",
1052
- "request_approval",
1053
- "resolve_approval",
1057
+ // C33: governance WRITES are deliberately not exposed here.
1058
+ // `create_policy` let a model author the rules it is judged by;
1059
+ // `request_approval` + `resolve_approval` let it raise and then
1060
+ // clear its own gate, which defeats the human-in-the-loop control
1061
+ // entirely. Authoring and resolving happen in the dashboard, by a
1062
+ // person. `get_pending` stays — reading the queue is safe and is
1063
+ // what an agent needs in order to wait correctly.
1054
1064
  "get_pending",
1055
1065
  "create_flow",
1056
1066
  "add_procedure_step",
@@ -1075,7 +1085,7 @@ var init_tools = __esm({
1075
1085
  },
1076
1086
  task_uid: {
1077
1087
  type: "string",
1078
- description: "Task/step UID (for update_status, execution actions, resolve_approval)"
1088
+ description: "Task/step UID (for update_status, execution actions)"
1079
1089
  },
1080
1090
  target_uid: {
1081
1091
  type: "string",
@@ -1266,11 +1276,11 @@ var init_tools = __esm({
1266
1276
  "ontology"
1267
1277
  ]
1268
1278
  },
1269
- description: "Cognitive layers to extract (defaults vary by action)"
1279
+ description: "Cognitive layers to extract (defaults vary by action). 'ontology' is a targeting flag rather than a cognitive layer: include it only alongside ontology_schema_id, and list it alone to extract domain objects without any cognitive extraction."
1270
1280
  },
1271
1281
  ontology_schema_id: {
1272
1282
  type: "string",
1273
- description: "When set, run typed Layer-7 (domain-object) extraction against this schema in addition to the cognitive layers."
1283
+ description: "When set, run typed Layer-7 (domain-object) extraction against this schema in addition to the cognitive layers. This field alone drives domain-object extraction \u2014 listing 'ontology' in layers without it extracts nothing."
1274
1284
  },
1275
1285
  participants: {
1276
1286
  type: "array",
@@ -1817,7 +1827,7 @@ Capture knowledge when the user shares something worth remembering:
1817
1827
  server = new import_server.Server(
1818
1828
  {
1819
1829
  name: "mindgraph",
1820
- version: "0.13.2"
1830
+ version: "0.13.4"
1821
1831
  },
1822
1832
  {
1823
1833
  capabilities: {
@@ -2273,9 +2283,9 @@ function installClaudeCode(apiKey, baseUrl) {
2273
2283
  envArgs.push("--env", `MINDGRAPH_BASE_URL=${baseUrl}`);
2274
2284
  }
2275
2285
  try {
2276
- (0, import_child_process.execSync)(
2286
+ (0, import_child_process.execFileSync)(
2287
+ "claude",
2277
2288
  [
2278
- "claude",
2279
2289
  "mcp",
2280
2290
  "add",
2281
2291
  "mindgraph",
@@ -2284,7 +2294,7 @@ function installClaudeCode(apiKey, baseUrl) {
2284
2294
  "npx",
2285
2295
  "-y",
2286
2296
  "mindgraph-mcp@latest"
2287
- ].join(" "),
2297
+ ],
2288
2298
  { stdio: "inherit" }
2289
2299
  );
2290
2300
  console.log("Added MindGraph MCP server to Claude Code.");
@@ -2315,7 +2325,9 @@ function uninstallClaudeDesktop() {
2315
2325
  }
2316
2326
  function uninstallClaudeCode() {
2317
2327
  try {
2318
- (0, import_child_process.execSync)("claude mcp remove mindgraph", { stdio: "inherit" });
2328
+ (0, import_child_process.execFileSync)("claude", ["mcp", "remove", "mindgraph"], {
2329
+ stdio: "inherit"
2330
+ });
2319
2331
  console.log("Removed MindGraph MCP server from Claude Code.");
2320
2332
  } catch {
2321
2333
  console.error("Failed to run 'claude mcp remove'.");
@@ -2409,13 +2421,13 @@ function openBrowser(url) {
2409
2421
  try {
2410
2422
  switch (process.platform) {
2411
2423
  case "darwin":
2412
- (0, import_child_process.execSync)(`open "${url}"`);
2424
+ (0, import_child_process.execFileSync)("open", [url]);
2413
2425
  break;
2414
2426
  case "win32":
2415
- (0, import_child_process.execSync)(`start "" "${url}"`);
2427
+ (0, import_child_process.execFileSync)("cmd", ["/c", "start", "", url]);
2416
2428
  break;
2417
2429
  case "linux":
2418
- (0, import_child_process.execSync)(`xdg-open "${url}"`);
2430
+ (0, import_child_process.execFileSync)("xdg-open", [url]);
2419
2431
  break;
2420
2432
  }
2421
2433
  } catch {
package/dist/index.js CHANGED
@@ -248,7 +248,7 @@ var TOOLS = [
248
248
  },
249
249
  {
250
250
  name: "mindgraph_plan",
251
- description: "Agent-level task management, governance, and procedural knowledge. Use 'create_plan'/'create_task'/'add_step' for task breakdowns, 'update_status' for progress, 'get_plan' to review. Use 'create_flow'/'add_procedure_step'/'add_affordance'/'add_control' for workflows and procedures. Use 'assess_risk'/'get_assessments' for risk analysis. Use 'create_policy'/'request_approval'/'resolve_approval'/'get_pending' for governance. Prefer mindgraph_commit for user goals/projects; use this for agent-managed execution.",
251
+ description: "Agent-level task management, governance, and procedural knowledge. Use 'create_plan'/'create_task'/'add_step' for task breakdowns, 'update_status' for progress, 'get_plan' to review. Use 'create_flow'/'add_procedure_step'/'add_affordance'/'add_control' for workflows and procedures. Use 'assess_risk'/'get_assessments' for risk analysis. Use 'get_pending' to read the governance approval queue \u2014 approvals are granted by a person in the MindGraph dashboard, never from here, so wait for one rather than trying to clear it. Prefer mindgraph_commit for user goals/projects; use this for agent-managed execution.",
252
252
  inputSchema: {
253
253
  type: "object",
254
254
  properties: {
@@ -263,9 +263,13 @@ var TOOLS = [
263
263
  "start_execution",
264
264
  "complete_execution",
265
265
  "fail_execution",
266
- "create_policy",
267
- "request_approval",
268
- "resolve_approval",
266
+ // C33: governance WRITES are deliberately not exposed here.
267
+ // `create_policy` let a model author the rules it is judged by;
268
+ // `request_approval` + `resolve_approval` let it raise and then
269
+ // clear its own gate, which defeats the human-in-the-loop control
270
+ // entirely. Authoring and resolving happen in the dashboard, by a
271
+ // person. `get_pending` stays — reading the queue is safe and is
272
+ // what an agent needs in order to wait correctly.
269
273
  "get_pending",
270
274
  "create_flow",
271
275
  "add_procedure_step",
@@ -290,7 +294,7 @@ var TOOLS = [
290
294
  },
291
295
  task_uid: {
292
296
  type: "string",
293
- description: "Task/step UID (for update_status, execution actions, resolve_approval)"
297
+ description: "Task/step UID (for update_status, execution actions)"
294
298
  },
295
299
  target_uid: {
296
300
  type: "string",
@@ -481,11 +485,11 @@ var TOOLS = [
481
485
  "ontology"
482
486
  ]
483
487
  },
484
- description: "Cognitive layers to extract (defaults vary by action)"
488
+ description: "Cognitive layers to extract (defaults vary by action). 'ontology' is a targeting flag rather than a cognitive layer: include it only alongside ontology_schema_id, and list it alone to extract domain objects without any cognitive extraction."
485
489
  },
486
490
  ontology_schema_id: {
487
491
  type: "string",
488
- description: "When set, run typed Layer-7 (domain-object) extraction against this schema in addition to the cognitive layers."
492
+ description: "When set, run typed Layer-7 (domain-object) extraction against this schema in addition to the cognitive layers. This field alone drives domain-object extraction \u2014 listing 'ontology' in layers without it extracts nothing."
489
493
  },
490
494
  participants: {
491
495
  type: "array",
@@ -971,19 +975,12 @@ async function handlePlan(client2, args) {
971
975
  return ok(await client2.execution({ action: "complete", task_uid, agent_id }));
972
976
  case "fail_execution":
973
977
  return ok(await client2.execution({ action: "fail", task_uid, agent_id }));
974
- // Governance
975
- case "create_policy":
976
- return ok(
977
- await client2.governance({ action: "create_policy", label, summary, props, agent_id })
978
- );
979
- case "request_approval":
980
- return ok(
981
- await client2.governance({ action: "request_approval", label, summary, props, agent_id })
982
- );
983
- case "resolve_approval":
984
- return ok(
985
- await client2.governance({ action: "resolve_approval", task_uid, props, agent_id })
986
- );
978
+ // Governance — read-only from MCP by design (C33). The write actions were
979
+ // removed rather than repaired: `resolve_approval` here also sent
980
+ // `task_uid` where the server requires `approval_uid`, and never sent
981
+ // `approved` at all, so the server's `unwrap_or(false)` would have silently
982
+ // DENIED every approval an agent tried to resolve. Wiring that correctly
983
+ // would have meant building a working self-approval path — the hole itself.
987
984
  case "get_pending":
988
985
  return ok(await client2.governance({ action: "get_pending", agent_id }));
989
986
  // Procedures (merged from mindgraph_action)
@@ -1251,6 +1248,15 @@ async function handleIngest(client2, args) {
1251
1248
  agent_id
1252
1249
  } = args;
1253
1250
  const src = source_uri ?? source;
1251
+ const targetsOntology = Array.isArray(layers) && layers.includes("ontology");
1252
+ const cognitiveLayers = targetsOntology ? layers.filter((layer) => layer !== "ontology") : layers;
1253
+ if (targetsOntology && !ontology_schema_id) {
1254
+ return err(
1255
+ "layers included 'ontology' but no ontology_schema_id was supplied. Typed Layer-7 extraction is driven by ontology_schema_id, not by the layers list \u2014 pass the schema id, or drop 'ontology' from layers."
1256
+ );
1257
+ }
1258
+ const forwardedLayers = Array.isArray(cognitiveLayers) && cognitiveLayers.length === 0 ? void 0 : cognitiveLayers;
1259
+ const ontologyOnly = targetsOntology && forwardedLayers === void 0;
1254
1260
  switch (action) {
1255
1261
  case "chunk":
1256
1262
  if (!content) return err("content is required for chunk ingestion");
@@ -1260,7 +1266,9 @@ async function handleIngest(client2, args) {
1260
1266
  label: title,
1261
1267
  document_uid,
1262
1268
  chunk_index,
1263
- layers,
1269
+ // `/ingest/chunk` runs its ontology pass inline from
1270
+ // ontology_schema_id alone and has no ontology_only switch.
1271
+ layers: forwardedLayers,
1264
1272
  agent_id,
1265
1273
  ontology_schema_id
1266
1274
  })
@@ -1274,8 +1282,9 @@ async function handleIngest(client2, args) {
1274
1282
  source_uri: src,
1275
1283
  content_type,
1276
1284
  document_type,
1277
- layers,
1285
+ layers: forwardedLayers,
1278
1286
  ontology_schema_id,
1287
+ ...ontologyOnly ? { ontology_only: true } : {},
1279
1288
  participants,
1280
1289
  occurred_at,
1281
1290
  context,
@@ -1290,8 +1299,9 @@ async function handleIngest(client2, args) {
1290
1299
  await client2.ingestSession({
1291
1300
  content,
1292
1301
  title,
1293
- layers,
1302
+ layers: forwardedLayers,
1294
1303
  ontology_schema_id,
1304
+ ...ontologyOnly ? { ontology_only: true } : {},
1295
1305
  participants,
1296
1306
  occurred_at,
1297
1307
  context,
@@ -1760,7 +1770,7 @@ Capture knowledge when the user shares something worth remembering:
1760
1770
  var server = new import_server.Server(
1761
1771
  {
1762
1772
  name: "mindgraph",
1763
- version: "0.13.2"
1773
+ version: "0.13.4"
1764
1774
  },
1765
1775
  {
1766
1776
  capabilities: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "MCP server for MindGraph — connect Claude Desktop, Claude Code, and any MCP client to your knowledge graph",
5
5
  "repository": {
6
6
  "type": "git",