-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(mcp): add Supabase-specific OAuth scopes to mcp-remote fallback #8949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Keep this PR in a mergeable state → Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
1 similar comment
|
Keep this PR in a mergeable state → Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
|
✅ Review Complete Code Review for PR #8949Overall AssessmentThe implementation looks solid and follows a reasonable approach. The code correctly adds Supabase-specific OAuth scopes when needed. Here are some observations: Issues & Suggestions1. Hardcoded Scopes (Medium Priority)
2. URL Pattern Matching (Low Priority)
3. Missing Tests
4. Documentation (Minor)
What's Good
Verdict: Functionally correct, but could benefit from more robust URL validation and test coverage. |
|
Added documentation update to explain the automatic OAuth fallback behavior for Supabase MCP. Changes:
This keeps users informed about the seamless authentication experience without needing to understand or configure the fallback mechanism manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
| const mcpRemoteArgs = ["-y", "mcp-remote", serverConfig.url]; | ||
|
|
||
| // Detect Supabase MCP and add custom OAuth scopes | ||
| if (serverConfig.url.includes("mcp.supabase.com")) { |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
mcp.supabase.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To robustly determine whether serverConfig.url points to a valid Supabase MCP host, we should parse the URL and examine its hostname component, ensuring that it is either exactly mcp.supabase.com or perhaps (if required) a known set of subdomains. This avoids false positives from substring matching on path, query, or other unrelated parts of the URL.
The best fix is to replace serverConfig.url.includes("mcp.supabase.com") with a check like new URL(serverConfig.url).hostname === "mcp.supabase.com". This change should be made at line 510. Since we're writing TypeScript/Node, the global URL class can be safely used. If for any reason we suspect serverConfig.url might not be a valid URL, a try/catch could be added for resilience, but assuming well-formed input for now is reasonable.
No new imports are needed because URL is available in modern Node environments.
-
Copy modified lines R510-R512 -
Copy modified lines R523-R529
| @@ -507,8 +507,9 @@ | ||
| const mcpRemoteArgs = ["-y", "mcp-remote", serverConfig.url]; | ||
|
|
||
| // Detect Supabase MCP and add custom OAuth scopes | ||
| if (serverConfig.url.includes("mcp.supabase.com")) { | ||
| const supabaseScopes = [ | ||
| try { | ||
| if (new URL(serverConfig.url).hostname === "mcp.supabase.com") { | ||
| const supabaseScopes = [ | ||
| "organizations:read", | ||
| "projects:read", | ||
| "database:read", | ||
| @@ -519,10 +520,13 @@ | ||
| "storage:read", | ||
| ].join(" "); | ||
|
|
||
| mcpRemoteArgs.push( | ||
| "--static-oauth-client-metadata", | ||
| JSON.stringify({ scope: supabaseScopes }), | ||
| ); | ||
| mcpRemoteArgs.push( | ||
| "--static-oauth-client-metadata", | ||
| JSON.stringify({ scope: supabaseScopes }), | ||
| ); | ||
| } | ||
| } catch (e) { | ||
| logger.warn(`[MCPService] Failed to parse URL '${serverConfig.url}': ${e}`); | ||
| } | ||
|
|
||
| const transport = this.constructStdioTransport( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
21a25c0 to
24f5859
Compare
|
🎉 This PR is included in version 1.33.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.37.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary by cubic
Adds Supabase-specific OAuth scopes to the mcp-remote fallback so Supabase MCP can authenticate with the right permissions after a 401. Sends static OAuth client metadata with required read scopes (organizations, projects, database, analytics, secrets, edge functions, environment, storage) to prevent scope-related auth errors.
Written for commit 24f5859. Summary will update automatically on new commits.