Skip to main content
Glama
Supabase MCP Server

Supabase MCP Server

by canbolayir

Supabase MCP Server

A comprehensive Model Context Protocol server for self-hosted Supabase instances

I built this MCP server for my own needs when working with self-hosted Supabase instances and Claude. Figured it might be useful for others, so here it is! πŸš€

This server provides 42 tools covering everything from database operations to edge functions - basically everything you can do in the Supabase dashboard, but through Claude.

What's This About?

When you're running your own Supabase instance and want Claude to help you manage it, the existing tools are pretty limited. So I built this comprehensive MCP server that gives Claude full access to:

  • πŸ” Authentication - User signup, login, session management

  • πŸ“Š Database - Full CRUD operations with smart query building

  • πŸ”„ Realtime - Subscribe to changes, create channels, broadcast messages

  • πŸ“ Storage - File upload, download, bucket management

  • πŸ›‘οΈ Security - Row Level Security (RLS) policies and permissions

  • ⚑ Edge Functions - Deploy, invoke, and manage serverless functions

  • πŸ—‚οΈ Schema - Explore tables, columns, and relationships

  • πŸ” SQL - Raw SQL execution with smart fallbacks

Related MCP server: Supabase MCP Server

Features

  • Complete Dashboard Parity - Pretty much everything you can do in Supabase Studio

  • Smart Error Handling - Helpful troubleshooting tips when things go wrong

  • Multiple Fallbacks - If one approach fails, it tries others automatically

  • Built-in Edge Functions - Local Node.js serverless handler for testing

  • Enhanced SQL - Client-side aggregation when raw SQL isn't available

  • TypeScript - Fully typed for better development experience

Quick Start

1. Install Dependencies

npm install

2. Build the Project

npm run build

3. Configure Claude Desktop

Copy mcp.json.example to your Claude Desktop config and update it:

{
  "mcpServers": {
    "supabase": {
      "command": "node",
      "args": ["/path/to/self-hosted-supabase-mcp/dist/index.js"],
      "env": {
        "SUPABASE_URL": "http://localhost:54321",
        "SUPABASE_ANON_KEY": "your_anon_key_here",
        "SUPABASE_SERVICE_ROLE_KEY": "your_service_role_key_here"
      }
    }
  }
}

4. Restart Claude Desktop

And you're good to go! Claude will now have access to all 42 Supabase tools.

Available Tools

Connection & Auth (5 tools)

  • connection_test - Test your Supabase connection

  • auth_signup - Register new users

  • auth_login - Authenticate users

  • auth_get_user - Get current user info

  • auth_logout - Sign out users

Database Operations (6 tools)

  • db_select - Query data with filters and sorting

  • db_insert - Insert new records

  • db_update - Update existing records

  • db_delete - Delete records

  • db_upsert - Insert or update (with conflict handling)

  • db_count - Count records with filters

Schema Exploration (3 tools)

  • schema_get_tables - List all tables

  • schema_get_columns - Get column information

  • schema_get_relations - Explore foreign key relationships

Storage Management (6 tools)

  • storage_list_buckets - List storage buckets

  • storage_create_bucket - Create new buckets

  • storage_delete_bucket - Remove buckets

  • storage_list_files - Browse files

  • storage_upload_file - Upload files (base64)

  • storage_download_file - Download files

  • storage_delete_file - Remove files

  • storage_get_public_url - Get public file URLs

Edge Functions (4 tools)

  • edge_list_functions - List deployed functions

  • edge_deploy_function - Deploy new functions

  • edge_invoke_function - Execute functions

  • edge_remove_function - Clean up functions

Realtime (3 tools)

  • realtime_subscribe - Listen to database changes

  • realtime_channel_create - Set up broadcast channels

  • realtime_broadcast - Send messages to channels

SQL & Advanced Queries (6 tools)

  • sql_execute - Run SQL queries with smart parsing

  • sql_call_rpc - Execute stored procedures

  • sql_aggregate - COUNT, SUM, AVG, MIN, MAX operations

  • sql_execute_raw - Raw SQL with multiple fallback methods

  • sql_aggregate_enhanced - Advanced aggregation with client-side processing

  • sql_analyze_table - Get detailed table statistics

Security & RLS (6 tools)

  • security_check_rls_status - Check Row Level Security status

  • security_enable_rls - Enable RLS on tables

  • security_disable_rls - Disable RLS

  • security_create_policy - Create RLS policies

  • security_list_policies - List existing policies

  • security_drop_policy - Remove policies

  • security_test_policy - Test policy effectiveness

What Makes This Different?

Most MCP servers for databases are pretty basic. This one is different because:

  1. It actually works with self-hosted Supabase - Many tools assume cloud Supabase

  2. Comprehensive coverage - 42 tools covering every major Supabase feature

  3. Smart fallbacks - If the direct approach fails, it tries other methods

  4. Built-in edge functions - Local Node.js serverless handler for testing

  5. Real troubleshooting help - When something breaks, it tells you how to fix it

Configuration Options

You can customize the server through environment variables:

  • SUPABASE_URL - Your Supabase instance URL

  • SUPABASE_ANON_KEY - Anonymous/public key

  • SUPABASE_SERVICE_ROLE_KEY - Service role key (for admin operations)

  • MCP_SERVER_NAME - Custom server name (default: "supabase-mcp-server")

  • MCP_SERVER_VERSION - Custom version (default: "1.0.0")

Development

# Install dependencies
npm install

# Build for production
npm run build

# Development mode (watch for changes)
npm run dev

# Clean build artifacts
npm run clean

Troubleshooting

Connection Issues

  • Make sure your Supabase instance is running

  • Check if the URL and keys are correct

  • Verify network connectivity to your Supabase instance

Authentication Problems

  • Email confirmation might be enabled but SMTP not configured

  • Try disabling email confirmation in Supabase Dashboard

  • Check if the user already exists

SQL/Database Issues

  • Some advanced SQL features require service role key

  • RLS policies might be blocking access

  • Use db_select instead of raw SQL for better compatibility

Contributing

Found a bug or want to add a feature? Feel free to open an issue or PR! This started as a personal project, but I'm happy to collaborate.

License

MIT - Use it however you want!

Why I Built This

I was getting frustrated with the limited Supabase integrations available for Claude, especially for self-hosted instances. Wanted something comprehensive that could handle everything I throw at it. Hope it helps you too!


Available Tools

42 tools
auth_get_userA

Get current authenticated user information

Inputs: no named parameters.

auth_loginC

Login user with email and password

Inputs: email (required), password (required).

auth_logoutA

Logout current user

Inputs: no named parameters.

auth_signupB

Register a new user with email and password

Inputs: email (required), password (required), options.

connection_testB

Test connection to Supabase database and get basic info

Inputs: no named parameters.

db_countA

Count rows in a table with optional filters

Inputs: table (required), filters.

db_deleteB

Delete rows from a table

Inputs: table (required), filters (required), returning.

db_insertB

Insert new row(s) into a table

Inputs: data (required), table (required), returning.

db_selectA

Select data from a table with optional filters and sorting

Inputs: table (required), limit, order, offset, +3 more.

db_updateB

Update existing rows in a table

Inputs: data (required), table (required), filters (required), returning.

db_upsertB

Insert or update rows (upsert) in a table

Inputs: data (required), table (required), returning, on_conflict.

edge_deploy_functionC

Deploy an Edge Function to Supabase

Inputs: function_code (required), function_name (required), import_map.

edge_invoke_functionC

Invoke a Supabase Edge Function

Inputs: function_name (required), headers, payload.

edge_list_functionsA

List available Edge Functions

Inputs: no named parameters.

edge_remove_functionA

Remove an Edge Function from local serverless handler

Inputs: function_name (required).

realtime_broadcastB

Broadcast a message to a channel

Inputs: event (required), payload (required), channel_name (required).

realtime_channel_createC

Create a real-time channel for broadcasting

Inputs: channel_name (required).

realtime_subscribeC

Subscribe to real-time changes on a table

Inputs: table (required), event, filter.

schema_get_columnsB

Get columns information for a specific table

Inputs: table_name (required), schema.

schema_get_relationsA

Get foreign key relationships for a table

Inputs: table_name (required), schema.

schema_get_tablesB

Get list of all tables in the database schema

Inputs: schema.

security_check_rls_statusC

Check RLS status for tables

Inputs: table_name.

security_create_policyB

Create a Row Level Security policy

Inputs: command (required), table_name (required), policy_name (required), roles, +2 more.

security_disable_rlsB

Disable Row Level Security (RLS) on a table

Inputs: table_name (required).

security_drop_policyB

Drop a Row Level Security policy

Inputs: table_name (required), policy_name (required).

security_enable_rlsB

Enable Row Level Security (RLS) on a table

Inputs: table_name (required).

security_list_policiesB

List all policies for a table

Inputs: table_name (required).

security_test_policyB

Test a policy by simulating different user contexts

Inputs: table_name (required), test_query (required), user_context.

sql_aggregateC

Execute SQL aggregate functions (COUNT, SUM, AVG, MIN, MAX)

Inputs: table (required), function (required), column, filters, +1 more.

sql_aggregate_enhancedB

Execute aggregate functions using raw SQL (bypasses Supabase client limitations)

Inputs: table (required), function (required), column, filters, +1 more.

sql_analyze_tableC

Get detailed table analysis including statistics

Inputs: table_name (required).

sql_call_rpcC

Call a stored procedure/function

Inputs: function_name (required), params.

sql_executeC

Execute raw SQL query (use with caution)

Inputs: query (required), params.

sql_execute_rawC

Execute raw SQL with enhanced error handling and result formatting

Inputs: query (required), params.

storage_create_bucketB

Create a new storage bucket

Inputs: name (required), public.

storage_delete_bucketB

Delete a storage bucket

Inputs: name (required).

storage_delete_fileB

Delete a file from storage

Inputs: paths (required), bucket (required).

storage_download_fileB

Download a file from storage

Inputs: path (required), bucket (required).

storage_get_public_urlB

Get public URL for a file

Inputs: path (required), bucket (required).

storage_list_bucketsA

List all storage buckets

Inputs: no named parameters.

storage_list_filesC

List files in a storage bucket

Inputs: bucket (required), path, limit.

storage_upload_fileB

Upload a file to storage (base64 encoded)

Inputs: path (required), bucket (required), file_base64 (required), content_type.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 42 tools

    Disambiguation2/5

    Several SQL tools have overlapping purposes: sql_execute, sql_execute_raw, and sql_aggregate_enhanced all essentially execute raw SQL with minor differences, making it unclear when to choose one over the other. The descriptions attempt to differentiate them but the boundaries are still fuzzy.

    Naming Consistency4/5

    Most tools follow a domain_prefix_verb_noun pattern (e.g., db_select, storage_upload_file, edge_invoke_function), which is consistent. Minor deviations exist such as sql_aggregate_enhanced and sql_execute_raw, where suffixes break the standard verb_noun order, but the overall naming is clear.

    Tool Count2/5

    With 42 tools, the server feels bloated, particularly due to redundant SQL tools (sql_execute, sql_execute_raw, sql_aggregate, sql_aggregate_enhanced) that inflate the count. While Supabase has a broad feature set, this could be consolidated to around 25-30 tools without losing functionality.

    Completeness4/5

    The tool set covers major Supabase areas: database CRUD, auth basics, realtime, storage, edge functions, and security. However, notable gaps exist in auth user management (e.g., listing users, updating user metadata) and schema modification (no create/alter table tools, rely on raw SQL). These are workable via sql_execute, so the impact is moderate.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables comprehensive management of self-hosted or cloud Supabase instances with 54+ tools for database operations, authentication, storage, real-time subscriptions, migrations, and monitoring through MCP protocol.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects AI assistants to Supabase projects, enabling them to manage tables, query data, deploy Edge Functions, handle migrations, and access project resources through natural language commands.
      Apache 2.0
    • A
      license
      C
      quality
      D
      maintenance
      Enables comprehensive management of self-hosted Supabase instances on Coolify, including database migrations, edge functions deployment, storage management, auth configuration, and full application lifecycle control through AI agents.
      56
      12 npm
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects AI assistants to Supabase projects to manage databases, execute SQL queries, and handle project configurations. It enables tasks like table management, edge function deployment, and log retrieval through the Model Context Protocol.
      Apache 2.0