managarten/apps/api/src
Till JS e969324cc8 feat(mcp): Phase 2 — real DB operations for tool execution
Implement actual sync_changes reads and writes for MCP tool calls:

- sync-db.ts: Connection to mana_sync DB, RLS-scoped withUser(),
  readLatestRecords() for replaying sync state, writeRecord() for
  creating sync_changes entries
- executor.ts: 10 tool handlers implemented:
  - Reads: list_tasks, get_task_stats, list_notes, get_todays_events,
    get_contacts, get_habits
  - Writes: create_task, complete_task, create_note, create_contact
  - Remaining tools return helpful "not yet implemented" message
- server.ts: userId from auth context bound into MCP session via closure
- index.ts: typed Hono app with AuthVariables

Write pattern matches mana-ai: INSERT into sync_changes with
actor={kind:'system', source:'mcp-tool'}, client_id='mcp-server'.
Records appear on user devices on next sync cycle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 13:46:06 +02:00
..
lib refactor: rename planta → plants, clean up codebase 2026-04-12 18:59:44 +02:00
mcp feat(mcp): Phase 2 — real DB operations for tool execution 2026-04-16 13:46:06 +02:00
modules feat(news-research): RSS feed discovery, filter, and AI-context export 2026-04-15 22:31:07 +02:00
index.ts feat(mcp): Phase 2 — real DB operations for tool execution 2026-04-16 13:46:06 +02:00