Supabase Database Manager
STDIOMCP server enables Cursor and Windsurf to safely interact with Supabase databases.
MCP server enables Cursor and Windsurf to safely interact with Supabase databases.
Let Cursor & Windsurf manage your Supabase and run SQL queries. Autonomously. In a safe way.
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.
Getting started • Feature overview • Troubleshooting • Roadmap
stdio
protocolInstalling the server requires the following on your system:
If you plan to install via uv
, ensure it's installed.
⚠️ Important: PostgreSQL must be installed BEFORE installing project dependencies, as psycopg2 requires PostgreSQL development libraries during compilation.
MacOS
brew install postgresql@16
Windows
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.
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 .
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
After installing the package, you'll need to configure your database connection settings. The server supports both local and remote Supabase instances.
Server is pre-configured to connect to the local Supabase instance using default settings:
Host
: 127.0.0.1:54322Password
: 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.
⚠️ IMPORTANT WARNING: Session pooling connections are not supported and there are no plans to support it yet. Let me know if you feel there is a use case for supporting this in an MCP server
For remote Supabase projects, you need to configure:
SUPABASE_PROJECT_REF
- Your project reference (found in project URL)SUPABASE_DB_PASSWORD
- Your database passwordSUPABASE_REGION
- (Optional) Defaults to us-east-1
SUPABASE_ACCESS_TOKEN
- (Optional) For Management API accessYou 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) - defaultus-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.
Since v0.46 there are two ways to configure MCP servers in Cursor:
mcp.json
in your project / repo folder and .env
to configure connection.env
which is supported by this MCP server onlyYou can create project-specific MCP by:
mcp.json
file with the following settings⚠ Environment variables: If you are configuring MCP server on a per-project basis you still need to create .env file for connection settings to be picked up. I wasn't able to configure mcp.json to pick up my env vars 😔
{ "mcpServers": { "filesystem": { "command": "supabase-mcp-server", } } }
Alternatively, if you want to configure MCP servers globally (i.e. not for each project), you can use configure connection settings by updating 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:
%APPDATA%/supabase-mcp/.env
~/.config/supabase-mcp/.env
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
The server looks for configuration in this order:
.env
file in current directory%APPDATA%/supabase-mcp/.env
~/.config/supabase-mcp/.env
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.
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.
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.
Here are some tips & tricks that might help you:
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_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).~/.local/share/supabase-mcp/mcp_server.log
%USERPROFILE%\.local\share\supabase-mcp\mcp_server.log
# On macOS/Linux cat ~/.local/share/supabase-mcp/mcp_server.log # On Windows (PowerShell) Get-Content "$env:USERPROFILE\.local\share\supabase-mcp\mcp_server.log"
If you are stuck or any of the instructions above are incorrect, please raise an issue.
A super useful tool to help debug MCP server issues is MCP Inspector. If you installed from source, you can run supabase-mcp-inspector
from the project repo and it will run the inspector instance. Coupled with logs this will give you complete overview over what's happening in the server.
📝 Running
supabase-mcp-inspector
, if installed from package, doesn't work properly - I will validate and fix in the cominng release.
Since v0.3.0 server supports both read-only and data modification operations:
*Note: DDL operations require:
live_dangerously
The server supports two approaches for executing write operations:
Explicit Transaction Control (Recommended):
BEGIN; CREATE TABLE public.test_table (id SERIAL PRIMARY KEY, name TEXT); COMMIT;
Single Statements:
CREATE TABLE public.test_table (id SERIAL PRIMARY KEY, name TEXT);
For DDL operations (CREATE/ALTER/DROP), tool description appropriately guides Cursor/Windsurft to use explicit transaction control with BEGIN/COMMIT blocks.
This MCP server uses::
When connecting via Supabase's Transaction Pooler, some complex transaction patterns may not work as expected. For schema changes in these environments, use explicit transaction blocks or consider using Supabase migrations or the SQL Editor in the dashboard.
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 comprehensive support for all PostgreSQL operations:
Supported modes:
read-only
- only read-only queries are allowed (default mode)read-write
- all SQL operations are allowed when explicitly enabledSafety features:
Since v0.3.0 server supports sending arbitrary requests to Supabase Management API with auto-injection of project ref and safety mode control:
send_management_api_request
to send arbitrary requests to Supabase Management API, with auto-injection of project ref and safety mode controlget_management_api_spec
to get the enriched API specification with safety informationget_management_api_safety_rules
to get all safety rules including blocked and unsafe operations with human-readable explanationslive_dangerously
to switch between safe and unsafe modessafe
, unsafe
and blocked
categories based on the risk of the operationI was planning to add support for Python SDK methods to the MCP server. Upon consideration I decided to only add support for Auth admin methods as I often found myself manually creating test users which was prone to errors and time consuming. Now I can just ask Cursor to create a test user and it will be done seamlessly. Check out the full Auth Admin SDK method docs to know what it can do.
Since v0.3.6 server supports direct access to Supabase Auth Admin methods via Python SDK:
get_auth_admin_methods_spec
to retrieve documentation for all available Auth Admin methodscall_auth_admin_method
to directly invoke Auth Admin methods with proper parameter handlingget_user_by_id
: Retrieve a user by their IDlist_users
: List all users with paginationcreate_user
: Create a new userdelete_user
: Delete a user by their IDinvite_user_by_email
: Send an invite link to a user's emailgenerate_link
: Generate an email link for various authentication purposesupdate_user_by_id
: Update user attributes by IDdelete_factor
: Delete a factor on a user (currently not implemented in SDK)The Auth Admin SDK provides several key advantages over direct SQL manipulation:
Functionality: Enables operations not possible with SQL alone (invites, magic links, MFA)
Accuracy: More reliable then creating and executing raw SQL queries on auth schemas
Simplicity: Offers clear methods with proper validation and error handling
user.id
instead of user["id"]
)invite_user_by_email
and generate_link
require email sending to be configured in your Supabase projectsignup
links don't require the user to existmagiclink
and recovery
links require the user to already exist in the systemdelete_factor
are exposed in the API but not fully implemented in the SDKI'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! ☺️