> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase

> Connect Supabase with OAuth so CloudThinker can review projects, schemas, migrations, and logs, and run changes through approvals

Connect Supabase to let CloudThinker agents review your projects, tables, migrations, branches, logs, and performance advisors, plus run SQL, apply migrations, and deploy Edge Functions through your [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md). Supabase connects with **OAuth** through Supabase's hosted MCP server (MCP is the protocol agents use to call a service's tools), so you don't create or paste an access token.

> [!WARNING]
>
> The connection reaches production projects, and Supabase's own read-only mode isn't available on it. Under the default Approval mode, AI can approve a migration, an Edge Function deploy, or a project pause on its own. Choose **Manual** before you connect an organization with production projects, so every write waits for a person. An [Ask first or Deny Rule](#write-access) adds to that once CloudThinker turns on [Rule enforcement](https://docs.cloudthinker.io/guide/approvals/rules.md#troubleshooting) for your workspace.

***

## Prerequisites

* A Supabase account that can see the organization and projects you want to investigate.
* The **Admin** role in the CloudThinker workspace, which you need to add connections. See [Roles](https://docs.cloudthinker.io/guide/security/roles.md).

***

## Setup

**1. Open the Supabase connection**

In CloudThinker, click **More → Workspace settings → Connections** in the sidebar. On the **Builtin Connections** tab, search for **Supabase** and click **Connect**.

**2. Authorize CloudThinker in Supabase**

CloudThinker opens Supabase in a new window. Sign in with the Supabase account that can access your projects, then approve access.

> [!NOTE]
>
> If Supabase asks you to pick an organization, the connection covers only that organization's projects. Pick the one that owns the projects you want agents to reach. A wrong pick shows up later as a project agents can't find.

If the window doesn't open, your browser blocked the pop-up. CloudThinker shows a dialog instead: click **Open Supabase** in it.

**3. Return to CloudThinker**

Switch back to the CloudThinker tab. If you used the **Open Supabase** dialog, it closes on its own once the connection is ready.

**Success state:** Supabase shows a **Connected** status.

**4. Run the verify prompt**

Run the [verify prompt](#verify-the-connection) to confirm the authorized account sees the projects you expect.

**Success state:** CloudThinker lists your projects, then the tables and latest migrations of the one you named.

***

## Connection details

Supabase has no fields to fill in. Supabase issues OAuth tokens during authorization and CloudThinker stores them for you.

A workspace holds one Supabase connection. To use a different Supabase account or organization, click **Disconnect** on the Supabase connection, then click **Connect** and sign in again.

***

## Required permissions

CloudThinker gets the same access as the Supabase account you authorize, across every project the authorization covers: the organization you picked during sign-in, or every project the account can see if Supabase didn't ask. Supabase's own project scoping and read-only mode aren't available on this connection. To get close, authorize with an account that belongs only to the organizations agents should reach, and use Rules to block writes.

| Agents can | Needs |
| - | - |
| List organizations and projects; read tables, extensions, migrations, branches, logs, advisors, Edge Functions, and storage buckets | Access to the project in Supabase |
| Run SQL, apply migrations, deploy Edge Functions, manage branches, pause or restore a project, change storage settings | Write access in Supabase, plus a pass through [approvals](https://docs.cloudthinker.io/guide/approvals/overview.md) |

***

## Agent capabilities

| Capability | Description |
| - | - |
| **Project discovery** | List organizations and projects, get project details, and check what a new project or branch would cost before creating one |
| **Database review** | List tables, installed Postgres extensions, and migrations |
| **Logs and advisors** | Read project logs and Supabase's performance advisors to trace errors and slow spots |
| **Branches** | List branches, and create, delete, merge, reset, or rebase one. Supabase branching needs a paid Supabase plan |
| **Edge Functions** | List and read Edge Functions, and deploy a new version |
| **Storage** | List storage buckets and read or update the storage configuration |
| **Types and keys** | Generate TypeScript types from the schema, and read the project API URL and publishable keys (including legacy `anon` keys). There's no tool to read secret or `service_role` keys. Reading keys is a read, so it never asks for approval and a Rule can't block it (see [Security](#security)) |
| **SQL and migrations** | Run a SQL query or apply a migration. CloudThinker shows the statement before it runs. |

If you decline a change, CloudThinker doesn't retry it. See [Write access](#write-access).

### Verify the connection

```text theme={null}
Check my Supabase connection: list my projects, then the tables and latest migrations in my <project-name> project
```

Replace `<project-name>` with one of your Supabase projects.

**Success state:** CloudThinker lists your projects, then the tables and latest migrations of the one you named. Name one project to keep the answer short on a large organization.

### Example prompts

```text theme={null}
Show the errors in my production Supabase project logs from the last 24 hours and what's causing them
What do the performance advisors flag on my staging project, and which fixes matter most?
Compare the tables and migrations on my staging branch with production and list what differs
```

***

## Write access

Every change an agent makes goes through your workspace's [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md) first. On the default **Auto · Rules + AI · Ask me** mode, AI judgment can let a safe change run without asking — and an Allow Rule can too, once CloudThinker turns on [Rule enforcement](https://docs.cloudthinker.io/guide/approvals/rules.md#troubleshooting) for your workspace. Choose **Manual** to approve every change yourself.

Pausing a project, deploying an Edge Function, and applying a migration to production are high-impact, so don't leave them to AI judgment. Choose **Manual** so a person approves every change. This connection has no **Allow writes** switch, so that is the control that works today.

Once CloudThinker turns on [Rule enforcement](https://docs.cloudthinker.io/guide/approvals/rules.md#troubleshooting) for your workspace, a Rule can narrow that:

* **Approve production writes with a Rule**: add an **Ask first** Rule on the Supabase connection so a person reviews every SQL statement, migration, and deploy.
* **Make it effectively read-only**: add a **Deny** Rule on the Supabase connection that covers every operation. Every statement through the SQL tool counts as a change, a `SELECT` included, so Deny stops all SQL. Listing projects and tables, extensions, migrations, logs, advisors, Edge Functions, storage buckets, and keys keep working.

To build either Rule once enforcement is on:

**1. Ask for the Rule**

In a chat, type `/create-policy Ask first for every write on the Supabase connection`. To block instead, ask for a **Deny** Rule.

**2. Check the proposal**

Open **Approvals** in the sidebar, then **Rules → Needs review**, and open the Rule. Check that **Effect** is **Ask first** (or **Deny**), the Rule carries the **Every operation** badge, and **Connections** names your Supabase connection. **What would change** should show recent Supabase writes as asking first (or refused).

**3. Accept it**

Select the Rule and click **Accept**.

**Success state:** a toast confirms the accepted Rule, and it moves to the **Active** tab.

***

## Troubleshooting

> [accordion] The authorization window closes but Supabase never shows Connected
>
> Your browser may be signed in to a different Supabase account, or the pop-up was blocked. Sign in to the right account in the same browser, then click **Connect** again.

> [accordion] Agents can't find a project you expect
>
> You authorized a Supabase account without access to that project, or the project is in another organization. Click **Disconnect**, then **Connect** with an account that can see it.

> [accordion] 401 errors or an error status after it worked before
>
> The OAuth authorization expired or was revoked in Supabase. Click **Connect** in the error alert on the connection to authorize again.

> [accordion] A SQL statement or migration fails on a paused project
>
> On the free plan, Supabase pauses a project after about 7 days of inactivity, and a paused project answers no SQL. Restore it in the Supabase dashboard, or ask CloudThinker to restore it (that's a change, so it goes through approvals), then run the statement again.

> [accordion] Permission denied on the auth or storage schema
>
> Supabase manages the `auth` and `storage` schemas itself, so a statement that alters their tables can fail with `permission denied`. Put your own tables and functions in `public` or a schema you create.

***

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **No read-only mode on this connection**: Supabase does ship a read-only mode and per-project scoping, but this connection doesn't offer them, and it has no **Allow writes** switch, so the read-only advice above can't apply. Choose **Manual** instead, so a person approves every change, and add an **Ask first** or **Deny** Rule once Rule enforcement is on (see [Write access](#write-access)).
- **Reach**: the connection reaches every project the authorization covers (see [Required permissions](#required-permissions)), including production. Your Supabase memberships are the real boundary.
- **Data path**: agents call Supabase's hosted MCP server at `https://mcp.supabase.com/mcp`. SQL, logs, and other results pass through it and show in the chat, so they're kept with the conversation. Logs can hold personal data, so ask for the narrowest window you need. CloudThinker stores the OAuth tokens.
- **Cutting access**: click **Disconnect** on the Supabase connection. If the grant is revoked on the Supabase side instead, the connection shows an error until someone authorizes again.
- **Keys in answers**: agents can read a project's publishable keys and logs, and an app can print secrets into its own logs. Treat those answers as sensitive.

***

## Related

> [card] [Neon Connection](https://docs.cloudthinker.io/guide/connections/neon.md)
>
> OAuth-connected serverless Postgres

> [card] [PostgreSQL Connection](https://docs.cloudthinker.io/guide/connections/postgresql.md)
>
> Connect any Postgres database directly

> [card] [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md)
>
> Decide which changes run on their own and which wait for you


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.