Supabase with MCP Server

Learn how to connect your AI tools to Supabase using the Model Context Protocol (MCP) for enhanced development workflow.

What is the Model Context Protocol (MCP)?

The Model Context Protocol is a powerful standard that enables Large Language Models (LLMs) to interact with platforms like Supabase. This protocol creates a bridge between AI tools and your Supabase projects, allowing AI assistants to query and manage your database directly.

Benefits of Using MCP

  • Seamless integration with AI tools
  • Enhanced development workflow with AI assistance

Setting Up MCP with Supabase

Step 1: Create a Personal Access Token

First, you'll need to create a personal access token in your Supabase settings:

  1. Navigate to your Supabase dashboard
  2. Go to Settings
  3. Create a new personal access token
  4. Give it a descriptive name (e.g. "Cursor MCP Server")

Step 2: Configure Your AI Tool

The configuration process varies slightly depending on your chosen AI tool. Here's an example configuration for Cursor:

{
  "mcpServers": {
    "supabase": {
      "command": "npx",
      "args": [
        "-y",
        "@supabase/mcp-server-supabase@latest",
        "--access-token",
        "<personal-access-token>"
      ]
    }
  }
}

Tools

The following tools are available to the MCP server. You can use them to manage your Supabase projects and database.

CategoryCommandDescription
Project Managementlist_projectsLists all Supabase projects for the user.
get_projectGets details for a project.
create_projectCreates a new Supabase project.
pause_projectPauses a project.
restore_projectRestores a project.
list_organizationsLists all organizations that the user is a member of.
get_organizationGets details for an organization.
Database Operationslist_tablesLists all tables within the specified schemas.
list_extensionsLists all extensions in the database.
list_migrationsLists all migrations in the database.
apply_migrationApplies a SQL migration to the database. SQL passed to this tool will be tracked within the database, so LLMs should use this for DDL operations (schema changes).
execute_sqlExecutes raw SQL in the database. LLMs should use this for regular queries that don't change the schema.
get_logsGets logs for a Supabase project by service type (api, postgres, edge functions, auth, storage, realtime). LLMs can use this to help with debugging and monitoring service performance.
Edge Functionslist_edge_functions Lists all Edge Functions in a Supabase project.
deploy_edge_functionDeploys a new Edge Function to a Supabase project. LLMs can use this to deploy new functions or update existing ones.
Project Configurationget_project_urlGets the API URL for a project.
get_anon_keyGets the anonymous API key for a project.
Branchingcreate_branchCreates a development branch with migrations from production branch.
list_branchesLists all development branches.
delete_branchDeletes a development branch.
merge_branchMerges migrations and edge functions from a development branch to production.
reset_branchResets migrations of a development branch to a prior version.
rebase_branchRebases development branch on production to handle migration drift.
Developmentgenerate_typescript_typesGenerates TypeScript types based on the database schema. LLMs can save this to a file and use it in their code.
Costget_costGets the cost of a new project or branch for an organization.
confirm_costConfirms the user's understanding of new project or branch costs. This is required to create a new project or branch.
;