filamental-mcp 0.2.2 → 0.2.3

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
@@ -120,10 +120,19 @@ This server opens that SQLite index read-write. Read tools query it directly. Wr
120
120
 
121
121
  ---
122
122
 
123
+ ## Compatibility
124
+
125
+ | filamental-mcp | Filamental app | DB schema |
126
+ |---|---|---|
127
+ | 0.2.x | 0.2.x | v5 |
128
+
129
+ If the versions are mismatched the server exits immediately with a clear message telling you which side to update.
130
+
131
+ ---
132
+
123
133
  ## Known limitations
124
134
 
125
135
  - The pre-built binary (`better-sqlite3`) is Windows x64 only. Other platforms require building from source.
126
- - The server must be restarted if you change the active vault in Filamental.
127
136
  - Auto-config via Filamental Settings has been tested on Windows. macOS path resolution is included but untested.
128
137
 
129
138
  ---
package/dist/index.js CHANGED
@@ -58,6 +58,17 @@ function resolveDbPath(vaultPath, explicitDb) {
58
58
  return appDbPath;
59
59
  return join(vaultPath, '.filamental', 'filamental.db');
60
60
  }
61
+ // ── Schema compatibility ──────────────────────────────────────────────────────
62
+ // Must match SCHEMA_VERSION in src-tauri/src/index.rs
63
+ const SUPPORTED_SCHEMA_VERSION = 5;
64
+ function schemaVersionHint(detected) {
65
+ if (detected > SUPPORTED_SCHEMA_VERSION) {
66
+ return (`Version mismatch: your Filamental app uses schema v${detected} but this MCP only supports v${SUPPORTED_SCHEMA_VERSION}. ` +
67
+ `To fix:\n 1. Open a terminal\n 2. Run: npm update -g filamental-mcp\n 3. Restart Claude Desktop`);
68
+ }
69
+ return (`Version mismatch: this MCP expects schema v${SUPPORTED_SCHEMA_VERSION} but detected v${detected}. ` +
70
+ `To fix:\n 1. Download the latest Filamental app at https://filamental.app\n 2. Install it\n 3. Restart Claude Desktop`);
71
+ }
61
72
  let activeState = null;
62
73
  function openVault(vaultPath, explicitDb) {
63
74
  const dbPath = resolveDbPath(vaultPath, explicitDb);
@@ -66,7 +77,15 @@ function openVault(vaultPath, explicitDb) {
66
77
  `Open this vault in Filamental at least once so the SQLite index is initialised.`);
67
78
  }
68
79
  const db = new Database(dbPath);
69
- return { vaultPath, db };
80
+ const row = db.prepare('PRAGMA user_version').get();
81
+ const schemaVersion = row.user_version;
82
+ let schemaHint = null;
83
+ if (schemaVersion !== SUPPORTED_SCHEMA_VERSION) {
84
+ schemaHint = schemaVersionHint(schemaVersion);
85
+ // Log to stderr only — user never sees this in normal operation
86
+ console.error(`[filamental-mcp] warning: ${schemaHint}`);
87
+ }
88
+ return { vaultPath, db, schemaHint };
70
89
  }
71
90
  // ── Main ──────────────────────────────────────────────────────────────────────
72
91
  async function main() {
@@ -129,7 +148,7 @@ async function main() {
129
148
  });
130
149
  }
131
150
  // Create the MCP server — it reads activeState on each tool call via the getter
132
- const server = createServer(() => activeState.db, () => activeState.vaultPath);
151
+ const server = createServer(() => activeState.db, () => activeState.vaultPath, () => activeState.schemaHint);
133
152
  const transport = new StdioServerTransport();
134
153
  await server.connect(transport);
135
154
  }
package/dist/server.js CHANGED
@@ -851,8 +851,8 @@ function toolDeleteEdge(db, args) {
851
851
  return { deleted: true, edge_id: edgeId };
852
852
  }
853
853
  // ── Server factory ────────────────────────────────────────────────────────────
854
- export function createServer(getDb, getVaultPath) {
855
- const server = new Server({ name: 'filamental', version: '0.2.1' }, { capabilities: { tools: {} } });
854
+ export function createServer(getDb, getVaultPath, getSchemaHint) {
855
+ const server = new Server({ name: 'filamental', version: '0.2.2' }, { capabilities: { tools: {} } });
856
856
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
857
857
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
858
858
  const { name, arguments: args = {} } = request.params;
@@ -909,7 +909,10 @@ export function createServer(getDb, getVaultPath) {
909
909
  catch (err) {
910
910
  if (err instanceof McpError)
911
911
  throw err;
912
- throw new McpError(ErrorCode.InternalError, String(err));
912
+ // Append version hint only if there is one — keeps the message clean when versions match
913
+ const hint = getSchemaHint();
914
+ const base = String(err);
915
+ throw new McpError(ErrorCode.InternalError, hint ? `${base}\n\n${hint}` : base);
913
916
  }
914
917
  });
915
918
  return server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filamental-mcp",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "MCP server exposing your Filamental vault to AI assistants (Claude, Claude Code, etc.)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",