mindgraph-mcp 0.2.1 → 0.3.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.
Files changed (3) hide show
  1. package/dist/cli.js +66 -27
  2. package/dist/index.js +66 -27
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -411,33 +411,43 @@ async function handlePlan(client2, args) {
411
411
  }
412
412
  }
413
413
  async function handleRetrieve(client2, args) {
414
- const { action, query, layer, limit, node_type, agent_id } = args;
414
+ const {
415
+ action,
416
+ query,
417
+ node_types,
418
+ layer,
419
+ limit,
420
+ include_chunks,
421
+ include_graph,
422
+ confidence_min,
423
+ salience_min,
424
+ agent_id
425
+ } = args;
415
426
  switch (action) {
416
427
  case "context":
417
428
  if (!query) return err("query is required for context retrieval");
418
- return ok(await client2.retrieveContext({ query, k: limit }));
419
- case "hybrid":
420
- if (!query) return err("query is required for hybrid search");
421
429
  return ok(
422
- await client2.hybridSearch(query, {
430
+ await client2.retrieveContext({
431
+ query,
423
432
  k: limit,
424
- node_types: node_type ? [node_type] : void 0
433
+ node_types,
434
+ layer,
435
+ include_chunks,
436
+ include_graph
425
437
  })
426
438
  );
427
- case "semantic":
428
- if (!query) return err("query is required for semantic search");
439
+ case "text":
440
+ if (!query) return err("query is required for text search");
429
441
  return ok(
430
442
  await client2.retrieve({
431
- action: "semantic",
443
+ action: "text",
432
444
  query,
433
445
  limit,
434
- node_type,
446
+ node_types,
447
+ layer,
435
448
  agent_id
436
449
  })
437
450
  );
438
- case "text":
439
- if (!query) return err("query is required for text search");
440
- return ok(await client2.search(query, { limit, node_type }));
441
451
  case "active_goals":
442
452
  return ok(await client2.getGoals());
443
453
  case "open_questions":
@@ -463,7 +473,9 @@ async function handleRetrieve(client2, args) {
463
473
  await client2.retrieve({
464
474
  action: "recent",
465
475
  limit,
466
- node_type,
476
+ node_types,
477
+ confidence_min,
478
+ salience_min,
467
479
  agent_id
468
480
  })
469
481
  );
@@ -943,15 +955,13 @@ var init_tools = __esm({
943
955
  },
944
956
  {
945
957
  name: "mindgraph_retrieve",
946
- description: "Search and query the knowledge graph. ALWAYS retrieve before answering questions about previously stored knowledge. Actions: 'context' for rich retrieval (follows graph edges \u2014 best for RAG), 'hybrid' for fast keyword+semantic search, 'text' for exact keyword match, 'semantic' for meaning-based search. Convenience queries: 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a specific cognitive layer, 'recent' for latest additions.",
958
+ description: "Search and query the knowledge graph using full-text search (BM25). ALWAYS retrieve before answering questions about previously stored knowledge. Use short keyword queries \u2014 specific nouns and terms, NOT full sentences. Actions: 'context' for rich retrieval (FTS + graph traversal \u2014 best for RAG, returns connected entities and source chunks), 'text' for fast direct keyword search. Convenience queries (no query needed): 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a specific cognitive layer, 'recent' for latest additions.",
947
959
  inputSchema: {
948
960
  type: "object",
949
961
  properties: {
950
962
  action: {
951
963
  type: "string",
952
964
  enum: [
953
- "hybrid",
954
- "semantic",
955
965
  "text",
956
966
  "context",
957
967
  "active_goals",
@@ -966,7 +976,12 @@ var init_tools = __esm({
966
976
  },
967
977
  query: {
968
978
  type: "string",
969
- description: "Search query (for hybrid, semantic, text, context)"
979
+ description: "Keyword search query \u2014 use specific nouns and terms, e.g. 'Rust async runtime' not 'what do I know about async in Rust' (for text, context)"
980
+ },
981
+ node_types: {
982
+ type: "array",
983
+ items: { type: "string" },
984
+ description: "Filter by node types (e.g. ['Claim', 'Entity', 'Observation'])"
970
985
  },
971
986
  layer: {
972
987
  type: "string",
@@ -978,15 +993,31 @@ var init_tools = __esm({
978
993
  "memory",
979
994
  "agent"
980
995
  ],
981
- description: "Layer filter (for layer action)"
996
+ description: "Filter by cognitive layer (for context, text, layer actions)"
982
997
  },
983
998
  limit: {
984
999
  type: "number",
985
1000
  description: "Max results to return (default: 10)"
986
1001
  },
987
- node_type: {
988
- type: "string",
989
- description: "Filter by node type"
1002
+ include_chunks: {
1003
+ type: "boolean",
1004
+ description: "Include source document chunks in context results (default: true)"
1005
+ },
1006
+ include_graph: {
1007
+ type: "boolean",
1008
+ description: "Include graph nodes in context results (default: true)"
1009
+ },
1010
+ confidence_min: {
1011
+ type: "number",
1012
+ minimum: 0,
1013
+ maximum: 1,
1014
+ description: "Minimum confidence filter (for recent action)"
1015
+ },
1016
+ salience_min: {
1017
+ type: "number",
1018
+ minimum: 0,
1019
+ maximum: 1,
1020
+ description: "Minimum salience filter (for recent action)"
990
1021
  },
991
1022
  agent_id: {
992
1023
  type: "string",
@@ -1064,7 +1095,7 @@ async function main() {
1064
1095
  const transport = new import_stdio.StdioServerTransport();
1065
1096
  await server.connect(transport);
1066
1097
  console.error(
1067
- `MindGraph MCP server v0.2.0 running on stdio (${BASE_URL})`
1098
+ `MindGraph MCP server v0.3.0 running on stdio (${BASE_URL})`
1068
1099
  );
1069
1100
  }
1070
1101
  var import_server, import_stdio, import_types, import_mindgraph, API_KEY, BASE_URL, AGENT_ID, client, INSTRUCTIONS, server, PROMPTS;
@@ -1107,12 +1138,20 @@ Store knowledge whenever the user shares something worth remembering:
1107
1138
  ## When to READ from the graph
1108
1139
 
1109
1140
  Retrieve context before answering questions that might benefit from prior knowledge:
1110
- - **"What do I know about X?"** \u2192 \`mindgraph_retrieve\` with action "hybrid" or "context"
1141
+ - **"What do I know about X?"** \u2192 \`mindgraph_retrieve\` with action "context" and keyword query
1111
1142
  - **"What are my goals?"** \u2192 \`mindgraph_retrieve\` with action "active_goals"
1112
1143
  - **"What questions are open?"** \u2192 \`mindgraph_retrieve\` with action "open_questions"
1113
1144
  - **Anything referencing past conversations or stored knowledge** \u2192 \`mindgraph_retrieve\` with action "context"
1114
1145
  - **Before making claims about things the user has told you** \u2192 retrieve first to avoid contradictions
1115
1146
 
1147
+ ## Search query style
1148
+
1149
+ MindGraph uses **full-text search (BM25)**, not semantic/embedding search. Write queries as **short keyword phrases**, not natural language questions:
1150
+ - GOOD: \`"Rust async runtime"\`, \`"project deadline March"\`, \`"Sarah engineering manager"\`
1151
+ - BAD: \`"what do I know about async programming in Rust?"\`, \`"tell me about Sarah's role"\`
1152
+
1153
+ Use the most specific nouns and terms from the topic. Multiple keywords broaden recall across label, summary, and content fields.
1154
+
1116
1155
  ## Session management
1117
1156
 
1118
1157
  - Open a session with \`mindgraph_session\` action "open" at the start of a substantial conversation
@@ -1124,7 +1163,7 @@ Retrieve context before answering questions that might benefit from prior knowle
1124
1163
  - **mindgraph_capture vs mindgraph_journal**: Use \`capture\` for structured entities (people, orgs, places) and factual observations. Use \`journal\` for informal notes, preferences, reflections, and anything that's more about the user's inner state than external facts.
1125
1164
  - **mindgraph_argue vs mindgraph_inquire**: Use \`argue\` when there's a specific claim with supporting evidence. Use \`inquire\` for open-ended questions, hypotheses without evidence yet, or theoretical frameworks.
1126
1165
  - **mindgraph_commit vs mindgraph_plan**: Use \`commit\` for the user's goals, projects, and milestones. Use \`plan\` for agent-level task management and execution tracking.
1127
- - **mindgraph_retrieve "hybrid" vs "context"**: Use "hybrid" for quick keyword+semantic search. Use "context" for richer retrieval that follows graph edges from matching chunks to find connected entities and claims.
1166
+ - **mindgraph_retrieve "text" vs "context"**: Use "text" for fast direct keyword lookup. Use "context" for richer retrieval that searches nodes via FTS, then follows graph edges to find connected entities, claims, and source chunks \u2014 best for RAG and comprehensive answers.
1128
1167
  - **mindgraph_ingest**: Use for any content longer than a paragraph. It automatically extracts entities, claims, and relationships. For short facts, use the specific cognitive tools instead.
1129
1168
 
1130
1169
  ## Important behaviors
@@ -1269,7 +1308,7 @@ Retrieve context before answering questions that might benefit from prior knowle
1269
1308
  role: "user",
1270
1309
  content: {
1271
1310
  type: "text",
1272
- text: `Search my knowledge graph for everything related to "${topic}". Use both hybrid search and context retrieval to find entities, claims, evidence, questions, and any connected knowledge. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1311
+ text: `Search my knowledge graph for everything related to "${topic}". Use context retrieval with keyword queries to find entities, claims, evidence, questions, and any connected knowledge. Try multiple keyword variations to ensure broad coverage. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1273
1312
  }
1274
1313
  }
1275
1314
  ]
@@ -1463,7 +1502,7 @@ ${conversation}`
1463
1502
  const searchMatch = uri.match(/^mindgraph:\/\/search\/(.+)$/);
1464
1503
  if (searchMatch) {
1465
1504
  const query = decodeURIComponent(searchMatch[1]);
1466
- const results = await client.hybridSearch(query, { k: 20 });
1505
+ const results = await client.search(query, { limit: 20 });
1467
1506
  return {
1468
1507
  contents: [
1469
1508
  {
package/dist/index.js CHANGED
@@ -428,15 +428,13 @@ var TOOLS = [
428
428
  },
429
429
  {
430
430
  name: "mindgraph_retrieve",
431
- description: "Search and query the knowledge graph. ALWAYS retrieve before answering questions about previously stored knowledge. Actions: 'context' for rich retrieval (follows graph edges \u2014 best for RAG), 'hybrid' for fast keyword+semantic search, 'text' for exact keyword match, 'semantic' for meaning-based search. Convenience queries: 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a specific cognitive layer, 'recent' for latest additions.",
431
+ description: "Search and query the knowledge graph using full-text search (BM25). ALWAYS retrieve before answering questions about previously stored knowledge. Use short keyword queries \u2014 specific nouns and terms, NOT full sentences. Actions: 'context' for rich retrieval (FTS + graph traversal \u2014 best for RAG, returns connected entities and source chunks), 'text' for fast direct keyword search. Convenience queries (no query needed): 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a specific cognitive layer, 'recent' for latest additions.",
432
432
  inputSchema: {
433
433
  type: "object",
434
434
  properties: {
435
435
  action: {
436
436
  type: "string",
437
437
  enum: [
438
- "hybrid",
439
- "semantic",
440
438
  "text",
441
439
  "context",
442
440
  "active_goals",
@@ -451,7 +449,12 @@ var TOOLS = [
451
449
  },
452
450
  query: {
453
451
  type: "string",
454
- description: "Search query (for hybrid, semantic, text, context)"
452
+ description: "Keyword search query \u2014 use specific nouns and terms, e.g. 'Rust async runtime' not 'what do I know about async in Rust' (for text, context)"
453
+ },
454
+ node_types: {
455
+ type: "array",
456
+ items: { type: "string" },
457
+ description: "Filter by node types (e.g. ['Claim', 'Entity', 'Observation'])"
455
458
  },
456
459
  layer: {
457
460
  type: "string",
@@ -463,15 +466,31 @@ var TOOLS = [
463
466
  "memory",
464
467
  "agent"
465
468
  ],
466
- description: "Layer filter (for layer action)"
469
+ description: "Filter by cognitive layer (for context, text, layer actions)"
467
470
  },
468
471
  limit: {
469
472
  type: "number",
470
473
  description: "Max results to return (default: 10)"
471
474
  },
472
- node_type: {
473
- type: "string",
474
- description: "Filter by node type"
475
+ include_chunks: {
476
+ type: "boolean",
477
+ description: "Include source document chunks in context results (default: true)"
478
+ },
479
+ include_graph: {
480
+ type: "boolean",
481
+ description: "Include graph nodes in context results (default: true)"
482
+ },
483
+ confidence_min: {
484
+ type: "number",
485
+ minimum: 0,
486
+ maximum: 1,
487
+ description: "Minimum confidence filter (for recent action)"
488
+ },
489
+ salience_min: {
490
+ type: "number",
491
+ minimum: 0,
492
+ maximum: 1,
493
+ description: "Minimum salience filter (for recent action)"
475
494
  },
476
495
  agent_id: {
477
496
  type: "string",
@@ -924,33 +943,43 @@ async function handlePlan(client2, args) {
924
943
  }
925
944
  }
926
945
  async function handleRetrieve(client2, args) {
927
- const { action, query, layer, limit, node_type, agent_id } = args;
946
+ const {
947
+ action,
948
+ query,
949
+ node_types,
950
+ layer,
951
+ limit,
952
+ include_chunks,
953
+ include_graph,
954
+ confidence_min,
955
+ salience_min,
956
+ agent_id
957
+ } = args;
928
958
  switch (action) {
929
959
  case "context":
930
960
  if (!query) return err("query is required for context retrieval");
931
- return ok(await client2.retrieveContext({ query, k: limit }));
932
- case "hybrid":
933
- if (!query) return err("query is required for hybrid search");
934
961
  return ok(
935
- await client2.hybridSearch(query, {
962
+ await client2.retrieveContext({
963
+ query,
936
964
  k: limit,
937
- node_types: node_type ? [node_type] : void 0
965
+ node_types,
966
+ layer,
967
+ include_chunks,
968
+ include_graph
938
969
  })
939
970
  );
940
- case "semantic":
941
- if (!query) return err("query is required for semantic search");
971
+ case "text":
972
+ if (!query) return err("query is required for text search");
942
973
  return ok(
943
974
  await client2.retrieve({
944
- action: "semantic",
975
+ action: "text",
945
976
  query,
946
977
  limit,
947
- node_type,
978
+ node_types,
979
+ layer,
948
980
  agent_id
949
981
  })
950
982
  );
951
- case "text":
952
- if (!query) return err("query is required for text search");
953
- return ok(await client2.search(query, { limit, node_type }));
954
983
  case "active_goals":
955
984
  return ok(await client2.getGoals());
956
985
  case "open_questions":
@@ -976,7 +1005,9 @@ async function handleRetrieve(client2, args) {
976
1005
  await client2.retrieve({
977
1006
  action: "recent",
978
1007
  limit,
979
- node_type,
1008
+ node_types,
1009
+ confidence_min,
1010
+ salience_min,
980
1011
  agent_id
981
1012
  })
982
1013
  );
@@ -1064,12 +1095,20 @@ Store knowledge whenever the user shares something worth remembering:
1064
1095
  ## When to READ from the graph
1065
1096
 
1066
1097
  Retrieve context before answering questions that might benefit from prior knowledge:
1067
- - **"What do I know about X?"** \u2192 \`mindgraph_retrieve\` with action "hybrid" or "context"
1098
+ - **"What do I know about X?"** \u2192 \`mindgraph_retrieve\` with action "context" and keyword query
1068
1099
  - **"What are my goals?"** \u2192 \`mindgraph_retrieve\` with action "active_goals"
1069
1100
  - **"What questions are open?"** \u2192 \`mindgraph_retrieve\` with action "open_questions"
1070
1101
  - **Anything referencing past conversations or stored knowledge** \u2192 \`mindgraph_retrieve\` with action "context"
1071
1102
  - **Before making claims about things the user has told you** \u2192 retrieve first to avoid contradictions
1072
1103
 
1104
+ ## Search query style
1105
+
1106
+ MindGraph uses **full-text search (BM25)**, not semantic/embedding search. Write queries as **short keyword phrases**, not natural language questions:
1107
+ - GOOD: \`"Rust async runtime"\`, \`"project deadline March"\`, \`"Sarah engineering manager"\`
1108
+ - BAD: \`"what do I know about async programming in Rust?"\`, \`"tell me about Sarah's role"\`
1109
+
1110
+ Use the most specific nouns and terms from the topic. Multiple keywords broaden recall across label, summary, and content fields.
1111
+
1073
1112
  ## Session management
1074
1113
 
1075
1114
  - Open a session with \`mindgraph_session\` action "open" at the start of a substantial conversation
@@ -1081,7 +1120,7 @@ Retrieve context before answering questions that might benefit from prior knowle
1081
1120
  - **mindgraph_capture vs mindgraph_journal**: Use \`capture\` for structured entities (people, orgs, places) and factual observations. Use \`journal\` for informal notes, preferences, reflections, and anything that's more about the user's inner state than external facts.
1082
1121
  - **mindgraph_argue vs mindgraph_inquire**: Use \`argue\` when there's a specific claim with supporting evidence. Use \`inquire\` for open-ended questions, hypotheses without evidence yet, or theoretical frameworks.
1083
1122
  - **mindgraph_commit vs mindgraph_plan**: Use \`commit\` for the user's goals, projects, and milestones. Use \`plan\` for agent-level task management and execution tracking.
1084
- - **mindgraph_retrieve "hybrid" vs "context"**: Use "hybrid" for quick keyword+semantic search. Use "context" for richer retrieval that follows graph edges from matching chunks to find connected entities and claims.
1123
+ - **mindgraph_retrieve "text" vs "context"**: Use "text" for fast direct keyword lookup. Use "context" for richer retrieval that searches nodes via FTS, then follows graph edges to find connected entities, claims, and source chunks \u2014 best for RAG and comprehensive answers.
1085
1124
  - **mindgraph_ingest**: Use for any content longer than a paragraph. It automatically extracts entities, claims, and relationships. For short facts, use the specific cognitive tools instead.
1086
1125
 
1087
1126
  ## Important behaviors
@@ -1226,7 +1265,7 @@ server.setRequestHandler(import_types.GetPromptRequestSchema, async (request) =>
1226
1265
  role: "user",
1227
1266
  content: {
1228
1267
  type: "text",
1229
- text: `Search my knowledge graph for everything related to "${topic}". Use both hybrid search and context retrieval to find entities, claims, evidence, questions, and any connected knowledge. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1268
+ text: `Search my knowledge graph for everything related to "${topic}". Use context retrieval with keyword queries to find entities, claims, evidence, questions, and any connected knowledge. Try multiple keyword variations to ensure broad coverage. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1230
1269
  }
1231
1270
  }
1232
1271
  ]
@@ -1420,7 +1459,7 @@ server.setRequestHandler(import_types.ReadResourceRequestSchema, async (request)
1420
1459
  const searchMatch = uri.match(/^mindgraph:\/\/search\/(.+)$/);
1421
1460
  if (searchMatch) {
1422
1461
  const query = decodeURIComponent(searchMatch[1]);
1423
- const results = await client.hybridSearch(query, { k: 20 });
1462
+ const results = await client.search(query, { limit: 20 });
1424
1463
  return {
1425
1464
  contents: [
1426
1465
  {
@@ -1451,7 +1490,7 @@ async function main() {
1451
1490
  const transport = new import_stdio.StdioServerTransport();
1452
1491
  await server.connect(transport);
1453
1492
  console.error(
1454
- `MindGraph MCP server v0.2.0 running on stdio (${BASE_URL})`
1493
+ `MindGraph MCP server v0.3.0 running on stdio (${BASE_URL})`
1455
1494
  );
1456
1495
  }
1457
1496
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.3.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",