@mcp-forge/supabase-admin-mcp
v1.2.1
Published
Supabase Admin MCP Server with full administrative capabilities
Maintainers
Readme
Supabase Admin MCP Server
A powerful Model Context Protocol (MCP) server that provides full administrative access to Supabase projects, including database management, authentication, storage, and monitoring capabilities.
Features
Database Management
- Execute raw SQL queries with safety checks
- Create and drop tables
- List and describe tables
- Manage Row Level Security (RLS) policies
Authentication Management
- Create, update, and delete users
- List users with pagination
- Update user metadata and passwords
Storage Management
- Create and delete storage buckets
- List all buckets
- Configure bucket permissions and limits
Monitoring & Health
- Check service health status
- Analyze slow queries (when pg_stat_statements is enabled)
Installation
# Install dependencies
npm install
# Build the TypeScript code
npm run build
# Test the server
npm testConfiguration
The server requires the following environment variables:
# Supabase Project Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
SUPABASE_ANON_KEY=your-anon-key
# Database Direct Access
SUPABASE_DB_HOST=db.your-project.supabase.co
SUPABASE_DB_PORT=5432
SUPABASE_DB_NAME=postgres
SUPABASE_DB_USER=postgres
SUPABASE_DB_PASSWORD=your-db-passwordUsage with Claude
Add the server to your .mcp.json configuration:
{
"mcpServers": {
"supabase-admin": {
"command": "node",
"args": [
"/path/to/supabase-admin-mcp/dist/index.js"
],
"env": {
"SUPABASE_URL": "https://your-project.supabase.co",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key",
"SUPABASE_ANON_KEY": "your-anon-key",
"SUPABASE_DB_HOST": "db.your-project.supabase.co",
"SUPABASE_DB_PORT": "5432",
"SUPABASE_DB_NAME": "postgres",
"SUPABASE_DB_USER": "postgres",
"SUPABASE_DB_PASSWORD": "your-db-password"
}
}
}
}Available Tools
Database Management
supabase_execute_sql
Execute raw SQL queries on the database.
// Example usage
{
"query": "SELECT * FROM users WHERE created_at > $1",
"params": ["2024-01-01"],
"confirm_destructive": false
}supabase_create_table
Create a new table with schema definition.
// Example usage
{
"table_name": "posts",
"columns": [
{ "name": "id", "type": "uuid", "primary_key": true, "default": "gen_random_uuid()" },
{ "name": "title", "type": "text", "nullable": false },
{ "name": "content", "type": "text" },
{ "name": "created_at", "type": "timestamptz", "default": "now()" }
],
"enable_rls": true
}supabase_drop_table
Drop a table (requires confirmation).
// Example usage
{
"table_name": "old_table",
"cascade": true,
"confirm": true
}supabase_manage_rls
Create, update, or delete RLS policies.
// Example usage - Create policy
{
"action": "create",
"table_name": "posts",
"policy_name": "users_can_view_own_posts",
"command": "SELECT",
"expression": "auth.uid() = user_id"
}Authentication Management
supabase_create_user
Create a new user with optional metadata.
// Example usage
{
"email": "[email protected]",
"password": "secure_password",
"email_confirm": true,
"user_metadata": {
"name": "John Doe"
}
}supabase_list_users
List users with pagination.
// Example usage
{
"page": 1,
"per_page": 50
}Storage Management
supabase_create_bucket
Create a new storage bucket.
// Example usage
{
"bucket_name": "avatars",
"public": true,
"allowed_mime_types": ["image/jpeg", "image/png"],
"file_size_limit": 5242880 // 5MB
}Safety Features
- Destructive Operation Confirmation: Operations like DROP, DELETE, and TRUNCATE require explicit confirmation.
- Error Handling: All operations include comprehensive error handling and reporting.
- Connection Pooling: Database connections are properly pooled and released.
Planned Features
- Edge function deployment and management
- Database migration management
- Backup and restore operations
- Advanced monitoring and analytics
- Realtime configuration management
Security Considerations
- Never expose service role keys in logs or responses
- Always use environment variables for sensitive configuration
- Implement proper access controls in production environments
- Regularly rotate service role keys
License
MIT
