The Supabase MCP server implements the Model Context Protocol to provide database operation tools that enable large language models to interact with Supabase databases. It offers a standardized way to perform common database operations like reading, creating, updating, and deleting records directly from AI assistants.
Clone this repository:
git clone https://github.com/gevans3000/supabase-mcp.git
cd supabase-mcp
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
Copy the example environment file:
cp .env.example .env
# On Windows, use:
# copy .env.example .env
Edit the .env
file and add your Supabase credentials:
SUPABASE_URL=your_supabase_project_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
With your virtual environment activated, run:
python server.py
The server uses Stdio transport, listening for MCP requests on standard input and responding on standard output.
Locate your mcp_config.json
file:
C:\Users\<username>\.codeium\windsurf\mcp_config.json
~/.codeium/windsurf/mcp_config.json
~/.codeium/windsurf/mcp_config.json
Add the Supabase MCP server to the configuration:
{
"mcpServers": {
"supabase": {
"command": "python",
"args": [
"/path/to/your/supabase-mcp/server.py"
],
"env": {
"SUPABASE_URL": "your_supabase_url",
"SUPABASE_SERVICE_ROLE_KEY": "your_supabase_key"
}
}
}
}
For better isolation, you can use the Python executable from your virtual environment:
{
"mcpServers": {
"supabase": {
"command": "/path/to/your/venv/bin/python",
"args": [
"/path/to/your/supabase-mcp/server.py"
]
}
}
}
Reads records from a Supabase database table with flexible querying options.
Parameters:
table
(string, required): Name of the table to read fromcolumns
(string, optional, default: "*"): Columns to select (comma-separated or * for all)filters
(object, optional): Filtering conditions as key-value pairslimit
(integer, optional): Maximum number of records to returnoffset
(integer, optional): Number of records to skip for paginationorder_by
(object, optional): Sorting options as column:direction pairsExample:
{
"table": "users",
"columns": "id,name,email",
"filters": {"is_active": true},
"limit": 10,
"offset": 0,
"order_by": {"created_at": "desc"}
}
Creates one or more records in a Supabase database table.
Parameters:
table
(string, required): Name of the table to create records inrecords
(object or array, required): A single record object or array of record objects to createExample (single record):
{
"table": "users",
"records": {
"name": "John Doe",
"email": "[email protected]",
"role": "user"
}
}
Example (multiple records):
{
"table": "users",
"records": [
{
"name": "John Doe",
"email": "[email protected]",
"role": "user"
},
{
"name": "Jane Smith",
"email": "[email protected]",
"role": "admin"
}
]
}
Updates existing records in a Supabase database table based on filter conditions.
Parameters:
table
(string, required): Name of the table to update records inupdates
(object, required): Fields to update as key-value pairsfilters
(object, required): Filtering conditions to identify records to updateDeletes records from a Supabase database table based on filter conditions.
Parameters:
table
(string, required): Name of the table to delete records fromfilters
(object, required): Filtering conditions to identify records to deleteTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "supabase" '{"command":"python","args":["/path/to/your/supabase-mcp/server.py"],"env":{"SUPABASE_URL":"your_supabase_url","SUPABASE_SERVICE_ROLE_KEY":"your_supabase_key"}}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"supabase": {
"command": "python",
"args": [
"/path/to/your/supabase-mcp/server.py"
],
"env": {
"SUPABASE_URL": "your_supabase_url",
"SUPABASE_SERVICE_ROLE_KEY": "your_supabase_key"
}
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"supabase": {
"command": "python",
"args": [
"/path/to/your/supabase-mcp/server.py"
],
"env": {
"SUPABASE_URL": "your_supabase_url",
"SUPABASE_SERVICE_ROLE_KEY": "your_supabase_key"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect