{"type":"mcp_server","name":"supabase-mcp-server","description":"Query MCP enables IDEs to safely execute SQL queries, manage databases end-to-end, access Management API, and handle user authentication with built-in safety controls. Query MCP enables IDEs to safely execute","category":"Developer Tools","language":"Python","stars":827,"forks":59,"owner":"alexander-zuev","github_url":"https://github.com/alexander-zuev/supabase-mcp-server","homepage":"https://thequery.dev","setup":"## Setup\n\n### Prerequisites\nInstalling the server requires Python 3.12+.\nIf installing via `uv`, ensure it's installed.\n\n### PostgreSQL Installation\nPostgreSQL installation is no longer required for the MCP server itself, as it now uses asyncpg which doesn't depend on PostgreSQL development libraries.\nHowever, you'll still need PostgreSQL if you're running a local Supabase instance:\n\n**MacOS**\n```bash\nbrew install postgresql@16\n```\n\n**Windows**\n- Download and install PostgreSQL 16+ from https://www.postgresql.org/download/windows/\n- Ensure \"PostgreSQL Server\" and \"Command Line Tools\" are selected during installation\n\n### Step 1. Installation\nInstall the server via `pipx install supabase-mcp-server` or `uv pip install supabase-mcp-server`.\nYou can also install manually by cloning the repository and running `pipx install -e .` from the root directory.\n\n#### Installing from source\nIf you would like to install from source, for example for local development:\n```bash\nuv venv\n# On Mac\nsource .venv/bin/activate\n# On Windows\n.venv\\Scripts\\activate\n# Install package in editable mode\nuv pip install -e .\n```\n\n#### Installing via Smithery.ai\nYou can find the full instructions on how to use Smithery.ai to connect to this MCP server [here](https://smithery.ai/server/@alexander-zuev/supabase-mcp-server).\n\n### Step 2. Configuration\nThe Supabase MCP server requires configuration to connect to your Supabase database, access the Management API, and use the Auth Admin SDK.\n\n#### Environment Variables\nThe server uses the following environment variables:\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `SUPABASE_PROJECT_REF` | Yes | `127.0.0.1:54322` | Your Supabase project reference ID (or local host:port) |\n| `SUPABASE_DB_PASSWORD` | Yes | `postgres` | Your database password |\n| `SUPABASE_REGION` | Yes* | `us-east-1` | AWS region where your Supabase project is hosted |\n| `SUPABASE_ACCESS_TOKEN` | No | None | Personal access token for Supabase Management API |\n| `SUPABASE_SERVICE_ROLE_KEY` | No | None | Service role key for Auth Admin SDK |\n\n#### Configuration Methods\nThe server looks for configuration in this order (highest to lowest priority):\n\n1. **Environment Variables**: Values set directly in your environment\n2. **Local `.env` File**: A `.env` file in your current working directory (only works when running from source)\n3. **Global Config File**:\n   - Windows: `%APPDATA%\\supabase-mcp\\.env`\n   - macOS/Linux: `~/.config/supabase-mcp/.env`\n4. **Default Settings**: Local development defaults (if no other config is found)\n\n#### Setting Up Configuration\n\n##### Option 1: Client-Specific Configuration (Recommended)\nSet environment variables directly in your MCP client configuration.\n\n##### Option 2: Global Configuration\nCreate a global `.env` configuration file that will be used for all MCP server instances:\n\n```bash\n# Create config directory\n# On macOS/Linux\nmkdir -p ~/.config/supabase-mcp\n# On Windows (PowerShell)\nmkdir -Force \"$env:APPDATA\\supabase-mcp\"\n\n# Create and edit .env file\n# On macOS/Linux\nnano ~/.config/supabase-mcp/.env\n# On Windows (PowerShell)\nnotepad \"$env:APPDATA\\supabase-mcp\\.env\"\n```\n\nAdd your configuration values to the file:\n\n```\nSUPABASE_PROJECT_REF=your-project-ref\nSUPABASE_DB_PASSWORD=your-db-password\nSUPABASE_REGION=us-east-1\nSUPABASE_ACCESS_TOKEN=your-access-token\nSUPABASE_SERVICE_ROLE_KEY=your-service-role-key\n```\n\n##### Option 3: Project-Specific Configuration (Source Installation Only)\nIf you're running the server from source (not via package), you can create a `.env` file in your project directory with the same format as above.\n\n### Step 3. Usage\nIn general, any MCP client that supports `stdio` protocol should work with this MCP server.\nFollow the guides below to install this MCP server in your client.\n\n#### Cursor\nGo to Settings -> Features -> MCP Servers and add a new server with the specified configuration.\n\n#### Windsurf\nGo to Cascade -> Click on the hammer icon -> Configure -> Fill in the configuration with the provided JSON.\n\n#### Claude Desktop\nConfigure the MCP server in Claude Desktop by adding a new configuration with the provided JSON, ensuring the full path to the executable is correct.\n\n#### Cline\nConfigure the MCP server in Cline by adding the provided JSON configuration to the `cline_mcp_settings.json` file.","tools":"## Available Tools\n\n1.  Compatible with Cursor, Windsurf, Cline and other MCP clients supporting `stdio` protocol (allows integration with various IDEs).\n2.  Control read-only and read-write modes of SQL query execution (manages SQL query permissions).\n3.  Runtime SQL query validation with risk level assessment (assesses the safety of SQL queries).\n4.  Three-tier safety system for SQL operations: safe, write, and destructive (provides different levels of safety for SQL operations).\n5.  Robust transaction handling for both direct and pooled database connections (ensures data consistency).\n6.  Automatic versioning of database schema changes (tracks database schema modifications).\n7.  Manage your Supabase projects with Supabase Management API (allows managing Supabase projects).\n8.  Manage users with Supabase Auth Admin methods via Python SDK (enables user management).\n9.  Pre-built tools to help Cursor & Windsurf work with MCP more effectively (improves integration with specific IDEs).\n10. Dead-simple install & setup via package manager (uv, pipx, etc.) (simplifies installation).\n11. `get_schemas` (Lists schemas with sizes and table counts).\n12. `get_tables` (Lists tables, foreign tables, and views with metadata).\n13. `get_table_schema` (Gets detailed table structure (columns, keys, relationships)).\n14. `execute_postgresql` (Executes SQL statements against your database).\n15. `confirm_destructive_operation` (Executes high-risk operations after confirmation).\n16. `retrieve_migrations` (Gets migrations with filtering and pagination options).\n17. `live_dangerously` (Toggles between safe and unsafe modes).\n18. `send_management_api_request` (Sends arbitrary requests to Supabase Management API with auto-injection of project ref).\n19. `get_management_api_spec` (Gets the enriched API specification with safety information).\n20. `get_management_api_safety_rules` (Gets all safety rules with human-readable explanations).\n21. `get_auth_admin_methods_spec` (retrieves documentation for all available Auth Admin methods).\n22. `call_auth_admin_method` (directly invoke Auth Admin methods with proper parameter handling).\n23. `retrieve_logs` (Access logs from any Supabase service).\n","faq":null,"created_at":"2025-02-15T08:54:29+00:00","updated_at":"2025-03-28T14:38:34+00:00","source_url":"https://model-context-protocol.com/servers/supabase-query-management-chat-interface","related_articles":[]}