Supabase MCP Server
April 9, 2025 ยท View on GitHub
A Model Context Protocol (MCP) server implementation that allows Large Language Models (LLMs) to interact with Supabase databases using natural language. This server implements the MCP specification and provides a set of tools for performing common database operations.
Note that this implementation is experimental and should be used with caution. It was built with the help of Claude 3.7 Sonnet.
Features
- Read Records: Query and filter data from Supabase tables
- Create Records: Insert new records into tables
- Update Records: Modify existing records based on filters
- Delete Records: Remove records that match specific criteria
Prerequisites
- Supabase project with a valid URL and service role key
Installation
-
Clone the repository:
git clone <repository-url> cd supabase-mcp -
Create a virtual environment:
python -m venv venv source venv/bin/activate -
Install the dependencies:
pip install -r requirements.txtFor development and testing, install development dependencies:
pip install -r requirements-dev.txt -
Create a
.envfile with your Supabase credentials:cp .env.example .envThen edit the
.envfile to add your actual Supabase URL and service role key.
Running as an MCP Server
The Supabase MCP server can be integrated with AI assistants using the Model Context Protocol.
- Include the below configuration in your MCP config (in Claude Desktop, Windsurf, etc.)
{
"mcpServers": {
"supabase": {
"command": "/path/to/python3/in/your/virtual/environment",
"args": ["path/to/server.py"]
}
}
}
Development
Running Tests
To run the test suite:
python -m pytest
The tests use pytest's fixtures and mocking capabilities to test the functionality without requiring a real Supabase connection.
Code Formatting
Format code using black:
black .