# Supabase MCP

> Supabase MCP connects your AI directly to a live PostgreSQL database instance. It lets you run complex queries, manage user accounts, and modify data structures using plain conversation. Forget writing boilerplate SQL; just tell your agent what records you need or what changes need making.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** postgresql, backend-as-a-service, database-management, api-generation, row-level-security

## Description

Need to work with a backend without leaving your chat window? This MCP gives your AI client direct access to the full power of Supabase's database infrastructure. You operate as if you were a fully privileged administrator, bypassing normal security restrictions so your agent can run any query necessary for debugging or development.

This means you don't have to copy-paste queries into a separate SQL tool every time. Instead, you speak naturally: "Find all active users who haven't logged in this month." Your AI client handles the complex database logic and returns clean results instantly. You can check user rosters by running an account list, count records with `db_count`, or even change data using functions like `db_insert` and `db_update`. When you integrate this through Vinkius, your entire team gets access to these capabilities from one spot in their preferred AI client.

## Tools

### delete_auth_user
Permanently removes an authenticated user account from the system.

### create_storage_bucket
Creates a new container in your object storage, optionally making it readable by anyone.

### delete_storage_file
Deletes specific files from a configured storage bucket using a list of paths.

### get_auth_user
Retrieves detailed profile information for one specific, known authenticated user.

### list_auth_users
Shows a complete list of all registered users within the Supabase Authentication system.

### db_count
Counts how many rows exist in any given database table, useful for simple analytics and pagination checks.

### db_delete
Permanently removes specified rows from a database table; you must specify which rows to delete.

### db_insert
Adds one or more new records into a target database table using a JSON payload.

### db_rpc
Runs custom, pre-compiled backend functions (stored procedures) in Postgres with specific arguments.

### db_select
Queries and retrieves records from any database table using advanced filtering syntax.

### db_update
Changes existing data in a specific set of rows, requiring you to target them precisely.

### list_storage_buckets
Retrieves a list of all configured object storage containers available for use.

### list_storage_files
Lists the specific files located inside a chosen storage bucket.

## Prompt Examples

**Prompt:** 
```
Verify the 'inventory_products' table sequentially effectively correctly querying all products labeled 'out-of-stock'.
```

**Response:** 
```
Confirming connections internally locally effectively...
**Records Accessed Matrix (`db_select`)**:
- Target table: `inventory_products`
- Applying filtering natively: `status=eq.out-of-stock`

Returning 12 distinct entries reliably safely. Execution successful locally.
```

**Prompt:** 
```
Trigger the custom stored procedure 'restock_items' using `db_rpc` to replenish the inventory of IDs 12 and 15 natively.
```

**Response:** 
```
Preparing RPC execution parameter payload locally...
Calling `db_rpc` mapped to 'restock_items' with arguments: `{"ids": [12, 15]}` naturally.
Response matrix from PostgreSQL indicates correct execution cleanly dynamically successfully. Items restocked securely.
```

**Prompt:** 
```
Check all registered accounts dynamically applying `list_auth_users` for recent logins natively securely.
```

**Response:** 
```
Authenticating logic cleanly verifying parameters...
**Supabase Auth Operatives Located (`list_auth_users`)**:
- 15 total authentications indexed.
- Latest user confirmed successfully natively.
Task complete organically.
```

## Capabilities

### Querying database records
Your agent can pull specific data subsets by querying any table using natural language commands.

### Modifying and adding data
You instruct the AI to insert new rows or update existing information, directly altering your database state.

### Executing custom backend logic
The AI can invoke complex pre-written PostgreSQL functions using specific procedures (RPCs).

### Managing user authentication
You audit the system by listing all registered users or fetching detailed profiles for specific accounts.

### Diagnosing file storage
The agent can list and check configurations for object storage buckets and files within them.

## Use Cases

### Auditing user access after a security incident
A DBA needs to know who accessed the system recently. They ask their agent, and it immediately runs `list_auth_users` to generate a clean roster of all active accounts for review.

### Mocking data for front-end testing
A full-stack engineer needs 50 sample records to test a new feature. They use the MCP to execute `db_select` on a staging table, pulling exactly the right amount of mock data without polluting the real database.

### Fixing product inventory in bulk
The operations team discovers 15 items are out of stock. They prompt their agent to trigger the `db_rpc` function 'restock_items' for those specific IDs, completing a critical database workflow instantly.

### Checking if file uploads worked
A developer asks the MCP to list all files in the 'profiles' storage bucket. The agent uses `list_storage_files` and confirms that all user avatars were successfully uploaded.

## Benefits

- You instantly run complex queries that would normally require writing `db_select` statements. Instead of remembering syntax, you just describe the data set you need.
- Need to make changes? You can use `db_insert`, `db_update`, or `db_delete` commands through natural language, automating tasks like adding new user records or correcting bad data entries.
- The MCP lets your agent execute custom backend code using `db_rpc`. This means you can trigger complex business logic—like restocking inventory—without ever touching a stored procedure file.
- It simplifies auditing. Use `list_auth_users` to instantly see who is logged in and check the status of every user account without navigating through multiple admin panels.
- You get full visibility over your files and structure. By running `list_storage_buckets`, you can verify that all necessary object storage areas are configured before deployment.

## How It Works

The bottom line is you get to manage complex backend operations just by talking to your AI client.

1. Enable the Supabase MCP integration in your AI client's settings.
2. Bind your specific database URL and authenticate using a powerful service role key.
3. Instruct your agent with a natural language request, such as "List all users who have paid for premium services."

## Frequently Asked Questions

**How does Supabase MCP handle authentication?**
The MCP uses a service role key to authenticate, giving your agent full database administrator privileges. This lets it bypass normal row-level security constraints when running queries.

**Can I use Supabase MCP to count rows in a table?**
Yes, you can run `db_count` to get the total number of records in any specified database table. This is useful for quick pagination checks or analytics counts.

**Is Supabase MCP safe for deleting data?**
The tools like `db_delete` and `delete_auth_user` are irreversible actions, so always confirm the target rows or users with your agent before authorizing deletion. The system is designed to alert you to these risks.

**What if I need to run a complex business process?**
Use `db_rpc` (Remote Procedure Call). This lets your agent execute pre-compiled, complex PostgreSQL functions that handle the entire logic flow for you.

**Does Supabase MCP help with file management?**
Yes. You can use `list_storage_buckets` to see all configured storage areas and `list_storage_files` to inspect what files are inside them.