Supabase MCP Server

Supabase MCP Server

Supabase MCP Server enabling Cursor & Windsurf to use any method from Management API and query your database - GitHub - nkeat12/supabase-mcp-server: Supabase MCP Server enabling Cursor & Windsurf to use any method from Management API and query your database

数据库交互
数据与应用分析
访问服务器

README

Supabase MCP Server

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/4a363bcd-7c15-47fa-a72a-d159916517f7" /> <source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/d255388e-cb1b-42ea-a7b2-0928f031e0df" /> <img alt="Supabase" src="https://github.com/user-attachments/assets/d255388e-cb1b-42ea-a7b2-0928f031e0df" height="40" /> </picture>    <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/38db1bcd-50df-4a49-a106-1b5afd924cb2" /> <source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/82603097-07c9-42bb-9cbc-fb8f03560926" /> <img alt="MCP" src="https://github.com/user-attachments/assets/82603097-07c9-42bb-9cbc-fb8f03560926" height="40" /> </picture> </p>

<p align="center"> <strong>Let Cursor & Windsurf manage your Supabase and run SQL queries. Autonomously. In a safe way.</strong> </p>

Star History Chart

<p align="center"> <a href="https://pypi.org/project/supabase-mcp-server/"><img src="https://img.shields.io/pypi/v/supabase-mcp-server.svg" alt="PyPI version" /></a> <a href="https://github.com/alexander-zuev/supabase-mcp-server/actions"><img src="https://github.com/alexander-zuev/supabase-mcp-server/workflows/CI/badge.svg" alt="CI Status" /></a> <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.12%2B-blue.svg" alt="Python 3.12+" /></a> <a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/badge/uv-package%20manager-blueviolet" alt="uv package manager" /></a> <a href="https://smithery.ai/server/@alexander-zuev/supabase-mcp"><img src="https://smithery.ai/badge/@alexander-zuev/supabase-mcp" alt="smithery badge" /></a> <a href="https://modelcontextprotocol.io/introduction"><img src="https://img.shields.io/badge/MCP-Server-orange" alt="MCP Server" /></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License" /></a> </p>

A feature-rich MCP server that enables Cursor and Windsurf to safely interact with Supabase databases. It provides tools for database management, SQL query execution, and Supabase Management API access with built-in safety controls.

Table of contents

<p align="center"> <a href="#-key-features">Key features</a> • <a href="#getting-started-guide">Getting started</a> • <a href="#feature-guides">Feature guides</a> • <a href="#troubleshooting">Troubleshooting</a> • <a href="#roadmap">Roadmap</a> </p>

✨ Key features

  • 💻 Compatible with Cursor, Windsurf, Cline and other MCP clients supporting stdio protocol
  • 🔐 Control read-only and read-write modes of SQL query execution
  • 💻 Manage your Supabase projects with Supabase Management API
  • 🔨 Pre-built tools to help Cursor & Windsurf work with MCP more effectively
  • 📦 Dead-simple install & setup via package manager (uv, pipx, etc.)

Getting Started Guide

Prerequisites

Installing the server requires the following on your system:

  • Python 3.12+
  • PostgresSQL 16+

If you plan to install via uv, ensure it's installed.

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

  • Download and install PostgreSQL 16+ from https://www.postgresql.org/download/windows/
  • Ensure "PostgreSQL Server" and "Command Line Tools" are selected during installation

Step 1. MCP Server Installation

Since v0.2.0 I introduced support for package installation. You can use your favorite Python package manager to install the server via:

# if pipx is installed (recommended)
pipx install supabase-mcp-server

# if uv is installed
uv pip install supabase-mcp-server

pipx is recommended because it creates isolated environments for each package.

You can also install the server manually by cloning the repository and running pipx install -editable . from the root directory.

⚠️ If you run into psycopg2 compilation issues, you might be missing PostgreSQL development packages. See above.

Installing from source

If you would like to install from source, for example for local development:

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

Installing via Smithery.ai

Please report any issues with Smithery, as I haven't tested it yet.

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

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

Step 2. Configuration

After installing the package, you'll need to configure your database connection settings. The server supports both local and remote Supabase instances.

Local Supabase instance (Default)

Server is pre-configured to connect to the local Supabase instance using default settings:

  • Host: 127.0.0.1:54322
  • Password: postgres

💡 As long as you didn't modify the default settings and you want to connect to the local instance, you don't need to set environment variables.

Remote Supabase instance

For remote Supabase projects, you need to configure:

  • SUPABASE_PROJECT_REF - Your project reference (found in project URL)
  • SUPABASE_DB_PASSWORD - Your database password
  • SUPABASE_REGION - (Optional) Defaults to us-east-1
  • SUPABASE_ACCESS_TOKEN - (Optional) For Management API access

You can get your SUPABASE_PROJECT_REF from your project's dashboard URL:

  • https://supabase.com/dashboard/project/<supabase-project-ref>

The server supports all Supabase regions:

  • us-west-1 - West US (North California)
  • us-east-1 - East US (North Virginia) - default
  • us-east-2 - East US (Ohio)
  • ca-central-1 - Canada (Central)
  • eu-west-1 - West EU (Ireland)
  • eu-west-2 - West Europe (London)
  • eu-west-3 - West EU (Paris)
  • eu-central-1 - Central EU (Frankfurt)
  • eu-central-2 - Central Europe (Zurich)
  • eu-north-1 - North EU (Stockholm)
  • ap-south-1 - South Asia (Mumbai)
  • ap-southeast-1 - Southeast Asia (Singapore)
  • ap-northeast-1 - Northeast Asia (Tokyo)
  • ap-northeast-2 - Northeast Asia (Seoul)
  • ap-southeast-2 - Oceania (Sydney)
  • sa-east-1 - South America (São Paulo)

Method of MCP configuration differs between Cursor and Windsurf. Read the relevant section to understand how to configure connection.

Cursor

Cursor does not currently support environment variable configuration via the MCP server UI. As a workaround, this server picks up a global .env file automatically. Cursor is expected to introduce .json config in v0.46, and this guide will be updated accordingly.

For now, create an .env file in a global config folder by running the following commands:

# Create config directory and navigate to it
# On macOS/Linux
mkdir -p ~/.config/supabase-mcp
cd ~/.config/supabase-mcp

# On Windows (in PowerShell)
mkdir -Force "$env:APPDATA\supabase-mcp"
cd "$env:APPDATA\supabase-mcp"

This creates the necessary config folder where your environment file will be stored.

# Create and edit .env file
# On macOS/Linux
nano ~/.config/supabase-mcp/.env

# On Windows (PowerShell)
notepad "$env:APPDATA\supabase-mcp\.env"

This will open the .env file. Once the file is open, copy & paste the following:

SUPABASE_PROJECT_REF=your-project-ref
SUPABASE_DB_PASSWORD=your-db-password
SUPABASE_REGION=us-east-1  # optional, defaults to us-east-1
SUPABASE_ACCESS_TOKEN=your-access-token  # optional, for management API

Verify the file exists - you should see the values you have just set:

# On macOS/Linux
cat ~/.config/supabase-mcp/.env

# On Windows (PowerShell)
Get-Content "$env:APPDATA\supabase-mcp\.env"

You can find global config file:

  • Windows: %APPDATA%/supabase-mcp/.env
  • macOS/Linux: ~/.config/supabase-mcp/.env
Windsurf

Windsurf supports de facto standard .json format for MCP Servers configuration. You can configure the server in mcp_config.json file:

{
    "mcpServers": {
      "supabase": {
        "command": "/Users/username/.local/bin/supabase-mcp-server",  // update path
        "env": {
          "SUPABASE_PROJECT_REF": "your-project-ref",
          "SUPABASE_DB_PASSWORD": "your-db-password",
          "SUPABASE_REGION": "us-east-1",  // optional, defaults to us-east-1
          "SUPABASE_ACCESS_TOKEN": "your-access-token"  // optional, for management API
        }
      }
    }
}

💡 Finding the server path:

  • macOS/Linux: Run which supabase-mcp-server
  • Windows: Run where supabase-mcp-server

Configuration Precedence

The server looks for configuration in this order:

  1. Environment variables (highest priority)
  2. Local .env file in current directory
  3. Global config file:
    • Windows: %APPDATA%/supabase-mcp/.env
    • macOS/Linux: ~/.config/supabase-mcp/.env
  4. Default settings (local development)

Step 3. Running MCP Server in Cursor/Windsurf

In general, any MCP client that supports stdio protocol should work with this MCP server (Cline, for example) but I haven't tested it with anything except Cursor/Windsurf.

Cursor

Go to Settings -> Features -> MCP Servers and add a new server with this configuration:

# can be set to any name
name: supabase
type: command
# if you installed with pipx
command: supabase-mcp-server
# if you installed with uv
command: uv run supabase-mcp-server

If configuration is correct, you should see a green dot indicator and the number of tools exposed by the server. How successful Cursor config looks like

Windsurf

Go to Cascade -> Click on the hammer icon -> Configure -> Fill in the configuration:

{
    "mcpServers": {
      "supabase": {
        "command": "/Users/username/.local/bin/supabase-mcp-server",  // update path
        "env": {
          "SUPABASE_PROJECT_REF": "your-project-ref",
          "SUPABASE_DB_PASSWORD": "your-db-password",
          "SUPABASE_REGION": "us-east-1",  // optional, defaults to us-east-1
          "SUPABASE_ACCESS_TOKEN": "your-access-token"  // optional, for management API
        }
      }
    }
}

If configuration is correct, you should see green dot indicator and clickable supabase server in the list of available servers.

How successful Windsurf config looks like

Troubleshooting

Here are some tips & tricks that might help you:

  • Debug installation - run supabase-mcp-server directly from the terminal to see if it works. If it doesn't, there might be an issue with the installation.
  • MCP Server configuration - if the above step works, it means the server is installed and configured correctly. As long as you provided the right command, IDE should be able to connect. Make sure to provide the right path to the server executable.
  • Environment variables - to connect to the right database, make sure you either set env variables in mcp_config.json or in .env file placed in a global config directory (~/.config/supabase-mcp/.env on macOS/Linux or %APPDATA%\supabase-mcp\.env on Windows).

If you are stuck or any of the instructions above are incorrect, please raise an issue on GitHub.

Feature Guides

Database query tools

Since v0.3.0 server supports both read-only and read-write SQL queries.

Available database tools:

  • get_db_schemas - Lists all database schemas with their sizes and table counts

  • get_tables - Lists all tables in a schema with their sizes, row counts, and metadata

  • get_table_schema - Gets detailed table structure including columns, keys, and relationships

  • execute_sql_query - Executes raw SQL queries with validation

  • Supported modes:

    • read-only - only read-only queries are allowed (default mode)
    • read-write - all SQL operations are allowed when explicitly enabled
  • Safety features:

    • Starts in read-only mode by default
    • Requires explicit mode switch for write operations
    • Automatically resets to read-only mode after write operations
    • Uses transactions to ensure clean state in tests
    • SQL query validation [TODO]

Management API tools

Since v0.3.0 server supports sending arbitrary requests to Supabase Management API with auto-injection of project ref and safety mode control:

  • Includes the following tools:
    • send_management_api_request to send arbitrary requests to Supabase Management API, with auto-injection of project ref and safety mode control
    • get_management_api_spec to get the enriched API specification with safety information
    • get_management_api_safety_rules to get all safety rules including blocked and unsafe operations with human-readable explanations
    • live_dangerously to switch between safe and unsafe modes
  • Safety features:
    • Divides API methods into safe, unsafe and blocked categories based on the risk of the operation
    • Allows to switch between safe and unsafe modes dynamically
    • Blocked operations (delete project, delete database) are not allowed regardless of the mode

Roadmap

  • 📦 Simplified installation via package manager - ✅ (v0.2.0)
  • 🌎 Support for different Supabase regions - ✅ (v0.2.2)
  • 🎮 Programmatic access to Supabase management API with safety controls - ✅ (v0.3.0)
  • 👷‍♂️ Read and read-write database SQL queries with safety controls - ✅ (v0.3.0)
  • 🐍 Support methods and objects available in native Python SDK
  • 🔍 Strong SQL query validation
  • 📝 Connect to db logs to help debug errors

Support of Python SDK methods

I'm planning to add support for Auth methods from Python SDK as it would allow Cursor to create test users for me, which might be handy.

Connect to Supabase logs

I'm planning to research, if it's possible to connect to Supabase db logs which might be useful for debugging (if not already supported.)


Enjoy! ☺️

推荐服务器

VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
AIO-MCP Server

AIO-MCP Server

🚀 集成了 AI 搜索、RAG 和多服务(GitLab/Jira/Confluence/YouTube)的一体化 MCP 服务器,旨在增强 AI 驱动的开发工作流程。来自 Folk。

精选
本地
Knowledge Graph Memory Server

Knowledge Graph Memory Server

为 Claude 实现持久性记忆,使用本地知识图谱,允许 AI 记住用户的信息,并可在自定义位置存储,跨对话保持记忆。

精选
本地
Hyperbrowser

Hyperbrowser

欢迎来到 Hyperbrowser,人工智能的互联网。Hyperbrowser 是下一代平台,旨在增强人工智能代理的能力,并实现轻松、可扩展的浏览器自动化。它专为人工智能开发者打造,消除了本地基础设施和性能瓶颈带来的麻烦,让您能够:

精选
本地
any-chat-completions-mcp

any-chat-completions-mcp

将 Claude 与任何 OpenAI SDK 兼容的聊天完成 API 集成 - OpenAI、Perplexity、Groq、xAI、PyroPrompts 等。

精选
Exa MCP Server

Exa MCP Server

一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。

精选
BigQuery MCP Server

BigQuery MCP Server

这是一个服务器,可以让你的大型语言模型(LLM,比如Claude)直接与你的BigQuery数据对话!可以把它想象成一个友好的翻译器,它位于你的AI助手和数据库之间,确保它们可以安全高效地进行交流。

精选
mcp-perplexity

mcp-perplexity

Perplexity API 的 MCP 服务器。

精选