mindgraph-mcp 0.14.0 → 0.14.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/dist/cli.js +57 -22
- package/dist/index.js +25 -19
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -710,6 +710,22 @@ var init_codegraph = __esm({
|
|
|
710
710
|
}
|
|
711
711
|
});
|
|
712
712
|
|
|
713
|
+
// src/error-detail.ts
|
|
714
|
+
function errorDetail(e) {
|
|
715
|
+
if (e instanceof import_mindgraph.MindGraphError && e.body !== void 0) {
|
|
716
|
+
const detail = typeof e.body === "string" ? e.body : JSON.stringify(e.body);
|
|
717
|
+
return `${e.message} \u2014 ${detail}`;
|
|
718
|
+
}
|
|
719
|
+
return e instanceof Error ? e.message : String(e);
|
|
720
|
+
}
|
|
721
|
+
var import_mindgraph;
|
|
722
|
+
var init_error_detail = __esm({
|
|
723
|
+
"src/error-detail.ts"() {
|
|
724
|
+
"use strict";
|
|
725
|
+
import_mindgraph = require("mindgraph");
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
|
|
713
729
|
// src/code-tool.ts
|
|
714
730
|
async function handleCodeTool(client2, args, adapter = new CodegraphAdapter()) {
|
|
715
731
|
const codeClient = client2;
|
|
@@ -893,10 +909,7 @@ async function handleCodeTool(client2, args, adapter = new CodegraphAdapter()) {
|
|
|
893
909
|
return err("unknown_action", `unknown mindgraph_code action: ${action}`);
|
|
894
910
|
}
|
|
895
911
|
} catch (cause) {
|
|
896
|
-
return err(
|
|
897
|
-
"code_tool_failed",
|
|
898
|
-
cause instanceof Error ? cause.message : String(cause)
|
|
899
|
-
);
|
|
912
|
+
return err("code_tool_failed", errorDetail(cause));
|
|
900
913
|
}
|
|
901
914
|
}
|
|
902
915
|
async function attachCodeRefsToToolResult(client2, result, args, adapter) {
|
|
@@ -1136,6 +1149,7 @@ var ok, err, CODE_TOOL;
|
|
|
1136
1149
|
var init_code_tool = __esm({
|
|
1137
1150
|
"src/code-tool.ts"() {
|
|
1138
1151
|
"use strict";
|
|
1152
|
+
init_error_detail();
|
|
1139
1153
|
init_codegraph();
|
|
1140
1154
|
ok = (data) => ({
|
|
1141
1155
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
@@ -1304,10 +1318,7 @@ async function handleSyncTool(client2, args) {
|
|
|
1304
1318
|
}
|
|
1305
1319
|
return ok2(await remote.memorySync(request));
|
|
1306
1320
|
} catch (error) {
|
|
1307
|
-
return err2(
|
|
1308
|
-
"sync_failed",
|
|
1309
|
-
error instanceof Error ? error.message : String(error)
|
|
1310
|
-
);
|
|
1321
|
+
return err2("sync_failed", errorDetail(error));
|
|
1311
1322
|
}
|
|
1312
1323
|
}
|
|
1313
1324
|
async function scanRepository(remote, repository, requested, provider, agentId) {
|
|
@@ -1351,6 +1362,7 @@ var init_sync_tool = __esm({
|
|
|
1351
1362
|
import_node_fs5 = __toESM(require("fs"));
|
|
1352
1363
|
import_node_path5 = __toESM(require("path"));
|
|
1353
1364
|
init_codegraph();
|
|
1365
|
+
init_error_detail();
|
|
1354
1366
|
ok2 = (data) => ({
|
|
1355
1367
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
1356
1368
|
});
|
|
@@ -1495,12 +1507,7 @@ async function handleTool(client2, name, args) {
|
|
|
1495
1507
|
].includes(action);
|
|
1496
1508
|
return attach ? await attachCodeRefsToToolResult(client2, result, args) : result;
|
|
1497
1509
|
} catch (e) {
|
|
1498
|
-
|
|
1499
|
-
const detail = typeof e.body === "string" ? e.body : JSON.stringify(e.body);
|
|
1500
|
-
return err3(`${e.message} \u2014 ${detail}`);
|
|
1501
|
-
}
|
|
1502
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
1503
|
-
return err3(message);
|
|
1510
|
+
return err3(errorDetail(e));
|
|
1504
1511
|
}
|
|
1505
1512
|
}
|
|
1506
1513
|
async function handleCapture(client2, args) {
|
|
@@ -1638,13 +1645,23 @@ async function handleReason(client2, args) {
|
|
|
1638
1645
|
agent_id
|
|
1639
1646
|
} = args;
|
|
1640
1647
|
if (action === "claim") {
|
|
1641
|
-
const claimObj = claim
|
|
1648
|
+
const claimObj = claim ? {
|
|
1649
|
+
label: claim.label,
|
|
1650
|
+
confidence: claim.confidence,
|
|
1651
|
+
...claim.content ? { props: { content: claim.content } } : {}
|
|
1652
|
+
} : label ? { label, confidence } : null;
|
|
1642
1653
|
if (!claimObj) return err3("claim object or label is required for action=claim");
|
|
1643
1654
|
return ok3(
|
|
1644
1655
|
await client2.argue({
|
|
1645
1656
|
claim: claimObj,
|
|
1646
|
-
evidence
|
|
1647
|
-
|
|
1657
|
+
evidence: evidence?.map((e) => ({
|
|
1658
|
+
label: e.label,
|
|
1659
|
+
...e.description ? { props: { description: e.description } } : {}
|
|
1660
|
+
})),
|
|
1661
|
+
warrant: warrant ? {
|
|
1662
|
+
label: warrant.label,
|
|
1663
|
+
...warrant.content ? { props: { content: warrant.content } } : {}
|
|
1664
|
+
} : void 0,
|
|
1648
1665
|
argument,
|
|
1649
1666
|
agent_id
|
|
1650
1667
|
})
|
|
@@ -2384,11 +2401,11 @@ async function handleOntology(client2, args) {
|
|
|
2384
2401
|
return err3(`Unknown ontology action: ${action}`);
|
|
2385
2402
|
}
|
|
2386
2403
|
}
|
|
2387
|
-
var
|
|
2404
|
+
var TOOLS, INVOCATION_CONTEXT_SCHEMA;
|
|
2388
2405
|
var init_tools = __esm({
|
|
2389
2406
|
"src/tools.ts"() {
|
|
2390
2407
|
"use strict";
|
|
2391
|
-
|
|
2408
|
+
init_error_detail();
|
|
2392
2409
|
init_code_tool();
|
|
2393
2410
|
init_sync_tool();
|
|
2394
2411
|
TOOLS = [
|
|
@@ -3988,7 +4005,7 @@ Capture knowledge when the user shares something worth remembering:
|
|
|
3988
4005
|
server = new import_server.Server(
|
|
3989
4006
|
{
|
|
3990
4007
|
name: "mindgraph",
|
|
3991
|
-
version: "0.14.
|
|
4008
|
+
version: "0.14.1"
|
|
3992
4009
|
},
|
|
3993
4010
|
{
|
|
3994
4011
|
capabilities: {
|
|
@@ -4738,7 +4755,20 @@ var import_node_os4 = __toESM(require("os"));
|
|
|
4738
4755
|
var import_node_path4 = __toESM(require("path"));
|
|
4739
4756
|
var import_node_crypto3 = __toESM(require("crypto"));
|
|
4740
4757
|
var OWNER_MARKER = "--owner mindgraph";
|
|
4741
|
-
var
|
|
4758
|
+
var RUNNER_RELATIVE = ".mindgraph/bin/mindgraph-hook.cjs";
|
|
4759
|
+
var COMMAND = `node "$HOME/${RUNNER_RELATIVE}" hook --harness claude-code --owner mindgraph`;
|
|
4760
|
+
function installHookRunner(sourceFile, homeDir) {
|
|
4761
|
+
const target = import_node_path4.default.join(homeDir || import_node_os4.default.homedir(), RUNNER_RELATIVE);
|
|
4762
|
+
import_node_fs4.default.mkdirSync(import_node_path4.default.dirname(target), { recursive: true });
|
|
4763
|
+
import_node_fs4.default.copyFileSync(sourceFile, target);
|
|
4764
|
+
return target;
|
|
4765
|
+
}
|
|
4766
|
+
function uninstallHookRunner(homeDir) {
|
|
4767
|
+
try {
|
|
4768
|
+
import_node_fs4.default.rmSync(import_node_path4.default.join(homeDir || import_node_os4.default.homedir(), RUNNER_RELATIVE));
|
|
4769
|
+
} catch {
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4742
4772
|
function settingsPath(scope, projectDir = process.cwd()) {
|
|
4743
4773
|
return scope === "user" ? import_node_path4.default.join(import_node_os4.default.homedir(), ".claude", "settings.json") : import_node_path4.default.join(projectDir, ".claude", "settings.json");
|
|
4744
4774
|
}
|
|
@@ -4759,7 +4789,7 @@ function desiredEntries() {
|
|
|
4759
4789
|
SessionStart: [
|
|
4760
4790
|
{
|
|
4761
4791
|
matcher: "startup|resume|clear|compact|fork",
|
|
4762
|
-
hooks: [ownedHook(
|
|
4792
|
+
hooks: [ownedHook(20)]
|
|
4763
4793
|
}
|
|
4764
4794
|
],
|
|
4765
4795
|
PreToolUse: [
|
|
@@ -5007,6 +5037,8 @@ function withHooksFlag() {
|
|
|
5007
5037
|
}
|
|
5008
5038
|
function finishCodeInstall(apiKey, baseUrl, withHooks) {
|
|
5009
5039
|
if (withHooks) {
|
|
5040
|
+
const runner = installHookRunner(__filename);
|
|
5041
|
+
console.log(`Installed pinned hook runner at ${runner}`);
|
|
5010
5042
|
const result = installClaudeHooks("user");
|
|
5011
5043
|
console.log(
|
|
5012
5044
|
`Installed ${result.added} MindGraph Claude Code hook entries in ${result.path}`
|
|
@@ -5215,6 +5247,8 @@ async function main2() {
|
|
|
5215
5247
|
if ((harness || "claude-code") !== "claude-code") {
|
|
5216
5248
|
throw new Error("only --harness claude-code is available in this release");
|
|
5217
5249
|
}
|
|
5250
|
+
const runner = installHookRunner(__filename);
|
|
5251
|
+
console.log(`Installed pinned hook runner at ${runner}`);
|
|
5218
5252
|
const result = installClaudeHooks(scope, projectDir);
|
|
5219
5253
|
console.log(
|
|
5220
5254
|
`Installed ${result.added} MindGraph Claude Code hook entries in ${result.path}`
|
|
@@ -5233,6 +5267,7 @@ async function main2() {
|
|
|
5233
5267
|
if ((harness || "claude-code") !== "claude-code") {
|
|
5234
5268
|
throw new Error("only --harness claude-code is available in this release");
|
|
5235
5269
|
}
|
|
5270
|
+
uninstallHookRunner();
|
|
5236
5271
|
const result = uninstallClaudeHooks(scope, projectDir);
|
|
5237
5272
|
console.log(
|
|
5238
5273
|
`Removed ${result.removed} MindGraph Claude Code hooks from ${result.path}`
|
package/dist/index.js
CHANGED
|
@@ -28,8 +28,15 @@ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
|
28
28
|
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
29
29
|
var import_mindgraph2 = require("mindgraph");
|
|
30
30
|
|
|
31
|
-
// src/
|
|
31
|
+
// src/error-detail.ts
|
|
32
32
|
var import_mindgraph = require("mindgraph");
|
|
33
|
+
function errorDetail(e) {
|
|
34
|
+
if (e instanceof import_mindgraph.MindGraphError && e.body !== void 0) {
|
|
35
|
+
const detail = typeof e.body === "string" ? e.body : JSON.stringify(e.body);
|
|
36
|
+
return `${e.message} \u2014 ${detail}`;
|
|
37
|
+
}
|
|
38
|
+
return e instanceof Error ? e.message : String(e);
|
|
39
|
+
}
|
|
33
40
|
|
|
34
41
|
// src/codegraph.ts
|
|
35
42
|
var import_node_child_process = require("child_process");
|
|
@@ -964,10 +971,7 @@ async function handleCodeTool(client2, args, adapter = new CodegraphAdapter()) {
|
|
|
964
971
|
return err("unknown_action", `unknown mindgraph_code action: ${action}`);
|
|
965
972
|
}
|
|
966
973
|
} catch (cause) {
|
|
967
|
-
return err(
|
|
968
|
-
"code_tool_failed",
|
|
969
|
-
cause instanceof Error ? cause.message : String(cause)
|
|
970
|
-
);
|
|
974
|
+
return err("code_tool_failed", errorDetail(cause));
|
|
971
975
|
}
|
|
972
976
|
}
|
|
973
977
|
async function attachCodeRefsToToolResult(client2, result, args, adapter) {
|
|
@@ -1374,10 +1378,7 @@ async function handleSyncTool(client2, args) {
|
|
|
1374
1378
|
}
|
|
1375
1379
|
return ok2(await remote.memorySync(request));
|
|
1376
1380
|
} catch (error) {
|
|
1377
|
-
return err2(
|
|
1378
|
-
"sync_failed",
|
|
1379
|
-
error instanceof Error ? error.message : String(error)
|
|
1380
|
-
);
|
|
1381
|
+
return err2("sync_failed", errorDetail(error));
|
|
1381
1382
|
}
|
|
1382
1383
|
}
|
|
1383
1384
|
async function scanRepository(remote, repository, requested, provider, agentId) {
|
|
@@ -2426,12 +2427,7 @@ async function handleTool(client2, name, args) {
|
|
|
2426
2427
|
].includes(action);
|
|
2427
2428
|
return attach ? await attachCodeRefsToToolResult(client2, result, args) : result;
|
|
2428
2429
|
} catch (e) {
|
|
2429
|
-
|
|
2430
|
-
const detail = typeof e.body === "string" ? e.body : JSON.stringify(e.body);
|
|
2431
|
-
return err3(`${e.message} \u2014 ${detail}`);
|
|
2432
|
-
}
|
|
2433
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
2434
|
-
return err3(message);
|
|
2430
|
+
return err3(errorDetail(e));
|
|
2435
2431
|
}
|
|
2436
2432
|
}
|
|
2437
2433
|
async function handleCapture(client2, args) {
|
|
@@ -2569,13 +2565,23 @@ async function handleReason(client2, args) {
|
|
|
2569
2565
|
agent_id
|
|
2570
2566
|
} = args;
|
|
2571
2567
|
if (action === "claim") {
|
|
2572
|
-
const claimObj = claim
|
|
2568
|
+
const claimObj = claim ? {
|
|
2569
|
+
label: claim.label,
|
|
2570
|
+
confidence: claim.confidence,
|
|
2571
|
+
...claim.content ? { props: { content: claim.content } } : {}
|
|
2572
|
+
} : label ? { label, confidence } : null;
|
|
2573
2573
|
if (!claimObj) return err3("claim object or label is required for action=claim");
|
|
2574
2574
|
return ok3(
|
|
2575
2575
|
await client2.argue({
|
|
2576
2576
|
claim: claimObj,
|
|
2577
|
-
evidence
|
|
2578
|
-
|
|
2577
|
+
evidence: evidence?.map((e) => ({
|
|
2578
|
+
label: e.label,
|
|
2579
|
+
...e.description ? { props: { description: e.description } } : {}
|
|
2580
|
+
})),
|
|
2581
|
+
warrant: warrant ? {
|
|
2582
|
+
label: warrant.label,
|
|
2583
|
+
...warrant.content ? { props: { content: warrant.content } } : {}
|
|
2584
|
+
} : void 0,
|
|
2579
2585
|
argument,
|
|
2580
2586
|
agent_id
|
|
2581
2587
|
})
|
|
@@ -3925,7 +3931,7 @@ if (PROFILE === "coding") {
|
|
|
3925
3931
|
var server = new import_server.Server(
|
|
3926
3932
|
{
|
|
3927
3933
|
name: "mindgraph",
|
|
3928
|
-
version: "0.14.
|
|
3934
|
+
version: "0.14.1"
|
|
3929
3935
|
},
|
|
3930
3936
|
{
|
|
3931
3937
|
capabilities: {
|