Query MCP is an open-source MCP server that lets your IDE safely run SQL, manage schema changes, call the Supabase Management API, and use Auth Admin SDK for Supabase projects. With built-in safety controls, it provides a secure interface between your development environment and Supabase services.
You can install the server using your preferred Python package manager:
# Recommended: install with pipx for isolated environments
pipx install supabase-mcp-server
# Alternative: install with uv
uv pip install supabase-mcp-server
The server requires configuration to connect to your Supabase database and related services.
Variable | Description |
---|---|
QUERY_API_KEY |
API key from thequery.dev (required) |
SUPABASE_PROJECT_REF |
Your Supabase project reference ID |
SUPABASE_DB_PASSWORD |
Your database password |
SUPABASE_REGION |
AWS region where your Supabase project is hosted |
Variable | Description |
---|---|
SUPABASE_ACCESS_TOKEN |
Personal access token for Supabase Management API |
SUPABASE_SERVICE_ROLE_KEY |
Service role key for Auth Admin SDK |
The server looks for configuration in this order (highest to lowest priority):
%APPDATA%\supabase-mcp\.env
~/.config/supabase-mcp/.env
# On macOS/Linux
mkdir -p ~/.config/supabase-mcp
nano ~/.config/supabase-mcp/.env
# On Windows (PowerShell)
mkdir -Force "$env:APPDATA\supabase-mcp"
notepad "$env:APPDATA\supabase-mcp\.env"
Add your configuration values to the file:
QUERY_API_KEY=your-api-key
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
name: supabase
type: command
command: /full/path/to/supabase-mcp-server
{
"mcpServers": {
"supabase": {
"command": "/full/path/to/supabase-mcp-server",
"env": {
"QUERY_API_KEY": "your-api-key",
"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"
}
}
}
}
Find the full path to the executable:
# On macOS/Linux
which supabase-mcp-server
# On Windows
where supabase-mcp-server
Go to Settings → Developer → Edit Config MCP Servers
Add a new configuration:
{
"mcpServers": {
"supabase": {
"command": "/full/path/to/supabase-mcp-server",
"env": {
"QUERY_API_KEY": "your-api-key",
"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
: Executes SQL statements against your databaseget_schemas
: Lists schemas with sizes and table countsget_tables
: Lists tables, foreign tables, and views with metadataget_table_schema
: Gets detailed table structureretrieve_migrations
: Gets migrations with filtering and pagination optionslive_dangerously
: Toggles between safe and unsafe modessend_management_api_request
: Sends arbitrary requests to Supabase Management APIget_management_api_spec
: Gets the enriched API specification with safety informationget_management_api_safety_rules
: Gets all safety rules with explanationscall_auth_admin_method
: Invoke Auth Admin methods with proper parameter handlingget_auth_admin_methods_spec
: Retrieve documentation for Auth Admin methodsAvailable methods include:
get_user_by_id
, list_users
, create_user
, delete_user
invite_user_by_email
, generate_link
, update_user_by_id
retrieve_logs
: Access logs from any Supabase service (postgres, auth, storage, etc.)supabase-mcp-server
directly from the terminalwhich supabase-mcp-server
(macOS/Linux) or where supabase-mcp-server
(Windows)~/.local/share/supabase-mcp/mcp_server.log
%USERPROFILE%\.local\share\supabase-mcp\mcp_server.log
supabase-mcp-inspector
for debugging (source installation only)The server implements a three-tier safety system for all operations:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "supabase" '{"command":"supabase-mcp-server","env":{"QUERY_API_KEY":"your-api-key","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"}}'
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": "supabase-mcp-server",
"env": {
"QUERY_API_KEY": "your-api-key",
"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"
}
}
}
}
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": "supabase-mcp-server",
"env": {
"QUERY_API_KEY": "your-api-key",
"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"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect