This Yazdani-Supabase-MCP Server integrates with Supabase PostgreSQL and uses Claude 3.7 for natural language query processing. It enables database schema inspection, SQL execution, and translating natural language queries into SQL, all designed for seamless integration with React Native applications.
Clone the repository:
git clone <repository-url>
cd Yazdani-supabase-mcp-server
Install dependencies:
pip install -r requirements.txt
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
Install as a package (optional):
pip install -e .
With Live Database:
python run_server.py
With Mock Database:
# Windows
improved_mock_server.bat
# Unix/macOS
USE_MOCK_DB=true python run_server.py
As Installed Package:
yazdani-supabase-mcp-server
Verify your connection is working properly:
python connection_test.py
Test natural language to SQL capabilities with the provided tools:
# Windows - Run the full test environment
run_nl_test.bat
# Manual setup
python http_server.py --port 8000 # Terminal 1
python nl_test_client.py # Terminal 2
Try these examples in the natural language test client:
Run the server using either mock or live database mode
Make the server accessible to your React Native application:
Connect from React Native using MCP client libraries, configuring with the server's address and port
The MCP server provides these tools through the MCP protocol:
get_schemas
: List all database schemasget_tables
: List tables in a schemaget_table_schema
: Get detailed table structureexecute_postgresql
: Execute SQL statementsretrieve_migrations
: List database migrationsgenerate_sql
: Generate SQL from natural languageThe server uses Supabase Session pooler with this connection format:
postgresql://postgres.{project_ref}:{password}@{pooler_host}:5432/postgres
If experiencing connection problems:
.env
fileUSE_MOCK_DB=true
python test_pooler_connection.py
python connection_test.py
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.