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
| Tool | What it does |
|---|---|
| list_tables | List tables, columns, and relationships in the database |
| execute_sql | Run a SQL query against the project's Postgres database |
| apply_migration | Apply a DDL migration to the database |
| list_branches | List development branches for the project |
| create_branch | Create a new development branch |
| get_logs | Fetch logs for the project (API, Postgres, auth, etc.) |
| generate_typescript_types | Generate TypeScript types from the current schema |
Connect the Supabase MCP server
Connect Supabase MCP to Cursor
- 1
Create a token
In the Supabase dashboard, generate a personal access token under Account → Access Tokens.
- 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
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
Add the server
Run `claude mcp add supabase -- npx -y @supabase/mcp-server-supabase@latest --project-ref=<ref>` with `SUPABASE_ACCESS_TOKEN` set.
- 2
Confirm
Ask Claude to "list my Supabase tables" to verify the connection.
Sample use cases
An agent monitors new user signups in the Supabase auth table and triggers a personalized onboarding email sequence
Every new user gets a tailored welcome flow without manual intervention.
A scheduled agent queries the database for usage metrics and posts a daily product health summary to Slack
The team sees key product metrics every morning without writing SQL manually.
An agent listens for database webhook events and updates a real-time analytics dashboard when key tables change
Dashboards stay current without polling or scheduled refreshes.
A data cleanup agent identifies and merges duplicate records across user and contact tables
Cleaner data with less manual deduplication effort.
An agent backs up critical tables to cloud storage on a nightly schedule and verifies row counts
Reliable backups with automated integrity checks.
A content agent stores and retrieves vector embeddings in Supabase for semantic search across a knowledge base
AI-powered search over internal documents using Supabase as the vector store.
An agent manages row-level security policies by updating user roles and permissions based on HR system changes
Access controls stay in sync with organizational changes automatically.
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.
Further reading: our Supabase MCP setup guide walks through server options, client configuration, and the security practices that matter.
Frequently asked questions
What database operations can the Supabase MCP server perform?
The server exposes tools for querying tables, inserting and updating rows, managing schemas, and interacting with Supabase Auth, Storage, and Edge Functions. Agents can run SQL queries and use the Supabase client API.
Does the Supabase MCP server support real-time subscriptions?
The MCP server provides read and write access to Supabase data. For real-time event handling, agents typically use Supabase webhooks or database triggers that invoke the agent on changes.
Can agents use Supabase vector search through MCP?
Yes. Supabase supports pgvector for vector similarity search. Agents can store embeddings and run semantic queries directly through the database tools exposed by the MCP server.
Is the Supabase MCP server suitable for production applications?
Yes. Supabase is built on PostgreSQL and designed for production workloads. The MCP server inherits these capabilities, making it suitable for automated data pipelines, user management, and application backend operations.