Supabase MCP Server provides a secure interface for executing SQL queries, managing your database, accessing the Management API, and handling user authentication within your favorite MCP-enabled IDEs like Cursor, Windsurf, and Claude Desktop.
Choose one of these installation methods:
# Using pipx (recommended for isolation)
pipx install supabase-mcp-server
# Using uv
uv pip install supabase-mcp-server
The MCP server needs configuration to connect to your Supabase resources. You have several options for providing this configuration.
Variable | Description | Default |
---|---|---|
SUPABASE_PROJECT_REF |
Project reference ID or local host:port | 127.0.0.1:54322 |
SUPABASE_DB_PASSWORD |
Database password | postgres |
SUPABASE_REGION |
AWS region for your project | us-east-1 |
SUPABASE_ACCESS_TOKEN |
Management API access token (optional) | None |
SUPABASE_SERVICE_ROLE_KEY |
Service role key for Auth Admin (optional) | None |
Critical Note: For remote Supabase projects, you MUST specify the correct region where your project is hosted using
SUPABASE_REGION
. Incorrect regions will cause connection errors.
The server checks these locations for configuration (in priority order):
%APPDATA%\supabase-mcp\.env
~/.config/supabase-mcp/.env
# Create config directory (macOS/Linux)
mkdir -p ~/.config/supabase-mcp
# Create config directory (Windows PowerShell)
mkdir -Force "$env:APPDATA\supabase-mcp"
# Edit the config file
nano ~/.config/supabase-mcp/.env # macOS/Linux
notepad "$env:APPDATA\supabase-mcp\.env" # Windows
Add your configuration values:
SUPABASE_PROJECT_REF=your-project-ref
SUPABASE_DB_PASSWORD=your-db-password
SUPABASE_REGION=us-east-1
SUPABASE_ACCESS_TOKEN=your-access-token
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
Go to Settings → Features → MCP Servers
Add a new server with this configuration:
name: supabase
type: command
command: /full/path/to/supabase-mcp-server
Find the full path with which supabase-mcp-server
(macOS/Linux) or where supabase-mcp-server
(Windows)
{
"mcpServers": {
"supabase": {
"command": "/full/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",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key"
}
}
}
}
{
"mcpServers": {
"supabase": {
"command": "/full/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",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key"
}
}
}
}
{
"mcpServers": {
"supabase": {
"command": "/full/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",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key"
}
}
}
}
execute_postgresql
: Run SQL with automatic risk assessmentget_schemas
: List schemas with sizes and table countsget_tables
: List tables, foreign tables, and views with metadataget_table_schema
: Get detailed table structuresend_management_api_request
: Send requests to Management APIget_management_api_spec
: Get documentation for available endpointscall_auth_admin_method
: Execute Auth Admin SDK methodsretrieve_logs
: Get logs from database, auth, API, storage, and moreAll operations are protected by a three-tier safety system:
live_dangerously
for data modificationsIf you encounter issues:
supabase-mcp-server
directly in terminalwhich supabase-mcp-server
)~/.local/share/supabase-mcp/mcp_server.log
%USERPROFILE%\.local\share\supabase-mcp\mcp_server.log
SUPABASE_REGION
value for remote projectsFor more help, check GitHub issues or community support channels.
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.