mindgraph-mcp 0.14.1 → 0.14.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.
package/dist/cli.js CHANGED
@@ -4005,7 +4005,7 @@ Capture knowledge when the user shares something worth remembering:
4005
4005
  server = new import_server.Server(
4006
4006
  {
4007
4007
  name: "mindgraph",
4008
- version: "0.14.1"
4008
+ version: "0.14.2"
4009
4009
  },
4010
4010
  {
4011
4011
  capabilities: {
@@ -4317,6 +4317,17 @@ function parseArgs(argv) {
4317
4317
  }
4318
4318
  return { command, apiKey, baseUrl, scope, projectDir, harness, hooks };
4319
4319
  }
4320
+ function mcpAddFailureOutput(e) {
4321
+ const err5 = e;
4322
+ return `${err5.stdout ?? ""}${err5.stderr ?? ""}`.trim();
4323
+ }
4324
+ function classifyMcpAddFailure(e) {
4325
+ if (e?.code === "ENOENT") return "missing-cli";
4326
+ if (mcpAddFailureOutput(e).toLowerCase().includes("already exists")) {
4327
+ return "already-exists";
4328
+ }
4329
+ return "other";
4330
+ }
4320
4331
 
4321
4332
  // src/claude-hooks.ts
4322
4333
  var import_node_crypto2 = __toESM(require("crypto"));
@@ -4829,19 +4840,21 @@ function installClaudeHooks(scope, projectDir = process.cwd()) {
4829
4840
  const settings = readSettings(file);
4830
4841
  const hooks = settings.hooks && typeof settings.hooks === "object" && !Array.isArray(settings.hooks) ? settings.hooks : {};
4831
4842
  let added = 0;
4843
+ let updated = 0;
4832
4844
  for (const [event, wanted] of Object.entries(desiredEntries())) {
4833
4845
  const current = Array.isArray(hooks[event]) ? [...hooks[event]] : [];
4846
+ const kept = current.filter((entry) => !entryHasOwnedHook(entry));
4847
+ const hadOwned = kept.length !== current.length;
4834
4848
  for (const entry of wanted) {
4835
- if (!current.some(entryHasOwnedHook)) {
4836
- current.push(entry);
4837
- added += 1;
4838
- }
4849
+ kept.push(entry);
4850
+ if (hadOwned) updated += 1;
4851
+ else added += 1;
4839
4852
  }
4840
- hooks[event] = current;
4853
+ hooks[event] = kept;
4841
4854
  }
4842
4855
  settings.hooks = hooks;
4843
4856
  writeSettings(file, settings);
4844
- return { path: file, added };
4857
+ return { path: file, added, updated };
4845
4858
  }
4846
4859
  function uninstallClaudeHooks(scope, projectDir = process.cwd()) {
4847
4860
  const file = settingsPath(scope, projectDir);
@@ -4962,7 +4975,7 @@ function installClaudeCode(apiKey, baseUrl) {
4962
4975
  envArgs.push("--env", `MINDGRAPH_BASE_URL=${baseUrl}`);
4963
4976
  }
4964
4977
  try {
4965
- (0, import_child_process.execFileSync)(
4978
+ const out = (0, import_child_process.execFileSync)(
4966
4979
  "claude",
4967
4980
  [
4968
4981
  "mcp",
@@ -4974,15 +4987,30 @@ function installClaudeCode(apiKey, baseUrl) {
4974
4987
  "-y",
4975
4988
  "mindgraph-mcp@latest"
4976
4989
  ],
4977
- { stdio: "inherit" }
4990
+ { stdio: ["inherit", "pipe", "pipe"] }
4978
4991
  );
4992
+ if (out?.length) process.stdout.write(out);
4979
4993
  console.log("Added MindGraph MCP server to Claude Code.");
4980
- } catch {
4981
- console.error(
4982
- "Failed to run 'claude mcp add'. Is Claude Code CLI installed?"
4983
- );
4984
- console.error("Install it from: https://claude.ai/code");
4985
- process.exit(1);
4994
+ } catch (e) {
4995
+ switch (classifyMcpAddFailure(e)) {
4996
+ case "already-exists":
4997
+ console.log(
4998
+ "MindGraph MCP server already registered in Claude Code \u2014 leaving it in place."
4999
+ );
5000
+ break;
5001
+ case "missing-cli":
5002
+ console.error(
5003
+ "Failed to run 'claude mcp add'. Is Claude Code CLI installed?"
5004
+ );
5005
+ console.error("Install it from: https://claude.ai/code");
5006
+ process.exit(1);
5007
+ break;
5008
+ default: {
5009
+ const detail = mcpAddFailureOutput(e);
5010
+ console.error(detail || "'claude mcp add' failed.");
5011
+ process.exit(1);
5012
+ }
5013
+ }
4986
5014
  }
4987
5015
  }
4988
5016
  function uninstallClaudeDesktop() {
@@ -5041,7 +5069,7 @@ function finishCodeInstall(apiKey, baseUrl, withHooks) {
5041
5069
  console.log(`Installed pinned hook runner at ${runner}`);
5042
5070
  const result = installClaudeHooks("user");
5043
5071
  console.log(
5044
- `Installed ${result.added} MindGraph Claude Code hook entries in ${result.path}`
5072
+ `Installed ${result.added} and refreshed ${result.updated} MindGraph Claude Code hook entries in ${result.path}`
5045
5073
  );
5046
5074
  const envPath = saveHookEnv({ apiKey, baseUrl });
5047
5075
  console.log(`Saved hook connection settings to ${envPath} (mode 600)`);
@@ -5251,7 +5279,7 @@ async function main2() {
5251
5279
  console.log(`Installed pinned hook runner at ${runner}`);
5252
5280
  const result = installClaudeHooks(scope, projectDir);
5253
5281
  console.log(
5254
- `Installed ${result.added} MindGraph Claude Code hook entries in ${result.path}`
5282
+ `Installed ${result.added} and refreshed ${result.updated} MindGraph Claude Code hook entries in ${result.path}`
5255
5283
  );
5256
5284
  if (apiKey || baseUrl) {
5257
5285
  const envPath = saveHookEnv({ apiKey, baseUrl });
package/dist/index.js CHANGED
@@ -3931,7 +3931,7 @@ if (PROFILE === "coding") {
3931
3931
  var server = new import_server.Server(
3932
3932
  {
3933
3933
  name: "mindgraph",
3934
- version: "0.14.1"
3934
+ version: "0.14.2"
3935
3935
  },
3936
3936
  {
3937
3937
  capabilities: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
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",