Files
tolaria/docs/adr/0019-mcp-server.md
Test bcd4b8fd99 docs: backfill ADRs 0016–0020 (historical decisions)
0016: Vault repair and auto-bootstrap
0017: Auto-save with 500ms debounce
0018: In-app git divergence and conflict resolution
0019: MCP server for AI integration
0020: AI dual architecture (chat + agent)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 10:57:21 +01:00

2.0 KiB

type, id, title, status, date
type id title status date
ADR 0019 MCP server for AI integration active 2026-03-01

Context

AI assistants (Claude Code, Cursor) are increasingly part of the development and knowledge management workflow. To make the vault accessible to these tools, Laputa needed to expose vault operations as a standardized tool interface. The Model Context Protocol (MCP) provides exactly this — a standard way for AI clients to discover and call tools.

Decision

Ship an MCP server (mcp-server/) as a Node.js process that exposes 14 vault tools via stdio transport, with a WebSocket bridge for live UI integration. Auto-register in Claude Code and Cursor configs on startup.

Options considered

  • Option A (chosen): MCP server with stdio + WebSocket — pros: standard protocol, works with Claude Code and Cursor out of the box, WebSocket bridge enables live UI actions from AI, auto-registration is frictionless / cons: Node.js dependency alongside Rust backend, two transport layers to maintain
  • Option B: REST API — pros: simpler, widely understood / cons: not a standard AI tool protocol, would need custom integration per AI client
  • Option C: Expose tools only via Claude CLI MCP config — pros: no separate server / cons: no WebSocket bridge, no live UI actions, limited to Claude CLI

Consequences

  • 14 tools: vault CRUD, search, frontmatter editing, note linking, UI actions (open note, highlight, set filter)
  • Two transports: stdio (Claude Code/Cursor) and WebSocket (port 9710 for tools, 9711 for UI actions)
  • Auto-registration in ~/.claude/mcp.json and ~/.cursor/mcp.json — non-destructive upsert
  • mcp.rs manages lifecycle: spawn on startup, kill on exit
  • useMcpBridge and useAiActivity hooks connect frontend to WebSocket bridge
  • MCP server reads/writes vault files directly — Tauri backend not involved in MCP tool execution
  • Re-evaluate if MCP protocol evolves to support binary transport or if vault operations need Tauri backend involvement