supabase-mcp-server
# Supabase MCP Server
An MCP (Model Context Protocol) server that enables LLMs to interact with Supabase services including Database, Auth, Storage, and Edge Functions.
## Setup
1. Install dependencies:
```bash
npm install
```
2. Copy `.env.example` to `.env` and fill in your Supabase credentials:
```bash
cp .env.example .env
```
3. Build:
```bash
npm run build
```
4. Run:
```bash
npm start
```
## Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| `SUPABASE_URL` | Yes | Your Supabase project URL |
| `SUPABASE_SERVICE_ROLE_KEY` | Yes | Service role key (found in Project Settings > API) |
| `TRANSPORT` | No | Transport mode: `stdio` (default) or `http` |
## MCP Client Configuration
Add to your MCP client config (e.g., Claude Desktop):
```json
{
"mcpServers": {
"supabase": {
"command": "node",
"args": ["/path/to/supabase-mcp-server/dist/index.js"],
"env": {
"SUPABASE_URL": "https://your-project.supabase.co",
"SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key"
}
}
}
}
```
## Available Tools
### Database (7 tools)
- **supabase_query** - Select rows with filters, ordering, pagination
- **supabase_insert** - Insert one or more rows
- **supabase_update** - Update rows matching filters
- **supabase_delete** - Delete rows matching filters
- **supabase_upsert** - Insert or update on conflict
- **supabase_rpc** - Call a Postgres function
- **supabase_list_tables** - List tables in the database
### Auth (5 tools)
- **supabase_auth_list_users** - List users with pagination
- **supabase_auth_get_user** - Get user by ID
- **supabase_auth_create_user** - Create a new user
- **supabase_auth_update_user** - Update user details
- **supabase_auth_delete_user** - Delete a user
### Storage (8 tools)
- **supabase_storage_list_buckets** - List storage buckets
- **supabase_storage_create_bucket** - Create a bucket
- **supabase_storage_list_files** - List files in a bucket
- **supabase_storage_upload** - Upload a file (base64)
- **supabase_storage_download** - Download a file (base64)
- **supabase_storage_delete** - Delete files
- **supabase_storage_get_public_url** - Get public URL
- **supabase_storage_move** - Move/rename a file
### Edge Functions (1 tool)
- **supabase_functions_invoke** - Invoke an Edge Function
## Development
```bash
npm run dev # Run with tsx (hot reload)
npm run build # Compile TypeScript
npm start # Run compiled output
```
## Testing with MCP Inspector
```bash
npx @modelcontextprotocol/inspector node dist/index.js
```
TDQS
Scored across 21 tools
Tools are cleanly separated into database, auth, storage, and functions domains, each with distinct actions. There is no overlap; e.g., supabase_insert, supabase_update, and supabase_upsert are clearly differentiated by their descriptions.
All tool names use snake_case and follow a consistent 'supabase_' prefix. The pattern is mostly verb_noun (e.g., supabase_storage_create_bucket), but database tools like supabase_query and supabase_insert lack a domain prefix, making them slightly less consistent with the auth/storage/functions groups.
21 tools is on the heavier side, but the server covers four distinct Supabase subsystems (database, auth, storage, functions), each with a reasonable set of operations. The count is justified for the broad scope, though it approaches the upper boundary.
The tool set provides solid CRUD coverage for database rows and users, plus file operations and RPC/function invocation. Minor gaps exist, such as missing storage bucket update/delete and lack of detailed schema inspection beyond listing tables, but these are not critical for most workflows.