Merge pull request #8949 from continuedev/nate/fix-supabase-mcp
feat(mcp): add Supabase-specific OAuth scopes to mcp-remote fallback
This commit is contained in:
commit
5ec8d74fc8
1 changed files with 23 additions and 1 deletions
|
|
@ -503,11 +503,33 @@ Org-level secrets can only be used for MCP by Background Agents (https://docs.co
|
|||
} catch (error: unknown) {
|
||||
// If token refresh didn't work and it's a 401, fall back to mcp-remote
|
||||
if (isAuthError(error) && !this.isHeadless) {
|
||||
// Build mcp-remote args with Supabase-specific OAuth scopes if needed
|
||||
const mcpRemoteArgs = ["-y", "mcp-remote", serverConfig.url];
|
||||
|
||||
// Detect Supabase MCP and add custom OAuth scopes
|
||||
if (serverConfig.url.includes("mcp.supabase.com")) {
|
||||
const supabaseScopes = [
|
||||
"organizations:read",
|
||||
"projects:read",
|
||||
"database:read",
|
||||
"analytics:read",
|
||||
"secrets:read",
|
||||
"edge_functions:read",
|
||||
"environment:read",
|
||||
"storage:read",
|
||||
].join(" ");
|
||||
|
||||
mcpRemoteArgs.push(
|
||||
"--static-oauth-client-metadata",
|
||||
JSON.stringify({ scope: supabaseScopes }),
|
||||
);
|
||||
}
|
||||
|
||||
const transport = this.constructStdioTransport(
|
||||
{
|
||||
name: serverConfig.name,
|
||||
command: "npx",
|
||||
args: ["-y", "mcp-remote", serverConfig.url],
|
||||
args: mcpRemoteArgs,
|
||||
},
|
||||
connection,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue