Supabase MCP in VS Code: "Failed to create authentication token" error?
On Windows 10 with VS Code, Chrome, Node v20.17.0, and supabase-js 2.75.0, the Supabase MCP server logs
Error getting token from server metadata: Error: Failed to create authentication tokenand repeatedly shows[info] Waiting for server to respond to 'initialize' request.... Going through "Authorize API access for Visual Studio Code" and then the URL-handler fallback both end with the same error. How can I get the Supabase MCP tools to authenticate and connect in VS Code?Originally asked on GitHub: https://github.com/supabase/mcp/issues/159
6 answers
Status: still open. No official fix was released in this thread; a Supabase team member reproduced a successful connection and asked for the reporter's VS Code version, while several other users confirmed the same failure.
Workarounds that worked for commenters:
- Use the HTTP server with an account token (comment 6). Replace the
supabaseentry inmcp.jsonwith:
json"supabase": { "type": "http", "url": "https://mcp.supabase.com/mcp?project_ref=[YOUR_PROJECT_ID]", "headers": { "Authorization": "Bearer [YOUR_TOKEN_FROM_ACCOUNT]" } }The commenter reports "it works for me" and warns that if this lives in a local
mcp.json, don't forget to gitignore it.- Use npx with a Personal Access Token instead of the OAuth flow (comment 8). Generate a PAT at
https://supabase.com/dashboard/account/tokens, then configure:
json{ "mcp": { "servers": { "supabase": { "command": "npx", "args": [ "-y", "@supabase/mcp-server-supabase@latest", "--access-token", "YOUR_PAT_HERE" ] } } } }Optionally add
"--project-ref", "YOUR_PROJECT_REF"to scope it to one project. The commenter says this connected immediately.- Check for a hidden dialog button (comment 7). After choosing the "different way" option, the popup on Ubuntu only showed copy/cancel buttons; dragging the dialog to the left revealed the "Open" button that completes the redirect back to VS Code.
General advice: both token-based configs store credentials in plain text in your editor config, so treat them as secrets and keep them out of version control.
Did this work for you?- Use the HTTP server with an account token (comment 6). Replace the
What a GitHub user tried on GitHub (Didn't work)
Followed the reproduction steps: start the server, click "Authorize API access for Visual Studio Code", click "Authorize...", then try the URL-handler fallback. The server still logged "Failed to create authentication token" and kept waiting on the
initializerequest.Source: https://github.com/supabase/mcp/issues/159 (opens external site)
Did this work for you?What @gregnr tried on GitHub (Worked)
A Supabase team member ran a fresh Supabase MCP connection from VS Code, completed the browser consent, and was redirected back to VS Code with tools listed successfully.
Source: https://github.com/supabase/mcp/issues/159#issuecomment-3392905730 (opens external site)
Did this work for you?What @ubeydtalha tried on GitHub (Worked)
Switched the MCP config to the HTTP URL with an
Authorization: Bearerheader using a token from the Supabase account; reported as working.Source: https://github.com/supabase/mcp/issues/159#issuecomment-3613052965 (opens external site)
Did this work for you?What @lance2k tried on GitHub (Worked)
On Ubuntu, dragged the popup that only showed copy/cancel buttons to the left to reveal the hidden "Open" button, then completed the authorization.
Source: https://github.com/supabase/mcp/issues/159#issuecomment-3903767129 (opens external site)
Did this work for you?What @hasanfaesal tried on GitHub (Worked)
Bypassed the OAuth flow by running
@supabase/mcp-server-supabase@latestthrough npx with--access-token <PAT>in the VS Code MCP config; connected immediately.Source: https://github.com/supabase/mcp/issues/159#issuecomment-3912964261 (opens external site)
Did this work for you?