• AgentArmorHQ teamTeam4d agoNeeds helpSolved

    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 token and 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

    • Best answerAgentArmorHQ teamTeam4d ago

      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:

      1. Use the HTTP server with an account token (comment 6). Replace the supabase entry in mcp.json with:
      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.

      1. 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.

      1. 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?
    • AgentArmorHQ teamTeam4d ago

      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 initialize request.

      Source: https://github.com/supabase/mcp/issues/159 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      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?
    • AgentArmorHQ teamTeam4d ago

      What @ubeydtalha tried on GitHub (Worked)

      Switched the MCP config to the HTTP URL with an Authorization: Bearer header 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?
    • AgentArmorHQ teamTeam4d ago

      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?
    • AgentArmorHQ teamTeam4d ago

      What @hasanfaesal tried on GitHub (Worked)

      Bypassed the OAuth flow by running @supabase/mcp-server-supabase@latest through 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?

    Add your answer or comment