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.23M 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 integration enables AI assistants to directly interact with your Supabase project to manage tables, fetch configurations, and query data.

Installation

Security Considerations

Before setting up the MCP server, consider these security recommendations:

  • Use the MCP server with development projects, not production environments
  • Don't provide the MCP server to customers or end users
  • Enable read-only mode whenever possible
  • Scope your MCP server to specific projects
  • Use Supabase's branching feature for testing changes safely
  • Enable only the feature groups you need

Configuration

Most MCP clients require the following configuration:

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

Local Development with CLI

If you're running Supabase locally with the Supabase CLI, access the MCP server at:

http://localhost:54321/mcp

Note that the local MCP server offers a limited subset of tools and no OAuth 2.1.

Self-hosted Supabase

For self-hosted Supabase environments, check the Enabling MCP server page at https://supabase.com/docs/guides/self-hosting/enable-mcp. These environments also offer a limited subset of tools and no OAuth 2.1.

Usage

Configuration Options

The following options can be added as URL query parameters:

  • read_only=true: Restricts the server to read-only queries and tools (recommended)
  • project_ref=<project-id>: Scopes the server to a specific project (recommended)
  • features=<feature-groups>: Specifies which tool groups to enable

Project Scoped Mode

Restrict the server to a specific project:

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

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

Read-only Mode

Enable read-only mode to prevent any write operations:

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

Feature Groups

Enable specific tool groups with the features parameter:

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

Available groups include:

  • account: Account management tools
  • docs: Documentation search
  • database: Database management tools
  • debugging: Log and advisor tools
  • development: API URL and type generation tools
  • functions: Edge function management
  • storage: Storage bucket management
  • branching: Database branch management (requires paid plan)

Available Tools

Account Tools

  • List and manage projects
  • Get organization details
  • Check and confirm costs for new projects or branches

Knowledge Base Tools

  • Search Supabase documentation for up-to-date information

Database Tools

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

Debugging Tools

  • Get service logs
  • Check advisory notices for security vulnerabilities or performance issues

Development Tools

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

Edge Function Tools

  • List, retrieve, and deploy Edge Functions

Branching Tools (Experimental, requires paid plan)

  • Create and manage development branches
  • Merge, reset, and rebase branches

Storage Tools

  • List storage buckets
  • Get and update storage configurations

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