mindgraph-mcp 0.23.0 → 0.24.0

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/server.d.mts CHANGED
@@ -77,6 +77,10 @@ interface MemoryRuntimeConfig {
77
77
  /** Everything the request handlers close over. */
78
78
  interface ServerWiring {
79
79
  client: MindGraph;
80
+ /** Fields a local harness hook recorded for a call (see call-ledger.ts).
81
+ * Injected by the stdio entry so this module stays free of node:fs for the
82
+ * hosted bundle. */
83
+ resolveHookFields?: (name: string, args: Record<string, unknown>) => Record<string, unknown> | undefined;
80
84
  serverVersion: string;
81
85
  instructions: string;
82
86
  profile: string;
package/dist/server.d.ts CHANGED
@@ -77,6 +77,10 @@ interface MemoryRuntimeConfig {
77
77
  /** Everything the request handlers close over. */
78
78
  interface ServerWiring {
79
79
  client: MindGraph;
80
+ /** Fields a local harness hook recorded for a call (see call-ledger.ts).
81
+ * Injected by the stdio entry so this module stays free of node:fs for the
82
+ * hosted bundle. */
83
+ resolveHookFields?: (name: string, args: Record<string, unknown>) => Record<string, unknown> | undefined;
80
84
  serverVersion: string;
81
85
  instructions: string;
82
86
  profile: string;
package/dist/server.js CHANGED
@@ -331,6 +331,14 @@ function hiddenSections(payload) {
331
331
  function renderContext(response, maxChars) {
332
332
  const payload = obj(response);
333
333
  if (!payload) return void 0;
334
+ if (typeof payload.context_text === "string" && payload.context_text.length > 0) {
335
+ const text2 = payload.context_text;
336
+ if (maxChars !== void 0 && text2.length > maxChars) {
337
+ return `${text2.slice(0, maxChars)}
338
+ [truncated to ${maxChars} characters]`;
339
+ }
340
+ return text2;
341
+ }
334
342
  const graph = obj(payload.graph);
335
343
  const rawNodes = Array.isArray(graph?.nodes) ? graph.nodes : [];
336
344
  const shaped = rawNodes.filter(isNodeShaped);
@@ -4465,6 +4473,15 @@ var TOOLS = [
4465
4473
  type: "string",
4466
4474
  description: "ISO-8601 date (e.g. '2021-06') for context: nodes with validity windows are annotated as of this date instead of today"
4467
4475
  },
4476
+ as_of: {
4477
+ type: "string",
4478
+ description: "ISO-8601 date for context: answer with what had been STATED by this date (a node is admitted when one of its sources was stated on or before it; fact dates never exclude it). Use for 'what did we know / what was the value as of <date>' questions."
4479
+ },
4480
+ retrieval_mode: {
4481
+ type: "string",
4482
+ enum: ["normal", "exhaustive"],
4483
+ description: "context: 'exhaustive' widens retrieval for list/count questions ('how many different \u2026 across', 'what two \u2026'); omitted lets the server's cue decide."
4484
+ },
4468
4485
  created_after: {
4469
4486
  type: "number",
4470
4487
  description: "Unix seconds \u2014 'recent' action: only nodes ingested after this time"
@@ -5693,6 +5710,8 @@ async function handleRetrieve(client, args, profile) {
5693
5710
  salience_min,
5694
5711
  article_limit,
5695
5712
  valid_at,
5713
+ as_of,
5714
+ retrieval_mode,
5696
5715
  created_after,
5697
5716
  created_before,
5698
5717
  explain,
@@ -5721,9 +5740,15 @@ async function handleRetrieve(client, args, profile) {
5721
5740
  // the advertised knob must not get a silent no-op).
5722
5741
  ...article_limit !== void 0 ? { article_limit } : include_documents === false || profile === "coding" && !include_documents ? { article_limit: 0 } : {},
5723
5742
  valid_at,
5743
+ as_of,
5744
+ retrieval_mode,
5724
5745
  include_graph,
5725
5746
  graph_expansion_limit: graph_expansion_limit ?? 3,
5726
- graph_max_depth: graph_max_depth ?? 2
5747
+ graph_max_depth: graph_max_depth ?? 2,
5748
+ // Evidence plan R2: the server's canonical rendering under a token
5749
+ // budget derived from the character budget; the local renderer is
5750
+ // the fallback for servers that predate it.
5751
+ ...format === "json" ? {} : { format: "text", max_tokens: Math.max(256, Math.floor((max_output_chars ?? 24e3) / 4)) }
5727
5752
  }),
5728
5753
  (raw) => renderContext(raw, max_output_chars)
5729
5754
  );
@@ -6197,7 +6222,12 @@ function buildMindGraphServer(wiring) {
6197
6222
  });
6198
6223
  server.setRequestHandler(import_types.CallToolRequestSchema, async (request) => {
6199
6224
  const { name, arguments: args } = request.params;
6200
- const rawArgs = { ...args || {} };
6225
+ const rawArgs = {
6226
+ ...args || {},
6227
+ // H1: session, lease and invocation fields the local hook recorded for
6228
+ // this exact call (stdio only; hosted mode has no local hook).
6229
+ ...hosted ? {} : wiring.resolveHookFields?.(name, args || {})
6230
+ };
6201
6231
  const toolArgs = { ...rawArgs };
6202
6232
  let governanceConfig = wiring.governance;
6203
6233
  if (hosted) {
package/dist/server.mjs CHANGED
@@ -303,6 +303,14 @@ function hiddenSections(payload) {
303
303
  function renderContext(response, maxChars) {
304
304
  const payload = obj(response);
305
305
  if (!payload) return void 0;
306
+ if (typeof payload.context_text === "string" && payload.context_text.length > 0) {
307
+ const text2 = payload.context_text;
308
+ if (maxChars !== void 0 && text2.length > maxChars) {
309
+ return `${text2.slice(0, maxChars)}
310
+ [truncated to ${maxChars} characters]`;
311
+ }
312
+ return text2;
313
+ }
306
314
  const graph = obj(payload.graph);
307
315
  const rawNodes = Array.isArray(graph?.nodes) ? graph.nodes : [];
308
316
  const shaped = rawNodes.filter(isNodeShaped);
@@ -4452,6 +4460,15 @@ var TOOLS = [
4452
4460
  type: "string",
4453
4461
  description: "ISO-8601 date (e.g. '2021-06') for context: nodes with validity windows are annotated as of this date instead of today"
4454
4462
  },
4463
+ as_of: {
4464
+ type: "string",
4465
+ description: "ISO-8601 date for context: answer with what had been STATED by this date (a node is admitted when one of its sources was stated on or before it; fact dates never exclude it). Use for 'what did we know / what was the value as of <date>' questions."
4466
+ },
4467
+ retrieval_mode: {
4468
+ type: "string",
4469
+ enum: ["normal", "exhaustive"],
4470
+ description: "context: 'exhaustive' widens retrieval for list/count questions ('how many different \u2026 across', 'what two \u2026'); omitted lets the server's cue decide."
4471
+ },
4455
4472
  created_after: {
4456
4473
  type: "number",
4457
4474
  description: "Unix seconds \u2014 'recent' action: only nodes ingested after this time"
@@ -5680,6 +5697,8 @@ async function handleRetrieve(client, args, profile) {
5680
5697
  salience_min,
5681
5698
  article_limit,
5682
5699
  valid_at,
5700
+ as_of,
5701
+ retrieval_mode,
5683
5702
  created_after,
5684
5703
  created_before,
5685
5704
  explain,
@@ -5708,9 +5727,15 @@ async function handleRetrieve(client, args, profile) {
5708
5727
  // the advertised knob must not get a silent no-op).
5709
5728
  ...article_limit !== void 0 ? { article_limit } : include_documents === false || profile === "coding" && !include_documents ? { article_limit: 0 } : {},
5710
5729
  valid_at,
5730
+ as_of,
5731
+ retrieval_mode,
5711
5732
  include_graph,
5712
5733
  graph_expansion_limit: graph_expansion_limit ?? 3,
5713
- graph_max_depth: graph_max_depth ?? 2
5734
+ graph_max_depth: graph_max_depth ?? 2,
5735
+ // Evidence plan R2: the server's canonical rendering under a token
5736
+ // budget derived from the character budget; the local renderer is
5737
+ // the fallback for servers that predate it.
5738
+ ...format === "json" ? {} : { format: "text", max_tokens: Math.max(256, Math.floor((max_output_chars ?? 24e3) / 4)) }
5714
5739
  }),
5715
5740
  (raw) => renderContext(raw, max_output_chars)
5716
5741
  );
@@ -6184,7 +6209,12 @@ function buildMindGraphServer(wiring) {
6184
6209
  });
6185
6210
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
6186
6211
  const { name, arguments: args } = request.params;
6187
- const rawArgs = { ...args || {} };
6212
+ const rawArgs = {
6213
+ ...args || {},
6214
+ // H1: session, lease and invocation fields the local hook recorded for
6215
+ // this exact call (stdio only; hosted mode has no local hook).
6216
+ ...hosted ? {} : wiring.resolveHookFields?.(name, args || {})
6217
+ };
6188
6218
  const toolArgs = { ...rawArgs };
6189
6219
  let governanceConfig = wiring.governance;
6190
6220
  if (hosted) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.23.0",
4
- "description": "MCP server for MindGraph \u2014 connect Claude Desktop, Claude Code, and any MCP client to your knowledge graph",
3
+ "version": "0.24.0",
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",
7
7
  "url": "git+https://github.com/shuruheel/mindgraph-mcp.git"
@@ -44,7 +44,7 @@
44
44
  "license": "MIT",
45
45
  "dependencies": {
46
46
  "@modelcontextprotocol/sdk": "^1.25.0",
47
- "mindgraph": "^0.16.0"
47
+ "mindgraph": "^0.17.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^22.0.0",