Skip to content

fix(grain): Grain API v2 (v1 retired, index stopped Sep 30) + service key for Supabase MCPs - #566

Merged
JonasJesus42 merged 1 commit into
mainfrom
fix/grain-v2-api
Oct 26, 2026
Merged

JonasJesus42 merged 1 commit into
mainfrom
fix/grain-v2-api

Conversation

@JonasJesus42

Copy link
Copy Markdown
Contributor

Why

  • Grain stopped indexing on 2026-09-30. Grain retired its v1 API (/_/public-api/... → 410 gone: The v1 API has been retired). The grain MCP only spoke v1, so the webhook died and every tool (LIST_RECORDINGS, GET_RECORDING, GET_SUMMARY, GET_TRANSCRIPT) fails. grain_meeting_recordings has nothing after Sep 30.
  • The shared Supabase (Deco-Ajuda) is wide open. With the public anon key one can read and write discord_connections / slack_connections (bot tokens, signing secrets, mesh tokens), trigger callback tokens, 241k Discord messages incl. DMs, and every Grain meeting summary. We're turning RLS on with no anon access; the MCPs must use the service-role key server-side.

What

grain

  • Client on /_/public-api/v2 + Public-Api-Version: 2026-10-01; recordings via POST; plain dates accepted (normalized to ISO date-times).
  • Hooks: v2 has one hook per type → ensures recording_added + recording_updated (with include: participants, ai_summary), drops stale ones.
  • Webhook: v2 hooks are unsigned, so the body only says which recording changed — the row is always re-fetched from Grain by id. A forged POST can't write the index (tested: real id indexed with Grain's data, forged title ignored; fake id not indexed).
  • GRAIN_API_KEY env fallback: onChange only runs when the connection is saved, so the in-memory client was lost on every restart and webhooks skipped enrichment.
  • Tools keep their output contract (owners = recorders' emails, notes = ai_summary).
  • scripts/backfill.ts on v2 with --since, full rows (participants, summary).

slack-mcp, discord-read, discord, registry, grain

  • Read SUPABASE_SERVICE_ROLE_KEY ?? SUPABASE_ANON_KEY — deploy-compatible: nothing changes until the secret is set.

Rollout

  1. Merge → deploy; set SUPABASE_SERVICE_ROLE_KEY (+ GRAIN_API_KEY on grain) via the control plane.
  2. Enable RLS / revoke anon on the Deco-Ajuda tables.
  3. Rotate the leaked secrets (Discord/Slack bot tokens, signing secret, mesh tokens, callback tokens).
  4. Register the v2 hooks and backfill --since 2026-09-30.

Tested

Live against Grain v2: list (date filter, cursor), get (participants, owners, summary), transcript json/txt, template sections, hooks list. Webhook end-to-end on a local server writing to the real index.

🤖 Generated with Claude Code

…stopped on Sep 30

- Client on /_/public-api/v2 with Public-Api-Version; recordings via POST,
  hooks are one per type (recording_added / recording_updated) with include.
- Webhook payloads only say which recording changed (v2 hooks are unsigned):
  the indexed row is always re-fetched from Grain by id, never trusted from
  the POST body. GRAIN_API_KEY keeps the webhook working after a restart
  (onChange only runs when the connection is saved).
- Tools keep their contract (owners = recorders, notes = ai_summary).
- Backfill script on v2, with --since and full rows.
- grain, slack-mcp, discord-read, discord, registry prefer
  SUPABASE_SERVICE_ROLE_KEY: the shared Supabase is moving to RLS on and no
  anon access (tokens and private data were readable/writable with the
  public anon key).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/airtable October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/blog-generator October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/content-scraper October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/deco-llm October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/deco-news-weekly-digest October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/discord-read October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/figma-mcp October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/flux October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-analytics October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-big-query October 26, 2026 00:55 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-calendar October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-calendar-sa October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-drive October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-meet October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-search-console October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-sheets October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-slides October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-tag-manager October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/google-workspace October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/grafana October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/grain October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/hyperdx October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/magento October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/meta-ads October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/nanobanana October 26, 2026 00:56 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/object-storage October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/pandadoc October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/perplexity October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/registry October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/shopify October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/slack-mcp October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/veo October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/vtex October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/vtex-docs October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/wake October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/whatsappagent October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/youtube-channel-admin October 26, 2026 00:57 Destroyed
@deco-hosting
deco-hosting Bot temporarily deployed to preview/pr-566/youtube-search October 26, 2026 00:57 Destroyed
@JonasJesus42
JonasJesus42 merged commit 2735401 into main Oct 26, 2026
2 of 40 checks passed

This branch was successfully deployed

No deployments
preview/pr-566/youtube-search — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/youtube-channel-admin — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/whatsappagent — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/wake — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/vtex-docs — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/vtex — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/veo — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/slack-mcp — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/shopify — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/registry — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/perplexity — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/pandadoc — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/object-storage — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/nanobanana — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/meta-ads — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/magento — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/hyperdx — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/grain — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/grafana — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-workspace — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-tag-manager — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-slides — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-sheets — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-search-console — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-meet — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-drive — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-calendar-sa — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-calendar — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-big-query — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/google-analytics — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/flux — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/figma-mcp — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/discord-read — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/deco-news-weekly-digest — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/deco-llm — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/content-scraper — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/blog-generator — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
preview/pr-566/airtable — a0b03a42 Deployed Oct 26, 2026 by deco-hosting[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant