Repository navigation
chore: add --oauth per-connection OAuth sign-in to the local dev server - #421
Closed
Rodriguespn wants to merge 3 commits into
Closed
Rodriguespn wants to merge 3 commits into
Rodriguespn wants to merge 3 commits into
Conversation
Coverage Report for CI Build 34290519484Coverage increased (+0.05%) to 96.463%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Rodriguespn
marked this pull request as ready for review
September 8, 2026 23:04
Rodriguespn
force-pushed
the
feat/local-oauth-resource-server
branch
from
September 8, 2026 23:24
a33c9d3 to
ab55388
Compare
Adds --oauth support to the local --http dev server as an OAuth resource server (RFC 9728): it advertises /.well-known/oauth-protected-resource/mcp pointing at the Supabase authorization server (mirroring the hosted endpoint's scopes), and each connecting MCP client signs in for itself in its own browser popup and sends its own bearer token on every request -- matching the per-user consent model the hosted MCP server already has. - local-http-entry.ts: serves the discovery route when oauthAuthorizationServer is set; challenges a missing bearer with a spec-correct 401 + WWW-Authenticate (RFC 6750) whose resource_metadata points back at the discovery route. The advertised resource URL is derived from the request's already-validated Host header, so a client dialing localhost or 127.0.0.1 both satisfy the OAuth client SDK's same-origin check. No local token validation: the server forwards whatever bearer it receives to the Management API unchanged, which remains the sole authority -- identical trust model to the existing PAT mode. - cli.ts: --oauth points the resource server at --api-url (or api.supabase.com) and warns at startup about the known platform limitation below. Not yet usable against production (documented in CONTRIBUTING.md and at CLI startup): api.supabase.com currently rejects the loopback `resource` value the OAuth client SDK is required to send (RFC 8707), pending a platform-side widening of its OAuth resource validation for loopback /mcp URLs. Verified end-to-end (discovery, 401 challenge, DCR, browser consent, token exchange, authenticated tool call) against a local mock authorization server; not yet provable against the real Supabase authorization server. Filed as chore: not yet usable end-to-end against production, so it must not trigger a release-please version bump until the platform side ships and this is confirmed working for real. Co-Authored-By: Claude <[email protected]>
Rodriguespn
force-pushed
the
feat/local-oauth-resource-server
branch
from
September 10, 2026 23:21
ab55388 to
037c25f
Compare
OAUTH_SCOPES_SUPPORTED in local-http-entry.ts is a static mirror of the hosted server's advertised scopes (needed so --oauth still works offline and against a mock authorization server in tests). Add an e2e test that fetches the real https://mcp.supabase.com/.well-known/oauth-protected-resource/mcp discovery endpoint and fails with an exact add/remove diff plus the file to edit if the mirror has gone stale, instead of letting the gap surface later as a confusing "insufficient scope" error. Bounds the check with a 15s timeout and guards the JSON parse so a network hiccup or a non-JSON response (e.g. a CDN interstitial) produces the same actionable message instead of a raw fetch/SyntaxError. Co-Authored-By: Claude <[email protected]>
Rodriguespn
force-pushed
the
feat/local-oauth-resource-server
branch
from
September 11, 2026 10:56
c1bce53 to
4b691a9
Compare
Co-Authored-By: Claude <[email protected]>
Contributor
Author
|
Closing this one in favor of #404 |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--oauthto the local--httpdev server as an alternative to a PAT. The server advertises itself as an OAuth-protected resource (RFC 9728, same model as the hosted endpoint); each connecting MCP client signs in with Supabase OAuth in its own browser popup and attaches its own bearer token per request. No local token validation — tokens are forwarded to the Management API unchanged, identical trust model to PAT mode today.api.supabase.comcurrently rejects the loopbackresourcevalue the OAuth client SDK must send. Themgmt-apiOAuth authorize/token endpoints need to accept loopback (127.0.0.1/localhost)/mcpresource URLs, not just the hostedmcp.supabase.comone, before sign-in against production will succeed.A follow up in the mgmt-api is still needed
Verification
Verified end-to-end (discovery, 401 challenge, DCR, browser consent, token exchange, authenticated call) against a local mock authorization server only — documented in CONTRIBUTING.md and at CLI startup.