Users can now read, search, and update existing local Obsidian notes through built-in tools without configuring an external MCP server or Obsidian plugin. Add vault discovery, an optional folder scope, and independent test, save, enablement, and runtime assignment controls in MCP settings. Bundle MCPVault 0.16.0 and its runtime dependencies, exposing 19 shared tools to direct models and managed local OpenCode and Continue conversations. Obsidian is disabled by default. Ask remains read-only; Execute permits writes. Scope and assignment changes revoke existing Obsidian grants. DeepSeek Harness and remote execution remain unsupported. Validate the isolated staged snapshot with its own dependency installation: typecheck, lint, production build, and 540 tests across 14 files passed. No paid model calls were repeated. Physical-offline, installer, and other platform acceptance remain pending as documented in the feature record. Release note: Connect local Obsidian vaults in MCP settings to find notes and write conversation results back to them. Test all registered vaults or a chosen folder before enabling access; no Obsidian plugin is required.
42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import { cp, mkdir, readFile, rm, stat } from 'node:fs/promises'
|
|
import { dirname, join, relative, resolve } from 'node:path'
|
|
|
|
/** Keep upstream module-relative assets and licenses, including trash's native helpers. */
|
|
export async function packageObsidianMcpVault(projectRoot: string, output: string): Promise<void> {
|
|
const modules = resolve(projectRoot, 'node_modules')
|
|
const visited = new Set<string>()
|
|
await rm(output, { recursive: true, force: true })
|
|
await mkdir(output, { recursive: true })
|
|
|
|
async function copyDependency(name: string, from: string): Promise<void> {
|
|
let directory = from
|
|
let source: string
|
|
for (;;) {
|
|
source = join(directory, 'node_modules', name)
|
|
if (await stat(join(source, 'package.json')).then(() => true, () => false)) break
|
|
const parent = dirname(directory)
|
|
if (parent === directory) throw new Error(`Missing MCPVault dependency: ${name}`)
|
|
directory = parent
|
|
}
|
|
if (visited.has(source)) return
|
|
visited.add(source)
|
|
const target = join(output, 'node_modules', relative(modules, source))
|
|
const manifest = JSON.parse(await readFile(join(source, 'package.json'), 'utf8')) as {
|
|
version: string
|
|
dependencies?: Record<string, string>
|
|
}
|
|
if (name === '@bitbonsai/mcpvault' && manifest.version !== '0.16.0') {
|
|
throw new Error(`Expected MCPVault 0.16.0, found ${manifest.version}`)
|
|
}
|
|
await cp(source, target, {
|
|
recursive: true,
|
|
filter: (path) => path === source || !relative(source, path).split(/[\\/]/u).includes('node_modules')
|
|
})
|
|
for (const dependency of Object.keys(manifest.dependencies ?? {})) {
|
|
await copyDependency(dependency, source)
|
|
}
|
|
}
|
|
|
|
await copyDependency('@bitbonsai/mcpvault', projectRoot)
|
|
}
|