mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 00:01:10 +02:00
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>
|
||
|---|---|---|
| .. | ||
| lib | ||
| mcp | ||
| modules | ||
| index.ts | ||