Provides full CRUD operations for Supabase databases, including reading, creating, updating, and deleting records with advanced filtering, pagination, ordering, and upsert capabilities across any Supabase table
Supabase MCP Server
A Model Context Protocol (MCP) server that provides seamless integration between AI assistants and Supabase databases. This server enables LLMs to perform CRUD operations on any Supabase database through standardized, well-documented tools.
🚀 Features
Full CRUD Operations: Read, Create, Update, and Delete records in any Supabase table
Advanced Filtering: Support for complex queries with multiple filter conditions
Safety First: Built-in safety checks for destructive operations
Type Safety: Full type hints and Pydantic validation
Comprehensive Error Handling: Detailed error messages and logging
Flexible Querying: Support for pagination, ordering, and column selection
Upsert Support: Insert or update records in a single operation
📋 Prerequisites
Python 3.11 or higher
A Supabase project (self-hosted or cloud)
Supabase service role key with appropriate permissions
🛠️ Installation
Clone or download the project:
git clone <repository-url> cd supabase-mcp-serverInstall dependencies:
pip install -r requirements.txtSet up environment variables:
cp .env.example .env # Edit .env with your Supabase credentialsConfigure your environment: Edit the
.env
file with your Supabase credentials:SUPABASE_URL=https://your-project-id.supabase.co SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here
🔧 Configuration
Environment Variables
Edit .env
file with your configuration:
Finding Your Supabase Credentials
Go to your Supabase project dashboard
Navigate to Settings → API
Copy the Project URL for
SUPABASE_URL
Copy the service_role secret for
SUPABASE_SERVICE_ROLE_KEY
⚠️ Important: Use the service_role
key, not the anon
key, as it has full database access.
📁 GitHub Repository Setup
🔗 Complete GitHub Setup & SSH Deployment Guide
Quick setup:
Create GitHub repository
Push code:
git init && git add . && git commit -m "Initial commit" && git push
SSH deploy:
git clone YOUR_REPO && cd PROJECT && ./scripts/deploy.sh
💡 SSH Quick Deploy Reference - 3-command deployment
🚀 Usage
Local Development
Running the Server
The server will start with stdio transport, which is the standard for MCP servers.
Installing in Claude Desktop
Add to your Claude Desktop MCP configuration:
{ "servers": { "supabase": { "command": "python", "args": ["path/to/supabase-mcp-server/src/server.py"], "env": { "SUPABASE_URL": "https://your-project-id.supabase.co", "SUPABASE_SERVICE_ROLE_KEY": "your-service-role-key" } } } }
Using with MCP Inspector
For development and testing:
🐳 Cloud Deployment
Deploy to your cloud Docker instance in minutes!
Quick Deploy (Automated)
Upload files to your cloud server:
scp -r supabase-mcp-server/ user@your-server.com:/home/user/SSH and deploy:
ssh user@your-server.com cd supabase-mcp-server chmod +x scripts/deploy.sh ./scripts/deploy.sh
Manual Deploy
Access: Server available on port 8085
📖 Complete Deployment Guide - Includes security, monitoring, scaling, and troubleshooting
🔨 Available Tools
1. Read Table Rows
Query data from any table with filtering, ordering, and pagination.
Usage: "Show me all users where status is 'active'"
2. Create Table Records
Insert new records into any table, with optional upsert functionality.
Usage: "Create a new user with name 'John' and email 'john@example.com'"
3. Update Table Records
Modify existing records based on specified conditions.
Usage: "Update the status to 'completed' for task with id 123"
4. Delete Table Records
Remove records from tables with safety checks and confirmation.
Usage: "Delete all inactive users created before 2023"
🔍 Filter Operators
The server supports various filter operators for precise querying:
Operator | Description | Example |
| Equal to |
|
| Not equal to |
|
| Greater than |
|
| Greater than or equal |
|
| Less than |
|
| Less than or equal |
|
| Pattern matching (case-sensitive) |
|
| Pattern matching (case-insensitive) |
|
| Value in list |
|
| Is null/true/false |
|
🧪 Testing
Run the test suite:
Run with coverage:
🛡️ Security Features
Environment Variable Validation: Ensures required credentials are set
Input Validation: Pydantic models validate all input data
Safety Checks: Requires confirmation for destructive operations
Where Clause Requirements: Updates and deletes require explicit conditions
Error Handling: Comprehensive error handling with detailed logging
📁 Project Structure
🔄 Example Usage Scenarios
Scenario 1: Content Management
"Show me all published blog posts from this year, ordered by publication date"
Scenario 2: User Management
"Create a new admin user and update their permissions"
Scenario 3: Data Cleanup
"Find and delete all expired session tokens"
Scenario 4: Analytics
"Get user count by registration month for the past year"
🐛 Troubleshooting
Common Issues
Environment Variables Not Set
Error: "Missing environment variables"
Solution: Ensure
.env
file exists with correctSUPABASE_URL
andSUPABASE_SERVICE_ROLE_KEY
Database Connection Failed
Error: "Failed to initialize Supabase client"
Solution: Verify your Supabase URL and service role key are correct
Permission Denied
Error: Various permission-related errors
Solution: Ensure your service role key has appropriate permissions for the tables you're accessing
Table Not Found
Error: Table-specific errors
Solution: Verify the table name exists in your Supabase database
📚 Development
Code Style
Follow PEP 8 standards
Use type hints for all functions
Include comprehensive docstrings
Maximum 500 lines per file
Testing Requirements
Minimum 95% test coverage
Test all CRUD operations
Include edge cases and error scenarios
Use pytest for all tests
🤝 Contributing
Follow the global rules defined in
GLOBAL_RULES.md
Ensure all tests pass before submitting changes
Update documentation for any new features
Add appropriate error handling and logging
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Built with the Model Context Protocol
Uses the Supabase Python Client
Based on FastMCP framework
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables AI assistants to perform CRUD operations on Supabase databases through natural language. Supports advanced filtering, pagination, and safety checks for seamless database interaction.
Related MCP Servers
- AsecurityAlicenseAqualityAllows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.Last updated -859MIT License
- -securityFlicense-qualityEnables AI assistants to interact with Metabase databases and dashboards, allowing users to list and execute queries, access data visualizations, and interact with database resources through natural language.Last updated -67
- -securityFlicense-qualityA bridge between AI assistants like GitHub Copilot and Supabase databases, allowing AI to understand schema, assist with query writing, and provide context-aware suggestions related to your data model.Last updated -
- -security-license-qualityEnables IDE access to Supabase databases with SQL query execution, schema management, Auth admin operations, and built-in safety controls to prevent accidental destructive actions.Last updated -Apache 2.0