feat: kiwi MCP for corpus DB access #124

Open
opened 2026-04-27 11:31:55 -07:00 by pyr0ball · 0 comments
Owner

Problem

Debugging browse/tag issues requires docker exec python3 -c "..." one-liners against the SQLite corpus. This is slow, error-prone, and the output disappears.

Proposed solution

Build a kiwi MCP server (similar to the existing Snipe MCP pattern) that exposes:

  • kiwi_query_corpus — run a read-only SQL query against the corpus DB, return results as JSON
  • kiwi_count_fts — run an FTS5 MATCH expression and return the row count
  • kiwi_sample_tags — return tag frequency distribution for inferred_tags, cuisine:X, meal:X, dietary:X etc.
  • kiwi_browse_preview — call the browse endpoint with given domain/category and return first-page results

DB path (inside container): /app/kiwi/data/kiwi.db
Browse counts cache: /app/kiwi/data/browse_counts.db

Benefits

  • Future tag/keyword audits take minutes instead of sessions
  • Can verify browse counts in-conversation without rebuilding containers
  • Documented access patterns become reusable tools
  • #122 Browse: meal_type categories near-empty
  • #123 Browse: audit and enrich domain keyword lists

Notes

  • Read-only only — no write access to corpus from MCP
  • Must work against both local dev DB and cloud per-user DBs
## Problem Debugging browse/tag issues requires `docker exec python3 -c "..."` one-liners against the SQLite corpus. This is slow, error-prone, and the output disappears. ## Proposed solution Build a kiwi MCP server (similar to the existing Snipe MCP pattern) that exposes: - `kiwi_query_corpus` — run a read-only SQL query against the corpus DB, return results as JSON - `kiwi_count_fts` — run an FTS5 MATCH expression and return the row count - `kiwi_sample_tags` — return tag frequency distribution for `inferred_tags`, `cuisine:X`, `meal:X`, `dietary:X` etc. - `kiwi_browse_preview` — call the browse endpoint with given domain/category and return first-page results DB path (inside container): `/app/kiwi/data/kiwi.db` Browse counts cache: `/app/kiwi/data/browse_counts.db` ## Benefits - Future tag/keyword audits take minutes instead of sessions - Can verify browse counts in-conversation without rebuilding containers - Documented access patterns become reusable tools ## Related - #122 Browse: meal_type categories near-empty - #123 Browse: audit and enrich domain keyword lists ## Notes - Read-only only — no write access to corpus from MCP - Must work against both local dev DB and cloud per-user DBs
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/kiwi#124
No description provided.