mindgraph-mcp 0.6.1 → 0.7.1

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 ADDED
@@ -0,0 +1,128 @@
1
+ # mindgraph-mcp
2
+
3
+ [![npm](https://img.shields.io/npm/v/mindgraph-mcp)](https://www.npmjs.com/package/mindgraph-mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+
6
+ Model Context Protocol server for [MindGraph](https://mindgraph.cloud) — plug your persistent, structured knowledge graph into Claude Desktop, Claude Code, and any MCP-compatible client.
7
+
8
+ ## Install
9
+
10
+ The fastest way to install is the interactive setup:
11
+
12
+ ```bash
13
+ npx mindgraph-mcp init
14
+ ```
15
+
16
+ This walks you through:
17
+
18
+ 1. Sign in via browser (or paste an existing API key).
19
+ 2. Pick your client — Claude Desktop, Claude Code, or both.
20
+ 3. The server is wired up automatically; restart your client to activate.
21
+
22
+ Don't have a MindGraph account yet? Sign up at [mindgraph.cloud](https://mindgraph.cloud) first.
23
+
24
+ ### Manual install
25
+
26
+ ```bash
27
+ # Claude Desktop
28
+ npx mindgraph-mcp install --api-key mg_your_key_here
29
+
30
+ # Claude Code
31
+ npx mindgraph-mcp install-code --api-key mg_your_key_here
32
+ ```
33
+
34
+ Or drop this into your Claude Desktop config by hand (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "mindgraph": {
40
+ "command": "npx",
41
+ "args": ["-y", "mindgraph-mcp@latest"],
42
+ "env": {
43
+ "MINDGRAPH_API_KEY": "mg_your_key_here"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## What You Get
51
+
52
+ **7 tools** covering the full knowledge-graph workflow:
53
+
54
+ | Tool | Purpose |
55
+ |------|---------|
56
+ | `mindgraph_capture` | Entities, observations, sources, snippets, concepts, journal entries |
57
+ | `mindgraph_reason` | Claims with evidence, open questions, hypotheses, theories, anomalies |
58
+ | `mindgraph_commit` | Goals, projects, decisions, options, milestones |
59
+ | `mindgraph_plan` | Plans, tasks, procedures, governance policies, risk assessments, executions |
60
+ | `mindgraph_retrieve` | BM25 / semantic / hybrid search, traversal (chain, neighborhood, path, subgraph), document index |
61
+ | `mindgraph_ingest` | Chunk / document / session ingestion with LLM-powered extraction |
62
+ | `mindgraph_synthesize` | Project-scoped cross-document synthesis — mine signals, spawn Article-generation jobs |
63
+
64
+ **7 prompt templates** for common workflows:
65
+
66
+ `graph-summary`, `active-goals`, `open-questions`, `review-contradictions`, `knowledge-about`, `daily-briefing`, `capture-conversation`.
67
+
68
+ **Resources** (static + dynamic URIs):
69
+
70
+ - `mindgraph://stats`, `mindgraph://goals`, `mindgraph://questions`, `mindgraph://contradictions`, `mindgraph://decisions`
71
+ - `mindgraph://node/{uid}` — a node with all its outgoing and incoming edges
72
+ - `mindgraph://search/{query}` — BM25 search results
73
+ - `mindgraph://layer/{layer}` — all nodes in a cognitive layer (reality, epistemic, intent, action, memory, agent)
74
+
75
+ ## CLI
76
+
77
+ ```text
78
+ mindgraph-mcp Start the MCP server (stdio transport)
79
+ mindgraph-mcp init Interactive setup
80
+ mindgraph-mcp install Install into Claude Desktop config
81
+ mindgraph-mcp install-code Install into Claude Code
82
+ mindgraph-mcp uninstall Remove from Claude Desktop config
83
+ mindgraph-mcp uninstall-code Remove from Claude Code
84
+ mindgraph-mcp status Show installation status
85
+ ```
86
+
87
+ Options: `--api-key <key>`, `--base-url <url>`, `--help`.
88
+
89
+ ## Environment
90
+
91
+ | Variable | Default | Purpose |
92
+ |----------|---------|---------|
93
+ | `MINDGRAPH_API_KEY` | *(required)* | Your MindGraph API key (`mg_…`) |
94
+ | `MINDGRAPH_BASE_URL` | `https://api.mindgraph.cloud` | Override for self-hosted deployments |
95
+ | `MINDGRAPH_AGENT_ID` | `mcp` | Stamped onto every node/edge written by the MCP — useful for provenance across multiple agents |
96
+ | `MINDGRAPH_ORG_ID` | *(unset)* | Pin operations to a specific organization when a key has access to more than one |
97
+
98
+ ## Usage in Claude
99
+
100
+ Once installed, start asking Claude about your knowledge graph naturally:
101
+
102
+ > "What did I capture about climate policy last week?"
103
+ > "Summarize my active goals and open decisions."
104
+ > "Ingest this PDF and extract the main claims."
105
+ > "Find entities mentioned across multiple project documents, then spin up a synthesis."
106
+
107
+ The server auto-injects `agent_id: "mcp"` on every write so you always know which nodes came from your MCP sessions.
108
+
109
+ ## Architecture
110
+
111
+ This MCP server is a thin wrapper over the [mindgraph](https://www.npmjs.com/package/mindgraph) TypeScript SDK. It exposes cognitive-layer abstractions (Reality, Epistemic, Intent, Action, Memory, Agent) as consolidated tools rather than one-tool-per-endpoint, which keeps the tool surface compact enough for high-quality tool selection by the model.
112
+
113
+ Search strategy is **keyword-first**: `mindgraph_retrieve` defaults to `action: "context"` which uses BM25. Escalate to `semantic` or `hybrid` only when keywords fail.
114
+
115
+ ## Development
116
+
117
+ ```bash
118
+ git clone https://github.com/shuruheel/mindgraph-mcp
119
+ cd mindgraph-mcp
120
+ npm install
121
+ npm run build # build with tsup (CJS + .d.ts)
122
+ npm run lint # tsc --noEmit
123
+ npm run dev # tsup --watch
124
+ ```
125
+
126
+ ## License
127
+
128
+ MIT
package/dist/cli.js CHANGED
@@ -53,6 +53,8 @@ async function handleTool(client2, name, args) {
53
53
  return await handleRetrieve(client2, args);
54
54
  case "mindgraph_ingest":
55
55
  return await handleIngest(client2, args);
56
+ case "mindgraph_synthesize":
57
+ return await handleSynthesize(client2, args);
56
58
  default:
57
59
  return err(`Unknown tool: ${name}`);
58
60
  }
@@ -566,6 +568,26 @@ async function handleIngest(client2, args) {
566
568
  return err(`Unknown ingest action: ${action}`);
567
569
  }
568
570
  }
571
+ async function handleSynthesize(client2, args) {
572
+ const { action, project_uid, signals, target_types, job_id } = args;
573
+ switch (action) {
574
+ case "signals":
575
+ if (!project_uid)
576
+ return err("project_uid is required for action='signals'");
577
+ return ok(
578
+ await client2.signals(project_uid, { signals, target_types })
579
+ );
580
+ case "run":
581
+ if (!project_uid)
582
+ return err("project_uid is required for action='run'");
583
+ return ok(await client2.runSynthesis(project_uid));
584
+ case "job_status":
585
+ if (!job_id) return err("job_id is required for action='job_status'");
586
+ return ok(await client2.getJob(job_id));
587
+ default:
588
+ return err(`Unknown synthesize action: ${action}`);
589
+ }
590
+ }
569
591
  var TOOLS;
570
592
  var init_tools = __esm({
571
593
  "src/tools.ts"() {
@@ -1011,6 +1033,41 @@ var init_tools = __esm({
1011
1033
  },
1012
1034
  required: ["action"]
1013
1035
  }
1036
+ },
1037
+ {
1038
+ name: "mindgraph_synthesize",
1039
+ description: "Work with Projects \u2014 scoped document corpora \u2014 and run cross-document synthesis over them. Use 'signals' to mine structural signals (entity bridges, claim hubs, theory support gaps, concept clusters, analogy candidates, dialectical pairs) without any LLM calls; useful for orientation before a full synthesis. Use 'run' to spawn a background synthesis job that turns the top idea clusters into Article nodes linked via Covers edges. Both operate on a Project's corpus, where documents are linked to the Project via PartOfProject edges (create the project with mindgraph_commit action 'project', then link docs via the ingest flow or add_link). Use 'job_status' to poll a synthesis job.",
1040
+ inputSchema: {
1041
+ type: "object",
1042
+ properties: {
1043
+ action: {
1044
+ type: "string",
1045
+ enum: ["signals", "run", "job_status"],
1046
+ description: "Synthesis action"
1047
+ },
1048
+ project_uid: {
1049
+ type: "string",
1050
+ description: "UID of the Project node (required for signals/run)"
1051
+ },
1052
+ signals: {
1053
+ type: "string",
1054
+ description: "Comma-separated subset of signal names to compute, e.g. 'clustered_claim_hubs,dialectical_pairs'. If omitted, all signals run. (Only for action='signals'.)"
1055
+ },
1056
+ target_types: {
1057
+ type: "string",
1058
+ description: "Comma-separated node types used to filter entity_bridges and claim_hubs (e.g. 'Person,Organization,Theory'). (Only for action='signals'.)"
1059
+ },
1060
+ job_id: {
1061
+ type: "string",
1062
+ description: "Job ID to poll (for action='job_status')"
1063
+ },
1064
+ agent_id: {
1065
+ type: "string",
1066
+ description: "Agent identity"
1067
+ }
1068
+ },
1069
+ required: ["action"]
1070
+ }
1014
1071
  }
1015
1072
  ];
1016
1073
  }
@@ -1022,10 +1079,10 @@ async function main() {
1022
1079
  const transport = new import_stdio.StdioServerTransport();
1023
1080
  await server.connect(transport);
1024
1081
  console.error(
1025
- `MindGraph MCP server v0.5.0 running on stdio (${BASE_URL})`
1082
+ `MindGraph MCP server v0.7.1 running on stdio (${BASE_URL})`
1026
1083
  );
1027
1084
  }
1028
- var import_server, import_stdio, import_types, import_mindgraph, API_KEY, BASE_URL, AGENT_ID, client, INSTRUCTIONS, server, PROMPTS;
1085
+ var import_server, import_stdio, import_types, import_mindgraph, API_KEY, BASE_URL, AGENT_ID, ORG_ID, client, INSTRUCTIONS, server, PROMPTS;
1029
1086
  var init_src = __esm({
1030
1087
  "src/index.ts"() {
1031
1088
  "use strict";
@@ -1037,6 +1094,7 @@ var init_src = __esm({
1037
1094
  API_KEY = process.env.MINDGRAPH_API_KEY;
1038
1095
  BASE_URL = process.env.MINDGRAPH_BASE_URL || "https://api.mindgraph.cloud";
1039
1096
  AGENT_ID = process.env.MINDGRAPH_AGENT_ID || "mcp";
1097
+ ORG_ID = process.env.MINDGRAPH_ORG_ID;
1040
1098
  if (!API_KEY) {
1041
1099
  console.error(
1042
1100
  "Error: MINDGRAPH_API_KEY environment variable is required.\nGet your API key at https://mindgraph.cloud/dashboard/keys\nOr run: npx mindgraph-mcp init"
@@ -1045,9 +1103,10 @@ var init_src = __esm({
1045
1103
  }
1046
1104
  client = new import_mindgraph.MindGraph({
1047
1105
  baseUrl: BASE_URL,
1048
- apiKey: API_KEY
1106
+ apiKey: API_KEY,
1107
+ orgId: ORG_ID
1049
1108
  });
1050
- INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph (6 tools).
1109
+ INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph (7 tools).
1051
1110
 
1052
1111
  ## #1 RULE: Go straight to the user's topic
1053
1112
 
@@ -1110,6 +1169,7 @@ Capture knowledge when the user shares something worth remembering:
1110
1169
  - Goals or projects \u2192 \`mindgraph_commit\` action "goal"/"project"
1111
1170
  - Decisions \u2192 \`mindgraph_commit\` action "open_decision"
1112
1171
  - Long-form content \u2192 \`mindgraph_ingest\`
1172
+ - Cross-document synthesis over a project corpus \u2192 \`mindgraph_synthesize\` (action "signals" for structural signals; action "run" to spawn a synthesis job that writes Article nodes)
1113
1173
 
1114
1174
  ## Tool tips
1115
1175
 
@@ -1123,7 +1183,7 @@ Capture knowledge when the user shares something worth remembering:
1123
1183
  server = new import_server.Server(
1124
1184
  {
1125
1185
  name: "mindgraph",
1126
- version: "0.5.0"
1186
+ version: "0.7.1"
1127
1187
  },
1128
1188
  {
1129
1189
  capabilities: {
package/dist/index.js CHANGED
@@ -448,6 +448,41 @@ var TOOLS = [
448
448
  },
449
449
  required: ["action"]
450
450
  }
451
+ },
452
+ {
453
+ name: "mindgraph_synthesize",
454
+ description: "Work with Projects \u2014 scoped document corpora \u2014 and run cross-document synthesis over them. Use 'signals' to mine structural signals (entity bridges, claim hubs, theory support gaps, concept clusters, analogy candidates, dialectical pairs) without any LLM calls; useful for orientation before a full synthesis. Use 'run' to spawn a background synthesis job that turns the top idea clusters into Article nodes linked via Covers edges. Both operate on a Project's corpus, where documents are linked to the Project via PartOfProject edges (create the project with mindgraph_commit action 'project', then link docs via the ingest flow or add_link). Use 'job_status' to poll a synthesis job.",
455
+ inputSchema: {
456
+ type: "object",
457
+ properties: {
458
+ action: {
459
+ type: "string",
460
+ enum: ["signals", "run", "job_status"],
461
+ description: "Synthesis action"
462
+ },
463
+ project_uid: {
464
+ type: "string",
465
+ description: "UID of the Project node (required for signals/run)"
466
+ },
467
+ signals: {
468
+ type: "string",
469
+ description: "Comma-separated subset of signal names to compute, e.g. 'clustered_claim_hubs,dialectical_pairs'. If omitted, all signals run. (Only for action='signals'.)"
470
+ },
471
+ target_types: {
472
+ type: "string",
473
+ description: "Comma-separated node types used to filter entity_bridges and claim_hubs (e.g. 'Person,Organization,Theory'). (Only for action='signals'.)"
474
+ },
475
+ job_id: {
476
+ type: "string",
477
+ description: "Job ID to poll (for action='job_status')"
478
+ },
479
+ agent_id: {
480
+ type: "string",
481
+ description: "Agent identity"
482
+ }
483
+ },
484
+ required: ["action"]
485
+ }
451
486
  }
452
487
  ];
453
488
  function ok(data) {
@@ -476,6 +511,8 @@ async function handleTool(client2, name, args) {
476
511
  return await handleRetrieve(client2, args);
477
512
  case "mindgraph_ingest":
478
513
  return await handleIngest(client2, args);
514
+ case "mindgraph_synthesize":
515
+ return await handleSynthesize(client2, args);
479
516
  default:
480
517
  return err(`Unknown tool: ${name}`);
481
518
  }
@@ -989,11 +1026,32 @@ async function handleIngest(client2, args) {
989
1026
  return err(`Unknown ingest action: ${action}`);
990
1027
  }
991
1028
  }
1029
+ async function handleSynthesize(client2, args) {
1030
+ const { action, project_uid, signals, target_types, job_id } = args;
1031
+ switch (action) {
1032
+ case "signals":
1033
+ if (!project_uid)
1034
+ return err("project_uid is required for action='signals'");
1035
+ return ok(
1036
+ await client2.signals(project_uid, { signals, target_types })
1037
+ );
1038
+ case "run":
1039
+ if (!project_uid)
1040
+ return err("project_uid is required for action='run'");
1041
+ return ok(await client2.runSynthesis(project_uid));
1042
+ case "job_status":
1043
+ if (!job_id) return err("job_id is required for action='job_status'");
1044
+ return ok(await client2.getJob(job_id));
1045
+ default:
1046
+ return err(`Unknown synthesize action: ${action}`);
1047
+ }
1048
+ }
992
1049
 
993
1050
  // src/index.ts
994
1051
  var API_KEY = process.env.MINDGRAPH_API_KEY;
995
1052
  var BASE_URL = process.env.MINDGRAPH_BASE_URL || "https://api.mindgraph.cloud";
996
1053
  var AGENT_ID = process.env.MINDGRAPH_AGENT_ID || "mcp";
1054
+ var ORG_ID = process.env.MINDGRAPH_ORG_ID;
997
1055
  if (!API_KEY) {
998
1056
  console.error(
999
1057
  "Error: MINDGRAPH_API_KEY environment variable is required.\nGet your API key at https://mindgraph.cloud/dashboard/keys\nOr run: npx mindgraph-mcp init"
@@ -1002,9 +1060,10 @@ if (!API_KEY) {
1002
1060
  }
1003
1061
  var client = new import_mindgraph.MindGraph({
1004
1062
  baseUrl: BASE_URL,
1005
- apiKey: API_KEY
1063
+ apiKey: API_KEY,
1064
+ orgId: ORG_ID
1006
1065
  });
1007
- var INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph (6 tools).
1066
+ var INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph (7 tools).
1008
1067
 
1009
1068
  ## #1 RULE: Go straight to the user's topic
1010
1069
 
@@ -1067,6 +1126,7 @@ Capture knowledge when the user shares something worth remembering:
1067
1126
  - Goals or projects \u2192 \`mindgraph_commit\` action "goal"/"project"
1068
1127
  - Decisions \u2192 \`mindgraph_commit\` action "open_decision"
1069
1128
  - Long-form content \u2192 \`mindgraph_ingest\`
1129
+ - Cross-document synthesis over a project corpus \u2192 \`mindgraph_synthesize\` (action "signals" for structural signals; action "run" to spawn a synthesis job that writes Article nodes)
1070
1130
 
1071
1131
  ## Tool tips
1072
1132
 
@@ -1080,7 +1140,7 @@ Capture knowledge when the user shares something worth remembering:
1080
1140
  var server = new import_server.Server(
1081
1141
  {
1082
1142
  name: "mindgraph",
1083
- version: "0.5.0"
1143
+ version: "0.7.1"
1084
1144
  },
1085
1145
  {
1086
1146
  capabilities: {
@@ -1436,7 +1496,7 @@ async function main() {
1436
1496
  const transport = new import_stdio.StdioServerTransport();
1437
1497
  await server.connect(transport);
1438
1498
  console.error(
1439
- `MindGraph MCP server v0.5.0 running on stdio (${BASE_URL})`
1499
+ `MindGraph MCP server v0.7.1 running on stdio (${BASE_URL})`
1440
1500
  );
1441
1501
  }
1442
1502
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
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",
@@ -27,7 +27,7 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@modelcontextprotocol/sdk": "^1.12.1",
30
- "mindgraph": "^0.3.0"
30
+ "mindgraph": "^0.4.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.0.0",