Skip to content

DEX-225: Fix MCP OAuth issuer mismatch behind the custom domain - #199

Merged
cvburgess merged 1 commit into
mainfrom
dex-225-fix-mcp-oauth-issuer
Oct 1, 2026
Merged

cvburgess merged 1 commit into
mainfrom
dex-225-fix-mcp-oauth-issuer

Conversation

@cvburgess

Copy link
Copy Markdown
Owner

Closes DEX-225

Summary

  • mcp-server advertised its OAuth authorization server as the request origin ({origin}/auth/v1), which through the Supabase custom domain is api.dexterplanner.com/auth/v1 — but GoTrue always publishes its issuer as the raw project URL (isreileykodwkyedcewv.supabase.co/auth/v1), even behind a custom domain. MCP clients enforce the RFC 8414 §3.3 issuer echo check, so OAuth sign-in failed in production. Preview branches only worked because their origin is the project URL.
  • The well-known metadata now advertises SUPABASE_URL/auth/v1, keeping the /auth/v1 path (the bare project URL 404s in discovery) and falling back to the request origin for local dev.

Also in this diff

  • CORS echoes allowlisted request origins (origin.ts) instead of a wildcard; non-browser MCP clients send no Origin header and are unaffected.
  • new URL(req.url) calls are guarded, returning 400/empty instead of throwing.

Testing

  • deno check --config functions/mcp-server/deno.json functions/mcp-server/index.ts
  • deno test --allow-all --config __tests__/deno.json __tests__/ — 135 passed
  • Deployed and verified live: well-known metadata returns the project-URL issuer and unauthenticated POST still returns 401; Pi MCP sign-in completes.

Notes

  • The production fix was deployed early (v46) via the Supabase Management API with an upload-time import-map patch; merging this PR lets CI's CLI deploy replace it with the canonical bundle.

GoTrue publishes its OAuth issuer as the raw project URL even behind the
api.dexterplanner.com custom domain, so advertising the request origin
failed the RFC 8414 issuer echo check in production. Also echoes
allowlisted CORS origins instead of a wildcard and guards URL parsing.
@netlify

netlify Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dexterplanner canceled.

Name Link
🔨 Latest commit 68591e3
🔍 Latest deploy log https://app.netlify.com/projects/dexterplanner/deploys/6abed22c31f3240008c25426

@supabase

supabase Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Updates to Preview Branch (dex-225-fix-mcp-oauth-issuer) ↗︎

Deployments Status Updated
Database ✅ Thu, 01 Oct 2026 21:36:28 UTC
Services ✅ Thu, 01 Oct 2026 21:36:28 UTC
APIs ✅ Thu, 01 Oct 2026 21:36:28 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ✅ Thu, 01 Oct 2026 21:36:38 UTC
Migrations ✅ Thu, 01 Oct 2026 21:36:41 UTC
Seeding ✅ Thu, 01 Oct 2026 21:36:42 UTC
Edge Functions ✅ Thu, 01 Oct 2026 21:36:50 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@cvburgess
cvburgess merged commit 5c53ea9 into main Oct 1, 2026
6 checks passed
@cvburgess
cvburgess deleted the dex-225-fix-mcp-oauth-issuer branch October 1, 2026 21:37
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