prism-mcp-server 6.5.0 → 6.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/dist/config.js CHANGED
@@ -73,38 +73,39 @@ export const PRISM_STORAGE = process.env.PRISM_STORAGE || "supabase";
73
73
  // When both SUPABASE_URL and SUPABASE_KEY are set, session memory tools
74
74
  // are registered. These tools allow AI agents to persist and recover
75
75
  // context between sessions.
76
- export const SUPABASE_URL = process.env.SUPABASE_URL;
77
- export const SUPABASE_KEY = process.env.SUPABASE_KEY;
78
- /**
79
- * SESSION_MEMORY_ENABLED — Master toggle for session persistence tools.
80
- *
81
- * Hardcoded to `true` since v3.0. This flag was originally used to gate
82
- * session memory tools when Supabase credentials were optional. Now that
83
- * session memory is a core feature (both SQLite and Supabase backends),
84
- * it is always enabled.
85
- *
86
- * The flag is kept (rather than removed) because several modules import
87
- * it for conditional registration of MCP tools. Removing it would require
88
- * a broader refactor with no functional benefit.
89
- */
90
- export const SESSION_MEMORY_ENABLED = true;
91
- // Note: debug() is defined at the bottom of this file; these lines
92
- // execute at import time after the full module is loaded by Node.
93
- if (!SESSION_MEMORY_ENABLED) {
94
- console.error("Info: Session memory disabled (set PRISM_STORAGE=local or configure Supabase)");
76
+ function sanitizeEnv(value) {
77
+ if (!value)
78
+ return undefined;
79
+ const trimmed = value.trim();
80
+ // Treat unresolved template placeholders as unset (e.g. "${SUPABASE_URL}")
81
+ if (!trimmed || trimmed.includes("${"))
82
+ return undefined;
83
+ return trimmed;
95
84
  }
96
- // ─── Optional: Multi-Tenant User ID ──────────────────────────
97
- // REVIEWER NOTE: When multiple users share the same Supabase instance,
98
- // PRISM_USER_ID isolates their data. Each user sets a unique ID in their
99
- // Claude Desktop config. All queries are scoped to this user_id.
100
- //
101
- // Defaults to "default" for backward compatibility — existing single-user
102
- // installations work without any config changes.
103
- //
104
- // For enterprise: use a stable unique identifier (UUID, email hash, etc.)
105
- // For personal use: any unique string works (e.g., "alice", "bob")
85
+ function isHttpUrl(value) {
86
+ try {
87
+ const parsed = new URL(value);
88
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
89
+ }
90
+ catch {
91
+ return false;
92
+ }
93
+ }
94
+ export const SUPABASE_URL = sanitizeEnv(process.env.SUPABASE_URL);
95
+ export const SUPABASE_KEY = sanitizeEnv(process.env.SUPABASE_KEY);
96
+ export const SUPABASE_CONFIGURED = !!SUPABASE_URL &&
97
+ !!SUPABASE_KEY &&
98
+ isHttpUrl(SUPABASE_URL);
99
+ if (process.env.SUPABASE_URL && !SUPABASE_URL) {
100
+ console.error("Warning: SUPABASE_URL appears unresolved/empty (e.g. template placeholder). Falling back to local storage unless explicitly fixed.");
101
+ }
102
+ if (SUPABASE_URL && !isHttpUrl(SUPABASE_URL)) {
103
+ console.error("Warning: SUPABASE_URL is not a valid http(s) URL. Falling back to local storage.");
104
+ }
105
+ // Session memory remains core-enabled in both local and Supabase modes.
106
+ export const SESSION_MEMORY_ENABLED = true;
107
+ // Optional multi-tenant scope ID (used by storage queries and handoffs).
106
108
  export const PRISM_USER_ID = process.env.PRISM_USER_ID || "default";
107
- // Multi-tenant info logged at debug level in startServer()
108
109
  // ─── v2.1: Auto-Capture Feature ─────────────────────────────
109
110
  // REVIEWER NOTE: Automatically captures HTML snapshots of local dev servers
110
111
  // when handoffs are saved. Prevents UI context loss between sessions.
@@ -841,12 +841,7 @@ export function renderDashboardHTML(version) {
841
841
  <span style="font-size:0.75rem; color:var(--text-muted); font-weight:600;">Active Recall</span>
842
842
  <button id="testMeBtn" onclick="triggerTestMe()" class="btn-modern" style="padding:0.3rem 0.6rem; font-size:0.75rem; background:var(--accent-teal); border-color:var(--accent-teal);" title="Generate 3 quiz questions using AI">📝 Test Me</button>
843
843
  </div>
844
- <div style="display:flex; justify-content:space-between; align-items:center; margin-top:0.8rem;">
845
- <span style="font-size:0.75rem; color:var(--text-muted); font-weight:600;">Cognitive Route (v6.5)</span>
846
- <button id="cognitiveRouteBtn" onclick="triggerCognitiveRoute()" class="btn-modern" style="padding:0.3rem 0.6rem; font-size:0.75rem; background:var(--accent-blue); border-color:var(--accent-blue);" title="Resolve concept route and explain why it surfaced">🧭 Route</button>
847
- </div>
848
844
  <div id="testMeContainer" style="margin-top:0.8rem; display:flex; flex-direction:column; gap:0.5rem;"></div>
849
-
850
845
  <div style="display:flex; justify-content:space-between; align-items:center; margin-top:0.8rem;">
851
846
  <span style="font-size:0.75rem; color:var(--text-muted); font-weight:600;">Cognitive Route (v6.5)</span>
852
847
  <button id="cognitiveRouteBtn" onclick="triggerCognitiveRoute()" class="btn-modern" style="padding:0.3rem 0.6rem; font-size:0.75rem; background:var(--accent-blue); border-color:var(--accent-blue);" title="Resolve concept route and explain why it surfaced">🧭 Route</button>
@@ -2443,6 +2438,7 @@ Example:\n## Dev Rules\n- Always write tests first\n- Use TypeScript strict mode
2443
2438
  }
2444
2439
  }
2445
2440
 
2441
+ async function triggerTestMe() {
2446
2442
  var input = document.getElementById('nodeEditorInput');
2447
2443
  var oldId = input.dataset.oldId;
2448
2444
  var _gpf = document.getElementById('graphProjectFilter');
@@ -1,15 +1,4 @@
1
- /**
2
- * Storage Factory (v2.0 — Step 1)
3
- *
4
- * Unified entry point for storage initialization.
5
- * Routes between Supabase (cloud) and SQLite (local) based on
6
- * the PRISM_STORAGE environment variable.
7
- *
8
- * Usage in server.ts:
9
- * const storage = await getStorage();
10
- * // Pass `storage` to all session memory handlers
11
- */
12
- import { PRISM_STORAGE as ENV_PRISM_STORAGE } from "../config.js";
1
+ import { PRISM_STORAGE as ENV_PRISM_STORAGE, SUPABASE_CONFIGURED } from "../config.js";
13
2
  import { debugLog } from "../utils/logger.js";
14
3
  import { SupabaseStorage } from "./supabase.js";
15
4
  import { getSetting } from "./configStorage.js";
@@ -20,16 +9,22 @@ export let activeStorageBackend = "local";
20
9
  *
21
10
  * On first call: creates and initializes the appropriate backend.
22
11
  * On subsequent calls: returns the cached instance.
23
- *
24
- * @throws Error if PRISM_STORAGE=local (not yet implemented in Step 1)
25
- * @throws Error if PRISM_STORAGE=supabase but Supabase is not configured
26
12
  */
27
13
  export async function getStorage() {
28
14
  if (storageInstance)
29
15
  return storageInstance;
30
16
  // Use environment variable if explicitly set, otherwise fall back to db config
31
17
  const envStorage = process.env.PRISM_STORAGE;
32
- activeStorageBackend = envStorage || await getSetting("PRISM_STORAGE", ENV_PRISM_STORAGE);
18
+ const requestedBackend = (envStorage || await getSetting("PRISM_STORAGE", ENV_PRISM_STORAGE));
19
+ // Guardrail: if Supabase is requested but credentials are unresolved/invalid,
20
+ // transparently fall back to local mode to keep dashboard + core tools usable.
21
+ if (requestedBackend === "supabase" && !SUPABASE_CONFIGURED) {
22
+ activeStorageBackend = "local";
23
+ console.error("[Prism Storage] Supabase backend requested but SUPABASE_URL/SUPABASE_KEY are invalid or unresolved. Falling back to local storage.");
24
+ }
25
+ else {
26
+ activeStorageBackend = requestedBackend;
27
+ }
33
28
  debugLog(`[Prism Storage] Initializing backend: ${activeStorageBackend}`);
34
29
  if (activeStorageBackend === "local") {
35
30
  const { SqliteStorage } = await import("./sqlite.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "6.5.0",
3
+ "version": "6.5.1",
4
4
  "mcpName": "io.github.dcostenco/prism-mcp",
5
5
  "description": "The Mind Palace for AI Agents — persistent memory (SQLite/Supabase), behavioral learning & IDE rules sync, multimodal VLM image captioning, pluggable LLM providers (OpenAI/Anthropic/Gemini/Ollama), OpenTelemetry distributed tracing, GDPR export, multi-agent Hivemind sync, time travel, visual Mind Palace dashboard. Zero-config local mode.",
6
6
  "module": "index.ts",