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
1.17M downloads
2.3K stars

The Supabase MCP Server allows you to connect your Supabase projects to AI assistants like Cursor, Claude, and Windsurf through the Model Context Protocol (MCP). This standardized protocol enables AI assistants to interact directly with your Supabase project to perform tasks such as managing tables, fetching configuration, and querying data.

Installation and Setup

Security Best Practices

Before setting up the MCP server, it's important to understand the security implications:

  • Don't connect to production environments; use development projects instead
  • Don't share MCP access with customers or end users
  • Use read-only mode when connecting to real data
  • Scope your MCP server to specific projects
  • Use Supabase's branching feature for testing changes safely
  • Enable only the specific tool groups you need

Configuring Your MCP Client

Most MCP clients require the following configuration:

{
  "mcpServers": {
    "supabase": {
      "type": "http",
      "url": "https://mcp.supabase.com/mcp"
    }
  }
}

Your MCP client will prompt you to log in to Supabase during setup. Make sure to choose the organization containing the project you want to work with.

Local Development

If you're running Supabase locally with the CLI:

http://localhost:54321/mcp

Self-Hosted Installation

For self-hosted Supabase installations, refer to the Enabling MCP server page at https://supabase.com/docs/guides/self-hosting/enable-mcp.

Configuration Options

The following options can be configured as URL query parameters:

Project Scoped Mode

Restrict the server to a specific project (recommended):

https://mcp.supabase.com/mcp?project_ref=<project-ref>

Replace <project-ref> with your Project ID found in your Supabase project settings.

Read-Only Mode

Limit the server to read-only operations (recommended):

https://mcp.supabase.com/mcp?read_only=true

This prevents write operations by executing SQL as a read-only user and disables mutating tools.

Feature Groups

Enable specific tool groups:

https://mcp.supabase.com/mcp?features=database,docs

Available groups: account, docs, database, debugging, development, functions, storage, and branching.

Available Tools

Account Tools

  • List projects and organizations
  • Create, pause, and restore projects
  • Get project and organization details
  • Manage costs

Knowledge Base

  • Search Supabase documentation for up-to-date information

Database Tools

  • List tables, extensions, and migrations
  • Apply migrations to the database
  • Execute SQL queries

Debugging Tools

  • Get logs for Supabase services
  • View advisory notices for security and performance issues

Development Tools

  • Get project API URLs and publishable keys
  • Generate TypeScript types based on database schema

Edge Functions

  • List, retrieve, and deploy Edge Functions

Branching (Requires a paid plan)

  • Create, list, merge, and delete development branches
  • Reset and rebase branches to handle migration drift

Storage

  • List storage buckets
  • Get and update storage configuration

Usage Examples

Setting Up with Read-Only Access to a Specific Project

To securely set up MCP with read-only access to just one project:

https://mcp.supabase.com/mcp?project_ref=abcd1234&read_only=true

Enabling Specific Tool Groups

To enable only database and documentation tools:

https://mcp.supabase.com/mcp?features=database,docs

Combining Options

You can combine multiple options:

https://mcp.supabase.com/mcp?project_ref=abcd1234&read_only=true&features=database,docs,debugging

This configuration restricts the MCP server to a specific project in read-only mode, with only database, documentation, and debugging tools enabled.

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