mindgraph-mcp 0.21.0 → 0.23.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/README.md CHANGED
@@ -88,6 +88,34 @@ cleanly. Connection settings persist to `~/.mindgraph/hooks.json` (mode 600) so
88
88
  hooks work regardless of shell environment; the API key is never written into
89
89
  project settings.
90
90
 
91
+ **Per-prompt recall (on by default).** A `UserPromptSubmit` hook runs a
92
+ bounded topic recall for each prompt — the same request the Hermes provider
93
+ makes: `POST /retrieve/context` with up to 8 keywords from the prompt (obvious
94
+ secrets redacted first), 5 items, no source chunks — and injects at most 4,000
95
+ characters headed `MindGraph recall (bounded):`, one line per item (type,
96
+ label, one-line summary, source document). Prompts under 12 characters and
97
+ slash commands are skipped, a block identical to the last one injected is not re-injected in the same
98
+ session, and the hook gives up after 4 s and injects nothing on any error, so
99
+ it never blocks a prompt. Turn it off with
100
+ `install-hooks --no-prompt-recall` (or `MINDGRAPH_HOOK_PROMPT_RECALL=off` in
101
+ the environment); `--prompt-recall` turns it back on.
102
+
103
+ **Transcript capture (off by default).** `install-hooks --capture` adds a
104
+ `PreCompact` hook and makes `SessionEnd` capture too. **What leaves the
105
+ machine when capture is on:** the user prompts and assistant text replies
106
+ from the Claude Code transcript (`transcript_path`) written since the last
107
+ capture, sent to `POST /ingest/session` for extraction, attached to the
108
+ session's MindGraph Session. Tool calls, tool output, thinking blocks,
109
+ subagent (sidechain) turns, compaction summaries, slash-command output and
110
+ system reminders are never sent; API keys, tokens, private keys and
111
+ `key=value` credentials are redacted by pattern (a heuristic, not a
112
+ guarantee). The capture offset lives in the hook ledger under
113
+ `~/.mindgraph/runtime/` (mode 600). `npx mindgraph-mcp hooks preview
114
+ [transcript_path]` prints exactly the request body that would be sent, and
115
+ sends nothing. `install-hooks --no-capture` (or
116
+ `MINDGRAPH_HOOK_CAPTURE=off`) turns it off. Both choices persist in
117
+ `~/.mindgraph/hooks.json`, so automatic hook refreshes keep them.
118
+
91
119
  **Updates are hands-free.** The MCP registration floats on `npx @latest`,
92
120
  and at startup the server self-heals the pinned hook runner from its own
93
121
  bundle — upgrade-only (never a downgrade from a stale npx cache), atomic,
@@ -224,13 +252,16 @@ mindgraph-mcp uninstall Remove from Claude Desktop config
224
252
  mindgraph-mcp uninstall-code Remove from Claude Code
225
253
  mindgraph-mcp install-hooks Install coding hooks (--harness claude-code|codex)
226
254
  mindgraph-mcp uninstall-hooks Remove MindGraph-owned hook entries
255
+ mindgraph-mcp hooks preview Print what transcript capture would send (sends nothing)
227
256
  mindgraph-mcp skills pull Render published and granted skills into local SKILL.md directories
228
257
  mindgraph-mcp skills push Import or update one local SKILL.md as a governed candidate
229
258
  mindgraph-mcp status Show installation status
230
259
  ```
231
260
 
232
261
  Options: `--api-key <key>`, `--base-url <url>`, `--agent-id <id>`,
233
- `--scope user|project`, `--project-dir <dir>`, `--harness <name>`, `--help`.
262
+ `--scope user|project`, `--project-dir <dir>`, `--harness <name>`,
263
+ `--no-prompt-recall` / `--prompt-recall`, `--capture` / `--no-capture`,
264
+ `--session-id <id>` (for `hooks preview`), `--help`.
234
265
 
235
266
  **Teams**: when several people share one org graph, give each member a
236
267
  distinct identity — `--agent-id claude-code:<name>` on `install-code` /
@@ -250,6 +281,8 @@ teammates one logical agent, which claims each other's work).
250
281
  | `MINDGRAPH_ORG_ID` | *(unset)* | Pin operations to a specific organization when a key has access to more than one |
251
282
  | `MINDGRAPH_CODEGRAPH_BIN` | *(auto)* | Explicit path to the codegraph binary (PATH and `~/.local/bin` are probed) |
252
283
  | `MINDGRAPH_HOOK_AUTOUPDATE` | *(on)* | `off` disables the server's startup self-heal of the pinned hook runner; the version-skew note then signals drift instead |
284
+ | `MINDGRAPH_HOOK_PROMPT_RECALL` | *(on)* | `off` disables the Claude `UserPromptSubmit` recall at runtime |
285
+ | `MINDGRAPH_HOOK_CAPTURE` | *(stored choice; off)* | `on`/`off` overrides the stored `--capture` choice for Claude transcript capture at runtime. With capture stored off, `on` captures only at `SessionEnd`, because the `PreCompact` entry is not installed; run `install-hooks --capture` to add it |
253
286
  | `MINDGRAPH_SKIP_MCP_REGISTRATION_CHECK` | *(unset)* | `1` silences the SessionStart warning for hooks running without a registered MindGraph MCP server (exotic registration layouts) |
254
287
 
255
288
  ## Usage in Claude
@@ -287,6 +320,35 @@ lifecycle observation, context delivery, and managed curation.
287
320
 
288
321
  Search strategy is **keyword-first**: `mindgraph_retrieve` defaults to `action: "context"`, which seeds bounded cheapest-first graph expansion from BM25/hybrid recall. Escalate to `semantic` or `hybrid` only when keywords fail. Set `graph_expansion_limit: 0` when direct-only retrieval is required. For model-facing reads, `max_output_chars` bounds the rendered response from 512 to 24,000 characters while preserving whole evidence items and reporting omissions; `format: "json"` deliberately bypasses that rendering contract.
289
322
 
323
+ ## Hosted mode
324
+
325
+ The same tool surface is importable as a library for a hosted Streamable HTTP
326
+ endpoint (the `https://mindgraph.cloud/mcp` connector that claude.ai, Claude
327
+ Code, ChatGPT and Cursor sign in to with OAuth). `mindgraph-mcp/server` exports
328
+ a per-request factory and has no load-time side effects — it never exits for a
329
+ missing key or touches hook files:
330
+
331
+ ```ts
332
+ import { handleHostedRequest } from "mindgraph-mcp/server";
333
+
334
+ // After the route has verified the OAuth bearer and exchanged it for an API token:
335
+ return handleHostedRequest(request, {
336
+ client, bearer, baseUrl, orgId, orgName, agentId: `mcp:${clientHost}:${userId}`,
337
+ user: { id: userId, name, email },
338
+ profile: "general", harness: "hosted", serverVersion,
339
+ caches, // { generatedTools: Map, governance: Map } — one entry per org, kept by the route
340
+ });
341
+ ```
342
+
343
+ Hosted mode serves the `general` profile plus the org's generated ontology
344
+ tools and three extra tools — `search`, `fetch` (the ChatGPT connector
345
+ contract, `structuredContent` + text twin) and `whoami` — each annotated and
346
+ carrying `_meta.securitySchemes` with its `graph:read` / `graph:write` /
347
+ `graph:evolve` scope. The signed-in member's identity overwrites `agent_id`
348
+ on every call; a model-supplied value is kept only as `requested_agent_id`
349
+ metadata. `mindgraph_code`, `mindgraph_sync` and hook installation are stdio-only.
350
+ The HTTP auth gate (401/403) is the route's job, not the library's.
351
+
290
352
  ## Development
291
353
 
292
354
  ```bash