What Is Supabase MCP Server?
Supabase MCP Server is an official integration that exposes the Supabase platform as a set of MCP tools accessible to AI coding assistants. It brings the full power of Supabase — PostgreSQL, Auth, Storage, and Edge Functions — into your AI-assisted development workflow, eliminating the need to switch between your IDE and the Supabase Dashboard.
The server runs locally via npx and connects to your Supabase project using the service role key. When Claude Code or Cursor sends a request, the MCP server translates it into Supabase API calls and returns the results. This means your AI assistant can write and execute SQL queries, manage users, upload files, and invoke Edge Functions — all through natural language.
For full-stack developers building on Supabase, this integration is transformative. Instead of manually writing SQL in the dashboard, you describe what you need: "create a profiles table with RLS policies for authenticated users" or "show me all orders from the last 7 days grouped by status." The agent handles the SQL generation, execution, and result formatting.
The security model is straightforward: the service role key stays in your local environment variables and never leaves your machine. For production databases, you can use a restricted key with custom RLS policies to limit what the MCP server can access. The server itself is stateless — it makes API calls on demand and does not cache any data.
How to Calculate Better Results with supabase mcp server claude code database query review
Install with Claude Code: claude mcp add supabase -- npx @supabase/mcp-server. Set environment variables: SUPABASE_URL (your project URL) and SUPABASE_SERVICE_ROLE_KEY (from Project Settings > API).
For Cursor, add the server to .cursor/mcp.json with the same npx command and environment variables. For Codex CLI, run: codex mcp add supabase npx "@supabase/mcp-server".
Verify the connection by asking your assistant to list all tables in your database. If configured correctly, it will return your schema with table names, column types, and row counts.
Start with read-only exploration before executing write operations. Ask the agent to describe your schema, then progressively move to writes. For production databases, always review generated SQL before confirming execution.
Treat this page as a decision map. Build a shortlist fast, then run a focused second pass for security, ownership, and operational fit.
When a team keeps one shared selection rubric, tool adoption speeds up because evaluators stop debating criteria every time a new option appears.
Worked Examples
Building a new feature with database-aware AI
- Ask: "Show me the current schema for the users and orders tables"
- Agent queries information_schema via MCP and returns table structures
- Ask: "Create a new reviews table — each review belongs to a user and an order, with a rating 1-5 and text body"
- Agent generates CREATE TABLE SQL with foreign keys and constraints, executes via MCP
- Ask: "Add RLS policies so users can only read their own reviews and create reviews for their own orders"
- Agent generates and applies RLS policies
- Ask: "Insert 3 test reviews and verify the RLS works"
- Agent inserts test data and runs verification queries from different user contexts
Outcome: A complete feature database schema designed, created, secured, and tested in a single conversation — no SQL editor, no dashboard switching, no manual migration files.
Debugging a production data issue
- Ask: "A user reports their order #1234 shows wrong status — investigate"
- Agent queries the orders table for order #1234 via MCP
- Agent finds status is "pending" but payment_confirmed_at is set
- Ask: "Check the order status update Edge Function logs"
- Agent invokes the Edge Function with test data and identifies a race condition
- Ask: "Fix the status for this order and find any other affected orders"
- Agent runs UPDATE for the specific order and a diagnostic SELECT to find similar cases
Outcome: Root cause identified and data corrected in minutes, with the agent handling all database queries and Edge Function testing through natural conversation.
Frequently Asked Questions
What is the Supabase MCP Server?
Supabase MCP Server is an official Model Context Protocol integration that connects AI coding assistants to the Supabase platform. It exposes Supabase capabilities — PostgreSQL queries, authentication management, storage operations, and Edge Functions — as MCP tools that Claude Code, Cursor, and other MCP-compatible clients can invoke through natural language.
How do I connect Supabase MCP Server to Claude Code?
Run: claude mcp add supabase -- npx @supabase/mcp-server. Set your SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY environment variables. The service role key gives the server admin access to your project — use it only in local development, never in client-facing code.
Is it safe to use the service role key with MCP?
The service role key bypasses Row Level Security and has full database access. This is acceptable for local development with Claude Code because the server runs on your machine and the key never leaves your environment. For production or shared environments, use a restricted API key with custom RLS policies instead.
Can Supabase MCP Server run database migrations?
Yes. The server can execute any SQL statement including CREATE TABLE, ALTER TABLE, and migration scripts. You can ask your AI assistant to write and execute migrations, create indexes, add columns, and modify schema — all through conversation. Always review generated SQL before execution on production databases.
What Supabase features does the MCP server support?
The server supports: PostgreSQL queries (SELECT, INSERT, UPDATE, DELETE, DDL), Auth user management (list users, create users, delete users), Storage bucket operations (list buckets, upload files, generate signed URLs), Edge Function invocation, and project metadata (list tables, columns, and RLS policies). Realtime subscriptions are not supported via MCP.
How does Supabase MCP compare to writing SQL manually?
The MCP server adds contextual awareness. Instead of writing raw SQL, you describe what you want: "show me all users who signed up this week" or "add a tags column to the posts table." The AI assistant generates the correct SQL, executes it via MCP, and returns formatted results. For complex queries, the agent can iterate — running exploratory queries to understand the schema before building the final query.