Back to Blog
Guide
5 min read
April 15, 2026

How to Use Supabase MCP with Claude Code

Learn how to connect Claude Code to your Supabase project using the Supabase MCP — query data, manage tables, run migrations, and debug your backend without leaving your editor.

supabasepostgresqldatabasebackendclaude-code

What is the Supabase MCP?

The Supabase MCP connects Claude Code directly to your Supabase project, giving it read and write access to your database, edge functions, storage, and project settings. Instead of switching between your editor and the Supabase dashboard, you can query tables, run migrations, and inspect logs entirely within your Claude Code session.

Installation

mcpizy install supabase-mcp

After installation, you will be prompted to provide your Supabase project URL and service role key. These are stored securely in your MCP configuration.

Key Capabilities

  • Execute SQL queries — run arbitrary SQL against your Supabase Postgres instance and see results inline.
  • Apply migrations — create and apply schema migrations without leaving Claude Code.
  • List and inspect tables — browse your schema, column types, and foreign key relationships.
  • Fetch logs — retrieve edge function and API gateway logs to debug production issues.
  • Generate TypeScript types — auto-generate type definitions from your current schema.
  • Manage branches — create, merge, and delete database branches for safe feature development.

Example Usage

Suppose you need to add a last_seen_at column to your users table and backfill it:

-- Ask Claude to run this migration via the Supabase MCP
ALTER TABLE users ADD COLUMN last_seen_at timestamptz DEFAULT now();
UPDATE users SET last_seen_at = created_at WHERE last_seen_at IS NULL;

Claude will call the MCP's apply_migration tool, execute the SQL, and report back the number of affected rows — all without you opening a browser tab.

Tips and Best Practices

  • Always use the service role key for the MCP, not the anon key, so Claude can perform write operations.
  • Use database branches when testing destructive migrations — the MCP supports branch creation natively.
  • Combine with the Postgres MCP if you need raw psql-level access alongside Supabase's management API.
  • Keep your service role key out of version control; configure it via environment variables or MCPizy's secret store.

View on MCPizy Marketplace

Found this useful? Share it.

MCP Servers Mentioned

Supabase McpPostgresNeon
All ArticlesBrowse Marketplace