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

# Supabase

> Connect AI agents to Supabase for database management, project creation, and serverless backend automation

> [!NOTE]
>
> **Prerequisites**
> Before you begin, [create an account](https://www.klavis.ai/home/api-keys) and get your API Key.

## Getting started

Connect to Supabase to manage database projects, execute SQL queries, handle migrations, and automate backend development workflows through AI agents.

> [tab] API
>
> **1. Install the SDKs (optional)**
>
> ```bash pip theme={null}
> pip install klavis
> ```
>
> ```bash npm theme={null}
> npm install klavis
> ```
>
> **2. Create a Strata MCP Server with Supabase**
>
> ```python Python theme={null}
> from klavis import Klavis
> from klavis.types import McpServerName
>
> klavis_client = Klavis(api_key="YOUR_API_KEY")
>
> response = klavis_client.mcp_server.create_strata_server(
>     servers=[McpServerName.SUPABASE],
>     user_id="user123"
> )
> ```
>
> ```typescript TypeScript theme={null}
> import { KlavisClient, Klavis } from 'klavis';
>
> const klavis = new KlavisClient({ apiKey: process.env.KLAVIS_API_KEY! });
>
> // Create a Strata MCP server with Supabase
> const response = await klavis.mcpServer.createStrataServer({
>     servers: [Klavis.McpServerName.Supabase],
>     userId: "user123"
> });
> ```
>
> ```bash cURL theme={null}
> curl -X POST "https://api.klavis.ai/mcp-server/strata/create" \
>   -H "Authorization: Bearer YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "servers": ["Supabase"],
>     "userId": "user123"
>   }'
> ```
>
> > [!TIP]
> >
> > `userId` specifies whose connected accounts and data you are accessing in Klavis. It should be a unique id for yourself, your team, or your organization.
>
> > [card] [API Reference](https://www.klavis.ai/docs/api-reference/strata/create.md)
> >
> > Full Strata API endpoints
>
> **3. Authenticate**
>
> > [tab] OAuth (Recommended)
> >
> > ```python Python theme={null}
> > import webbrowser
> >
> > # Open OAuth authorization page
> > webbrowser.open(response.oauth_urls[McpServerName.SUPABASE])
> > ```
> >
> > ```typescript TypeScript theme={null}
> > import open from 'open';
> >
> > // Open OAuth authorization page
> > await open(response.oauthUrls[Klavis.McpServerName.Supabase]);
> > ```
> >
> > ```bash cURL theme={null}
> > # Copy and paste the OAuth URL into your browser
> > echo "Visit this URL to authorize: https://api.klavis.ai/oauth/supabase/authorize?instance_id=YOUR_INSTANCE_ID"
> > ```
>
> > [tab] API Key
> >
> > ```python Python theme={null}
> > from klavis import Klavis
> >
> > klavis_client = Klavis(api_key="YOUR_KLAVIS_API_KEY")
> >
> > # Set the Supabase access token
> > response = klavis_client.mcp_server.set_instance_auth(
> >     instance_id="YOUR_INSTANCE_ID",
> >     auth_data={
> >         "token": "YOUR_SUPABASE_ACCESS_TOKEN"
> >     }
> > )
> > ```
> >
> > ```typescript TypeScript theme={null}
> > import { KlavisClient } from 'klavis';
> >
> > const klavis = new KlavisClient({ apiKey: 'YOUR_KLAVIS_API_KEY' });
> >
> > // Set the Supabase access token
> > const response = await klavis.mcpServer.setInstanceAuth({
> >     instanceId: "YOUR_INSTANCE_ID",
> >     authData: {
> >         token: "YOUR_SUPABASE_ACCESS_TOKEN"
> >     }
> > });
> > ```
> >
> > ```bash cURL theme={null}
> > curl -X POST "https://api.klavis.ai/mcp-server/instance/set-auth" \
> >   -H "Authorization: Bearer YOUR_KLAVIS_API_KEY" \
> >   -H "Content-Type: application/json" \
> >   -d '{
> >     "instanceId": "YOUR_INSTANCE_ID",
> >     "authData": {
> >       "token": "YOUR_SUPABASE_ACCESS_TOKEN"
> >     }
> >   }'
> > ```
> >
> > > [!NOTE]
> > >
> > > Get your Supabase access token from [Supabase Dashboard Account Tokens](https://supabase.com/dashboard/account/tokens).
>
> > [!TIP]
> >
> > Your Supabase MCP Server is ready! Once authentication is complete, you can use your MCP server URL with any MCP-compatible client.

> [tab] UI
>
> **1. Open Dashboard**
>
> Go to your [Dashboard](https://www.klavis.ai/home/mcp-servers).
>
> **2. Choose Supabase**
>
> Select Supabase from the list of available integrations.
>
> **3. Authenticate**
>
> Complete the OAuth flow to connect your Supabase account.
>
> **4. Use in your app**
>
> Copy the MCP endpoint URL and add it to your MCP-supported client (Claude Desktop, Cursor, VS Code, etc.).

> [tab] Open Source
>
> **1. Clone repository (for developers to build from source)**
>
> ```bash theme={null}
> git clone https://github.com/klavis-ai/klavis
> cd klavis/mcp_servers/supabase
> ```
>
> **2. Run with Docker**
>
> ```bash theme={null}
> # Pull the Docker image
> docker pull ghcr.io/klavis-ai/supabase-mcp-server:latest
>
> # Run with OAuth support (requires Klavis API key)
> docker run -p 5000:5000 \
>   -e KLAVIS_API_KEY=$KLAVIS_API_KEY \
>   ghcr.io/klavis-ai/supabase-mcp-server:latest
> ```
>
> **3. Configure MCP client**
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "supabase": {
>       "url": "http://localhost:5000/mcp/"
>     }
>   }
> }
> ```

### Video Tutorial

[YouTube video player](https://www.youtube.com/embed/K7NnYbEhmyM)

## Available Tools

> [!TIP]
>
> With our progressive discovery approach, Klavis System is capable of enabling all tools for Supabase. Please use the [get\_tools](https://www.klavis.ai/docs/api-reference/mcp-server/get-tools.md) API for more details. If you find any tool that is missing, please reach out to [contact@klavis.ai](mailto:contact@klavis.ai).

## Next Steps

> [card] [White-label Authentication](https://www.klavis.ai/docs/auth/white-label.md)
>
> Customize OAuth flows with your own branding

> [card] [AI Platform Integrations](https://www.klavis.ai/docs/ai-platform-integration/overview.md)
>
> Integrate Klavis MCP Servers with leading AI platforms

> [card] [Integrations](https://www.klavis.ai/docs/mcp-server/overview.md)
>
> Explore available MCP servers

> [card] [API Reference](https://www.klavis.ai/docs/api-reference/introduction)
>
> REST endpoints and schemas


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