DEC-AIC-0061: Split vault-server into pure vault-mcp-server and dedicated vault-view-server
Status: draft · 2026-11-30
Context
DEC-AIC-0048 kept the vault server in this repository behind the MCP boundary, and DEC-AIC-0052 split the vault logic into hexagonal domain, application, and adapter libraries composed by apps/vault-server. At that time apps/vault-server hosted two local transports under one binary (coach-vault): stdio MCP (serve) and the loopback HTTP UI server (view) backed by @ai-coach/vault-adapter-view (observed: apps/vault-server/src/main.ts @ 2026-11-30).
Because @ai-coach/vault-adapter-view depends on the Angular frontend @ai-coach/vault-view (apps/vault-view, introduced in DEC-AIC-0059), every build, typecheck, and test run of apps/vault-server triggered an Angular ng build even when only MCP tools changed (observed: Nx task graph @ 2026-11-30). At the same time, apps/vault-view is a browser-only scope:vault-view layered app that cannot import Node scope:vault libraries directly.
Decision
- Rename
apps/vault-servertoapps/vault-mcp-server(@ai-coach/vault-mcp-server, binarycoach-vault-mcp):- Hosts only the stdio MCP server (
serve) and removes@ai-coach/vault-adapter-viewfrom its dependencies and TypeScript project references. - Tagged
scope:vault,architecture:hexagonal,type:app,app:vault-mcp-server.
- Hosts only the stdio MCP server (
- Create
apps/vault-view-server(@ai-coach/vault-view-server, binarycoach-vault-view):- Dedicated Node loopback HTTP server (BFF) that composes the vault with its adapters, serves
@ai-coach/vault-adapter-viewAPIs and the built Angular@ai-coach/vault-viewbundle on127.0.0.1, and owns the loopback HTTP integration tests (src/view.test.ts). - Tagged
scope:vault,architecture:hexagonal,type:app,app:vault-view-server.
- Dedicated Node loopback HTTP server (BFF) that composes the vault with its adapters, serves
- Move shared process-level CLI flag parsing and vault-root resolution into
@ai-coach/vault-adapter-fs:parseVaultFlags,parseViewFlags,workspaceRootsAbove, andresolveVaultForProcesslive inlibs/vault/adapter-fs/src/lib/process-root.tsalongsideresolveVaultRoot, keeping both Node apps thin without introducing a new composition library or relaxingtype:adapterESLint boundaries.
- Update
apps/cliconfiguration andcoach view:defaultVaultMcpServerBin()resolvesapps/vault-mcp-server/dist/main.js(still overridable viaDOCS_MCP_BIN/docsMcpBin).defaultVaultViewServerBin()resolvesapps/vault-view-server/dist/main.js(overridable viaVAULT_VIEW_BIN/vaultViewBin), andcoach viewspawnsconfig.vaultViewBindirectly.
Consequences
@ai-coach/vault-mcp-serveris a pure MCP server with zero dependency on@ai-coach/vault-adapter-viewor Angular (@ai-coach/vault-view), making MCP server builds and tests faster and more isolated.@ai-coach/vault-viewremains a pure browser-only Angular application while@ai-coach/vault-view-serverserves as its dedicated Node backend.- External MCP configurations (
.mcp.json) point toapps/vault-mcp-server/dist/main.jsinstead ofapps/vault-server/dist/main.js.