neuro-vault-mcp 5.4.0 → 5.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/cli.js CHANGED
@@ -33,6 +33,9 @@ async function parseConfig(argv) {
33
33
  }).option("obsidian-cli", {
34
34
  type: "string",
35
35
  describe: 'Path to the obsidian CLI binary (default: "obsidian" from PATH)'
36
+ }).option("vault-name", {
37
+ type: "string",
38
+ describe: `Override the Obsidian vault name used in CLI invocations. Defaults to the basename of --vault. Set this only if you renamed the vault in Obsidian's "Manage vaults" UI and the display name differs from the directory name.`
36
39
  }).strict().help().version(false).parse();
37
40
  if (!path.isAbsolute(args.vault)) {
38
41
  throw new Error("--vault must be an absolute path");
@@ -40,6 +43,9 @@ async function parseConfig(argv) {
40
43
  if (!args.semantic && !args.operations) {
41
44
  throw new Error("At least one module must be enabled (--semantic or --operations)");
42
45
  }
46
+ if (args["vault-name"] !== void 0 && args["vault-name"].trim() === "") {
47
+ throw new Error("--vault-name must not be empty");
48
+ }
43
49
  const normalizedVaultPath = path.resolve(args.vault);
44
50
  return {
45
51
  vaultPath: normalizedVaultPath,
@@ -51,7 +57,8 @@ async function parseConfig(argv) {
51
57
  },
52
58
  operations: {
53
59
  enabled: args.operations,
54
- binaryPath: args["obsidian-cli"]
60
+ binaryPath: args["obsidian-cli"],
61
+ vaultName: args["vault-name"]?.trim() ?? path.basename(normalizedVaultPath)
55
62
  }
56
63
  };
57
64
  }
@@ -16303,6 +16310,13 @@ var ObsidianCLIProvider = class {
16303
16310
  { details: { stderr, command }, cause: error48 }
16304
16311
  );
16305
16312
  }
16313
+ if (/vault (not found|does not exist)/i.test(stderr)) {
16314
+ return new ToolHandlerError(
16315
+ "VAULT_NOT_FOUND",
16316
+ `Obsidian does not recognize a vault named '${this.vaultName}'. This usually means the vault was renamed in Obsidian's "Manage vaults" UI and the display name no longer matches the directory basename. Re-launch the server with --vault-name <exact-name-in-obsidian>.`,
16317
+ { details: { stderr, vaultName: this.vaultName }, cause: error48 }
16318
+ );
16319
+ }
16306
16320
  if (/not found/i.test(stderr)) {
16307
16321
  return new ToolHandlerError("NOT_FOUND", `Note not found: ${stderr.trim() || "unknown"}`, {
16308
16322
  details: { stderr, command },
@@ -16316,9 +16330,10 @@ var ObsidianCLIProvider = class {
16316
16330
  );
16317
16331
  }
16318
16332
  buildArgs(command, ...kvPairs) {
16319
- const args = [command, ...kvPairs];
16320
- if (this.vaultName) args.push(`vault=${this.vaultName}`);
16321
- return args;
16333
+ if (this.vaultName) {
16334
+ return [`vault=${this.vaultName}`, command, ...kvPairs];
16335
+ }
16336
+ return [command, ...kvPairs];
16322
16337
  }
16323
16338
  };
16324
16339
 
@@ -17020,7 +17035,7 @@ function createOperationsModule(config2, deps = {}) {
17020
17035
  const providerFactory = deps.vaultProviderFactory ?? ((opts) => new ObsidianCLIProvider(opts));
17021
17036
  const readerFactory = deps.vaultReaderFactory ?? ((opts) => new FsVaultReader({ vaultRoot: opts.vaultRoot }));
17022
17037
  const writerFactory = deps.vaultWriterFactory ?? ((opts) => new FsVaultWriter({ vaultRoot: opts.vaultRoot }));
17023
- const provider = providerFactory({ binaryPath: config2.binaryPath });
17038
+ const provider = providerFactory({ binaryPath: config2.binaryPath, vaultName: config2.vaultName });
17024
17039
  const reader = readerFactory({ vaultRoot: config2.vaultPath });
17025
17040
  const writer = writerFactory({ vaultRoot: config2.vaultPath });
17026
17041
  const graph = deps.graph ?? new WikilinkGraphIndex({ reader });
@@ -17184,6 +17199,7 @@ async function startNeuroVaultServer(config2, deps = {}) {
17184
17199
  const operations = createOperationsModule(
17185
17200
  {
17186
17201
  vaultPath: config2.vaultPath,
17202
+ vaultName: config2.operations.vaultName,
17187
17203
  binaryPath: config2.operations.binaryPath
17188
17204
  },
17189
17205
  { graph: sharedGraph, ...deps.operations }