Skip to main content

Unofficial MCP server for Supabase providing basic schema, table, and column management.

Project description

Supabase MCP Server

Supabase    MCP

Let Cursor & Windsurf interact with Supabase

Star History Chart

Python 3.12+ uv package manager smithery badge MCP Server License PyPI version CI Status

Implementation of Supabase MCP server that enables Cursor and Windsurf to interact directly with Supabase PostgreSQL database. It provides a set of database management tools that work seamlessly with these IDEs through the MCP protocol.

✨ Key features

  • 💻 Designed to work with Windsurf, Cursor, Cline and other MCP-compatible IDEs
  • ✅ Pre-configured to work with both free and paid Supabase projects (direct and transaction pooling connection)
  • 🔨 Pre-built database exploration tools with schema insights greatly improve LLM 'onboarding experience' into your db
  • 🔐 Enforces read-only mode when executing SQL queries
  • 🔍 Basic QoL features like query validation, retry logic for connection errors
  • 📦 Installation via package manager (uv, pipx, etc.) or from source

Prerequisites

  • Python 3.12+
  • PostgreSQL 16+
  • uv package manager

#todo delete

PostgreSQL Installation

⚠️ Important: PostgreSQL must be installed BEFORE installing project dependencies, as psycopg2 requires PostgreSQL development libraries during compilation.

MacOS

brew install postgresql@16

Windows

MCP Server Installation

⚠️ 0.2.0 Breaking change: Installation and execution methods have changed to support package distribution. The server now runs as a proper Python module instead of a direct script.

You can install Supabase MCP Server either using a package manager (recommended) or from source.

Migration from 0.1.0 to 0.2.0

The simplest way to migrate is to do a clean install using package manager:

# Remove old installation
rm -rf supabase-mcp-server

# Install via UV (recommended)
uv pip install supabase-mcp-server

However you can still install from source if you prefer.

Using Package Managers (Recommended)

# Using UV
uv pip install supabase-mcp-server

# Using pipx
pipx install supabase-mcp-server

Why these package managers?

  • pipx: Installs CLI tools in isolated environments, making them available globally without conflicts
  • uv: Fast, reliable Python package installer with dependency resolution, perfect for development

Installing from Source

  1. Clone the repository
git clone https://github.com/alexander-zuev/supabase-mcp-server.git
cd supabase-mcp-server
  1. Create and activate virtual environment
# Create venv
uv venv

# Activate it
# On Mac/Linux
source .venv/bin/activate
# On Windows
.venv\Scripts\activate
  1. Install in editable mode
uv pip install -e .

Installing via Smithery (not tested)

To install Supabase MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @alexander-zuev/supabase-mcp --client claude

Running Supabase MCP Server

This MCP server was designed to be used with AI IDEs like Cursor and Windsurf and not tested with other clients.

You can run the server in several ways:

  • as a package script (if you installed it using package manager)
  • as a python module (if you installed it from source)

💡 0.2.0 Breaking change: Installation and execution methods have changed to support package distribution. The server now runs as a proper Python module instead of a direct script:

  • Old: uv --directory /path/to/supabase-mcp-server run main.py
  • New: uv run supabase-mcp-server (if installed via package manager)
  • New: uv --directory /path/to/supabase-mcp-server run python -m supabase_mcp.main (if installed from source)

Running as a package script (if you installed it using package manager)

If you installed it using package manager, you can run the server with this command:

# UV
uv run supabase-mcp-server

# Pipx
pipx run supabase-mcp-server

Setup Cursor

💡 Setting environment variables: For Cursor....

  1. Create a new MCP server
  2. Add the following configuration:
name: supabase
protocol: command
command: uv run supabase-mcp-server

Setup Windsurf

💡 Setting environment variables: For Windsurf, it's recommended to set environment variables directly in the mcp_config.json as shown below.

  1. Add / modify mcp_config.json file:
{
    "mcpServers": {
      "supabase": {
        "command": "/Users/az/.local/bin/uv",  # Path to UV executable
        "args": [
          "run",
          "supabase-mcp-server"
        ],
        "env": {
          "SUPABASE_PROJECT_REF": "your-project-ref",
          "SUPABASE_DB_PASSWORD": "your-db-password"
        }
      }
    }
}

💡 Finding UV executable path:

  • On macOS/Linux: Run which uv in terminal
  • On Windows: Run where uv in command prompt The output will show the full path to use in your configuration.

Running as a python module (if you installed it from source)

If you installed from source or want to run the development version, use this command:

uv --directory /path/to/supabase-mcp-server run python -m supabase_mcp.main

Setup Cursor

  1. Create a new MCP server
  2. Add the following configuration:
name: supabase
protocol: command
command: uv --directory /path/to/supabase-mcp-server run python -m supabase_mcp.main

Replace /path/to/supabase-mcp-server with your actual repository path, for example:

command: uv --directory /Users/username/projects/supabase-mcp-server run python -m supabase_mcp.main

Setup Windsurf

  1. Add / modify mcp_config.json file:
{
    "mcpServers": {
      "supabase": {
        "command": "/Users/az/.local/bin/uv",
        "args": [
          "--directory",
          "/path/to/supabase-mcp-server",
          "run",
          "python",
          "-m",
          "supabase_mcp.main"
        ],
        "env": {
          "SUPABASE_PROJECT_REF": "your-project-ref",
          "SUPABASE_DB_PASSWORD": "your-db-password"
        }
      }
    }
}

Configuring connection to different Supabase projects

💡 Tip: Connection to local Supabase project is configured out of the box. You don't need to set environment variables.

To connect to a different Supabase project, you need to set environment variables:

  • SUPABASE_PROJECT_REF
  • SUPABASE_DB_PASSWORD

The recommended way to set these variables depends on your IDE:

  • For Windsurf: Set them directly in mcp_config.json (cleanest approach)
  • For Cursor: Set them as environment variables in your shell
  • For local development: Use .env in the project root (when installed from source)

Local Supabase project

If no configuration is provided, the server defaults to local Supabase settings:

  • Host: 127.0.0.1:54322
  • Password: postgres

This works out of the box with Supabase CLI's local development setup.

Remote Supabase project (staging / production)

When using Windsurf

Set the environment variables directly in your mcp_config.json:

{
    "mcpServers": {
      "supabase": {
        "command": "/Users/az/.local/bin/uv",
        "args": [
          "run",
          "supabase-mcp-server"
        ],
        "env": {
          "SUPABASE_PROJECT_REF": "your-project-ref",
          "SUPABASE_DB_PASSWORD": "your-db-password"
        }
      }
    }
}
When using Cursor

Set the environment variables in your shell:

# Set directly in your shell
export SUPABASE_PROJECT_REF=your-project-ref
export SUPABASE_DB_PASSWORD=your-db-password
  1. Global config (Lowest precedence)
    # Create in your home config directory for persistent access
    mkdir -p ~/.config/supabase-mcp
    echo "SUPABASE_PROJECT_REF=your-project-ref
    SUPABASE_DB_PASSWORD=your-db-password" > ~/.config/supabase-mcp/.env
    
    Perfect for developers who want to set up once and use across multiple projects.
When developing locally (installed from source)

Create .env file in the root of the cloned repository:

# In the supabase-mcp-server directory (project root)
echo "SUPABASE_PROJECT_REF=your-project-ref
SUPABASE_DB_PASSWORD=your-db-password" > .env

When running from source, it looks for .env in the project root directory (where you cloned the repository).

Troubleshooting

Before connecting to IDEs, verify server functionality using the MCP Inspector:

# Using MCP inspector
mcp dev supabase_mcp.main

# Or run directly
uv --directory /path/to/supabase-mcp-server run python -m supabase_mcp.main

This connects to MCP Inspector which allows you to debug and test the server without a client.

Future improvements

  • 📦 Simplified installation via package manager - ✅ (0.2.0)
  • 🐍 Support methods and objects available in native Python SDK
  • 🔍 Improve SQL syntax validation
  • Support for creating edge functions, managing secrets (similar to Loveble integration)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supabase_mcp_server-0.2.1.tar.gz (52.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supabase_mcp_server-0.2.1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file supabase_mcp_server-0.2.1.tar.gz.

File metadata

  • Download URL: supabase_mcp_server-0.2.1.tar.gz
  • Upload date:
  • Size: 52.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.0

File hashes

Hashes for supabase_mcp_server-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a9cd3bec22d2bf4e4558e03c21fd56716d209bce8b1954fc6343a4a5d55a3bd4
MD5 51a9232a70106f0ea1cb8c1735c7fb05
BLAKE2b-256 97185466424d2b2a909c134c21941340816bbe07db499d208baa2a245b9cc3ee

See more details on using hashes here.

File details

Details for the file supabase_mcp_server-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for supabase_mcp_server-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5423cb5a227024a9fbd4490f88f27a93518326f85e34d9939837f9cecef67d56
MD5 791f00456e2acd9c256692442c1428f2
BLAKE2b-256 a6def9582df51ee6dd20cf5dff70480118ddc2712e044384bd6a4ed96ec987bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page