Yazdani-Supabase-MCP-Server

by byazdani9

175 downloads Not rated yet MIT license
GitHub

About

A Supabase PostgreSQL MCP server with Claude 3.7 Sonnet integration for natural language to SQL conversion

Details

License
MIT license

Explore

- Schema Inspection: View database schemas, tables, columns, and relationships
- SQL Execution: Run SQL queries with safety controls
- Migration Management: View and manage database migrations
- Natural Language Processing: Convert natural language to SQL using Claude 3.7
- Safety Controls: Protection against destructive operations
- Mock Database Mode: Support for development and testing without a live database connection
- Auto-Fallback Mechanism: Gracefully falls back to mock data when database connection fails
- Session Pooler Support: Uses Supabase Session pooler for stable connections

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Yazdani-Supabase-MCP-Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Python 3.8 or higher
- Access to a Supabase PostgreSQL database (optional with mock mode)
- Anthropic API key (for Claude integration)

For normal operation with a Supabase database connection:

python run_server.py

For development or testing without a live database connection:


run_nl_test.bat

python http_server.py --port 8000 # Terminal 1
python nl_test_client.py # Terminal 2

The natural language test client provides:
- Interactive command-line interface for testing
- Natural language to SQL conversion using Claude
- SQL execution against the Supabase database
- Formatted result display
- Command history and result saving capabilities

Sample natural language queries to try:
- "Show me all tables in the public schema"
- "Get all users who signed up in the last month"
- "What is the total number of users in the database?"

pip install -e .
yazdani-supabase-mcp-server

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "yazdani-supabase-mcp-server": {
            "yazdani-supabase-mcp-server": {
                "command": "python",
                "args": [
                    "run_server.py"
                ]
            }
        }
    }
}

McpServers

{
    "yazdani-supabase-mcp-server": {
        "command": "python",
        "args": [
            "run_server.py"
        ]
    }
}

An MCP server that integrates with Supabase PostgreSQL and uses Claude 3.7 for natural language query processing, designed for integration with React Native PaveApp.

Features

- Schema Inspection: View database schemas, tables, columns, and relationships
- SQL Execution: Run SQL queries with safety controls
- Migration Management: View and manage database migrations
- Natural Language Processing: Convert natural language to SQL using Claude 3.7
- Safety Controls: Protection against destructive operations
- Mock Database Mode: Support for development and testing without a live database connection
- Auto-Fallback Mechanism: Gracefully falls back to mock data when database connection fails
- Session Pooler Support: Uses Supabase Session pooler for stable connections

Installation

Prerequisites

- Python 3.8 or higher
- Access to a Supabase PostgreSQL database (optional with mock mode)
- Anthropic API key (for Claude integration)

Setup

1. Clone the repository:

   git clone <repository-url>
cd Yazdani-supabase-mcp-server

2. Install dependencies:

   pip install -r requirements.txt

3. Create a .env file with your credentials:

   # Supabase credentials
SUPABASE_PROJECT_REF=your_project_ref
SUPABASE_URL=https://your_project_ref.supabase.co
SUPABASE_DB_PASSWORD=your_db_password
SUPABASE_REGION=your_region
SUPABASE_ACCESS_TOKEN=your_access_token
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# Database connection
POSTGRES_HOST=db.your_project_ref.supabase.co
POSTGRES_PORT=5432
POSTGRES_DB=postgres
POSTGRES_USER=postgres
SUPABASE_POOLER_HOST=aws-0-ca-central-1.pooler.supabase.com

# Claude API
ANTHROPIC_API_KEY=your_anthropic_api_key

# Optional: for mock database mode
# USE_MOCK_DB=true

Usage

Running the Server with Live Database

For normal operation with a Supabase database connection:

python run_server.py

Running the Server with Mock Database

For development or testing without a live database connection:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.