home / mcp / supabase mcp server
An MCP Server for your Self Hosted Supabase
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.
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.
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.
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.
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.
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.
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.
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 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.
Execute SQL queries directly against the database.
List all tables in the database.
Inspect the database schema to understand structure.
Apply database migrations to update schema.
Create a backup of the entire database.
Restore a database from a backup.
Run vacuum and analyze to optimize performance.
Retrieve statistics for the database.
Create a database index to improve queries.
Remove a database index.
List installed database extensions.
Manage database extensions.
Run psql commands against the database.
Check the health status of the database.
List active database connections.
List authentication users.
Create a new authentication user.
Update an authentication user.
Delete an authentication user.
Get details of an authentication user.
Verify the JWT secret integrity.
Manage authentication roles.
Manage Row-Level Security policies.
List storage buckets.
List objects within a storage bucket.
Manage access policies for storage.
Upload a file to storage.
Download a file from storage.
Delete a file from storage.
List real-time publications.
Manage real-time configurations.
Create a real-time subscription.
Delete a real-time subscription.
Create a new database migration.
List available migrations.
Push migrations to the server.
Validate a migration before applying.
Run a smart migration to adapt schema.
Automatically migrate the database.
Synchronize schema across environments.
Import a database schema.
Fetch server logs.
Open the metrics dashboard.
Analyze performance metrics.
Analyze RLS coverage for data protection.
Audit security and configurations.
Generate TypeScript types from database schemas.
Generate CRUD API stubs from schemas.
Manage internal cache.
Manage environment configurations.
Manage secret values used by the app.
Manage server-side functions.
Manage database triggers.
Manage webhooks for integrations.