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

# Manage Supabase Projects With AI Agents

> Let agents manage Supabase projects, run SQL, and inspect edge functions and storage through the Management API, with OAuth tokens the agent never sees.

## Overview

Buckle connects AI agents to Supabase through OAuth. Agents can manage projects, run database queries, view edge functions, manage storage buckets, and access auth configuration. The gateway injects OAuth credentials into requests to the Supabase Management API automatically.

## What you will set up

* A Supabase connection through OAuth
* Automatic token injection on Management API requests
* Per-agent, per-tool access, such as approval before running SQL

## Setup

**1. Open the app**

Open the Buckle dashboard and navigate to **Settings** > **Apps** > **Supabase**.

**2. Authorize**

Click **Connect Supabase**. You'll be redirected to Supabase to authorize Buckle. Review the permissions and click **Authorize**.

![Buckle connect window for Supabase on Cloud, showing the Connect to Supabase button.](https://mintcdn.com/onecli-17d3f772/h1DTAVlDkLshz4JZ/images/integrations/supabase/buckle-connect-supabase.png?fit=max\&auto=format\&n=h1DTAVlDkLshz4JZ\&q=85\&s=043f9a3e2958fcc4084cb17389e56421)

The Supabase connect window on Buckle Cloud.

**3. Verify**

After authorization, you'll be redirected back to the dashboard. The connection will show as **Connected** with your Supabase organization name.

## What agents can do

| Area | Description |
| - | - |
| **Projects** | View projects, settings, and network configuration |
| **Database (read)** | Read database config, connection pooler, and SSL settings |
| **Database (write)** | Run SQL queries, manage webhooks, and backups |
| **Auth** | View auth configuration and SSO providers |
| **Organizations** | View organization metadata and members |
| **Storage** | List and view storage buckets |
| **Edge Functions** | List and view edge functions |
| **Secrets** | View API keys and project secrets |

## Use cases

* Database management agents that run SQL queries and manage schemas
* Infrastructure agents that provision and configure Supabase projects
* Monitoring agents that check database health and connection pool status
* Agents that manage storage buckets and edge function deployments

## Self-hosted: use your own Supabase OAuth app

> [!NOTE]
>
> **Skip this section on Buckle Cloud.** It's only for self-hosted Buckle without `SUPABASE_CLIENT_ID` and `SUPABASE_CLIENT_SECRET` set, or if you want your own company name on Supabase's consent screen.

> [accordion] 1. Create the OAuth app
>
> In the [Supabase dashboard](https://supabase.com/dashboard), open your organization's **Settings** > **OAuth Apps** and select **Add application**. Name it and enter your website URL.
>
> ![Supabase Create OAuth application form with the name Buckle, website https://buckle.example.com, and the callback URL https://buckle.example.com/v1/apps/supabase/callback.](https://mintcdn.com/onecli-17d3f772/h1DTAVlDkLshz4JZ/images/integrations/supabase/01-provider-setup.png?fit=max\&auto=format\&n=h1DTAVlDkLshz4JZ\&q=85\&s=c1643a121266c18d6154fc485e67d108)
>
> The new OAuth application form in Supabase, with the Buckle callback URL.

> [accordion] 2. Choose the scopes
>
> Tick the scopes your agents need. Buckle can request:
>
> `organizations:read`, `projects:read`, `database:read`, `database:write`, `auth:read`, `storage:read`, `edge_functions:read`, `secrets:read`

> [accordion] 3. Add the callback URL
>
> In Buckle, open **Settings** > **Apps** > **Supabase** > **Custom credentials** and copy the **Redirect URI**. In Supabase, paste it into **Authorization callback URLs**, and save the app.
>
> ![Buckle Custom credentials card for Supabase with the setup guide link, the Redirect URI and its copy button, and the client ID and secret fields.](https://mintcdn.com/onecli-17d3f772/h1DTAVlDkLshz4JZ/images/integrations/supabase/buckle-custom-credentials-supabase.png?fit=max\&auto=format\&n=h1DTAVlDkLshz4JZ\&q=85\&s=29bb7db752549db8d9891d494fe0c343)
>
> Copy the Redirect URI from Custom credentials in Buckle.

> [accordion] 4. Connect with your app
>
> Copy the **Client ID** and **Client secret** Supabase shows (the secret is shown once). Paste both into **Settings** > **Apps** > **Supabase** > **Custom credentials**, select **Save credentials**, then **Connect** and authorize in Supabase.

## Controlling access

Access is per agent: [grant](/docs/guides/agent-access.md) the connection to each agent that needs it, choosing per tool what runs freely, what needs human approval, and what stays blocked — a read-only agent is a single grant. Organization [rules](/docs/guides/rules.md) add guardrails on top, like rate limits and blanket blocks. Everything is checked before credential injection, so a blocked request never reaches Supabase.

## FAQ

> [accordion] Does the agent see my Supabase token?
>
> No. The token stays in Buckle, and the gateway adds it at the proxy. See [How it works](/docs/how-it-works.md).

> [accordion] Can I require approval before an agent runs SQL?
>
> Yes. Put database write tools behind approval when you [grant](/docs/guides/agent-access.md) the connection, and add [rules](/docs/guides/rules.md).

> [accordion] How do I reconnect Supabase?
>
> Open **Settings** > **Apps** > **Supabase** and connect again. Agents with access use the new connection automatically.


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