Supabase MCP server

Connects directly to Supabase projects for managing databases, executing SQL queries, applying migrations, and handling configurations through natural language commands.
Back to servers
Setup instructions
Provider
Supabase
Release date
Apr 01, 2025
Language
TypeScript
Package
Stats
349.6K downloads
1.8K stars

The Supabase MCP Server connects your Supabase projects to AI assistants like Cursor, Claude, and Windsurf using the Model Context Protocol (MCP). This standardized protocol allows AI assistants to interact directly with your Supabase project to manage tables, fetch configuration, and query data.

Prerequisites

You need Node.js installed on your machine. Verify your installation by running:

node -v

If Node.js isn't installed, download it from nodejs.org.

Installation

Step 1: Create a Personal Access Token

  1. Go to your Supabase settings and create a personal access token
  2. Give it a descriptive name, like "Cursor MCP Server"
  3. Copy the token immediately as you won't be able to see it again

Step 2: Configure Your MCP Client

Configure your MCP client (such as Cursor) with the following JSON configuration:

{
  "mcpServers": {
    "supabase": {
      "command": "npx",
      "args": [
        "-y",
        "@supabase/mcp-server-supabase@latest",
        "--read-only",
        "--project-ref=<project-ref>"
      ],
      "env": {
        "SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
      }
    }
  }
}

Replace <personal-access-token> with your token from Step 1 and <project-ref> with your Supabase project ID.

Windows Configuration

On Windows, prefix the command with cmd /c:

{
  "mcpServers": {
    "supabase": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@supabase/mcp-server-supabase@latest",
        "--read-only",
        "--project-ref=<project-ref>"
      ],
      "env": {
        "SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
      }
    }
  }
}

If using WSL, use this configuration instead:

{
  "mcpServers": {
    "supabase": {
      "command": "wsl",
      "args": [
        "npx",
        "-y",
        "@supabase/mcp-server-supabase@latest",
        "--read-only",
        "--project-ref=<project-ref>"
      ],
      "env": {
        "SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
      }
    }
  }
}

Make sure Node.js is in your PATH environment variable:

  1. Find npm's location:

    npm config get prefix
    
  2. Add it to your PATH:

    setx PATH "%PATH%;<path-to-dir>"
    
  3. Restart your MCP client

Usage Options

Project Scoped Mode

Restrict the server to a specific project using the --project-ref flag:

npx -y @supabase/mcp-server-supabase@latest --project-ref=<project-ref>

Find your project ID in your Supabase project settings under "Project ID".

Read-Only Mode

Enable read-only mode to prevent write operations:

npx -y @supabase/mcp-server-supabase@latest --read-only

This is recommended for security as it restricts database operations to read-only.

Feature Groups

Enable specific tool groups with the --features flag:

npx -y @supabase/mcp-server-supabase@latest --features=database,docs

Available groups:

  • account: Project and organization management tools
  • docs: Supabase documentation search
  • database: Table listing and SQL execution
  • debug: Logs and advisory notices
  • development: Project URL, API keys, TypeScript type generation
  • functions: Edge Functions management
  • storage: Storage bucket operations
  • branching: Branch management (requires a paid plan)

Available Tools

Database Tools

  • List tables and extensions
  • Execute SQL queries
  • Apply migrations
  • List migrations

Knowledge Base Tools

  • Search Supabase documentation

Debug Tools

  • Get logs from various services
  • Access advisory notices

Development Tools

  • Get project URLs and API keys
  • Generate TypeScript types

Edge Functions

  • List all Edge Functions
  • Deploy new Edge Functions

Security Recommendations

  1. Use with development projects, not production: Avoid exposing real data
  2. Keep the server internal: Don't give access to customers or end users
  3. Enable read-only mode: Limit database operations to read-only
  4. Scope to specific projects: Restrict access to just one project
  5. Use branching: Create separate development branches for testing
  6. Limit feature groups: Only enable the tools you actually need
  7. Review tool calls: Always review AI-generated SQL before execution

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "supabase" '{"command":"npx","args":["-y","@supabase/mcp-server-supabase@latest","--read-only","--project-ref=<project-ref>"],"env":{"SUPABASE_ACCESS_TOKEN":"<personal-access-token>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "supabase": {
            "command": "npx",
            "args": [
                "-y",
                "@supabase/mcp-server-supabase@latest",
                "--read-only",
                "--project-ref=<project-ref>"
            ],
            "env": {
                "SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "supabase": {
            "command": "npx",
            "args": [
                "-y",
                "@supabase/mcp-server-supabase@latest",
                "--read-only",
                "--project-ref=<project-ref>"
            ],
            "env": {
                "SUPABASE_ACCESS_TOKEN": "<personal-access-token>"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later