← All posts

Supabase MCP: Let Claude Manage Your Database

Stop switching between Claude and the Supabase dashboard. Supabase MCP lets you execute queries, design schemas, and deploy Edge Functions from chat.

Sup

The Problem

You’re building with Supabase. Claude generates a database schema. You copy it. You tab over to the Supabase dashboard, open the SQL editor, paste it in, hit run. You tab back to Claude. “Done, what’s next?”

Fifteen times a day.

Or Claude writes a query but you’re not sure if the table name is right. Dashboard tab. Check the schema. Back to Claude. “Actually, it’s users_profile not user_profiles.”

Or you need Edge Function logs while debugging. Another tab. Another context switch.

Context switching between Claude and Supabase dashboard wastes maybe 15-20% of your development time. Doesn’t sound like much until you realize that’s 2-3 hours a week.


The Solution: Supabase MCP

Supabase MCP is an MCP server that connects Claude directly to your Supabase project. Execute SQL. Design schemas. Check Edge Functions. Deploy migrations. All from chat. No tab switching.

What It Actually Does

Execute SQL Queries

You: "Get the last 10 users and their total orders"
Claude: Writes the query, executes it, shows results
Result: SQL + data, ready to use

Generate & Apply Migrations

You: "Create a comments table with users relationship"
Claude: Generates migration, applies it, confirms schema
Result: Table exists, no manual dashboard steps

Check Edge Function Logs

You: "Why is my auth function failing?"
Claude: Fetches logs, finds the error, suggests fixes
Result: Debugging happens in chat

Manage Database Secrets

You: "Set up Stripe API key for webhooks"
Claude: Creates/updates the secret in your environment
Result: Done, no dashboard needed

Deploy Functions

You: "Deploy this function"
Claude: Deploys to Supabase, returns URL
Result: Function is live

The Real Impact

I tested this with a developer building a SaaS product. Normal workflow:

  1. Ask Claude for a feature
  2. Claude writes code
  3. Tab to Supabase dashboard
  4. Copy-paste schema
  5. Execute query
  6. Tab back
  7. Continue building

With Supabase MCP:

  1. Ask Claude for a feature
  2. Claude writes code AND schema AND executes everything
  3. Continue building

Workflow goes from 5 minutes per feature to 2 minutes. That’s not just faster—it’s a different experience. You’re actually building in Claude now, not using it as a code suggester.


How to Set It Up

Installation (2 minutes)

Claude Desktop:

  1. Install Supabase MCP:
npm install -g supabase-mcp
  1. Add to ~/.claude/mcp.json:
{
  "mcpServers": {
    "supabase": {
      "command": "supabase-mcp",
      "args": [],
      "env": {
        "SUPABASE_URL": "https://your-project.supabase.co",
        "SUPABASE_API_KEY": "your-service-role-key"
      }
    }
  }
}
  1. Restart Claude. Done.

Cursor / VS Code:

Same JSON, different file. For Cursor, add to .cursor/mcp.json in your project root.

Configuration

Restrict to Read-Only (Safer):

{
  "env": {
    "SUPABASE_READONLY": "true"
  }
}

Claude can read everything but can’t execute writes. Good for learning.

Scope to One Database:

{
  "env": {
    "SUPABASE_DATABASE": "public"
  }
}

Limits Claude to one database. Good for shared projects.


Real Examples

Example 1: Building a Comments Feature

You: “Add a comments feature. Users can comment on posts. Show me the schema.”

Claude:

  1. Creates migration for comments table
  2. Adds foreign keys to users and posts
  3. Creates indexes on post_id and created_at
  4. Executes the migration
  5. Returns the schema

Result: Schema is live, no manual steps.

Example 2: Debugging a Query

You: “Why are comments not showing? Users have commented.”

Claude:

  1. Executes SELECT * FROM comments WHERE post_id = 123
  2. Executes SELECT * FROM posts WHERE id = 123
  3. Checks the relationship
  4. Spots the issue: user_id is NULL
  5. Suggests a WHERE clause to filter

Result: Bug identified in seconds, no dashboard needed.

Example 3: Setting Up Webhooks

You: “Create a webhook for Stripe events. I’ll handle the function logic.”

Claude:

  1. Creates Edge Function stub
  2. Sets up STRIPE_SECRET_KEY in environment
  3. Shows you the webhook URL
  4. Returns code to handle events

Result: Infrastructure is ready, you write business logic.

I don't speak any language, this is good


What You Actually Need

Supabase API Key - Get from Settings → API. Use the service role key (has full permissions).

Project URL - From Settings → API, copy the URL.

Permissions - Your API key needs:

  • SQL execution (query tool)
  • Schema inspection (introspect tool)
  • Edge Function deployment (deploy tool)

Service role key has all of these by default.

Security Note: Don’t commit your API key. Use .env files or environment variables. The MCP server reads from env, not from code.


When This Actually Helps

Building Fast

  • Iterating on schema? Don’t context switch. Ask Claude to modify the table and it’s done.
  • Testing queries? Try variations in chat instead of dashboard SQL editor.

Learning Supabase

  • New to Postgres? Ask Claude for examples, have it execute them, see results immediately.
  • Don’t know if a query is correct? Claude writes it, executes it, shows you what worked.

Debugging

Show me the data

  • “Show me the last 10 errors from my function”
  • “What’s in the audit log for this user?”
  • “Are there orphaned records?”

All answerable without leaving chat.

Team Collaboration

  • Pair with a teammate in Claude? Share the chat and they see actual results.
  • No “wait, what’s the schema?” questions. Claude knows it in real-time.

The Gotchas

It’s SQL, not magic - Claude still writes SQL queries. They can be slow or wrong. Read-only mode is great for learning.

Secrets aren’t visible - Claude can’t read your STRIPE_KEY from the dashboard, but it can set/update them. If you need to retrieve secrets, you’ll still use the dashboard.

Cascading deletes are real - Claude can delete data. Always use read-only until you’re comfortable.

Rate limits apply - Supabase has rate limits. Don’t ask Claude to run 1000 queries in a loop. It’s still Supabase underneath.

It’s not a debugger - For complex issues, you’ll still need the Supabase dashboard. This is for speed, not replacing all tools.


The Bottom Line

Supabase MCP removes friction from database development. You stay in Claude. You write features faster. You context switch less.

Is it essential? No. Do you need it to build with Supabase? No. But if you spend 20% of your time tab-switching, this saves you hours per week.

For builders who live in Claude (which is increasingly everyone), Supabase MCP makes Supabase feel like a native part of your workflow instead of a separate tool you have to manage.

Try it for one feature. If you like staying in chat, keep it. If you prefer the dashboard, you can turn it off.


Get Started: