Purpose
Query MCP is an open-source MCP (Model Context Protocol) server for managing Supabase end-to-end through a chat interface. It enables AI assistants in the IDE to securely run SQL queries, manage database schema changes, call the Supabase Management API, and manage users using the Auth Admin SDK.
Main Capabilities
- Execute read and write SQL queries through the chat interface
- Support the Supabase Management API
- Automatically version database schema changes
- Access logs and other features
- Controllable read-only and read-write modes for SQL query execution
- Runtime SQL query validation and risk level assessment
- Three-level security system for SQL operations: safe, write, destructive
- Robust transaction handling for direct and connection-pooled database connections
- Manage users using Supabase Auth Admin methods through the Python SDK
- Provide prebuilt tools to help Cursor and Windsurf use MCP more effectively
- Minimal installation and setup through package managers (uv, pipx, etc.)
Usage
Installation
The system must meet the following conditions: if you plan to install via uv, make sure uv is installed. A PostgreSQL installation is no longer required for the MCP server itself, because it now uses asyncpg, which does not depend on PostgreSQL development libraries. However, if you run a local Supabase instance, PostgreSQL 16+ is still required.
Package installation has been supported since v0.2.0, and you can install it using a Python package manager. pipx is recommended because it creates an isolated environment for each package. You can also manually install by cloning the repository and running pipx install -e . in the root directory.
Configuration
The server needs to be configured to connect to the Supabase database, access the Management API, and use the Auth Admin SDK. Since v0.4, the MCP server requires an API key, which can be obtained for free at thequery.dev.
The server uses the following environment variables:
QUERY_API_KEY: required, obtain it at thequery.devSUPABASE_PROJECT_REF: required for remote projectsSUPABASE_DB_PASSWORD: required for remote projectsSUPABASE_REGION: for remote projects, the correct region must be specified, otherwise a "Tenant or user not found" error will occur. Default is us-east-1SUPABASE_ACCESS_TOKEN: used for the Management API, only applicable to remote projectsSUPABASE_SERVICE_ROLE_KEY: used for the Auth Admin SDK
The server connects to the Supabase PostgreSQL database through the transaction pooling endpoint. For local development, use the direct connection 127.0.0.1:54322; for remote projects, use the format:postgresql://postgres.[project_ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres. Session pooling connections are not supported; only transaction pooling is used.
Configuration lookup order (from highest to lowest priority): environment variables, local .env file (only effective when running from source), global configuration file (Windows: %APPDATA%\supabase-mcp\.env;macOS/Linux: ~/.config/supabase-mcp/.env), default settings. Note: packages installed via pipx or uv will not detect the local .env file in the project directory, so you must use environment variables or the global configuration file.
Client Configuration
Supports any MCP client compatible with the stdio protocol. Compatibility has been explicitly tested with Cursor, Windsurf, Cline, and Claude Desktop. It can also be installed via smithery.ai.
Cursor: Settings -> Features -> MCP Servers, add a new server. If configured correctly, a green dot indicator and the number of tools will be displayed.
Windsurf: Cascade -> click the hammer icon -> Configure -> fill in the configuration.
Claude Desktop: You must use the full absolute path to the executable in the configuration, otherwise a "spawn ENOENT" error will occur. Example JSON 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"
}
}
}
}
Cline: Open Cline in VS Code, click the "MCP Servers" tab in the sidebar, click "Configure MCP Servers", edit the cline_mcp_settings.json file, and add a configuration similar to the above.
Troubleshooting
- Debug installation: run directly in the terminal
supabase-mcp-serverCheck whether it is working properly - "No tools found" error: use
which supabase-mcp-server(macOS/Linux) orwhere supabase-mcp-server(Windows) to find the full path, and use the full path in the configuration - Environment variables: make sure they are set in mcp_config.json or the .env file in the global configuration directory
- Log locations: macOS/Linux:
~/.local/share/supabase-mcp/mcp_server.log;Windows:%USERPROFILE%\.local\share\supabase-mcp\mcp_server.log - You can debug with MCP Inspector; after installing from source, you can run
supabase-mcp-inspector
Use cases
- Safely query and modify the Supabase database through the AI chat interface in the IDE
- Manage database schema changes with automatic versioning
- Manage Supabase projects through the Management API
- Manage users through the Auth Admin SDK
- Development workflows that require security controls for SQL operations
Limitations
- Self-hosted Supabase is not supported; only official Supabase.com hosted projects and local development are supported
- Custom connection strings are not supported
- Session pooling is not supported; only transaction pooling is supported
- Management API and Auth Admin SDK features are only available for remote Supabase projects, not for local development
- An API key is required since v0.4
- The author has announced that it is no longer actively maintained and recommends using the official Supabase MCP server
- When installed via package,
supabase-mcp-inspectordoes not work properly, and the author plans to verify and fix it in a later version
Supported regions
us-west-1, us-east-1 (default), us-east-2, ca-central-1, eu-west-1, eu-west-2, eu-west-3, eu-central-1, eu-central-2, eu-north-1, ap-south-1, ap-southeast-1, ap-northeast-1, ap-northeast-2, ap-southeast-2, sa-east-1.