Supabase logo
Developer ToolsAuth: OAuthHosting: Hosted or self-hosted

Supabase MCP Server

Give your AI agents a Postgres backend — query, manage, and build on Supabase.

Updated

What is Supabase MCP?

The Supabase MCP server is a Model Context Protocol server that lets AI agents and coding assistants work directly with your Supabase projects. With it connected, an agent can run SQL queries, create and modify tables, manage database branches, read logs, and generate TypeScript types — turning Supabase into a tool the model can act on rather than something you copy schema out of.

It runs locally via npx (stdio) and authenticates with a Supabase personal access token. You can scope it to a single project and run it in read-only mode for safety.

Tools the Supabase MCP server exposes

ToolWhat it does
list_tablesList tables, columns, and relationships in the database
execute_sqlRun a SQL query against the project's Postgres database
apply_migrationApply a DDL migration to the database
list_branchesList development branches for the project
create_branchCreate a new development branch
get_logsFetch logs for the project (API, Postgres, auth, etc.)
generate_typescript_typesGenerate TypeScript types from the current schema

Connect the Supabase MCP server

Connect Supabase MCP to Cursor

  1. 1

    Create a token

    In the Supabase dashboard, generate a personal access token under Account → Access Tokens.

  2. 2

    Add to .cursor/mcp.json

    Add a `supabase` server running `npx -y @supabase/mcp-server-supabase@latest --project-ref=<ref> --read-only`, passing the token via the `SUPABASE_ACCESS_TOKEN` env var.

  3. 3

    Reload

    Reload Cursor's MCP settings and confirm the Supabase tools appear.

Start with `--read-only` and a single `--project-ref` so the agent can't touch production by accident.

Connect Supabase MCP to Claude Code

  1. 1

    Add the server

    Run `claude mcp add supabase -- npx -y @supabase/mcp-server-supabase@latest --project-ref=<ref>` with `SUPABASE_ACCESS_TOKEN` set.

  2. 2

    Confirm

    Ask Claude to "list my Supabase tables" to verify the connection.

Sample use cases

You're scaffolding a feature in Cursor

The agent inspects your schema, writes the migration, applies it to a branch, and generates matching TypeScript types.

Debugging a production error

The agent pulls Postgres and API logs through the MCP and points to the failing query.

Ad-hoc analytics question

Ask in plain English; the agent writes and runs the SQL read-only and returns the answer.

Security & permissions

The Supabase MCP server authenticates with a personal access token that you supply as an environment variable — keep it out of source control. Two flags materially reduce risk: `--read-only` restricts the agent to read queries, and `--project-ref` pins it to a single project so it can't reach the rest of your account. Supabase recommends connecting to a development project, not production, when using MCP with autonomous tools. Rotate the token from the dashboard if it leaks.

Using Supabase MCP with Gamut

On Gamut, the Supabase MCP server lets agents use your database as part of an automated, event-driven workflow. An agent can be triggered by a webhook, query Supabase for the relevant rows, enrich or transform the data using other connected MCP servers, and write results back — on a schedule or in response to events, with the connection and credentials managed by Gamut rather than living in a local config file.

Frequently asked questions

What is the Supabase MCP server?

An open-source Model Context Protocol server that connects AI agents to your Supabase projects so they can run SQL, manage schema and branches, read logs, and generate types.

Is the Supabase MCP server free?

Yes — it's free and open source. You authenticate with a Supabase personal access token and normal project limits apply.

How do I connect Supabase MCP to Cursor?

Add a `supabase` MCP server in `.cursor/mcp.json` that runs `npx @supabase/mcp-server-supabase` with your access token and `--project-ref`, ideally with `--read-only`.

Is the Supabase MCP server safe for production?

Use `--read-only` and pin `--project-ref` to a development project. Avoid pointing autonomous agents at production data.