anthropics / anthropics/claude-code

Supabase MCP fails with CONNECTION_CLOSED due to missing peer dependencies

Open Beginner friendly
#95,435 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:mcp enhancement external
Dominant language
TypeScript
Stars
147k
Forks
24k
PR merge metrics
PR metrics pending

Description

Problem

When using the Supabase MCP with Claude Code, the connection fails with:

Failed to reconnect to supabase: CONNECTION_CLOSED

Root Cause

The @supabase/mcp-server-supabase package has peer dependencies (@modelcontextprotocol/server, @modelcontextprotocol/node, zod) that are not automatically installed. When the MCP is configured to run via npx, npm fails to resolve these dependencies, causing the server to crash with a module-not-found error.

Solution

Install the package and its peer dependencies locally in your project:

npm install --save-dev @supabase/mcp-server-supabase @modelcontextprotocol/server @modelcontextprotocol/node zod

Then update your .mcp.json to use the local binary instead of npx:

{
  "mcpServers": {
    "supabase": {
      "command": "node_modules/.bin/mcp-server-supabase",
      "args": [
        "--project-ref=YOUR_PROJECT_REF"
      ],
      "env": {
        "SUPABASE_ACCESS_TOKEN": "YOUR_TOKEN"
      }
    }
  }
}

Suggested Fix

Consider documenting this in the Claude Code docs, or adjust how MCP servers handle peer dependencies when run via npx.

Labels: mcp, supabase, documentation

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the Claude Code MCP configuration documentation and reproduce the npx setup using the commands and .mcp.json example in the issue. Done means documenting the peer-dependency installation and local node_modules/.bin/mcp-server-supabase configuration, or clarifying an alternative supported fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.