Repository navigation
fix(web): derive MCP URLs for any Supabase URL, not only *.supabase.co - #696
Conversation
|
The dashboard preview for this PR — redeployed on each push that changes the web app.
Preview always points at this PR's latest commit; Deployment is the immutable build of |
|
| Gate | Status | Details |
|---|---|---|
| Description vs. code | Description omits the switch to supabaseUrl(), which now honours NEXT_PUBLIC_USE_LOCAL_SUPABASE | |
| Prior review feedback | ✅ | Earlier review comments are resolved. |
| Documentation | ✅ | JSDoc on resolveMcpUrls names the local-flag behaviour; spec covers it |
| Self-review signals | ✅ | No debug logs, leftover TODOs, or unreviewed stubs. |
| Code review | ✅ | The multi-lens review found no blocking issues. |
Found
Quality — produced 1 → posted inline 0 · cleared 0 · carried forward 0 · deferred 0 · below-bar 0
Standards — ran — 2 delta files checked against root CLAUDE.md; 0 findings
Measurability — ran — quiet: delta adds no new observable behaviour or failure mode
Run
incremental · 17 lines in delta · tier standard · depth checkout
Integrations — not activated — no manifest or lockfile in the diff
CI — still pending: Detect changes · 1 passed
Memories — no relevance rules or lessons consulted
Nothing to report — optimality (skipped), severity, 0 files skipped.
pr-reviewer · commit 4a07877 · incremental review, delta since aaa1f03 · how these findings are produced · updated
…s at the local stack
What
resolveMcpUrls()(packages/web/src/lib/mcp-url.ts) now derives the MCP URL as<base>/functions/v1/mcpfrom any Supabase base URL —https://<ref>.supabase.co, a self-hosted custom domain (https://db.example.com), or localhttp://127.0.0.1:54321— instead of string-strippinghttps://and.supabase.co.Why
A self-hoster on a custom domain got a broken snippet in the dashboard (e.g.
https://db.example.com.supabase.co/functions/v1/mcp), and localhttp://URLs producedhttps://http://…. The same URL feeds the GitHub installation-sync call ingithub-installations.ts, so that broke too.How
Read the base through
supabaseUrl()(lib/supabase/config.ts), the dashboard's one Supabase resolver. Soserve-local(NEXT_PUBLIC_USE_LOCAL_SUPABASE) now gives the local MCP URL instead of production, andinstallations/syncno longer sends a local session token to the production endpoint. Parse withnew URL, keeporigin + pathname(trailing slashes trimmed, so a reverse-proxy base path survives). Anything not an absolute http(s) URL — empty, whitespace, a bare word,ftp://— falls back to the hosted endpoint, exactly as empty/unset did before. Output for*.supabase.coand the fallback is byte-identical; the return type is unchanged, so the three callers (API keys settings, onboarding, GitHub installations) need no change.Behaviour note: a bare non-URL value like
myrefused to be treated as a project ref; it now falls back to the hosted URL (supabase-js can't use such a value anyway).Tests
mcp-url.spec.ts: 13 cases — supabase.co, the serve-local flag, trailing slash, custom domain (+ webhook), local http with port, base path, unset/empty/whitespace/bare word/non-http fallbackpnpm nx test webandpnpm nx typecheck webpassDocs
No user-facing doc change: the dashboard now shows the correct URL; no docs claimed otherwise (
self-host.mdxanddocs/install.mdStep 8 make no claim about the dashboard snippet on custom domains).