neuro-vault-mcp 6.0.0 → 7.0.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/dist/cli.js +34 -60
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -59,10 +59,6 @@ async function parseConfig(argv) {
|
|
|
59
59
|
type: "boolean",
|
|
60
60
|
default: true,
|
|
61
61
|
describe: "Enable semantic search module (Smart Connections embeddings)"
|
|
62
|
-
}).option("operations", {
|
|
63
|
-
type: "boolean",
|
|
64
|
-
default: true,
|
|
65
|
-
describe: "Enable vault operations module (Obsidian CLI required at call time)"
|
|
66
62
|
}).option("obsidian-cli", {
|
|
67
63
|
type: "string",
|
|
68
64
|
describe: 'Path to the obsidian CLI binary (default: "obsidian" from PATH)'
|
|
@@ -71,9 +67,6 @@ async function parseConfig(argv) {
|
|
|
71
67
|
if (rawVaults.length === 0) {
|
|
72
68
|
throw new Error("--vault is required: provide at least one vault with --vault <path>");
|
|
73
69
|
}
|
|
74
|
-
if (!args.semantic && !args.operations) {
|
|
75
|
-
throw new Error("At least one module must be enabled (--semantic or --operations)");
|
|
76
|
-
}
|
|
77
70
|
const vaults = rawVaults.map(buildVaultConfig);
|
|
78
71
|
const seen = /* @__PURE__ */ new Set();
|
|
79
72
|
for (const v of vaults) {
|
|
@@ -92,10 +85,7 @@ async function parseConfig(argv) {
|
|
|
92
85
|
modelKey: DEFAULT_MODEL_KEY,
|
|
93
86
|
modelId: DEFAULT_MODEL_ID
|
|
94
87
|
},
|
|
95
|
-
|
|
96
|
-
enabled: args.operations,
|
|
97
|
-
binaryPath: args["obsidian-cli"]
|
|
98
|
-
}
|
|
88
|
+
obsidianCli: args["obsidian-cli"]
|
|
99
89
|
};
|
|
100
90
|
}
|
|
101
91
|
|
|
@@ -14315,19 +14305,21 @@ function registerTool(tool) {
|
|
|
14315
14305
|
|
|
14316
14306
|
// src/lib/resolve-vault.ts
|
|
14317
14307
|
function resolveVault(input, registry2, opts) {
|
|
14318
|
-
let entry;
|
|
14319
14308
|
if (input.vault !== void 0 && input.vault !== "") {
|
|
14320
|
-
|
|
14321
|
-
}
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
throw new ToolHandlerError(
|
|
14325
|
-
"VAULT_REQUIRED",
|
|
14326
|
-
`Tool "${opts.tool}" requires a vault: parameter in multi-vault mode`,
|
|
14327
|
-
{ details: { tool: opts.tool, registered_vaults: registry2.names() } }
|
|
14328
|
-
);
|
|
14309
|
+
return registry2.require(input.vault);
|
|
14310
|
+
}
|
|
14311
|
+
if (!registry2.isMulti()) {
|
|
14312
|
+
return registry2.list()[0];
|
|
14329
14313
|
}
|
|
14330
|
-
|
|
14314
|
+
throw new ToolHandlerError(
|
|
14315
|
+
"VAULT_REQUIRED",
|
|
14316
|
+
`Tool "${opts.tool}" requires a vault: parameter in multi-vault mode`,
|
|
14317
|
+
{ details: { tool: opts.tool, registered_vaults: registry2.names() } }
|
|
14318
|
+
);
|
|
14319
|
+
}
|
|
14320
|
+
function resolveSemanticVault(input, registry2, opts) {
|
|
14321
|
+
const entry = resolveVault(input, registry2, opts);
|
|
14322
|
+
if (!entry.semanticAvailable) {
|
|
14331
14323
|
throw new ToolHandlerError(
|
|
14332
14324
|
"SEMANTIC_INDEX_NOT_FOUND",
|
|
14333
14325
|
`Semantic index for vault "${entry.name}" is unavailable: ${entry.semanticUnavailableReason ?? "unknown reason"}`,
|
|
@@ -14511,9 +14503,8 @@ function buildFindDuplicatesTool(deps) {
|
|
|
14511
14503
|
),
|
|
14512
14504
|
inputSchema,
|
|
14513
14505
|
handler: async (input) => {
|
|
14514
|
-
const entry =
|
|
14515
|
-
tool: "find_duplicates"
|
|
14516
|
-
requireSemantic: true
|
|
14506
|
+
const entry = resolveSemanticVault(input, registry2, {
|
|
14507
|
+
tool: "find_duplicates"
|
|
14517
14508
|
});
|
|
14518
14509
|
const corpus = entry.corpus;
|
|
14519
14510
|
const threshold = readThreshold(input.threshold, DEFAULT_DUPLICATE_THRESHOLD, "threshold");
|
|
@@ -15612,9 +15603,8 @@ function buildGetSimilarNotesTool(deps) {
|
|
|
15612
15603
|
),
|
|
15613
15604
|
inputSchema,
|
|
15614
15605
|
handler: async (input) => {
|
|
15615
|
-
const entry =
|
|
15616
|
-
tool: "get_similar_notes"
|
|
15617
|
-
requireSemantic: true
|
|
15606
|
+
const entry = resolveSemanticVault(input, registry2, {
|
|
15607
|
+
tool: "get_similar_notes"
|
|
15618
15608
|
});
|
|
15619
15609
|
const corpus = entry.corpus;
|
|
15620
15610
|
const notePath = normalizeNotePath(input.path);
|
|
@@ -15696,9 +15686,8 @@ function buildGetStatsTool(deps) {
|
|
|
15696
15686
|
),
|
|
15697
15687
|
inputSchema,
|
|
15698
15688
|
handler: async (input) => {
|
|
15699
|
-
const entry =
|
|
15700
|
-
tool: "get_stats"
|
|
15701
|
-
requireSemantic: true
|
|
15689
|
+
const entry = resolveSemanticVault(input, registry2, {
|
|
15690
|
+
tool: "get_stats"
|
|
15702
15691
|
});
|
|
15703
15692
|
const corpus = entry.corpus;
|
|
15704
15693
|
try {
|
|
@@ -16179,12 +16168,15 @@ function buildSearchNotesTool(deps) {
|
|
|
16179
16168
|
if (input.vault === void 0 && registry2.isMulti()) {
|
|
16180
16169
|
return await runSemanticFanOut(
|
|
16181
16170
|
registry2,
|
|
16182
|
-
(entry2) => runSearchForEntry(
|
|
16171
|
+
(entry2) => runSearchForEntry(
|
|
16172
|
+
entry2,
|
|
16173
|
+
input,
|
|
16174
|
+
entryDeps
|
|
16175
|
+
)
|
|
16183
16176
|
);
|
|
16184
16177
|
}
|
|
16185
|
-
const entry =
|
|
16186
|
-
tool: "search_notes"
|
|
16187
|
-
requireSemantic: true
|
|
16178
|
+
const entry = resolveSemanticVault(input, registry2, {
|
|
16179
|
+
tool: "search_notes"
|
|
16188
16180
|
});
|
|
16189
16181
|
return runSearchForEntry(entry, input, entryDeps);
|
|
16190
16182
|
}
|
|
@@ -16368,9 +16360,6 @@ function buildCreateNoteTool(deps) {
|
|
|
16368
16360
|
inputSchema,
|
|
16369
16361
|
handler: async (input) => {
|
|
16370
16362
|
const entry = resolveVault(input, registry2, { tool: "create_note" });
|
|
16371
|
-
if (!entry.provider) {
|
|
16372
|
-
throw invalidArgument("operations module is disabled", "vault");
|
|
16373
|
-
}
|
|
16374
16363
|
if (input.name === void 0 && input.path === void 0) {
|
|
16375
16364
|
throw invalidArgument("Provide name or path", "name");
|
|
16376
16365
|
}
|
|
@@ -16948,11 +16937,6 @@ function registerResource(resource) {
|
|
|
16948
16937
|
// src/modules/operations/resources/vault-overview.ts
|
|
16949
16938
|
function buildVaultOverviewResource(opts) {
|
|
16950
16939
|
const { uri, entry } = opts;
|
|
16951
|
-
if (!entry.provider) {
|
|
16952
|
-
throw new Error(
|
|
16953
|
-
`buildVaultOverviewResource: vault "${entry.name}" has no provider \u2014 operations module must be enabled`
|
|
16954
|
-
);
|
|
16955
|
-
}
|
|
16956
16940
|
return {
|
|
16957
16941
|
name: uri === "vault://overview" ? "vault-overview" : `vault-overview-${entry.name}`,
|
|
16958
16942
|
uri,
|
|
@@ -17008,8 +16992,8 @@ var VaultRegistry = class _VaultRegistry {
|
|
|
17008
16992
|
const reader = deps.readerFactory({ vaultRoot: v.path });
|
|
17009
16993
|
const graph = deps.graphFactory({ reader });
|
|
17010
16994
|
const listMatchingPaths = deps.listMatchingPathsFactory({ reader, graph });
|
|
17011
|
-
const writer =
|
|
17012
|
-
const provider =
|
|
16995
|
+
const writer = deps.writerFactory({ vaultRoot: v.path });
|
|
16996
|
+
const provider = deps.providerFactory({ vaultName: v.name, binaryPath: config2.binaryPath });
|
|
17013
16997
|
let corpus;
|
|
17014
16998
|
let semanticAvailable = false;
|
|
17015
16999
|
let semanticUnavailableReason;
|
|
@@ -17304,7 +17288,7 @@ var ObsidianCLIProvider = class {
|
|
|
17304
17288
|
if (/vault (not found|does not exist)/i.test(stderr)) {
|
|
17305
17289
|
return new ToolHandlerError(
|
|
17306
17290
|
"VAULT_NOT_FOUND",
|
|
17307
|
-
`Obsidian does not recognize a vault named '${this.vaultName}'.
|
|
17291
|
+
`Obsidian does not recognize a vault named '${this.vaultName}'. The MCP-side alias is derived from the vault directory's basename and must match the display name Obsidian shows in "Manage vaults". Rename either the directory (and re-launch with the matching --vault path) or the vault in Obsidian so the two agree.`,
|
|
17308
17292
|
{ details: { stderr, vaultName: this.vaultName }, cause: error48 }
|
|
17309
17293
|
);
|
|
17310
17294
|
}
|
|
@@ -17522,16 +17506,12 @@ function buildDefaultVaultEntryDeps(overrides = {}) {
|
|
|
17522
17506
|
};
|
|
17523
17507
|
}
|
|
17524
17508
|
async function startNeuroVaultServer(config2, deps = {}) {
|
|
17525
|
-
if (!config2.semantic.enabled && !config2.operations.enabled) {
|
|
17526
|
-
throw new Error("No modules enabled \u2014 pass --semantic or --operations");
|
|
17527
|
-
}
|
|
17528
17509
|
const registry2 = await VaultRegistry.create(
|
|
17529
17510
|
{
|
|
17530
17511
|
vaults: config2.vaults,
|
|
17531
|
-
operationsEnabled: config2.operations.enabled,
|
|
17532
17512
|
semanticEnabled: config2.semantic.enabled,
|
|
17533
17513
|
modelKey: config2.semantic.modelKey,
|
|
17534
|
-
binaryPath: config2.
|
|
17514
|
+
binaryPath: config2.obsidianCli
|
|
17535
17515
|
},
|
|
17536
17516
|
buildDefaultVaultEntryDeps(deps.vaultEntryDeps)
|
|
17537
17517
|
);
|
|
@@ -17552,15 +17532,9 @@ async function startNeuroVaultServer(config2, deps = {}) {
|
|
|
17552
17532
|
toolRegistrations.push(...semantic.tools);
|
|
17553
17533
|
warmup = semantic.warmup;
|
|
17554
17534
|
}
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
{ binaryPath: config2.operations.binaryPath },
|
|
17559
|
-
deps.operations
|
|
17560
|
-
);
|
|
17561
|
-
toolRegistrations.push(...operations.tools);
|
|
17562
|
-
resourceRegistrations.push(...operations.resources);
|
|
17563
|
-
}
|
|
17535
|
+
const operations = createOperationsModule(registry2, {}, deps.operations);
|
|
17536
|
+
toolRegistrations.push(...operations.tools);
|
|
17537
|
+
resourceRegistrations.push(...operations.resources);
|
|
17564
17538
|
for (const tool of toolRegistrations) {
|
|
17565
17539
|
server.registerTool(tool.name, tool.spec, tool.handler);
|
|
17566
17540
|
}
|