# Self-Hosted Supabase MCP Server

> A database management MCP server for self-hosted Supabase.

- **URL**: https://followmcp.com/en/servers/selfhosted-supabase-mcp
- **Category**: Database
- **Origin**: Community
- **Stars**: 137
- **FMRS Score**: 44/100 (Grade D)
- **Source**: https://github.com/HenkDz/selfhosted-supabase-mcp
- **Transports**: stdio (local process), Streamable HTTP
- **Runtimes**: Bun 1.1+
- **Auth**: API key / credential required

## Overview
This MCP server connects MCP clients to local or privately hosted Supabase projects. Its tools cover database schemas and data, migrations, statistics, auth users, Storage, Realtime, Edge Functions, and type generation. It supports stdio and Streamable HTTP; HTTP mode uses Supabase JWT authentication and role-based tool access.

## Best for
- Developers running self-hosted Supabase who want to inspect or manage a project from an MCP client.
- Teams that need remote access through HTTP JWT authentication and role-based access controls.

## Not for
- Workflows requiring Supabase cloud multi-project management or cloud-specific APIs.
- Users unable to provide Supabase connection details or unwilling to grant database and service-role access.
- Remote deployments that require built-in authentication in stdio mode.

## Required permissions
- Basic configuration requires the Supabase URL and anon key.
- Privileged tools require a service_role JWT in HTTP mode; stdio mode has no authentication and exposes all tools.
- Tools that directly access auth, storage, pg_catalog, and similar objects generally require DATABASE_URL.
- HTTP mode requires a JWT secret; JWT role controls access, with authenticated limited to regular tools and anon denied tool access.

## Risks
- execute_sql can run arbitrary SQL and should be exposed only to service_role.
- Stdio mode has no authentication and exposes all tools, including privileged ones; it is intended for trusted local clients.
- Plain-text passwords supplied to auth user tools travel over the MCP transport; use TLS for network deployments.
- Service role keys, database connection strings, and JWT secrets are sensitive configuration.
- HTTP access depends on JWT, per-IP rate limits, CORS, and request timeout settings.

## Client config (JSON)
```json
{"mcpServers":{"selfhosted-supabase":{"command":"bun","args":["run","<path-to-dist/index.js>","--url","<your-supabase-url>","--anon-key","<your-anon-key>","--service-key","<your-service-key>","--db-url","<your-db-url>","--jwt-secret","<your-jwt-secret>"]}}}
```

## Tools (43)
- `list_tables`: Lists tables in database schemas.
- `list_extensions`: Lists installed PostgreSQL extensions.
- `list_available_extensions`: Lists available PostgreSQL extensions for installation.
- `list_migrations`: Lists applied migrations recorded in the Supabase CLI migration table.
- `apply_migration`: Applies a SQL migration and records it in the migration table; privileged access required.
- `list_table_columns`: Lists columns for a specified table.
- `list_indexes`: Lists indexes for a specified table.
- `list_constraints`: Lists constraints for a specified table.
- `list_foreign_keys`: Lists foreign keys for a specified table.
- `list_triggers`: Lists triggers for a specified table.
- `list_database_functions`: Lists user-defined database functions.
- `get_function_definition`: Gets the source definition of a function.
- `get_trigger_definition`: Gets the source definition of a trigger.
- `execute_sql`: Executes an arbitrary SQL query; privileged access required.
- `explain_query`: Runs EXPLAIN ANALYZE on a query; privileged access required.
- `get_database_connections`: Shows active connections in pg_stat_activity.
- `get_database_stats`: Retrieves pg_stat_* database statistics.
- `get_index_stats`: Shows index usage statistics.
- `get_vector_index_stats`: Shows pgvector index statistics.
- `list_rls_policies`: Lists Row-Level Security policies for a specified table.
- `get_rls_status`: Shows whether Row-Level Security is enabled for tables.
- `get_advisors`: Retrieves security and performance advisories.
- `get_project_url`: Returns the configured Supabase URL.
- `verify_jwt_secret`: Checks whether a JWT secret is configured.
- `generate_typescript_types`: Generates TypeScript types from the database schema.
- `rebuild_hooks`: Restarts the pg_net worker, if used; privileged access required.
- `get_logs`: Retrieves recent logs from the analytics stack or CSV fallback.
- `list_auth_users`: Lists users from auth.users.
- `get_auth_user`: Retrieves details for a specified auth user.
- `create_auth_user`: Creates an auth user with a bcrypt-hashed password via pgcrypto; privileged access required.
- `update_auth_user`: Updates auth user details; changed passwords are bcrypt-hashed; privileged access required.
- `delete_auth_user`: Deletes an auth user; privileged access required.
- `list_storage_buckets`: Lists all Storage buckets.
- `list_storage_objects`: Lists objects in a specified bucket.
- `get_storage_config`: Retrieves bucket configuration.
- `update_storage_config`: Updates Storage bucket settings; privileged access required.
- `list_realtime_publications`: Lists PostgreSQL publications such as supabase_realtime.
- `list_cron_jobs`: Lists scheduled jobs; requires the pg_cron extension.
- `get_cron_job_history`: Shows recent execution history for a scheduled job.
- `list_vector_indexes`: Lists pgvector indexes; requires the pgvector extension.
- `list_edge_functions`: Lists deployed Edge Functions.
- `get_edge_function_details`: Gets details and metadata for an Edge Function.
- `list_edge_function_logs`: Retrieves recent logs for an Edge Function.
