This MCP server enables secure interaction between Cursor and Windsurf AI coding assistants and Supabase databases, allowing them to safely execute SQL queries and manage your database resources with built-in safety controls.
Before installing, ensure you have:
PostgreSQL must be installed before installing the MCP server as it requires PostgreSQL development libraries.
PostgreSQL Installation:
MacOS:
brew install postgresql@16
Windows:
Install using a package manager:
# Recommended: using pipx (for isolated environment)
pipx install supabase-mcp-server
# Alternative: using uv
uv pip install supabase-mcp-server
The server requires configuration to connect to your Supabase instance.
The server is pre-configured for local Supabase with default settings:
No additional configuration needed for local instances with default settings.
For remote Supabase projects, configure these variables:
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
Find your SUPABASE_PROJECT_REF
from your project's dashboard URL:
https://supabase.com/dashboard/project/<supabase-project-ref>
Two options for configuration:
Project-specific configuration:
.cursor
folder in your repo (if it doesn't exist)mcp.json
file:
{
"mcpServers": {
"filesystem": {
"command": "supabase-mcp-server"
}
}
}
.env
file in your project with your Supabase connection detailsGlobal configuration:
Create config directory:
# On macOS/Linux
mkdir -p ~/.config/supabase-mcp
# On Windows (PowerShell)
mkdir -Force "$env:APPDATA\supabase-mcp"
Create and edit .env
file:
# On macOS/Linux
nano ~/.config/supabase-mcp/.env
# On Windows
notepad "$env:APPDATA\supabase-mcp\.env"
Add your Supabase connection details:
SUPABASE_PROJECT_REF=your-project-ref
SUPABASE_DB_PASSWORD=your-db-password
SUPABASE_REGION=us-east-1
SUPABASE_ACCESS_TOKEN=your-access-token
Create or update mcp_config.json
file:
{
"mcpServers": {
"supabase": {
"command": "/path/to/supabase-mcp-server",
"env": {
"SUPABASE_PROJECT_REF": "your-project-ref",
"SUPABASE_DB_PASSWORD": "your-db-password",
"SUPABASE_REGION": "us-east-1",
"SUPABASE_ACCESS_TOKEN": "your-access-token"
}
}
}
}
Find the server path with:
which supabase-mcp-server
where supabase-mcp-server
name: supabase
type: command
command: supabase-mcp-server
If configured correctly, you'll see a green dot indicator and available tools.
The server supports both read-only and data modification operations:
SELECT * FROM my_table WHERE id = 123;
Enable write access first with the live_dangerously
tool, then execute:
BEGIN;
INSERT INTO my_table (name, description) VALUES ('New item', 'Description');
COMMIT;
Recommended approach for changes:
BEGIN;
CREATE TABLE public.test_table (id SERIAL PRIMARY KEY, name TEXT);
COMMIT;
get_db_schemas
- List all database schemas with sizes and table countsget_tables
- List all tables in a schema with metadataget_table_schema
- Get detailed table structure including columns and keysexecute_sql_query
- Execute SQL queries with comprehensive support for all operationssend_management_api_request
- Send requests to Supabase Management APIget_management_api_spec
- Get API specification with safety informationget_management_api_safety_rules
- Get safety rules for operationslive_dangerously
- Switch between safe and unsafe modesget_auth_admin_methods_spec
- Get documentation for Auth Admin methodscall_auth_admin_method
- Call Auth Admin methods (create users, generate links, etc.)If you encounter issues:
supabase-mcp-server
directly in terminal to verify installation~/.local/share/supabase-mcp/mcp_server.log
%USERPROFILE%\.local\share\supabase-mcp\mcp_server.log
Check logs with:
# 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"
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.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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.
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.