fes0010/mcp-supabase-server
If you are the rightful owner of mcp-supabase-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A minimal Model Context Protocol (MCP) server designed for self-hosted Supabase instances, providing full database control and integration with AI agents and n8n automation.
MCP Server for Self-hosted Supabase
A minimal Model Context Protocol (MCP) server that provides full database control for self-hosted Supabase instances. Perfect for AI agents and n8n automation.
🚀 Features
- Full SQL Control - Execute any SQL query (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP)
- 9 Essential Tools - Streamlined from 25+ tools to core functionality
- Global Access - Deploy to cloud for worldwide accessibility
- n8n Compatible - Direct integration with n8n MCP Client
- Auto-restart - Built-in health checks and error recovery
- Secure - Input validation and SQL injection protection
🎯 Quick Start
Local Development
# Clone and setup
git clone https://github.com/fes0010/mcp-supabase-server.git
cd mcp-supabase-server
npm install
# Set environment variables
export SUPABASE_URL="https://your-supabase-url.com"
export SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"
# Build and start
npm run build
npm run start:mcp
Local endpoint: http://localhost:3001/mcp
Cloud Deployment (Dokploy)
# Quick deploy to your VPS
./deploy-to-dokploy.sh
Global endpoint: https://your-domain.com/mcp
🔧 Available Tools
list_tables- List all database tablesget_table_schema- Get table structure with sample dataexecute_sql- Execute any SQL query with full database controlget_table_data- Query table data with filtering and sortinginsert_data- Insert new records into tablesupdate_data- Update existing recordsdelete_data- Delete records from tablesget_business_analytics- Business insights and KPIs
📱 n8n Integration
MCP Client Node Configuration:
- Endpoint:
https://your-domain.com/mcp(orhttp://localhost:3001/mcp) - Server Transport:
HTTP Streamable - Authentication:
None - Tools to Include:
All
Example Usage in n8n:
// Get product count
execute_sql({
query: "SELECT COUNT(*) as total FROM products"
})
// Add new product
insert_data({
table_name: "products",
data: {
name: "New Product",
sku: "NP001",
retail_price: 25.99
}
})
// Business analytics
get_business_analytics({
date_from: "2025-01-01",
date_to: "2025-01-31"
})
🌐 Deployment Options
1. Dokploy (Recommended)
- Use
./deploy-to-dokploy.shfor guided setup - Automatic SSL, health checks, and monitoring
- See for details
2. Docker
docker build -t mcp-supabase .
docker run -d -p 3001:3001 \
-e SUPABASE_URL="https://your-url.com" \
-e SUPABASE_SERVICE_ROLE_KEY="your-key" \
mcp-supabase
3. PM2 (Local Auto-start)
./setup-autostart.sh
🔒 Security
- Input Validation - All parameters validated
- SQL Injection Protection - Parameterized queries
- Required WHERE Clauses - Prevents accidental mass operations
- Service Role Authentication - Uses Supabase service role key
- HTTPS Support - SSL encryption for cloud deployments
📊 Database Schema Support
Optimized for business management systems:
products- Product inventorytransactions- Sales recordscustomers- Customer informationexpenses- Business expensescustomer_debts- Credit management
🛠️ Development
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start MCP server
npm run start:mcp
# Start HTTP API (alternative)
npm run start:http
# Run tests
npm test
📋 Environment Variables
SUPABASE_URL=https://your-supabase-instance.com
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
PORT=3001 # Optional, defaults to 3001
NODE_ENV=production # For production deployments
HOST_URL=https://your-domain.com # For production deployments (replaces localhost in URLs)
🔍 Health Check
curl http://localhost:3001/health
# or
curl https://your-domain.com/health
Response:
{
"status": "healthy",
"timestamp": "2025-01-25T10:30:00.000Z",
"mcp_endpoint": "https://your-domain.com/mcp",
"tools_available": 8
}
📚 Documentation
- - REST API documentation
- - Cloud deployment guide
- - Local auto-start setup
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
📄 License
MIT License - see file for details.
🆘 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built for AI agents, n8n automation, and business intelligence workflows. 🤖✨