Labsco
dj-pearson logo

Supabase Coolify MCP Server

โ˜… 2

from dj-pearson

Comprehensive MCP server for managing self-hosted Supabase on Coolify with full deployment, migrations, edge functions, and rollback support.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

Supabase Coolify MCP Server

npm downloads

๐Ÿš€ Features

Supabase Management

  • Database Migrations: Deploy, track, rollback, and manage database migrations
  • Migration Rollback: Safely rollback migrations with down SQL support
  • Supabase CLI Integration: Full CLI integration for local development and deployment
  • Edge Functions: Deploy, invoke, monitor, and delete edge functions
  • Storage Management: Create and manage storage buckets
  • Auth Configuration: Configure authentication providers and settings
  • Realtime Configuration: Manage realtime service settings
  • Health Monitoring: Check status of all Supabase services
  • Type Generation: Generate TypeScript types from database schema

Production Features

  • Input Validation: Zod-based validation for all tool inputs
  • Health Checks: Automatic startup checks and verification tool
  • Error Handling: Comprehensive error messages with troubleshooting hints
  • Type Safety: Full TypeScript support throughout

Coolify Integration

  • Application Management: List, deploy, start, stop, and restart applications
  • Service Management: Control Coolify services
  • Database Management: Manage Coolify-hosted databases
  • Environment Variables: Update application configuration securely
  • Logs: Access application logs for debugging

Deployment Automation

  • One-Click Deployment: Deploy complete Supabase instances on Coolify
  • Configuration Management: Update deployment settings dynamically
  • Status Monitoring: Track deployment health and status

๐Ÿ› ๏ธ Available Tools

Database Migration Tools

list_migrations

List all database migrations with their status.

// No parameters required

deploy_migration

Deploy a new database migration.

{
  "sql": "CREATE TABLE users (id SERIAL PRIMARY KEY, email TEXT);",
  "name": "create_users_table"
}

execute_sql

Execute raw SQL query on the Supabase database.

{
  "sql": "SELECT * FROM users LIMIT 10;"
}

get_migration_status

Get status of a specific migration.

{
  "version": "20231201120000"
}

Edge Functions Tools

list_edge_functions

List all deployed edge functions.

deploy_edge_function

Deploy a new edge function.

{
  "name": "hello-world",
  "code": "export default function handler(req) { return new Response('Hello World'); }",
  "verify_jwt": true
}

delete_edge_function

Delete an edge function.

{
  "name": "hello-world"
}

get_edge_function_logs

Get logs for an edge function.

{
  "name": "hello-world",
  "limit": 100
}

invoke_edge_function

Invoke an edge function.

{
  "name": "hello-world",
  "payload": { "key": "value" }
}

Storage Tools

list_storage_buckets

List all storage buckets.

create_storage_bucket

Create a new storage bucket.

{
  "id": "avatars",
  "public": true,
  "file_size_limit": 5242880
}

delete_storage_bucket

Delete a storage bucket.

{
  "id": "avatars"
}

Auth & Configuration Tools

get_auth_config

Get authentication configuration.

update_auth_config

Update authentication configuration.

{
  "config": {
    "site_url": "https://myapp.com",
    "enable_signup": true
  }
}

check_supabase_health

Check health of all Supabase services.

get_supabase_version

Get Supabase version information.

verify_setup โญ

Verify system setup and check health of all services (Coolify, Supabase, CLI).

This comprehensive tool checks:

  • Coolify connection and authentication
  • Supabase connection and authentication
  • Database accessibility
  • CLI availability
  • Response times and service status

Returns: Detailed health report with recommendations for any issues found.

See docs/VERIFICATION.md for complete verification guide.

Coolify Management Tools

list_coolify_applications

List all Coolify applications.

get_coolify_application

Get details of a specific application.

{
  "uuid": "app-uuid-here"
}

update_coolify_application_env

Update application environment variables.

{
  "uuid": "app-uuid-here",
  "env": {
    "NODE_ENV": "production",
    "API_KEY": "secret"
  }
}

deploy_coolify_application

Deploy a Coolify application.

{
  "uuid": "app-uuid-here"
}

start_coolify_application / stop_coolify_application / restart_coolify_application

Control application lifecycle.

{
  "uuid": "app-uuid-here"
}

get_coolify_logs

Get application logs.

{
  "uuid": "app-uuid-here",
  "lines": 100
}

Deployment Tools

deploy_supabase_to_coolify

Deploy a complete Supabase instance on Coolify.

{
  "name": "my-supabase",
  "config": {
    "postgres_version": "15",
    "enable_realtime": true,
    "enable_storage": true,
    "enable_auth": true,
    "custom_domain": "https://supabase.myapp.com",
    "environment_variables": {
      "CUSTOM_VAR": "value"
    }
  }
}

update_supabase_deployment

Update an existing Supabase deployment.

{
  "uuid": "app-uuid-here",
  "config": {
    "enable_graphql": true
  }
}

get_deployment_status

Get status of a Supabase deployment.

{
  "uuid": "app-uuid-here"
}

๐Ÿ“š MCP Resources

The server exposes these resources for MCP clients:

  • supabase://migrations - All database migrations
  • supabase://edge-functions - All edge functions
  • supabase://storage-buckets - All storage buckets
  • supabase://auth-config - Authentication configuration
  • supabase://health - Service health status
  • coolify://applications - All Coolify applications
  • coolify://services - All Coolify services
  • coolify://databases - All Coolify databases

๐Ÿ”’ Security Best Practices

  1. Never commit API tokens to version control
  2. Use environment variables for sensitive data
  3. Restrict API token permissions to minimum required
  4. Rotate tokens regularly
  5. Use service role key only on secure servers
  6. Enable JWT verification for edge functions
  7. Validate all inputs (automatic with Zod schemas)
  8. Verify setup before production deployments
  9. Set appropriate file permissions on configuration files:
chmod 600 ~/.env
chmod 600 ~/Library/Application\ Support/Claude/claude_desktop_config.json

๐Ÿงช Testing & Verification

Build and Type Check

# Run type checking
npm run typecheck

# Run linter
npm run lint

# Build project
npm run build

Verify Setup

After starting the server, verify everything is working:

# Start the server
npm start

# Then ask Claude:
"Run verify_setup to check if everything is configured correctly"

See docs/VERIFICATION.md for complete verification guide.

๐Ÿ” Diagnostics & Testing

Before reporting issues or if you're having connection problems, use the built-in diagnostic tool:

Quick Diagnosis

Run the automated diagnostic tool to check your setup:

# Using npm
npm run diagnose

# Or on Windows
.\diagnose.ps1

# Or on Linux/Mac
./diagnose.sh

The diagnostic tool will automatically check:

  • โœ… .env file existence and configuration
  • โœ… Required environment variables
  • โœ… Coolify API connection and authentication
  • โœ… Supabase connection and authentication
  • โœ… All Supabase services health
  • โœ… Network connectivity

Expected Output (When Working)

๐ŸŸข ALL CHECKS PASSED - MCP Server should work correctly

โœ… Passed:   10
โŒ Failed:   0
โš ๏ธ  Warnings: 0

Common Diagnostic Issues

Missing .env File

โŒ .env file NOT found!

Fix: cp env.example .env then edit with your credentials

Placeholder Values

โŒ ENV: COOLIFY_API_TOKEN: Contains placeholder value

Fix: Replace your-coolify-api-token-here with actual token from Coolify Dashboard โ†’ Keys & Tokens

Wrong Supabase Key

โŒ Supabase Authentication: Invalid service role key

Fix: Make sure you're using the service_role key, NOT the anon key!
Get it from: Supabase Dashboard โ†’ Settings โ†’ API โ†’ service_role key

Connection Failed

โŒ Coolify Connection: ECONNREFUSED

Fix: Verify Coolify is running and accessible at the configured URL

Getting Credentials

Coolify API Token:

  1. Coolify Dashboard โ†’ Profile โ†’ Keys & Tokens โ†’ API Tokens
  2. Click "Create New Token"
  3. Copy the token (you won't see it again!)
  4. Add to .env as COOLIFY_API_TOKEN

Supabase Service Role Key:

  • Supabase Cloud: Dashboard โ†’ Settings โ†’ API โ†’ Copy service_role key
  • Self-hosted: Check Coolify deployment environment variables for SERVICE_ROLE_KEY

Quick Start Guide

For detailed troubleshooting, see:

๐Ÿ“– Example Use Cases

1. Deploy a New Supabase Instance

// Using the MCP tool
deploy_supabase_to_coolify({
  name: "production-supabase",
  config: {
    postgres_version: "15",
    enable_realtime: true,
    enable_storage: true,
    custom_domain: "https://api.myapp.com"
  }
})

2. Deploy Database Migration

deploy_migration({
  name: "add_user_profiles",
  sql: `
    CREATE TABLE user_profiles (
      id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
      user_id UUID REFERENCES auth.users(id),
      display_name TEXT,
      avatar_url TEXT,
      created_at TIMESTAMP DEFAULT NOW()
    );
  `
})

3. Deploy Edge Function

deploy_edge_function({
  name: "send-email",
  code: `
    import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'
    
    serve(async (req) => {
      const { to, subject, body } = await req.json()
      // Send email logic here
      return new Response(JSON.stringify({ success: true }))
    })
  `,
  verify_jwt: true
})

4. Monitor Deployment Health

// Check overall health
check_supabase_health()

// Get specific deployment status
get_deployment_status({ uuid: "your-app-uuid" })

// View logs
get_coolify_logs({ uuid: "your-app-uuid", lines: 100 })

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

MIT

๐Ÿ“ž Support

For issues and questions:


Note: This MCP server is designed for self-hosted Supabase instances on Coolify. It provides comprehensive management capabilities while maintaining security through environment variables and proper token handling.