obsidian-sync-mcp 0.8.0 → 0.10.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
@@ -63,7 +63,7 @@ docker run -p 8787:8787 \
63
63
  ghcr.io/es617/obsidian-sync-mcp:latest
64
64
  ```
65
65
 
66
- Set `COUCHDB_PASSPHRASE` if you use E2E encryption in LiveSync. Set `COUCHDB_OBFUSCATE_PROPERTIES=true` if "Obfuscate Properties" is also enabled in your LiveSync settings. For an existing vault the server detects the actual setting from the database at startup and corrects a mismatch with a warning; only for a brand-new empty database does the value need to match your LiveSync settings. Set `BASE_URL` to your public URL (required for OAuth callbacks when agents connect over HTTPS).
66
+ Set `COUCHDB_PASSPHRASE` if you use E2E encryption in LiveSync. Set `COUCHDB_OBFUSCATE_PROPERTIES=true` if "Obfuscate Properties" is also enabled in your LiveSync settings. For an existing vault the server detects the actual setting from the database at startup and corrects a mismatch with a warning; only for a brand-new empty database does the value need to match your LiveSync settings. If the vault was created with LiveSync 1.0.33+ and path obfuscation, also set `COUCHDB_ID_DERIVATION_KEY` to your LiveSync recovery code (`sls-id-v1:...`, from "Show current recovery code") so the server can resolve note paths. Set `BASE_URL` to your public URL (required for OAuth callbacks when agents connect over HTTPS).
67
67
 
68
68
  Your MCP endpoint is `https://your-app.fly.dev/mcp` (Fly.io) or `https://your-server:8787/mcp` (Docker behind HTTPS).
69
69
 
@@ -101,6 +101,7 @@ cd obsidian-sync-mcp
101
101
 
102
102
  cat > .env <<EOF
103
103
  COUCHDB_PASSWORD=changeme
104
+ MCP_AUTH_TOKEN=changeme-too
104
105
  VAULT_NAME=MyVault
105
106
  EOF
106
107
 
@@ -110,7 +111,7 @@ docker compose up -d
110
111
  **After deployment:**
111
112
 
112
113
  1. In Obsidian, install [Self-hosted LiveSync](https://github.com/vrtmrz/obsidian-livesync) and configure it with the credentials from the setup output
113
- 2. Your MCP endpoint is `https://your-app.fly.dev/mcp` (Fly.io) or `http://your-server:8787/mcp` (Docker)
114
+ 2. Your MCP endpoint is `https://your-app.fly.dev/mcp` (Fly.io). With Docker Compose the MCP port is published on `localhost:8787` only; to reach it from other machines, put an HTTPS tunnel or reverse proxy in front (see [remote access](#c-run-on-your-machine)) and set `BASE_URL` to its public URL
114
115
  3. The `MCP_AUTH_TOKEN` is the password you enter when an agent connects
115
116
 
116
117
  ```
@@ -170,12 +171,12 @@ VAULT_NAME=MyVault \
170
171
  npx obsidian-sync-mcp
171
172
  ```
172
173
 
173
- Omit `COUCHDB_PASSPHRASE` if you don't use E2E encryption in LiveSync. Set `COUCHDB_OBFUSCATE_PROPERTIES=true` if "Obfuscate Properties" is also enabled in your LiveSync settings. For an existing vault the server detects the actual setting from the database at startup and corrects a mismatch with a warning; only for a brand-new empty database does the value need to match your LiveSync settings.
174
+ Omit `COUCHDB_PASSPHRASE` if you don't use E2E encryption in LiveSync. Set `COUCHDB_OBFUSCATE_PROPERTIES=true` if "Obfuscate Properties" is also enabled in your LiveSync settings. For an existing vault the server detects the actual setting from the database at startup and corrects a mismatch with a warning; only for a brand-new empty database does the value need to match your LiveSync settings. If the vault was created with LiveSync 1.0.33+ and path obfuscation, also set `COUCHDB_ID_DERIVATION_KEY` to your LiveSync recovery code (`sls-id-v1:...`) so the server can resolve note paths.
174
175
 
175
176
  **Or with Docker:**
176
177
 
177
178
  ```bash
178
- docker run -p 8787:8787 \
179
+ docker run -p 127.0.0.1:8787:8787 \
179
180
  -v mcp-data:/data -e DATA_DIR=/data \
180
181
  -e VAULT_PATH=/vault -v ~/Documents/MyVault:/vault \
181
182
  -e VAULT_NAME=MyVault \
@@ -250,6 +251,8 @@ Without `MCP_AUTH_TOKEN`, the server runs without authentication — suitable fo
250
251
  | `COUCHDB_DATABASE` | CouchDB mode | `obsidian` | CouchDB database name. The server never creates it: if it doesn't exist, startup fails with an error |
251
252
  | `COUCHDB_PASSPHRASE` | CouchDB mode | — | LiveSync E2E encryption passphrase (must match plugin setting) |
252
253
  | `COUCHDB_OBFUSCATE_PROPERTIES` | CouchDB mode | `false` | Set to `true` if "Obfuscate Properties" is enabled in LiveSync (obfuscates file paths, sizes, dates in the database). For existing vaults the actual setting is auto-detected at startup; this value only decides the format for a brand-new empty database |
254
+ | `COUCHDB_ID_DERIVATION_KEY` | CouchDB mode | — | LiveSync "independent ID derivation" recovery code (`sls-id-v1:...`). Needed to read and write notes on vaults created with LiveSync 1.0.33+ that use path obfuscation; leave unset for older (passphrase-derived) vaults. Get it from LiveSync's "Show current recovery code" |
255
+ | `COUCHDB_CASE_SENSITIVE` | CouchDB mode | `false` | Set to `true` only if your LiveSync vault has "Handle filenames as case-sensitive" enabled. It must match the vault, or obfuscated document IDs won't resolve (the server fails to start with a clear message). Leave unset otherwise |
253
256
  | `VAULT_NAME` | Both | `MyVault` | Vault name (used for deep links and index storage) |
254
257
  | `MCP_AUTH_TOKEN` | Optional | — | Password for authentication |
255
258
  | `BASE_URL` | Optional | `http://localhost:PORT` | Public URL (for OAuth callbacks when using a tunnel) |
@@ -288,7 +291,7 @@ Set transport to **Streamable HTTP**, enter `http://localhost:8787/mcp`, and con
288
291
  |---|---|
289
292
  | `npx obsidian-sync-mcp` | Automatic — npx pulls latest |
290
293
  | Fly.io | From the same directory where you ran setup: `fly deploy`. If you lost the fly.toml, run `fly config save --app your-app-name` to restore it. |
291
- | Docker | `docker pull ghcr.io/es617/obsidian-sync-mcp:latest` and restart |
294
+ | Docker | `docker pull ghcr.io/es617/obsidian-sync-mcp:latest` and restart. The image runs as the unprivileged `node` user (uid 1000). If your data volume was created by an older image that ran as root, make it writable once: `docker run --rm -v mcp-data:/data alpine chown -R 1000:1000 /data` (for a bind mount, `chown -R 1000:1000` the host directory) |
292
295
 
293
296
  ---
294
297
 
package/dist/main.js CHANGED
@@ -1346,6 +1346,8 @@ var COUCHDB_PASSWORD = process.env.COUCHDB_PASSWORD;
1346
1346
  var COUCHDB_DATABASE = process.env.COUCHDB_DATABASE ?? "obsidian";
1347
1347
  var COUCHDB_PASSPHRASE = process.env.COUCHDB_PASSPHRASE || void 0;
1348
1348
  var COUCHDB_OBFUSCATE_PROPERTIES = process.env.COUCHDB_OBFUSCATE_PROPERTIES === "true";
1349
+ var COUCHDB_ID_DERIVATION_KEY = process.env.COUCHDB_ID_DERIVATION_KEY || void 0;
1350
+ var COUCHDB_CASE_SENSITIVE = process.env.COUCHDB_CASE_SENSITIVE === "true";
1349
1351
  var VAULT_NAME = process.env.VAULT_NAME ?? "MyVault";
1350
1352
  var PORT = parseInt(process.env.PORT ?? "8787");
1351
1353
  var BASE_URL = process.env.BASE_URL ?? `http://localhost:${PORT}`;
@@ -1383,14 +1385,16 @@ if (VAULT_PATH) {
1383
1385
  console.error("COUCHDB_PASSWORD is required in remote mode.");
1384
1386
  process.exit(1);
1385
1387
  }
1386
- const { Vault } = await import("./vault-IAH37QM4.js");
1388
+ const { Vault } = await import("./vault-6H64Y46A.js");
1387
1389
  vault = new Vault({
1388
1390
  couchdbUrl: COUCHDB_URL,
1389
1391
  couchdbUser: COUCHDB_USER,
1390
1392
  couchdbPassword: COUCHDB_PASSWORD,
1391
1393
  database: COUCHDB_DATABASE,
1392
1394
  passphrase: COUCHDB_PASSPHRASE,
1393
- obfuscatePaths: COUCHDB_OBFUSCATE_PROPERTIES
1395
+ obfuscatePaths: COUCHDB_OBFUSCATE_PROPERTIES,
1396
+ idDerivationKey: COUCHDB_ID_DERIVATION_KEY,
1397
+ caseSensitive: COUCHDB_CASE_SENSITIVE
1394
1398
  });
1395
1399
  console.log(`Remote mode: ${redactCredentials(COUCHDB_URL)}`);
1396
1400
  } else {
@@ -1480,10 +1484,12 @@ async function rebuildIndex() {
1480
1484
  }
1481
1485
  await searchIndex.saveToDisk();
1482
1486
  searchIndex.state = "ready";
1487
+ if (COUCHDB_URL && vault.watchChanges) startCouchDbWatcher();
1483
1488
  }
1484
1489
  rebuildIndex().catch((err) => {
1485
1490
  searchIndex.state = "failed";
1486
1491
  console.error(`Index rebuild failed: ${describeError(err, debugLogging2)}`);
1492
+ if (COUCHDB_URL && vault.watchChanges) startCouchDbWatcher();
1487
1493
  });
1488
1494
  var syncChain = Promise.resolve();
1489
1495
  async function syncBeforeSearch() {
@@ -1534,7 +1540,8 @@ if (VAULT_PATH) {
1534
1540
  }
1535
1541
  }
1536
1542
  console.log("Watching vault for external changes.");
1537
- } else if (COUCHDB_URL && vault.watchChanges) {
1543
+ }
1544
+ function startCouchDbWatcher() {
1538
1545
  vault.watchChanges((path, content, mtime, seq) => {
1539
1546
  if (debugLogging2) console.log(`[debug] CouchDB ${content === null ? "delete" : "change"}: ${path}`);
1540
1547
  applyIndexChange(searchIndex, path, content, mtime);
@@ -1548,7 +1555,7 @@ if (VAULT_PATH) {
1548
1555
  var BASE_INSTRUCTIONS = "Access and manage an Obsidian vault. You can read, write, list, search, move, and delete markdown notes. Every tool response includes an Obsidian deep link. Always show this link to the user using the format [obsidian://open?vault=...&file=...](obsidian://open?vault=...&file=...) so it is both clickable and visible as a URL.";
1549
1556
  var serverOptions = {
1550
1557
  name: "obsidian-sync-mcp",
1551
- version: "0.8.0",
1558
+ version: "0.10.0",
1552
1559
  instructions: MCP_EXTRA_INSTRUCTIONS ? `${BASE_INSTRUCTIONS}
1553
1560
 
1554
1561
  ${MCP_EXTRA_INSTRUCTIONS}` : BASE_INSTRUCTIONS
@@ -1615,7 +1622,7 @@ server.start({
1615
1622
  transportType: "httpStream",
1616
1623
  httpStream: { port: PORT, endpoint: "/mcp", host: process.env.HOST ?? "0.0.0.0" }
1617
1624
  });
1618
- console.log(`obsidian-sync-mcp v${"0.8.0"} listening on port ${PORT}`);
1625
+ console.log(`obsidian-sync-mcp v${"0.10.0"} listening on port ${PORT}`);
1619
1626
  process.on("unhandledRejection", (err) => {
1620
1627
  console.error(`Unhandled rejection: ${describeError(err, debugLogging2)}`);
1621
1628
  });