Skip to main content
Glama
Steph-ux

supabase

by Steph-ux
README.md
# mcp-supabase

Supabase MCP server — Postgres direct + Storage REST + Auth + Edge Functions + Management API.

## Features
- **24 tools** covering Database, Storage, Auth, Edge Functions, and Project Management
- **Direct Postgres** via `pg` pool (no Supabase JS client needed)
- **SSL support** for Supabase pooler
- **Service role key** for admin operations
- **Access token** for Management API

## Setup

```bash
cd mcp-supabase
npm install
cp .env.example .env  # Edit with your credentials
node server.cjs
```

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `DATABASE_URL` | Yes | Postgres connection string from Supabase dashboard |
| `SUPABASE_SERVICE_ROLE_KEY` | Yes | Service role key for Storage/Auth operations |
| `SUPABASE_PROJECT_REF` | Yes | Project reference ID (from dashboard URL) |
| `SUPABASE_ACCESS_TOKEN` | No | Personal access token for Management API |
| `SUPABASE_ANON_KEY` | No | Anonymous key for client-side operations |

## Tools

### Database
- `execute_sql` — Run arbitrary SQL
- `list_schemas` — List database schemas
- `list_tables` — List tables in a schema
- `get_schema` — Get table schema details
- `get_table_row_counts` — Get row counts for all tables
- `run_rpc` — Call PostgreSQL functions

### Storage
- `list_buckets` — List storage buckets
- `create_bucket` — Create a storage bucket
- `delete_bucket` — Delete a storage bucket
- `list_files` — List files in a bucket
- `upload_file` — Upload a file
- `download_file` — Download a file (base64)
- `delete_file` — Delete a file

### Auth
- `list_auth_users` — List users
- `create_auth_user` — Create a user
- `update_auth_user` — Update a user
- `delete_auth_user` — Delete a user

### Edge Functions
- `list_edge_functions` — List deployed functions
- `invoke_edge_function` — Invoke a function

### Management
- `list_projects` — List all projects
- `get_project` — Get project details

## MCP Configuration

```json
{
  "mcpServers": {
    "supabase": {
      "command": "node",
      "args": ["path/to/server.cjs"]
    }
  }
}
```

## Security Notes

- Service role key has admin access — use with caution
- Never commit `.env` or `config.json`
- Use environment variables in production