143 lines
4.6 KiB
Markdown

# Supabase MCP Server
Complete MCP server for Supabase backend-as-a-service platform. Manage projects, databases, storage, Edge Functions, and authentication — all via AI.
## Features
- 🗄️ **Projects** - Create, list, and manage Supabase projects
- 📊 **Database** - Query tables, insert/update/delete rows, browse schemas
- 💾 **Storage** - Manage buckets and files with upload/download
-**Edge Functions** - Deploy and manage serverless Deno functions
- 🔐 **Authentication** - Configure auth providers, manage users
- 🔑 **Secrets** - Manage environment variables for Edge Functions
## Installation
```bash
npm install
npm run build
```
## Environment Variables
| Variable | Required | Description | Example |
|----------|----------|-------------|---------|
| `SUPABASE_ACCESS_TOKEN` | ✅ | Supabase Management API access token | `sbp_abc123...` |
| `SUPABASE_PROJECT_REF` | ❌ | Default project reference (optional) | `xyzabc123` |
## Getting Your Access Token
1. Log in to Supabase: https://app.supabase.com/
2. Navigate to **Account Settings** (click your avatar)
3. Go to **Access Tokens** tab
4. Click **Generate New Token**
5. Give it a name and copy the token
6. Set environment variable:
```bash
export SUPABASE_ACCESS_TOKEN='sbp_your_token_here'
```
## Required API Scopes
- **Full Management API Access** - Read/write access to all resources
## Usage
### Stdio Mode (Default)
```bash
npm start
# or
node dist/main.js
```
### With MCP Client
Add to your MCP settings:
```json
{
"mcpServers": {
"supabase": {
"command": "node",
"args": ["/path/to/servers/supabase/dist/main.js"],
"env": {
"SUPABASE_ACCESS_TOKEN": "your_token_here",
"SUPABASE_PROJECT_REF": "optional_default_project"
}
}
}
}
```
## Available Tools (30)
### Projects (5)
- `supabase_list_projects` - List all projects with status
- `supabase_get_project` - Get project details by ID
- `supabase_create_project` - Create new Supabase project
- `supabase_get_project_settings` - Get project configuration
- `supabase_delete_project` - Delete project permanently
### Database (5)
- `supabase_list_tables` - List tables in schema
- `supabase_query_table` - Query rows with filters and pagination
- `supabase_insert_rows` - Insert one or more rows
- `supabase_update_rows` - Update rows matching filters
- `supabase_delete_rows` - Delete rows matching filters
### Storage (8)
- `supabase_list_buckets` - List storage buckets
- `supabase_get_bucket` - Get bucket details
- `supabase_create_bucket` - Create new bucket (public/private)
- `supabase_upload_file` - Upload file to bucket
- `supabase_list_objects` - List files in bucket with pagination
- `supabase_delete_object` - Delete file from bucket
- `supabase_delete_bucket` - Delete bucket and all contents
### Edge Functions (4)
- `supabase_list_functions` - List Edge Functions
- `supabase_get_function` - Get function details
- `supabase_deploy_function` - Deploy or update function
- `supabase_delete_function` - Delete Edge Function
### Auth & Secrets (9)
- `supabase_get_auth_config` - Get auth configuration
- `supabase_update_auth_config` - Update auth settings
- `supabase_list_users` - List authenticated users with pagination
- `supabase_get_user` - Get user details by ID
- `supabase_delete_user` - Delete auth user
- `supabase_list_secrets` - List environment variables
- `supabase_create_secret` - Create/update secret
- `supabase_delete_secret` - Delete secret
## Coverage Manifest
**Total Supabase Management API endpoints:** ~120 (Projects, Database, Storage, Functions, Auth, Realtime, Logs)
**Tools implemented:** 30
**Coverage:** ~25%
### Intentionally Skipped:
- **Database Migrations** - Complex schema management (better via CLI/UI)
- **Realtime Channels** - WebSocket configuration (runtime feature, not management)
- **Logs & Analytics** - Log streaming and metrics (better via dashboard)
- **Database Backups** - Backup/restore management (better via UI/CLI)
- **Custom Domains** - SSL/DNS configuration (one-time setup)
- **Billing & Usage** - Subscription management (sensitive, UI-preferred)
- **Organization Members** - Team/role management (administrative UI task)
- **Network Restrictions** - IP allowlisting (security-sensitive)
Focus is on high-value development operations: project provisioning, database CRUD, storage management, function deployment, and auth configuration.
## Architecture
- **main.ts** - Entry point with env validation and graceful shutdown
- **server.ts** - MCP server class with lazy-loaded tool modules
- **tools/** - Domain-organized tool files (projects, database, storage, functions, auth)
- **client/supabase-client.ts** - Fetch-based API client
## License
MIT