Skip to main content

@ai-coach/vault-view-server

The local HTTP backend for the vault web UI. It composes vault-application with its Node adapters and runs vault-adapter-view on 127.0.0.1 so the Angular vault-view frontend can read and edit your Obsidian vault locally.

What it does not do​

  • No MCP transport or AI agent tools. Stdio MCP lives in vault-mcp-server (DEC-AIC-0061).
  • No frontend UI code or HTTP route logic. Route handlers, CSP headers, and token checks live in vault-adapter-view; browser UI components live in vault-view.
  • No coaching or LLM dependencies. Nothing in scope:coach may be imported here, and nothing in the workspace may import this app.

Architecture fit​

  • Scope: scope:vault
  • Style: architecture:hexagonal (type:app, app:vault-view-server)
  • Depends on: @ai-coach/vault-application, @ai-coach/vault-adapter-fs, @ai-coach/vault-adapter-markdown, @ai-coach/vault-adapter-pdf, @ai-coach/vault-adapter-search, @ai-coach/vault-adapter-view
  • Used by: coach view in apps/cli and direct terminal runs
[Browser (vault-view)] ──HTTP 127.0.0.1──▶ [@ai-coach/vault-view-server] ──▶ [vault-adapter-view]
│
└──▶ [vault-application] + [vault-adapter-*]

Internal architecture & rules​

  • Composition root (src/compose.ts): Wires createVault to the filesystem, markdown, PDF, and search adapters.
  • CLI entrypoint (src/main.ts): Parses --vault, --vault-config, and --port via parseViewFlags and resolveVaultForProcess from vault-adapter-fs, then starts createVaultViewServer on loopback only.
  • No comments in source code: Keep TypeScript source files comment-free (DEC-AIC-0011).

Public surface​

  • coach-vault-view — starts the loopback HTTP server on 127.0.0.1 (default port 4747) serving the graph, plans, and climb pages plus their JSON/write APIs. See Vault view for full usage.

How to extend it​

  1. Add new vault read/write operations in vault-application.
  2. Expose new HTTP endpoints or security checks in vault-adapter-view.
  3. Update the Angular UI in vault-view.
  4. Add loopback HTTP integration tests in src/view.test.ts and run npm exec nx run @ai-coach/vault-view-server:lint, typecheck, test, and build.

Running & testing​

The build outputs dist/main.js (the coach-vault-view binary). Pass --vault (with a path or using DOCS_MCP_VAULT / ~/.config/docs-mcp/config.json) and optional --port:

node apps/vault-view-server/dist/main.js --vault ~/Documents/my-vault
node apps/vault-view-server/dist/main.js --vault ~/Documents/my-vault --port=4747

See Vault view and Configuration for CLI integration (coach view and vaultViewBin).

npm exec nx lint @ai-coach/vault-view-server
npm exec nx typecheck @ai-coach/vault-view-server
npm exec nx test @ai-coach/vault-view-server
npm exec nx build @ai-coach/vault-view-server

Tests​

src/view.test.ts runs Vitest against isolated temporary vaults over real loopback HTTP (127.0.0.1), checking CSP/token/origin guards, note and page endpoints, distillation writes, and graph regeneration without touching your vault.

Key ADRs​

  • DEC-AIC-0061 — splits this HTTP view server out of the pure MCP server.
  • DEC-AIC-0059 — defines the Angular vault-view frontend served by this host.
  • DEC-AIC-0052 — defines the hexagonal vault libraries composed here.
  • DEC-AIC-0060 — governs this README's eight-section structure.