home / mcp / supabase mcp server

Supabase MCP Server

An MCP Server for your Self Hosted Supabase

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "abdqum-supabase-mcp-selfhosted": {
      "command": "python",
      "args": [
        "src/supabase_server.py"
      ],
      "env": {
        "PORT": "8000",
        "SUPABASE_URL": "https://your-project.supabase.co",
        "PYTHONUNBUFFERED": "1",
        "SUPABASE_ANON_KEY": "YOUR_ANON_KEY",
        "SUPABASE_SERVICE_KEY": "YOUR_SERVICE_KEY"
      }
    }
  }
}

You run a self-hosted MCP server to manage your private Supabase instance. This MCP server exposes a set of tools for database, authentication, storage, real-time features, migrations, and monitoring, enabling you to operate and automate your Supabase deployment from a single control plane.

How to use

Connect to the MCP server using your MCP client or hub. Start by configuring connection details (host, port, and authentication as required by your setup). You can perform actions such as executing database queries, managing users and roles, handling storage, working with real-time subscriptions, running migrations, and accessing monitoring data. Use the MCP client to discover available tools, run operations, and view results or logs. When you initiate an operation, you will typically pass tool names and parameters through the client’s interface; the server validates inputs, executes the requested operation, and returns results and diagnostics.

How to install

Prerequisites you need before installing the MCP server: Python 3.11 or newer. An instance of Supabase to connect to (self-hosted or cloud). Environment variables for your Supabase project.

Step 1: Prepare the environment for a local HTTP self-hosted server. You will run the server via Python directly from the source file.

Step 2: Start the server using Python for the HTTP self-hosted option.

Step 3: (Optional) Use Docker to build and run the server in a container if you prefer containerized deployment.

Configuration and deployment notes

Environment variables you will configure for Supabase access and server operation include the following. Replace the placeholders with your actual values.

SUPABASE_URL=https://your-project.supabase.co SUPABASE_ANON_KEY=your-anon-key SUPABASE_SERVICE_KEY=your-service-key (optional)

Server runtime configuration includes the port and Python I/O settings.

Security and monitoring

The MCP server validates inputs to prevent SQL injections, applies rate limiting per IP and user, and maintains audit logs of all operations. HTTPS is required in production to secure data in transit, and secrets are managed securely. You can access a comprehensive monitoring setup with real-time metrics, structured logs, health checks, alerts, and a dedicated metrics dashboard.

Deployment options

Smithery (recommended for Python SDK workflows): use the Smithery workflow to deploy and scan. The server entry point is configured to create the server in your environment. You run a development or playground session with Smithery as your MCP client.

Railway or Docker deployments are also supported. You can build a Docker image and run the container on port 8000, supplying your Supabase project URL and keys as environment variables.

Troubleshooting and tips

If you encounter cache or profile issues in your MCP client, re-save the profile and re-run the Scan. Ensure all required environment variables are available to the server at startup. Check that the server process has access to the network and that the Supabase project is reachable from the host.

Examples and workflow notes

For HTTP self-hosted operation, you start the server with a command similar to the following from your environment: Use the exact command shown in your setup to run the server.

Security and access control

Security measures include input validation, audit logs, HTTPS enforcement, secret management, and Row-Level Security (RLS) policies to protect data. Always run in a secure production environment with proper access controls and monitoring.

Available tools

execute_sql

Execute SQL queries directly against the database.

list_tables

List all tables in the database.

inspect_schema

Inspect the database schema to understand structure.

apply_migration

Apply database migrations to update schema.

backup_database

Create a backup of the entire database.

restore_database

Restore a database from a backup.

vacuum_analyze

Run vacuum and analyze to optimize performance.

get_database_stats

Retrieve statistics for the database.

create_index

Create a database index to improve queries.

drop_index

Remove a database index.

list_extensions

List installed database extensions.

manage_extensions

Manage database extensions.

execute_psql

Run psql commands against the database.

check_health

Check the health status of the database.

get_database_connections

List active database connections.

list_auth_users

List authentication users.

create_auth_user

Create a new authentication user.

update_auth_user

Update an authentication user.

delete_auth_user

Delete an authentication user.

get_auth_user

Get details of an authentication user.

verify_jwt_secret

Verify the JWT secret integrity.

manage_roles

Manage authentication roles.

manage_rls_policies

Manage Row-Level Security policies.

list_storage_buckets

List storage buckets.

list_storage_objects

List objects within a storage bucket.

manage_storage_policies

Manage access policies for storage.

upload_file

Upload a file to storage.

download_file

Download a file from storage.

delete_file

Delete a file from storage.

list_realtime_publications

List real-time publications.

manage_realtime

Manage real-time configurations.

create_subscription

Create a real-time subscription.

delete_subscription

Delete a real-time subscription.

create_migration

Create a new database migration.

list_migrations

List available migrations.

push_migrations

Push migrations to the server.

validate_migration

Validate a migration before applying.

smart_migration

Run a smart migration to adapt schema.

auto_migrate

Automatically migrate the database.

sync_schema

Synchronize schema across environments.

import_schema

Import a database schema.

get_logs

Fetch server logs.

metrics_dashboard

Open the metrics dashboard.

analyze_performance

Analyze performance metrics.

analyze_rls_coverage

Analyze RLS coverage for data protection.

audit_security

Audit security and configurations.

generate_typescript_types

Generate TypeScript types from database schemas.

generate_crud_api

Generate CRUD API stubs from schemas.

cache_management

Manage internal cache.

environment_management

Manage environment configurations.

manage_secrets

Manage secret values used by the app.

manage_functions

Manage server-side functions.

manage_triggers

Manage database triggers.

manage_webhooks

Manage webhooks for integrations.