Skip to main content
Glama
romankonoplinai-arch

Supabase MCP HTTP Server

README.md
# šŸš€ Supabase MCP HTTP Server

Production-ready HTTP MCP server for Supabase with **43 tools** for complete database control.

## Features

- āœ… **No hardcoded credentials** - Pass credentials per request
- āœ… **43 Supabase tools** - Complete database, storage, auth, admin control
- āœ… **HTTP API** - Ready for n8n integration
- āœ… **Railway ready** - One-click deploy
- āœ… **Production ready** - Health checks, CORS enabled

## šŸ“Š All 43 Tools

### Database (13)
- query, list_tables, get_table_schema, create_table, alter_table
- drop_table, insert_data, query_table, update_data, delete_data
- list_views, list_triggers, list_indexes

### RPC (2)
- call_rpc, list_functions

### Storage (8)
- list_buckets, create_bucket, delete_bucket, list_files
- upload_file, download_file, delete_file, get_public_url

### Auth (7)
- list_users, get_user, create_user, update_user
- delete_user, invite_user, reset_password

### Edge Functions (3)
- list_edge_functions, invoke_edge_function, get_function_logs

### Monitoring (3)
- get_table_stats, get_database_size, get_connection_info

### Admin (7)
- execute_migration, list_policies, create_policy
- list_extensions, enable_extension

## šŸš‚ Deploy to Railway

1. Push to GitHub
2. Connect Railway to your repo
3. Deploy - Railway will auto-detect Node.js app
4. Your MCP server will be available at `https://your-app.railway.app`

## šŸ”§ n8n Integration

Use in n8n AI Agent as MCP Tool:

1. Add MCP Tools node
2. Set endpoint: `https://your-app.railway.app`
3. Pass credentials in each request:
```json
{
  "supabase_url": "https://your-project.supabase.co",
  "supabase_key": "your-service-role-key"
}
```

## šŸ“” API Usage

### List Tools
```bash
curl -X POST https://your-app.railway.app/ \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/list"}'
```

### Call Tool
```bash
curl -X POST https://your-app.railway.app/ \
  -H "Content-Type: application/json" \
  -d '{
    "method": "tools/call",
    "params": {
      "name": "supabase:list_tables",
      "arguments": {},
      "supabase_url": "YOUR_URL",
      "supabase_key": "YOUR_KEY"
    }
  }'
```

### Health Check
```bash
curl https://your-app.railway.app/health
```

## šŸ—ļø Local Development

```bash
# Install
npm install

# Build
npm run build

# Run
npm start
```

Server runs on `http://localhost:3000`

## šŸ”’ Security

- No credentials stored in code
- Each request requires credentials
- Service role key for full admin access
- CORS enabled for browser usage

## šŸ“¦ Repository Structure

```
ā”œā”€ā”€ src/
│   └── server.ts    # Main HTTP server
ā”œā”€ā”€ dist/            # Compiled JS
ā”œā”€ā”€ package.json
ā”œā”€ā”€ tsconfig.json
ā”œā”€ā”€ railway.json     # Railway config
└── README.md
```

## ✨ Ready for Production

This server is production-ready:
- Health checks at `/health`
- Error handling
- TypeScript types
- No hardcoded secrets
- Railway optimized

---

Built for n8n AI Agents šŸ¤–