mindgraph-mcp 0.14.3 → 0.14.5

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
@@ -151,8 +151,14 @@ mindgraph-mcp uninstall-hooks Remove MindGraph-owned hook entries
151
151
  mindgraph-mcp status Show installation status
152
152
  ```
153
153
 
154
- Options: `--api-key <key>`, `--base-url <url>`, `--scope user|project`,
155
- `--project-dir <dir>`, `--harness <name>`, `--help`.
154
+ Options: `--api-key <key>`, `--base-url <url>`, `--agent-id <id>`,
155
+ `--scope user|project`, `--project-dir <dir>`, `--harness <name>`, `--help`.
156
+
157
+ **Teams**: when several people share one org graph, give each member a
158
+ distinct identity — `--agent-id claude-code:<name>` on `install-code` /
159
+ `install-hooks`. Anchored knowledge is shared automatically; distinct agent
160
+ ids keep task leases and resume briefs per-person (identical ids make
161
+ teammates one logical agent, which claims each other's work).
156
162
 
157
163
  ## Environment
158
164
 
package/dist/cli.js CHANGED
@@ -916,6 +916,15 @@ var init_dist = __esm({
916
916
  });
917
917
 
918
918
  // src/codegraph.ts
919
+ function unavailabilityCaveats(reason, message) {
920
+ const caveats = [message || "codegraph status failed"];
921
+ if (reason === "absent") {
922
+ caveats.push(
923
+ "Optional: install codegraph (https://github.com/colbymchenry/codegraph) and run `codegraph init` in this repository to enable code anchoring and structural recall. Memory and work tools are unaffected."
924
+ );
925
+ }
926
+ return caveats;
927
+ }
919
928
  function normalizePath(path6) {
920
929
  return path6.replaceAll("\\", "/").replace(/^\.\//, "");
921
930
  }
@@ -1272,11 +1281,12 @@ var init_codegraph = __esm({
1272
1281
  return availability;
1273
1282
  } catch (cause) {
1274
1283
  const failure = cause;
1284
+ const reason = failure.kind ?? "command_failed";
1275
1285
  return {
1276
1286
  available: false,
1277
- reason: failure.kind ?? "command_failed",
1287
+ reason,
1278
1288
  stale: false,
1279
- caveats: [failure.message || "codegraph status failed"]
1289
+ caveats: unavailabilityCaveats(reason, failure.message)
1280
1290
  };
1281
1291
  }
1282
1292
  }
@@ -4893,7 +4903,7 @@ Capture knowledge when the user shares something worth remembering:
4893
4903
  server = new import_server.Server(
4894
4904
  {
4895
4905
  name: "mindgraph",
4896
- version: "0.14.3"
4906
+ version: "0.14.5"
4897
4907
  },
4898
4908
  {
4899
4909
  capabilities: {
@@ -5131,7 +5141,8 @@ function loadHookEnv(dir) {
5131
5141
  const parsed = JSON.parse(raw);
5132
5142
  return {
5133
5143
  baseUrl: typeof parsed.baseUrl === "string" ? parsed.baseUrl : void 0,
5134
- apiKey: typeof parsed.apiKey === "string" ? parsed.apiKey : void 0
5144
+ apiKey: typeof parsed.apiKey === "string" ? parsed.apiKey : void 0,
5145
+ agentId: typeof parsed.agentId === "string" ? parsed.agentId : void 0
5135
5146
  };
5136
5147
  } catch {
5137
5148
  return {};
@@ -5143,7 +5154,8 @@ function saveHookEnv(env, dir) {
5143
5154
  const existing = loadHookEnv(dir);
5144
5155
  const merged = {
5145
5156
  baseUrl: env.baseUrl ?? existing.baseUrl,
5146
- apiKey: env.apiKey ?? existing.apiKey
5157
+ apiKey: env.apiKey ?? existing.apiKey,
5158
+ agentId: env.agentId ?? existing.agentId
5147
5159
  };
5148
5160
  import_node_fs.default.writeFileSync(file, `${JSON.stringify(merged, null, 2)}
5149
5161
  `, {
@@ -5163,6 +5175,7 @@ function parseArgs(argv) {
5163
5175
  let projectDir;
5164
5176
  let harness;
5165
5177
  let hooks = false;
5178
+ let agentId = process.env.MINDGRAPH_AGENT_ID;
5166
5179
  for (let i = 0; i < args.length; i++) {
5167
5180
  const arg = args[i];
5168
5181
  switch (arg) {
@@ -5186,6 +5199,9 @@ function parseArgs(argv) {
5186
5199
  case "--harness":
5187
5200
  harness = args[++i];
5188
5201
  break;
5202
+ case "--agent-id":
5203
+ agentId = args[++i];
5204
+ break;
5189
5205
  case "--hooks":
5190
5206
  hooks = true;
5191
5207
  break;
@@ -5203,7 +5219,7 @@ function parseArgs(argv) {
5203
5219
  break;
5204
5220
  }
5205
5221
  }
5206
- return { command, apiKey, baseUrl, scope, projectDir, harness, hooks };
5222
+ return { command, apiKey, baseUrl, scope, projectDir, harness, hooks, agentId };
5207
5223
  }
5208
5224
  function mcpAddFailureOutput(e) {
5209
5225
  const err5 = e;
@@ -5848,7 +5864,7 @@ function installClaudeDesktop(apiKey, baseUrl) {
5848
5864
  }
5849
5865
  console.log("Restart Claude Desktop to activate.");
5850
5866
  }
5851
- function installClaudeCode(apiKey, baseUrl) {
5867
+ function installClaudeCode(apiKey, baseUrl, agentId) {
5852
5868
  const envArgs = [
5853
5869
  `--env`,
5854
5870
  `MINDGRAPH_API_KEY=${apiKey}`,
@@ -5857,7 +5873,7 @@ function installClaudeCode(apiKey, baseUrl) {
5857
5873
  "--env",
5858
5874
  "MINDGRAPH_HARNESS=claude-code",
5859
5875
  "--env",
5860
- "MINDGRAPH_AGENT_ID=claude-code"
5876
+ `MINDGRAPH_AGENT_ID=${agentId || "claude-code"}`
5861
5877
  ];
5862
5878
  if (baseUrl) {
5863
5879
  envArgs.push("--env", `MINDGRAPH_BASE_URL=${baseUrl}`);
@@ -5951,7 +5967,7 @@ function printStatus() {
5951
5967
  function withHooksFlag() {
5952
5968
  return process.argv.includes("--hooks");
5953
5969
  }
5954
- function finishCodeInstall(apiKey, baseUrl, withHooks) {
5970
+ function finishCodeInstall(apiKey, baseUrl, withHooks, agentId) {
5955
5971
  if (withHooks) {
5956
5972
  const runner = installHookRunner(__filename);
5957
5973
  console.log(`Installed pinned hook runner at ${runner}`);
@@ -5959,7 +5975,7 @@ function finishCodeInstall(apiKey, baseUrl, withHooks) {
5959
5975
  console.log(
5960
5976
  `Installed ${result.added} and refreshed ${result.updated} MindGraph Claude Code hook entries in ${result.path}`
5961
5977
  );
5962
- const envPath = saveHookEnv({ apiKey, baseUrl });
5978
+ const envPath = saveHookEnv({ apiKey, baseUrl, agentId });
5963
5979
  console.log(`Saved hook connection settings to ${envPath} (mode 600)`);
5964
5980
  } else {
5965
5981
  console.log(
@@ -6111,13 +6127,23 @@ async function interactiveInit(baseUrl) {
6111
6127
  installClaudeDesktop(apiKey, baseUrl);
6112
6128
  break;
6113
6129
  case "2":
6114
- installClaudeCode(apiKey, baseUrl);
6115
- finishCodeInstall(apiKey, baseUrl, withHooksFlag());
6130
+ installClaudeCode(apiKey, baseUrl, process.env.MINDGRAPH_AGENT_ID);
6131
+ finishCodeInstall(
6132
+ apiKey,
6133
+ baseUrl,
6134
+ withHooksFlag(),
6135
+ process.env.MINDGRAPH_AGENT_ID
6136
+ );
6116
6137
  break;
6117
6138
  case "3":
6118
6139
  installClaudeDesktop(apiKey, baseUrl);
6119
- installClaudeCode(apiKey, baseUrl);
6120
- finishCodeInstall(apiKey, baseUrl, withHooksFlag());
6140
+ installClaudeCode(apiKey, baseUrl, process.env.MINDGRAPH_AGENT_ID);
6141
+ finishCodeInstall(
6142
+ apiKey,
6143
+ baseUrl,
6144
+ withHooksFlag(),
6145
+ process.env.MINDGRAPH_AGENT_ID
6146
+ );
6121
6147
  break;
6122
6148
  default:
6123
6149
  console.error("Invalid choice.");
@@ -6126,7 +6152,7 @@ async function interactiveInit(baseUrl) {
6126
6152
  console.log("\nDone! Your knowledge graph is now connected.");
6127
6153
  }
6128
6154
  async function main2() {
6129
- const { command, apiKey, baseUrl, scope, projectDir, harness, hooks } = parseArgs(process.argv);
6155
+ const { command, apiKey, baseUrl, scope, projectDir, harness, hooks, agentId } = parseArgs(process.argv);
6130
6156
  switch (command) {
6131
6157
  case "help":
6132
6158
  printUsage();
@@ -6150,8 +6176,8 @@ async function main2() {
6150
6176
  );
6151
6177
  process.exit(1);
6152
6178
  }
6153
- installClaudeCode(apiKey, baseUrl);
6154
- finishCodeInstall(apiKey, baseUrl, withHooksFlag());
6179
+ installClaudeCode(apiKey, baseUrl, agentId);
6180
+ finishCodeInstall(apiKey, baseUrl, withHooksFlag(), agentId);
6155
6181
  break;
6156
6182
  case "uninstall":
6157
6183
  uninstallClaudeDesktop();
@@ -6169,8 +6195,9 @@ async function main2() {
6169
6195
  console.log(
6170
6196
  `Installed ${result.added} and refreshed ${result.updated} MindGraph Claude Code hook entries in ${result.path}`
6171
6197
  );
6172
- if (apiKey || baseUrl) {
6173
- const envPath = saveHookEnv({ apiKey, baseUrl });
6198
+ printCodegraphStatus();
6199
+ if (apiKey || baseUrl || agentId) {
6200
+ const envPath = saveHookEnv({ apiKey, baseUrl, agentId });
6174
6201
  console.log(`Saved hook connection settings to ${envPath} (mode 600)`);
6175
6202
  } else {
6176
6203
  console.log(
@@ -6208,7 +6235,7 @@ async function main2() {
6208
6235
  telemetrySurface: "mcp"
6209
6236
  });
6210
6237
  const output = await runClaudeHook(input, client2, {
6211
- agentId: process.env.MINDGRAPH_AGENT_ID || "claude-code"
6238
+ agentId: process.env.MINDGRAPH_AGENT_ID || stored.agentId || "claude-code"
6212
6239
  });
6213
6240
  process.stdout.write(`${JSON.stringify(output)}
6214
6241
  `);
package/dist/index.js CHANGED
@@ -45,6 +45,15 @@ var import_promises = require("fs/promises");
45
45
  var import_node_os = require("os");
46
46
  var import_node_path = require("path");
47
47
  var import_node_crypto = require("crypto");
48
+ function unavailabilityCaveats(reason, message) {
49
+ const caveats = [message || "codegraph status failed"];
50
+ if (reason === "absent") {
51
+ caveats.push(
52
+ "Optional: install codegraph (https://github.com/colbymchenry/codegraph) and run `codegraph init` in this repository to enable code anchoring and structural recall. Memory and work tools are unaffected."
53
+ );
54
+ }
55
+ return caveats;
56
+ }
48
57
  var DEFAULT_TIMEOUT_MS = 5e3;
49
58
  var DEFAULT_STATUS_TTL_MS = 6e4;
50
59
  var MAX_OUTPUT_BYTES = 5 * 1024 * 1024;
@@ -364,11 +373,12 @@ var CodegraphAdapter = class {
364
373
  return availability;
365
374
  } catch (cause) {
366
375
  const failure = cause;
376
+ const reason = failure.kind ?? "command_failed";
367
377
  return {
368
378
  available: false,
369
- reason: failure.kind ?? "command_failed",
379
+ reason,
370
380
  stale: false,
371
- caveats: [failure.message || "codegraph status failed"]
381
+ caveats: unavailabilityCaveats(reason, failure.message)
372
382
  };
373
383
  }
374
384
  }
@@ -3931,7 +3941,7 @@ if (PROFILE === "coding") {
3931
3941
  var server = new import_server.Server(
3932
3942
  {
3933
3943
  name: "mindgraph",
3934
- version: "0.14.3"
3944
+ version: "0.14.5"
3935
3945
  },
3936
3946
  {
3937
3947
  capabilities: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
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",