mindgraph-mcp 0.4.0 → 0.6.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/cli.js CHANGED
@@ -387,10 +387,10 @@ async function handleRetrieve(client2, args) {
387
387
  return ok(
388
388
  await client2.retrieveContext({
389
389
  query,
390
- k: limit,
390
+ node_limit: limit,
391
391
  node_types,
392
392
  layer,
393
- include_chunks,
393
+ chunk_limit: include_chunks ? limit ?? 5 : 0,
394
394
  include_graph
395
395
  })
396
396
  );
@@ -462,6 +462,14 @@ async function handleRetrieve(client2, args) {
462
462
  agent_id
463
463
  })
464
464
  );
465
+ // Document inventory
466
+ case "document_index":
467
+ return ok(
468
+ await client2.getNodes({
469
+ node_type: "Document",
470
+ limit: limit ?? 100
471
+ })
472
+ );
465
473
  // Graph traversal
466
474
  case "chain":
467
475
  if (!start_uid) return err("start_uid is required for chain traversal");
@@ -852,7 +860,7 @@ var init_tools = __esm({
852
860
  },
853
861
  {
854
862
  name: "mindgraph_retrieve",
855
- description: "Search and explore the knowledge graph. Use 'context' (default) for BM25 keyword retrieval \u2014 pass 1-3 discriminating keywords (proper nouns, technical terms), not sentences. GOOD: 'Kissinger NATO'. BAD: 'What is Kissinger\\'s view on NATO?'. Use 'semantic' when keywords return nothing \u2014 good for conceptual/fuzzy queries where user words differ from stored labels. Use 'hybrid' to combine keyword + semantic. Use 'text' for fast keyword-only lookup. Use 'neighborhood' to explore around a known node, 'chain' for reasoning chains, 'path' between two nodes, 'subgraph' for connected components. Other actions ('active_goals', 'open_questions', etc.) only when the user explicitly asks.",
863
+ description: "Search and explore the knowledge graph. Use 'context' (default) for BM25 keyword retrieval \u2014 returns graph nodes only by default (labels, summaries, types, confidence); set include_chunks=true to also get full source text. Pass 1-3 discriminating keywords, not sentences. GOOD: 'Kissinger NATO'. BAD: 'What is Kissinger\\'s view on NATO?'. Use 'document_index' to list all ingested documents (titles, dates, UIDs) for orientation. Use 'semantic' when keywords return nothing \u2014 conceptual/fuzzy queries. Use 'hybrid' for keyword + semantic. Use 'text' for fast keyword-only. Use 'neighborhood'/'chain'/'path'/'subgraph' for graph traversal. Other actions ('active_goals', 'open_questions', etc.) only when the user explicitly asks.",
856
864
  inputSchema: {
857
865
  type: "object",
858
866
  properties: {
@@ -873,7 +881,8 @@ var init_tools = __esm({
873
881
  "chain",
874
882
  "neighborhood",
875
883
  "path",
876
- "subgraph"
884
+ "subgraph",
885
+ "document_index"
877
886
  ],
878
887
  description: "Retrieval or traversal strategy"
879
888
  },
@@ -919,7 +928,7 @@ var init_tools = __esm({
919
928
  },
920
929
  include_chunks: {
921
930
  type: "boolean",
922
- description: "Include source document chunks in context results (default: true)"
931
+ description: "Include source document chunks in context results (default: false \u2014 set true to fetch full chunk text for citations or deep reading)"
923
932
  },
924
933
  include_graph: {
925
934
  type: "boolean",
@@ -1013,7 +1022,7 @@ async function main() {
1013
1022
  const transport = new import_stdio.StdioServerTransport();
1014
1023
  await server.connect(transport);
1015
1024
  console.error(
1016
- `MindGraph MCP server v0.4.0 running on stdio (${BASE_URL})`
1025
+ `MindGraph MCP server v0.5.0 running on stdio (${BASE_URL})`
1017
1026
  );
1018
1027
  }
1019
1028
  var import_server, import_stdio, import_types, import_mindgraph, API_KEY, BASE_URL, AGENT_ID, client, INSTRUCTIONS, server, PROMPTS;
@@ -1056,6 +1065,17 @@ There is no session to open. There is no context to pre-load. Just search for wh
1056
1065
  \u2717 WRONG: First retrieve active_goals, then open_questions, then search
1057
1066
  \u2717 WRONG: \`mindgraph_retrieve({action: "context", query: "Tell me about Indian philosophy and Taoism"})\` \u2014 natural language won't match BM25
1058
1067
 
1068
+ ## Two-phase retrieval protocol
1069
+
1070
+ **Phase 1 \u2014 Orient (default, fast, lightweight):**
1071
+ Use \`action: "context"\` with keywords. By default this returns only graph nodes \u2014 structured knowledge with labels, summaries, types, confidence scores, and edges. This is usually sufficient and keeps results compact.
1072
+
1073
+ **Phase 2 \u2014 Fetch source text (only when needed):**
1074
+ If you need the original source text behind a node (for verbatim quotes, citations, or when graph summaries lack detail), use \`action: "context"\` with \`include_chunks: true\`. This adds full document chunks (400-800 words each) to the response.
1075
+
1076
+ **Orientation shortcut:**
1077
+ - \`action: "document_index"\` \u2014 list all ingested documents (titles, dates, UIDs) to see what's in the graph
1078
+
1059
1079
  ## Search strategy \u2014 keyword first, semantic as fallback
1060
1080
 
1061
1081
  The default search uses BM25 keyword matching. Query with 1\u20133 discriminating terms (proper nouns, technical terms). Drop filler words.
@@ -1073,6 +1093,7 @@ If keyword search returns no results, escalate:
1073
1093
  ## When to READ
1074
1094
 
1075
1095
  - User asks about topic X \u2192 \`mindgraph_retrieve\` action "context", query "X keywords"
1096
+ - User asks "what documents are in my graph?" \u2192 action "document_index"
1076
1097
  - User explicitly asks "what are my goals?" \u2192 action "active_goals"
1077
1098
  - User explicitly asks about open questions \u2192 action "open_questions"
1078
1099
  - Explore around a known node \u2192 action "neighborhood" with start_uid
@@ -1094,6 +1115,7 @@ Capture knowledge when the user shares something worth remembering:
1094
1115
 
1095
1116
  - \`capture\`: "entity"/"observation" for facts, "journal" for personal/informal
1096
1117
  - \`reason\`: "claim" when evidence exists, "open_question"/"hypothesis" otherwise
1118
+ - \`retrieve\`: "context" returns graph nodes only by default \u2014 set include_chunks=true for source text
1097
1119
  - \`retrieve\`: "context" (FTS default) \u2192 "semantic" (conceptual fallback) \u2192 "hybrid" (both)
1098
1120
  - \`retrieve\`: "neighborhood"/"chain"/"path"/"subgraph" for graph exploration
1099
1121
  - Confidence: 0.9+ for facts, 0.5-0.8 for uncertain, <0.5 for speculation
@@ -1101,7 +1123,7 @@ Capture knowledge when the user shares something worth remembering:
1101
1123
  server = new import_server.Server(
1102
1124
  {
1103
1125
  name: "mindgraph",
1104
- version: "0.4.0"
1126
+ version: "0.5.0"
1105
1127
  },
1106
1128
  {
1107
1129
  capabilities: {
package/dist/index.js CHANGED
@@ -297,7 +297,7 @@ var TOOLS = [
297
297
  },
298
298
  {
299
299
  name: "mindgraph_retrieve",
300
- description: "Search and explore the knowledge graph. Use 'context' (default) for BM25 keyword retrieval \u2014 pass 1-3 discriminating keywords (proper nouns, technical terms), not sentences. GOOD: 'Kissinger NATO'. BAD: 'What is Kissinger\\'s view on NATO?'. Use 'semantic' when keywords return nothing \u2014 good for conceptual/fuzzy queries where user words differ from stored labels. Use 'hybrid' to combine keyword + semantic. Use 'text' for fast keyword-only lookup. Use 'neighborhood' to explore around a known node, 'chain' for reasoning chains, 'path' between two nodes, 'subgraph' for connected components. Other actions ('active_goals', 'open_questions', etc.) only when the user explicitly asks.",
300
+ description: "Search and explore the knowledge graph. Use 'context' (default) for BM25 keyword retrieval \u2014 returns graph nodes only by default (labels, summaries, types, confidence); set include_chunks=true to also get full source text. Pass 1-3 discriminating keywords, not sentences. GOOD: 'Kissinger NATO'. BAD: 'What is Kissinger\\'s view on NATO?'. Use 'document_index' to list all ingested documents (titles, dates, UIDs) for orientation. Use 'semantic' when keywords return nothing \u2014 conceptual/fuzzy queries. Use 'hybrid' for keyword + semantic. Use 'text' for fast keyword-only. Use 'neighborhood'/'chain'/'path'/'subgraph' for graph traversal. Other actions ('active_goals', 'open_questions', etc.) only when the user explicitly asks.",
301
301
  inputSchema: {
302
302
  type: "object",
303
303
  properties: {
@@ -318,7 +318,8 @@ var TOOLS = [
318
318
  "chain",
319
319
  "neighborhood",
320
320
  "path",
321
- "subgraph"
321
+ "subgraph",
322
+ "document_index"
322
323
  ],
323
324
  description: "Retrieval or traversal strategy"
324
325
  },
@@ -364,7 +365,7 @@ var TOOLS = [
364
365
  },
365
366
  include_chunks: {
366
367
  type: "boolean",
367
- description: "Include source document chunks in context results (default: true)"
368
+ description: "Include source document chunks in context results (default: false \u2014 set true to fetch full chunk text for citations or deep reading)"
368
369
  },
369
370
  include_graph: {
370
371
  type: "boolean",
@@ -809,10 +810,10 @@ async function handleRetrieve(client2, args) {
809
810
  return ok(
810
811
  await client2.retrieveContext({
811
812
  query,
812
- k: limit,
813
+ node_limit: limit,
813
814
  node_types,
814
815
  layer,
815
- include_chunks,
816
+ chunk_limit: include_chunks ? limit ?? 5 : 0,
816
817
  include_graph
817
818
  })
818
819
  );
@@ -884,6 +885,14 @@ async function handleRetrieve(client2, args) {
884
885
  agent_id
885
886
  })
886
887
  );
888
+ // Document inventory
889
+ case "document_index":
890
+ return ok(
891
+ await client2.getNodes({
892
+ node_type: "Document",
893
+ limit: limit ?? 100
894
+ })
895
+ );
887
896
  // Graph traversal
888
897
  case "chain":
889
898
  if (!start_uid) return err("start_uid is required for chain traversal");
@@ -1013,6 +1022,17 @@ There is no session to open. There is no context to pre-load. Just search for wh
1013
1022
  \u2717 WRONG: First retrieve active_goals, then open_questions, then search
1014
1023
  \u2717 WRONG: \`mindgraph_retrieve({action: "context", query: "Tell me about Indian philosophy and Taoism"})\` \u2014 natural language won't match BM25
1015
1024
 
1025
+ ## Two-phase retrieval protocol
1026
+
1027
+ **Phase 1 \u2014 Orient (default, fast, lightweight):**
1028
+ Use \`action: "context"\` with keywords. By default this returns only graph nodes \u2014 structured knowledge with labels, summaries, types, confidence scores, and edges. This is usually sufficient and keeps results compact.
1029
+
1030
+ **Phase 2 \u2014 Fetch source text (only when needed):**
1031
+ If you need the original source text behind a node (for verbatim quotes, citations, or when graph summaries lack detail), use \`action: "context"\` with \`include_chunks: true\`. This adds full document chunks (400-800 words each) to the response.
1032
+
1033
+ **Orientation shortcut:**
1034
+ - \`action: "document_index"\` \u2014 list all ingested documents (titles, dates, UIDs) to see what's in the graph
1035
+
1016
1036
  ## Search strategy \u2014 keyword first, semantic as fallback
1017
1037
 
1018
1038
  The default search uses BM25 keyword matching. Query with 1\u20133 discriminating terms (proper nouns, technical terms). Drop filler words.
@@ -1030,6 +1050,7 @@ If keyword search returns no results, escalate:
1030
1050
  ## When to READ
1031
1051
 
1032
1052
  - User asks about topic X \u2192 \`mindgraph_retrieve\` action "context", query "X keywords"
1053
+ - User asks "what documents are in my graph?" \u2192 action "document_index"
1033
1054
  - User explicitly asks "what are my goals?" \u2192 action "active_goals"
1034
1055
  - User explicitly asks about open questions \u2192 action "open_questions"
1035
1056
  - Explore around a known node \u2192 action "neighborhood" with start_uid
@@ -1051,6 +1072,7 @@ Capture knowledge when the user shares something worth remembering:
1051
1072
 
1052
1073
  - \`capture\`: "entity"/"observation" for facts, "journal" for personal/informal
1053
1074
  - \`reason\`: "claim" when evidence exists, "open_question"/"hypothesis" otherwise
1075
+ - \`retrieve\`: "context" returns graph nodes only by default \u2014 set include_chunks=true for source text
1054
1076
  - \`retrieve\`: "context" (FTS default) \u2192 "semantic" (conceptual fallback) \u2192 "hybrid" (both)
1055
1077
  - \`retrieve\`: "neighborhood"/"chain"/"path"/"subgraph" for graph exploration
1056
1078
  - Confidence: 0.9+ for facts, 0.5-0.8 for uncertain, <0.5 for speculation
@@ -1058,7 +1080,7 @@ Capture knowledge when the user shares something worth remembering:
1058
1080
  var server = new import_server.Server(
1059
1081
  {
1060
1082
  name: "mindgraph",
1061
- version: "0.4.0"
1083
+ version: "0.5.0"
1062
1084
  },
1063
1085
  {
1064
1086
  capabilities: {
@@ -1414,7 +1436,7 @@ async function main() {
1414
1436
  const transport = new import_stdio.StdioServerTransport();
1415
1437
  await server.connect(transport);
1416
1438
  console.error(
1417
- `MindGraph MCP server v0.4.0 running on stdio (${BASE_URL})`
1439
+ `MindGraph MCP server v0.5.0 running on stdio (${BASE_URL})`
1418
1440
  );
1419
1441
  }
1420
1442
  main().catch((error) => {
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "MCP server for MindGraph — connect Claude Desktop, Claude Code, and any MCP client to your knowledge graph",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
8
8
  "mindgraph-mcp": "dist/cli.js"
9
9
  },
10
- "files": ["dist"],
10
+ "files": [
11
+ "dist"
12
+ ],
11
13
  "scripts": {
12
14
  "build": "tsup",
13
15
  "lint": "tsc --noEmit",
@@ -25,7 +27,7 @@
25
27
  "license": "MIT",
26
28
  "dependencies": {
27
29
  "@modelcontextprotocol/sdk": "^1.12.1",
28
- "mindgraph": "^0.2.1"
30
+ "mindgraph": "^0.3.0"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@types/node": "^22.0.0",