prism-mcp-server 2.3.12 → 2.5.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 CHANGED
@@ -8,13 +8,56 @@
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
9
9
  [![Node.js](https://img.shields.io/badge/Node.js-18+-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
10
10
 
11
- > **Your AI agent's memory that survives between sessions.** Prism MCP is a Model Context Protocol server that gives Claude Desktop, Cursor, Windsurf, and any MCP client **persistent memory**, **time travel**, **visual context**, **multi-agent sync**, and **multi-engine search** — all running locally with zero cloud dependencies.
11
+ > **Your AI agent's memory that survives between sessions.** Prism MCP is a Model Context Protocol server that gives Claude Desktop, Cursor, Windsurf, and any MCP client **persistent memory**, **time travel**, **visual context**, **multi-agent sync**, **GDPR-compliant deletion**, **memory tracing**, and **LangChain integration** — all running locally with zero cloud dependencies.
12
12
  >
13
- > Built with **SQLite + F32_BLOB vector search**, **optimistic concurrency control**, **MCP Prompts & Resources**, **auto-compaction**, **Gemini-powered Morning Briefings**, and optional **Supabase cloud sync**.
13
+ > Built with **SQLite + F32_BLOB vector search**, **optimistic concurrency control**, **MCP Prompts & Resources**, **auto-compaction**, **Gemini-powered Morning Briefings**, **MemoryTrace explainability**, and optional **Supabase cloud sync**.
14
+
15
+ ## Table of Contents
16
+
17
+ - [What's New (v2.5.0)](#whats-new-in-v250---enterprise-memory-)
18
+ - [How Prism Compares](#how-prism-compares)
19
+ - [Quick Start](#quick-start-zero-config--local-mode)
20
+ - [Mind Palace Dashboard](#-the-mind-palace-dashboard)
21
+ - [Integration Examples](#integration-examples)
22
+ - [Use Cases](#use-cases)
23
+ - [Architecture](#architecture)
24
+ - [Tool Reference](#tool-reference)
25
+ - [LangChain / LangGraph Integration](#langchain--langgraph-integration)
26
+ - [Environment Variables](#environment-variables)
27
+ - [Progressive Context Loading](#progressive-context-loading)
28
+ - [Time Travel](#time-travel-version-history)
29
+ - [Agent Telepathy](#agent-telepathy-multi-client-sync)
30
+ - [Knowledge Accumulation](#knowledge-accumulation)
31
+ - [GDPR Compliance](#gdpr-compliance)
32
+ - [Observability & Tracing](#observability--tracing)
33
+ - [Supabase Setup](#supabase-setup-cloud-mode)
34
+ - [Project Structure](#project-structure)
35
+ - [Hybrid Search Pipeline](#hybrid-search-pipeline-brave--vertex-ai)
36
+ - [🚀 Roadmap](#-roadmap)
14
37
 
15
38
  ---
16
39
 
17
- ## What's New in v2.3.12Stability & Fixes 🛠️
40
+ ## What's New in v2.5.0Enterprise Memory 🏗️
41
+
42
+ | Feature | Description |
43
+ |---|---|
44
+ | 🔍 **Memory Tracing (Phase 1)** | Every search now returns a structured `MemoryTrace` with latency breakdown (`embedding_ms`, `storage_ms`, `total_ms`), search strategy, and scoring metadata — surfaced as a separate `content[1]` block for LangSmith integration. |
45
+ | 🛡️ **GDPR Memory Deletion (Phase 2)** | New `session_forget_memory` tool with soft-delete (tombstoning via `deleted_at`) and hard-delete. Ownership guards prevent cross-user deletion. `deleted_reason` column captures GDPR Article 17 justification. Top-K Hole solved by filtering inside SQL, not post-query (ensures we always return exactly K results, rather than returning fewer because deleted items were filtered out after the vector search). |
46
+ | 🔗 **LangChain Integration (Phase 3)** | `PrismMemoryRetriever` and `PrismKnowledgeRetriever` — async-first `BaseRetriever` subclasses that wrap Prism MCP's traced search endpoints. Trace metadata flows automatically into `Document.metadata["trace"]` for LangSmith visibility. |
47
+ | 🧩 **LangGraph Research Agent** | Full example in `examples/langgraph-agent/` — a 5-node agentic research loop with MCP bridge, persistent memory, and `EnsembleRetriever` hybrid search. |
48
+
49
+ <details>
50
+ <summary><strong>What's in v2.5.1 — Version Sync & Embedding Safety</strong></summary>
51
+
52
+ | Feature | Description |
53
+ |---|---|
54
+ | 🔄 **Dynamic Versioning** | Server version is now derived from `package.json` at startup — MCP handshake, dashboard badge, and npm metadata always stay in sync. Falls back to `0.0.0` if unreadable. |
55
+ | 🛡️ **Embedding Dimension Validation** | `generateEmbedding()` now validates the returned vector is exactly 768 dimensions at runtime, catching model regressions before storing bad vectors. Removed `as any` cast in favor of proper `EmbedContentRequest` typing. |
56
+
57
+ </details>
58
+
59
+ <details>
60
+ <summary><strong>What's in v2.3.12 — Stability & Fixes</strong></summary>
18
61
 
19
62
  | Feature | Description |
20
63
  |---|---|
@@ -22,6 +65,8 @@
22
65
  | 📝 **Debug Logging** | Gated verbose startup logs behind `PRISM_DEBUG_LOGGING` for a cleaner default experience. |
23
66
  | ⚡ **Excess Loading Fixes** | Performance improvements to resolve excess loading loops. |
24
67
 
68
+ </details>
69
+
25
70
  <details>
26
71
  <summary><strong>What's in v2.3.8 — LangGraph Research Agent</strong></summary>
27
72
 
@@ -63,6 +108,8 @@
63
108
 
64
109
  ---
65
110
 
111
+ > 💡 **TL;DR:** Prism MCP gives your AI agent persistent memory using a local SQLite database. No cloud accounts, no API keys, and no Postgres/Qdrant containers required. Just `npx -y prism-mcp-server` and you're running.
112
+
66
113
  ## How Prism Compares
67
114
 
68
115
  | Feature | **Prism MCP** | [MCP Memory](https://github.com/modelcontextprotocol/servers/tree/main/src/memory) | [Mem0](https://github.com/mem0ai/mem0) | [Mnemory](https://github.com/fpytloun/mnemory) | [Basic Memory](https://github.com/basicmachines-co/basic-memory) |
@@ -82,6 +129,9 @@
82
129
  | **Auto-Compaction** | ✅ Gemini rollups | ❌ | ❌ | ❌ | ❌ |
83
130
  | **Morning Briefing** | ✅ Gemini synthesis | ❌ | ❌ | ❌ | ❌ |
84
131
  | **OCC (Concurrency)** | ✅ Version-based | ❌ | ❌ | ❌ | ❌ |
132
+ | **GDPR Compliance** | ✅ Soft/hard delete + audit trail | ❌ | ❌ | ❌ | ❌ |
133
+ | **Memory Tracing** | ✅ MemoryTrace with latency breakdown | ❌ | ❌ | ❌ | ❌ |
134
+ | **LangChain Native** | ✅ BaseRetriever adapters | ❌ | ❌ | ❌ | ❌ |
85
135
  | **MCP Native** | ✅ stdio (Claude Desktop, Cursor) | ✅ stdio | ❌ Python SDK / REST | ✅ HTTP + MCP | ✅ stdio |
86
136
  | **Language** | TypeScript | TypeScript | Python | Python | Python |
87
137
 
@@ -158,7 +208,7 @@ Then add to your MCP config:
158
208
  }
159
209
  ```
160
210
 
161
- ### Restart your MCP client. That's it — all tools are now available.
211
+ **Restart your MCP client. That's it — all tools are now available.**
162
212
 
163
213
  ---
164
214
 
@@ -168,6 +218,8 @@ Prism MCP spins up a lightweight, zero-dependency HTTP server alongside the MCP
168
218
 
169
219
  Open **`http://localhost:3000`** in your browser to see exactly what your AI agent is thinking:
170
220
 
221
+ ![Mind Palace Dashboard](docs/mind-palace-dashboard.png)
222
+
171
223
  - **Current State & TODOs** — See the exact context injected into the LLM's prompt
172
224
  - **Git Drift Detection** — Alerts you if you've modified code outside the agent's view
173
225
  - **Morning Briefing** — AI-synthesized action plan from your last sessions
@@ -316,32 +368,39 @@ Verification pattern (same for both clients):
316
368
  ```mermaid
317
369
  graph TB
318
370
  Client["AI Client<br/>(Claude Desktop / Cursor / Windsurf)"]
371
+ LangChain["LangChain / LangGraph<br/>(Python Retrievers)"]
319
372
  MCP["Prism MCP Server<br/>(TypeScript)"]
320
373
 
321
374
  Client -- "MCP Protocol (stdio)" --> MCP
375
+ LangChain -- "JSON-RPC via MCP Bridge" --> MCP
322
376
 
377
+ MCP --> Tracing["MemoryTrace Engine<br/>Latency + Strategy + Scoring"]
323
378
  MCP --> Dashboard["Mind Palace Dashboard<br/>localhost:3000"]
324
379
  MCP --> Brave["Brave Search API<br/>Web + Local + AI Answers"]
325
380
  MCP --> Gemini["Google Gemini API<br/>Analysis + Briefings"]
326
381
  MCP --> Sandbox["QuickJS Sandbox<br/>Code-Mode Templates"]
327
382
  MCP --> SyncBus["SyncBus<br/>Agent Telepathy"]
383
+ MCP --> GDPR["GDPR Engine<br/>Soft/Hard Delete + Audit"]
328
384
 
329
385
  MCP --> Storage{"Storage Backend"}
330
386
  Storage --> SQLite["SQLite (Local)<br/>libSQL + F32_BLOB vectors"]
331
387
  Storage --> Supabase["Supabase (Cloud)<br/>PostgreSQL + pgvector"]
332
388
 
333
- SQLite --> Ledger["session_ledger"]
389
+ SQLite --> Ledger["session_ledger<br/>(+ deleted_at tombstoning)"]
334
390
  SQLite --> Handoffs["session_handoffs"]
335
391
  SQLite --> History["history_snapshots<br/>(Time Travel)"]
336
392
  SQLite --> Media["media vault<br/>(Visual Memory)"]
337
393
 
338
394
  style Client fill:#4A90D9,color:#fff
395
+ style LangChain fill:#1C3D5A,color:#fff
339
396
  style MCP fill:#2D3748,color:#fff
397
+ style Tracing fill:#D69E2E,color:#fff
340
398
  style Dashboard fill:#9F7AEA,color:#fff
341
399
  style Brave fill:#FB542B,color:#fff
342
400
  style Gemini fill:#4285F4,color:#fff
343
401
  style Sandbox fill:#805AD5,color:#fff
344
402
  style SyncBus fill:#ED64A6,color:#fff
403
+ style GDPR fill:#E53E3E,color:#fff
345
404
  style Storage fill:#2D3748,color:#fff
346
405
  style SQLite fill:#38B2AC,color:#fff
347
406
  style Supabase fill:#3ECF8E,color:#fff
@@ -390,6 +449,14 @@ graph TB
390
449
  |------|---------|----------|---------|
391
450
  | `session_health_check` | Scan brain for integrity issues (`fsck`) | `auto_fix` (boolean) | Health report & auto-repairs |
392
451
 
452
+ ### v2.5 Enterprise Memory Tools
453
+
454
+ | Tool | Purpose | Key Args | Returns |
455
+ |------|---------|----------|---------|
456
+ | `session_forget_memory` | GDPR-compliant deletion (soft/hard) | `memory_id`, `hard_delete`, `reason` | Deletion confirmation + audit |
457
+ | `session_search_memory` | Semantic search with `enable_trace` | `query`, `enable_trace` | Results + `MemoryTrace` in `content[1]` |
458
+ | `knowledge_search` | Knowledge search with `enable_trace` | `query`, `enable_trace` | Results + `MemoryTrace` in `content[1]` |
459
+
393
460
  ### Code Mode Templates (v2.1)
394
461
 
395
462
  Instead of writing custom JavaScript, pass a `template` name for instant extraction:
@@ -405,7 +472,54 @@ Instead of writing custom JavaScript, pass a `template` name for instant extract
405
472
  | `slack_messages` | Slack Web API | `[timestamp] @user: message` |
406
473
  | `csv_summary` | CSV text | Column names, row count, sample rows |
407
474
 
408
- **Usage:** `{ "data": "<raw JSON>", "template": "github_issues" }` — no custom code needed.
475
+ **Tool Arguments:** `{ "data": "<raw JSON>", "template": "github_issues" }` — no custom code needed.
476
+
477
+ ---
478
+
479
+ ## LangChain / LangGraph Integration
480
+
481
+ Prism MCP includes first-class Python adapters for the LangChain ecosystem, located in `examples/langgraph-agent/`:
482
+
483
+ | Component | File | Purpose |
484
+ |-----------|------|---------|
485
+ | **MCP Bridge** | `mcp_client.py` | JSON-RPC 2.0 client with `call_tool()` and `call_tool_raw()` (preserves `MemoryTrace`) |
486
+ | **Semantic Retriever** | `prism_retriever.py` | `PrismMemoryRetriever(BaseRetriever)` — async-first vector search |
487
+ | **Keyword Retriever** | `prism_retriever.py` | `PrismKnowledgeRetriever(BaseRetriever)` — FTS5 keyword search |
488
+ | **Forget Tool** | `tools.py` | `forget_memory()` — GDPR deletion bridge |
489
+ | **Research Agent** | `agent.py` | 5-node LangGraph agent (plan→search→analyze→decide→answer→save) |
490
+
491
+ ### Hybrid Search with EnsembleRetriever
492
+
493
+ Combine both retrievers for hybrid (semantic + keyword) search with a single line:
494
+
495
+ ```python
496
+ from langchain.retrievers import EnsembleRetriever
497
+ from prism_retriever import PrismMemoryRetriever, PrismKnowledgeRetriever
498
+
499
+ retriever = EnsembleRetriever(
500
+ retrievers=[PrismMemoryRetriever(...), PrismKnowledgeRetriever(...)],
501
+ weights=[0.7, 0.3], # 70% semantic, 30% keyword
502
+ )
503
+ ```
504
+
505
+ ### MemoryTrace in LangSmith
506
+
507
+ When `enable_trace=True`, each `Document.metadata["trace"]` contains:
508
+
509
+ ```json
510
+ {
511
+ "strategy": "vector_cosine_similarity",
512
+ "latency": { "embedding_ms": 45, "storage_ms": 12, "total_ms": 57 },
513
+ "result_count": 5,
514
+ "threshold": 0.7
515
+ }
516
+ ```
517
+
518
+ This metadata flows automatically into LangSmith traces for observability.
519
+
520
+ ### Async Architecture
521
+
522
+ The retrievers use `_aget_relevant_documents` as the primary path with `asyncio.to_thread()` to wrap the synchronous MCP bridge. This prevents the `RuntimeError: This event loop is already running` crash that plagues most LangGraph deployments.
409
523
 
410
524
  ---
411
525
 
@@ -422,6 +536,7 @@ Instead of writing custom JavaScript, pass a `template` name for instant extract
422
536
  | `PRISM_USER_ID` | No | Multi-tenant user isolation (default: `"default"`) |
423
537
  | `PRISM_AUTO_CAPTURE` | No | Set `"true"` to auto-capture HTML snapshots of dev servers |
424
538
  | `PRISM_CAPTURE_PORTS` | No | Comma-separated ports to scan (default: `3000,3001,5173,8080`) |
539
+ | `PRISM_DEBUG_LOGGING` | No | Set `"true"` to enable verbose debug logs (default: quiet) |
425
540
 
426
541
  ---
427
542
 
@@ -455,6 +570,7 @@ For the best experience, configure your AI coding assistant to **automatically c
455
570
  Add this rule to your project's `.clauderules` or `CLAUDE.md`:
456
571
 
457
572
  ```markdown
573
+
458
574
  ## Prism MCP Memory Auto-Load (CRITICAL)
459
575
  At the start of every new session, you MUST call `session_load_context`
460
576
  at the `standard` level for these projects:
@@ -472,17 +588,19 @@ Do NOT skip this step.
472
588
  Add this rule to your `~/.gemini/GEMINI.md` global rules file:
473
589
 
474
590
  ```markdown
591
+
475
592
  ## Prism MCP Memory Auto-Load (CRITICAL)
593
+
476
594
  **At the start of every new session**, immediately after displaying
477
595
  the startup block, you MUST call `session_load_context` (via the
478
- `athena-public` MCP server) at the `standard` level for these projects:
596
+ `prism-mcp` MCP server) at the `standard` level for these projects:
479
597
  - `my-project`
480
598
  - `my-other-project`
481
599
 
482
600
  This ensures accumulated project memory, pending TODOs, and key context
483
601
  from previous sessions are always available. Do NOT skip this step.
484
602
 
485
- **IMPORTANT:** The `athena-public` MCP server is always available.
603
+ **IMPORTANT:** The `prism-mcp` MCP server is always available.
486
604
  Do NOT display any warnings or notes about MCP server availability
487
605
  — just call the tools directly. Never claim the server is unavailable.
488
606
  ```
@@ -590,6 +708,101 @@ Every `session_save_ledger` and `session_save_handoff` automatically extracts ke
590
708
  | **By age** | `older_than_days: 30` | Forget entries older than 30 days |
591
709
  | **Dry run** | `dry_run: true` | Preview what would be deleted |
592
710
 
711
+ ## GDPR Compliance
712
+
713
+ ### GDPR-Compliant Deletion
714
+
715
+ Prism supports surgical, per-entry deletion for GDPR Article 17 compliance:
716
+
717
+ ```json
718
+ // Soft delete (tombstone — reversible, keeps audit trail)
719
+ { "name": "session_forget_memory", "arguments": {
720
+ "memory_id": "abc123",
721
+ "reason": "User requested data deletion"
722
+ }}
723
+
724
+ // Hard delete (permanent — irreversible)
725
+ { "name": "session_forget_memory", "arguments": {
726
+ "memory_id": "abc123",
727
+ "hard_delete": true
728
+ }}
729
+ ```
730
+
731
+ **How it works:**
732
+ - **Soft delete** sets `deleted_at = NOW()` + `deleted_reason`. The entry stays in the DB for audit but is excluded from ALL search results (vector, FTS5, and context loading).
733
+ - **Hard delete** physically removes the row. FTS5 triggers auto-clean the full-text index.
734
+ - **Top-K Hole Prevention**: `deleted_at IS NULL` filtering happens INSIDE the SQL query, BEFORE the `LIMIT` clause — so `LIMIT 5` always returns 5 live results, never fewer. *(A "Top-K Hole" occurs when deleted entries are filtered out after the vector search, causing fewer than K results to be returned. Prism avoids this by filtering inside SQL before the LIMIT.)*
735
+
736
+ ### Article 17 — Right to Erasure ("Right to be Forgotten")
737
+
738
+ | Requirement | How Prism Satisfies It |
739
+ |-------------|----------------------|
740
+ | **Individual deletion** | `session_forget_memory` operates on a single `memory_id` — the data subject can request deletion of *specific* memories, not just bulk wipes. |
741
+ | **Soft delete (audit trail)** | `deleted_at` + `deleted_reason` columns prove *when* and *why* data was deleted — required for SOC2 audit logs. |
742
+ | **Hard delete (full erasure)** | `hard_delete: true` physically removes the row from the database. No tombstone, no trace. True erasure as required by Article 17(1). |
743
+ | **Justification logging** | The `reason` parameter captures the GDPR justification (e.g., `"User requested data deletion"`, `"Data retention policy expired"`). |
744
+
745
+ ### Article 25 — Data Protection by Design and by Default
746
+
747
+ | Requirement | How Prism Satisfies It |
748
+ |-------------|----------------------|
749
+ | **Ownership guards** | `softDeleteLedger()` and `hardDeleteLedger()` verify `user_id` before executing. User A cannot delete User B's data. |
750
+ | **Database-level filtering** | `deleted_at IS NULL` is inside the SQL `WHERE` clause, *before* `LIMIT`. Soft-deleted data never leaks into search results — not even accidentally. |
751
+ | **Default = safe** | The system defaults to soft delete (reversible). Hard delete requires an explicit `hard_delete: true` flag — preventing accidental permanent data loss. |
752
+ | **Multi-tenant isolation** | `PRISM_USER_ID` environment variable ensures all operations are scoped to a single tenant. |
753
+
754
+ ### Coverage Summary
755
+
756
+ | GDPR Right | Status | Implementation |
757
+ |-----------|--------|----------------|
758
+ | Right to Erasure (Art. 17) | ✅ Implemented | `session_forget_memory` (soft + hard delete) |
759
+ | Data Protection by Design (Art. 25) | ✅ Implemented | Ownership guards, DB-level filtering, safe defaults |
760
+ | Audit Trail | ✅ Implemented | `deleted_at` + `deleted_reason` columns |
761
+ | User Isolation | ✅ Implemented | `user_id` verification on all delete operations |
762
+ | Right to Portability (Art. 20) | ⬜ Roadmap | `session_export_memory` (planned) |
763
+ | Consent Management | ➖ Out of scope | Application-layer responsibility |
764
+
765
+ > **Note:** No software is "GDPR certified" on its own — GDPR is an organizational compliance framework. Prism provides the technical controls that a DPO (Data Protection Officer) needs to satisfy the data deletion and privacy-by-design requirements.
766
+
767
+ ---
768
+
769
+ ## Observability & Tracing
770
+
771
+ Prism MCP includes a custom **MemoryTrace** engine that provides per-query observability for every memory operation. This is not the OpenTelemetry SDK — it's a lightweight, zero-dependency tracing system purpose-built for MCP.
772
+
773
+ ### What MemoryTrace Provides
774
+
775
+ | Capability | MemoryTrace | Full OpenTelemetry SDK |
776
+ |------------|:-----------:|:----------------------:|
777
+ | Per-query latency breakdown (`embedding_ms`, `storage_ms`, `total_ms`) | ✅ | ✅ |
778
+ | Search strategy attribution (`semantic`, `keyword`, `hybrid`) | ✅ | ❌ (custom) |
779
+ | Result scoring metadata | ✅ | ❌ (custom) |
780
+ | LangSmith integration (via retriever metadata) | ✅ | ✅ |
781
+ | W3C `traceparent` / distributed trace context | ❌ | ✅ |
782
+ | Export to Jaeger / Zipkin / Datadog | ❌ | ✅ |
783
+ | Auto-instrumentation of HTTP / DB calls | ❌ | ✅ |
784
+ | External SDK dependency | **None** | `@opentelemetry/sdk-*` |
785
+
786
+ ### Example MemoryTrace Output
787
+
788
+ ```json
789
+ {
790
+ "type": "text",
791
+ "text": "{\"trace\":{\"strategy\":\"semantic\",\"latency\":{\"embedding_ms\":45,\"storage_ms\":12,\"total_ms\":57},\"result_count\":3,\"threshold\":0.7}}"
792
+ }
793
+ ```
794
+
795
+ Traces are returned as `content[1]` in MCP responses — a separate content block that keeps structured telemetry out of the LLM's context window while making it available to orchestration layers like LangSmith.
796
+
797
+ ### Roadmap
798
+
799
+ | Feature | Status |
800
+ |---------|--------|
801
+ | MemoryTrace (current) | ✅ Shipped |
802
+ | OpenTelemetry SDK integration | ⬜ Planned |
803
+ | Span export to Jaeger/Zipkin | ⬜ Planned |
804
+ | W3C Trace Context propagation | ⬜ Planned |
805
+
593
806
  ---
594
807
 
595
808
  ## Supabase Setup (Cloud Mode)
@@ -617,12 +830,16 @@ Go to **Settings → API** and copy:
617
830
 
618
831
  ### 4. Configure
619
832
 
833
+ Add these to your MCP client's configuration file (e.g., `claude_desktop_config.json` under `"env"`), or export them if running the server manually:
834
+
620
835
  ```bash
621
836
  export SUPABASE_URL="https://your-project.supabase.co"
622
837
  export SUPABASE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
623
838
  export PRISM_STORAGE="supabase"
624
839
  ```
625
840
 
841
+ > **Note:** Claude Desktop, Cursor, and other MCP clients spawn isolated processes — terminal `export` commands won't be inherited. Always set env vars in the client's config JSON.
842
+
626
843
  ### Security
627
844
 
628
845
  1. **Use the anon key** for MCP server config
@@ -657,12 +874,12 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
657
874
 
658
875
  ```
659
876
  ├── src/
660
- │ ├── server.ts # MCP server core + Mind Palace HTTP server
877
+ │ ├── server.ts # MCP server core + tool routing
661
878
  │ ├── config.ts # Environment management
662
879
  │ ├── storage/
663
- │ │ ├── interface.ts # StorageBackend abstraction
664
- │ │ ├── sqlite.ts # SQLite local storage (libSQL + F32_BLOB)
665
- │ │ ├── supabase.ts # Supabase cloud storage
880
+ │ │ ├── interface.ts # StorageBackend abstraction (+ GDPR delete methods)
881
+ │ │ ├── sqlite.ts # SQLite local storage (libSQL + F32_BLOB + deleted_at migration)
882
+ │ │ ├── supabase.ts # Supabase cloud storage (+ soft/hard delete)
666
883
  │ │ └── index.ts # Backend factory (auto-selects based on PRISM_STORAGE)
667
884
  │ ├── sync/
668
885
  │ │ ├── interface.ts # SyncBus abstraction (Telepathy)
@@ -675,21 +892,30 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
675
892
  │ ├── templates/
676
893
  │ │ └── codeMode.ts # 8 pre-built QuickJS extraction templates
677
894
  │ ├── tools/
678
- │ │ ├── definitions.ts # All tool schemas (JSON Schema + type guards)
895
+ │ │ ├── definitions.ts # Search & analysis tool schemas
679
896
  │ │ ├── handlers.ts # Search & analysis handlers
680
- │ │ ├── sessionMemoryDefinitions.ts # Memory + knowledge tool schemas
681
- │ │ ├── sessionMemoryHandlers.ts # Memory handlers (OCC, Time Travel, Drift, Briefing)
897
+ │ │ ├── sessionMemoryDefinitions.ts # Memory tools + GDPR + tracing schemas
898
+ │ │ ├── sessionMemoryHandlers.ts # Memory handlers (OCC, GDPR, Tracing, Time Travel)
899
+ │ │ ├── compactionHandler.ts # Gemini-powered ledger compaction
682
900
  │ │ └── index.ts # Tool registration & re-exports
683
901
  │ └── utils/
902
+ │ ├── tracing.ts # MemoryTrace types + factory (Phase 1)
903
+ │ ├── logger.ts # Debug logging (gated by PRISM_DEBUG_LOGGING)
684
904
  │ ├── braveApi.ts # Brave Search REST client
685
905
  │ ├── googleAi.ts # Gemini SDK wrapper
686
906
  │ ├── executor.ts # QuickJS sandbox executor
687
907
  │ ├── autoCapture.ts # Dev server HTML snapshot utility
688
- │ ├── healthCheck.ts # Brain integrity engine (v2.2.0) + security scanner (v2.3.0)
689
- │ ├── factMerger.ts # Async LLM contradiction resolution (v2.3.0)
908
+ │ ├── healthCheck.ts # Brain integrity engine + security scanner
909
+ │ ├── factMerger.ts # Async LLM contradiction resolution
690
910
  │ ├── git.ts # Git state capture + drift detection
691
911
  │ ├── embeddingApi.ts # Embedding generation (Gemini)
692
912
  │ └── keywordExtractor.ts # Zero-dependency NLP keyword extraction
913
+ ├── examples/langgraph-agent/ # LangChain/LangGraph integration
914
+ │ ├── agent.py # 5-node LangGraph research agent
915
+ │ ├── mcp_client.py # MCP Bridge (call_tool + call_tool_raw)
916
+ │ ├── prism_retriever.py # PrismMemoryRetriever + PrismKnowledgeRetriever
917
+ │ ├── tools.py # Agent tools + GDPR forget_memory
918
+ │ └── demo_retriever.py # Standalone retriever demo
693
919
  ├── supabase/migrations/ # Cloud mode SQL schemas
694
920
  ├── vertex-ai/ # Vertex AI hybrid search pipeline
695
921
  ├── index.ts # Server entry point
@@ -698,10 +924,40 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
698
924
 
699
925
  ---
700
926
 
927
+ ## 🚀 Roadmap
928
+
929
+ > **[View the full project board →](https://github.com/users/dcostenco/projects/1/views/1)**
930
+
931
+ ### 🚀 Future Ideas
932
+
933
+ | Feature | Issue | Description |
934
+ |---------|-------|-------------|
935
+ | OpenTelemetry SDK Integration | [#6](https://github.com/dcostenco/prism-mcp/issues/6) | W3C-compliant tracing with Jaeger/Zipkin export |
936
+ | GDPR Right to Portability | [#7](https://github.com/dcostenco/prism-mcp/issues/7) | `session_export_memory` tool for Art. 20 compliance |
937
+ | Multi-agent CRDT Conflict Resolution | [#9](https://github.com/dcostenco/prism-mcp/issues/9) | Conflict-free replicated data types for concurrent agent edits |
938
+ | Memory Analytics Dashboard | [#10](https://github.com/dcostenco/prism-mcp/issues/10) | Usage trends, token costs, and memory health metrics |
939
+ | Pluggable LLM Providers | [#13](https://github.com/dcostenco/prism-mcp/issues/13) | Anthropic, OpenAI, Ollama provider adapters |
940
+ | VLM / OCR for Visual Memory | [#14](https://github.com/dcostenco/prism-mcp/issues/14) | Auto-extract text and insights from stored images |
941
+ | Automated Data Retention (TTL) | [#16](https://github.com/dcostenco/prism-mcp/issues/16) | Time-based memory expiration policies |
942
+ | Obsidian / Logseq Export Bridge | [#17](https://github.com/dcostenco/prism-mcp/issues/17) | Export memory to Markdown knowledge bases |
943
+ | Interactive Knowledge Graph Editor | [#19](https://github.com/dcostenco/prism-mcp/issues/19) | Visual graph editor inside the Mind Palace dashboard |
944
+
945
+ ### 🧰 Infrastructure & Stack
946
+
947
+ | Feature | Issue | Description |
948
+ |---------|-------|-------------|
949
+ | Supabase RPC Soft-Delete Filtering | [#8](https://github.com/dcostenco/prism-mcp/issues/8) | Server-side RPC filtering for GDPR-deleted records |
950
+ | Pluggable Embedding Providers | [#11](https://github.com/dcostenco/prism-mcp/issues/11) | Swap Gemini for OpenAI, Cohere, or local models |
951
+ | Automated Test Suite | [#12](https://github.com/dcostenco/prism-mcp/issues/12) | Unit, integration, and E2E test coverage with CI/CD |
952
+ | Mind Palace Auth & Secure Access | [#15](https://github.com/dcostenco/prism-mcp/issues/15) | Authentication for the dashboard when exposed remotely |
953
+ | TypeScript LangGraph & Vercel AI SDK Examples | [#18](https://github.com/dcostenco/prism-mcp/issues/18) | Reference implementations for popular frameworks |
954
+
955
+ ---
956
+
701
957
  ## License
702
958
 
703
959
  MIT
704
960
 
705
961
  ---
706
962
 
707
- <sub>**Keywords:** MCP server, Model Context Protocol, Claude Desktop memory, persistent session memory, AI agent memory, local-first, SQLite MCP, Mind Palace, time travel, visual memory, agent telepathy, multi-agent sync, reality drift detection, morning briefing, code mode templates, cursor MCP server, windsurf MCP server, cline MCP server, pgvector semantic search, progressive context loading, MCP Prompts, MCP Resources, knowledge management AI, Brave Search MCP, Gemini analysis, optimistic concurrency control, zero config</sub>
963
+ <sub>**Keywords:** MCP server, Model Context Protocol, Claude Desktop memory, persistent session memory, AI agent memory, local-first, SQLite MCP, Mind Palace, time travel, visual memory, agent telepathy, multi-agent sync, reality drift detection, morning briefing, code mode templates, cursor MCP server, windsurf MCP server, cline MCP server, pgvector semantic search, progressive context loading, MCP Prompts, MCP Resources, knowledge management AI, Brave Search MCP, Gemini analysis, optimistic concurrency control, zero config, GDPR compliant, memory tracing, LangChain retriever, LangGraph agent, soft delete, memory lineage, explainability, enterprise AI memory</sub>
package/dist/config.js CHANGED
@@ -1,3 +1,6 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
1
4
  /**
2
5
  * Configuration & Environment Variables
3
6
  *
@@ -18,11 +21,25 @@
18
21
  * with reduced functionality (the corresponding tools will be unavailable).
19
22
  */
20
23
  // ─── Server Identity ──────────────────────────────────────────
21
- // REVIEWER NOTE: v1.5.0 includes all v0.4.0 enhancements PLUS
22
- // multi-tenant Row Level Security (RLS) for production hosting.
24
+ function resolveServerVersion() {
25
+ try {
26
+ const moduleDir = dirname(fileURLToPath(import.meta.url));
27
+ const packageJsonPath = resolve(moduleDir, "../package.json");
28
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
29
+ if (typeof packageJson?.version === "string" && packageJson.version.trim()) {
30
+ return packageJson.version.trim();
31
+ }
32
+ }
33
+ catch {
34
+ // Fallback below keeps server booting even if package metadata is unavailable.
35
+ }
36
+ return "0.0.0";
37
+ }
38
+ // REVIEWER NOTE: derive version from package.json so MCP handshake,
39
+ // dashboard badge, and package metadata stay in sync.
23
40
  export const SERVER_CONFIG = {
24
41
  name: "prism-mcp",
25
- version: "2.3.9",
42
+ version: resolveServerVersion(),
26
43
  };
27
44
  // ─── Required: Brave Search API Key ───────────────────────────
28
45
  export const BRAVE_API_KEY = process.env.BRAVE_API_KEY;
@@ -19,7 +19,7 @@
19
19
  import * as http from "http";
20
20
  import { execSync } from "child_process";
21
21
  import { getStorage } from "../storage/index.js";
22
- import { PRISM_USER_ID } from "../config.js";
22
+ import { PRISM_USER_ID, SERVER_CONFIG } from "../config.js";
23
23
  import { renderDashboardHTML } from "./ui.js";
24
24
  const PORT = parseInt(process.env.PRISM_DASHBOARD_PORT || "3000", 10);
25
25
  /**
@@ -78,7 +78,7 @@ export async function startDashboardServer() {
78
78
  "Content-Type": "text/html; charset=utf-8",
79
79
  "Cache-Control": "no-store, no-cache, must-revalidate",
80
80
  });
81
- return res.end(renderDashboardHTML());
81
+ return res.end(renderDashboardHTML(SERVER_CONFIG.version));
82
82
  }
83
83
  // ─── API: List all projects ───
84
84
  if (url.pathname === "/api/projects") {
@@ -13,7 +13,7 @@
13
13
  * - Responsive grid layout
14
14
  * ═══════════════════════════════════════════════════════════════════
15
15
  */
16
- export function renderDashboardHTML() {
16
+ export function renderDashboardHTML(version) {
17
17
  return `<!DOCTYPE html>
18
18
  <html lang="en">
19
19
  <head>
@@ -279,7 +279,7 @@ export function renderDashboardHTML() {
279
279
  <div class="logo">
280
280
  <span class="logo-icon">🧠</span>
281
281
  Prism Mind Palace
282
- <span class="version-badge">v2.3.7</span>
282
+ <span class="version-badge">v${version}</span>
283
283
  </div>
284
284
  <div class="selector">
285
285
  <select id="projectSelect">
package/dist/server.js CHANGED
@@ -79,7 +79,9 @@ MEMORY_HISTORY_TOOL, MEMORY_CHECKOUT_TOOL,
79
79
  // ─── v2.0: Visual Memory tool definitions ───
80
80
  SESSION_SAVE_IMAGE_TOOL, SESSION_VIEW_IMAGE_TOOL,
81
81
  // ─── v2.2.0: Health Check tool definition ───
82
- SESSION_HEALTH_CHECK_TOOL, sessionSaveLedgerHandler, sessionSaveHandoffHandler, sessionLoadContextHandler, knowledgeSearchHandler, knowledgeForgetHandler,
82
+ SESSION_HEALTH_CHECK_TOOL,
83
+ // ─── Phase 2: GDPR Memory Deletion tool definition ───
84
+ SESSION_FORGET_MEMORY_TOOL, sessionSaveLedgerHandler, sessionSaveHandoffHandler, sessionLoadContextHandler, knowledgeSearchHandler, knowledgeForgetHandler,
83
85
  // ─── v0.4.0: New tool handlers ───
84
86
  compactLedgerHandler, sessionSearchMemoryHandler,
85
87
  // ─── v2.0: Time Travel handlers ───
@@ -87,7 +89,9 @@ memoryHistoryHandler, memoryCheckoutHandler,
87
89
  // ─── v2.0: Visual Memory handlers ───
88
90
  sessionSaveImageHandler, sessionViewImageHandler,
89
91
  // ─── v2.2.0: Health Check handler ───
90
- sessionHealthCheckHandler, } from "./tools/index.js";
92
+ sessionHealthCheckHandler,
93
+ // ─── Phase 2: GDPR Memory Deletion handler ───
94
+ sessionForgetMemoryHandler, } from "./tools/index.js";
91
95
  // ─── Dynamic Tool Registration ───────────────────────────────────
92
96
  // Base tools: always available regardless of configuration
93
97
  const BASE_TOOLS = [
@@ -118,6 +122,8 @@ const SESSION_MEMORY_TOOLS = [
118
122
  SESSION_VIEW_IMAGE_TOOL, // session_view_image — retrieve image from vault (v2.0)
119
123
  // ─── v2.2.0: Health Check tool ───
120
124
  SESSION_HEALTH_CHECK_TOOL, // session_health_check — brain integrity checker (v2.2.0)
125
+ // ─── Phase 2: GDPR Memory Deletion tool ───
126
+ SESSION_FORGET_MEMORY_TOOL, // session_forget_memory — GDPR-compliant memory deletion (Phase 2)
121
127
  ];
122
128
  // Combine: always list ALL tools so scanners (Glama, Smithery, MCP Registry)
123
129
  // can enumerate the full capability set. Runtime guards in the CallTool handler
@@ -493,6 +499,11 @@ export function createServer() {
493
499
  if (!SESSION_MEMORY_ENABLED)
494
500
  throw new Error("Session memory not configured. Set SUPABASE_URL and SUPABASE_KEY.");
495
501
  return await sessionHealthCheckHandler(args);
502
+ // ─── Phase 2: GDPR Memory Deletion Tool ───
503
+ case "session_forget_memory":
504
+ if (!SESSION_MEMORY_ENABLED)
505
+ throw new Error("Session memory not configured. Set SUPABASE_URL and SUPABASE_KEY.");
506
+ return await sessionForgetMemoryHandler(args);
496
507
  default:
497
508
  return {
498
509
  content: [{ type: "text", text: `Unknown tool: ${name}` }],