Supabase MCP Server

Supabase MCP Server Github

What is the Supabase MCP Server?

The Supabase MCP Server is a specialized tool that acts as a bridge, connecting your AI assistants directly to your Supabase projects. Built using the Model Context Protocol (MCP) standard, it allows Large Language Models (LLMs) – like those powering assistants such as Cursor, Claude, or Windsurf – to understand and interact with your Supabase environment.

Think of it as a translator that enables your AI assistant to perform tasks within your Supabase project based on your instructions. Instead of just talking about your database, the AI can actually manage tables, retrieve configuration details, query data, and much more, directly interfacing with Supabase.

How to Use the Supabase MCP Server

Setting up the Supabase MCP Server involves configuring your AI assistant (the MCP client) to use it. Here's a simplified overview:

  1. Prerequisite: Ensure you have Node.js installed on your computer. You can check this by running 'node -v' in your terminal.
  2. Get a Supabase Token: Go to your Supabase account settings and create a Personal Access Token (PAT). Name it something descriptive (e.g., "AI Assistant Access") and copy the token securely. This token allows the MCP server to authenticate with your Supabase account.
  3. Configure Your AI Assistant (MCP Client): You don't run the server directly. Instead, you tell your MCP client (like Cursor) how to start it.
  • Replace '' with the token you generated.
  • Alternatively, omit '--access-token' and set the 'SUPABASE_ACCESS_TOKEN' environment variable to keep your token out of configuration files.
  • Windows users might need to prefix the command (e.g., with 'cmd /c' or 'wsl'). Refer to the official documentation for specifics.

The 'npx' command automatically downloads and runs the latest version of the Supabase MCP Server when your AI assistant needs it.

Key Features of the Supabase MCP Server

  • Direct Supabase Integration: Enables AI assistants to interact directly with your Supabase projects.
  • MCP Standard: Uses the standardized Model Context Protocol for communication.
  • Wide Range of Tools: Allows AI to perform various tasks, including:
    • Project Management (list, get, create, pause, restore projects)
    • Database Operations (list tables/extensions/migrations, apply migrations, execute SQL)
    • Configuration Retrieval (get project URL, get API keys)
    • Branching Management (experimental feature for paid plans)
    • Development Aids (generate TypeScript types)
    • Cost Confirmation for new resources.
  • Easy Setup: Uses 'npx' for automatic download and execution via client configuration.
  • Secure Authentication: Authenticates using Supabase Personal Access Tokens.
  • Read-Only Mode: Offers an optional '--read-only' flag to restrict the AI from making database changes for added safety (primarily affects SQL execution tools).
  • Compatibility: Designed to work with various MCP clients like Cursor, Claude, and Windsurf.

User Case Example

Imagine you're a developer using Cursor (an AI code editor) integrated with the Supabase MCP Server.

  • Scenario: You need to quickly check the structure of a table and get its TypeScript definition.
  • Action: You simply ask Cursor: "Show me the tables in my 'public' schema in the 'prod-db' project, and then generate TypeScript types for the 'profiles' table."
  • Behind the Scenes:
    1. Cursor uses the Supabase MCP Server to execute the 'list_tables' tool for your specified project.
    2. It then uses the 'generate_typescript_types' tool for the 'profiles' table.
    3. The server interacts with your Supabase project (using your PAT) and returns the results.
  • Result: Cursor displays the list of tables and the generated TypeScript types directly in your editor, saving you time and context switching.

FAQ

What do I need to use the Supabase MCP Server?

You need Node.js installed on your machine and an MCP-compatible client application (like Cursor, Claude, etc.) where you can configure the server connection.

How does the server connect to my Supabase account?

It uses a Supabase Personal Access Token (PAT) that you generate in your Supabase account settings and provide during the client configuration.

Can I prevent the AI assistant from modifying my database?

Yes, you can add the '--read-only' flag when configuring the server command in your MCP client. This restricts database write operations for tools like 'execute_sql' and 'apply_migration', though it doesn't affect all tools (like project creation).

What kind of tasks can my AI assistant perform with this server?

It can perform a wide range of Supabase-related tasks defined by the available tools, including listing projects, managing tables, executing SQL queries, applying database migrations, managing project settings, handling experimental branching features, and generating type definitions.

Is the Supabase MCP Server stable?

The documentation notes that the server is currently pre-1.0, meaning there might be breaking changes between versions. However, LLMs are often able to adapt automatically to the available tools.

Visual Examples

## Demo Videos

Demo Videos