# Let Cursor manage your Supabase project

> Switching between the editor and the dashboard to check tables, logs and migrations breaks your flow.

This setup is for developers building on Supabase who keep switching to the dashboard to check tables, logs and migrations. The Supabase MCP server lets Cursor or Claude Code list tables, run SQL, read logs and draft migrations, and GitHub keeps those migrations in a reviewed branch. You end up asking database questions from the editor instead of clicking through the dashboard.

## Steps

1. **Add the Supabase MCP server**: In Cursor, open Settings > MCP and add Supabase's remote server at https://mcp.supabase.com/mcp, or run claude mcp add with the same URL in Claude Code. Sign in to Supabase in the browser window that opens and pick your organisation. Check that tools such as list_tables and execute_sql appear.
   Tip: Connect a development project, not production, the first time.
2. **Start in read-only mode**: Add read_only=true and project_ref=your-project-ref as query parameters on the server URL. Read-only mode runs SQL as a read-only Postgres user, and the project ref stops the agent from touching other projects. Ask the agent to list tables to confirm the scope.
   Tip: You find the project ref in the project's URL or under Project Settings.
3. **Ask in context**: Ask the agent to describe a table, explain a slow query, check the logs for errors, or draft a migration for a new column. It runs read queries and returns the SQL it plans for any change. Read the SQL before you apply anything.
   Tip: Ask for the advisors check to catch missing RLS policies and indexes.
4. **Commit migrations**: Save new migrations as files in supabase/migrations and ask the agent to commit them to a new branch through the GitHub MCP server or your local git. Open a pull request so someone reviews the SQL before it reaches production. Apply migrations through your normal deploy process.
   Tip: Keep the agent out of production writes; let CI or the Supabase CLI apply migrations.

## Prompts to try

- List the tables in the public schema with their row counts and RLS status.
- Why is this query on orders slow? Run EXPLAIN and suggest an index.
- Show me the last 50 error logs from the API service.
- Write a migration that adds a nullable archived_at timestamp to projects and save it in supabase/migrations.
- Check the security advisors and list tables that have RLS disabled.

## What you need

- A Supabase account and a development project
- Cursor or Claude Code
- A GitHub repository with a supabase/migrations folder
- The Supabase CLI if you apply migrations locally

## Limits

- Read-only mode blocks writes, so the agent cannot test a migration against the database for you.
- Table contents can include prompt injection text; review what the agent does after reading user data.
- The agent only sees the scoped project, not your other environments.

## Security notes

- Keep read-only mode on for production projects.
- Scope the server to a development project first.

## MCP servers

- [Supabase MCP Server](https://github.com/supabase-community/supabase-mcp): database-read, database-write, project-admin
- [GitHub MCP Server](https://github.com/github/github-mcp-server): repository-read, issue-write, pull-request-write

## FAQ

**Is it safe to connect the agent to my database?**

Supabase recommends connecting the MCP server to development projects and using read-only mode. Scope it to one project with project_ref and keep tool approvals on in Cursor.

**Which Supabase plan do I need?**

The MCP server works with free and paid Supabase projects. Features such as branching depend on your plan.

**Can the agent apply migrations?**

With read-only mode off, it has an apply_migration tool. This setup keeps it read-only and sends migrations through GitHub review instead.

**What about data in my tables?**

Query results go into the conversation and to the model provider. Use a project with test data, or avoid selecting columns with personal data.

## Tools

- **[Supabase](https://suiteintent.com/t/supabase?m=GB)**: Hosted Postgres with auth and storage. · Best for: A backend for an app you built with AI · Free plan
- **[GitHub](https://suiteintent.com/t/github?m=GB)**: Code hosting, issues and pull requests. · Best for: Teams reviewing code through pull requests · Free plan · 10000
