Deploy the Docs RAG
Apply the pgvector schema, deploy the embed-docs function, and embed the docs for semantic search.
The docs MCP server works offline with local full-text search. To also enable semantic (hybrid) search, deploy the pgvector backend once, then embed the docs whenever they change.
One-time setup
-
Apply the migration (adds
docs_chunksandhybrid_search_docs):cd kredal-app supabase db push -
Deploy the Edge Function (uses Supabase's built-in
gte-smallmodel — no external key):supabase functions deploy embed-docs --no-verify-jwt -
Set the ingest secret (protects the write path; keep the value safe):
supabase secrets set INGEST_SECRET="$(openssl rand -hex 24)"
Embed the docs
From the repo root, build the local index and push embeddings to Supabase:
INGEST_SECRET=<the-secret> npm run docs:index -- --remoteIngest is idempotent — it embeds only new/changed chunks (matched by content hash), so
re-running after a docs edit is cheap. It batches and retries automatically (the gte-small
model can transiently exhaust a cold worker's memory).
How it is used
- The docs MCP server's
docs_search_semanticcalls the function's query mode and falls back to local keyword search if the backend is offline. hybrid_search_docs()fuses full-text and vector ranks with Reciprocal Rank Fusion.
See the architecture reference and database schema for how this fits together.