Connect your PolarDB Supabase instances to Cursor, Claude, Windsurf, and other AI assistants.
The Model Context Protocol (MCP) standardizes how Large Language Models (LLMs) talk to external services like Supabase. This server connects AI assistants directly with your PolarDB Supabase project and allows them to perform tasks like managing tables, fetching config, and querying data.
You will need Node.js installed on your machine. You can check this by running:
node -vIf you don't have Node.js installed, you can download it from nodejs.org.
You'll need the following from your PolarDB instance:
- API URL: Your PolarDB instance endpoint (e.g.,
http://your-host:port) - Service Role Key: For database operations
- Dashboard Username/Password: For Edge Functions and type generation
Configure your MCP client (such as Cursor) to use this server. Most MCP clients store the configuration as JSON:
{
"mcpServers": {
"polardb-supabase": {
"command": "node",
"args": [
"/path/to/supabase-mcp/packages/mcp-server-supabase/dist/transports/stdio.js",
"--api-url",
"http://your-polardb-supabase-host:port",
"--service-role-key",
"your-service-role-key",
"--anon-key",
"your-anon-key",
"--dashboard-username",
"your-dashboard-username",
"--dashboard-password",
"your-dashboard-password",
"--project-ref",
"default"
]
}
}
}Replace the placeholder values with your actual PolarDB credentials.
Before running the MCP server, we recommend you read our security best practices to understand the risks of connecting an LLM to your PolarDB projects and how to mitigate them.
To restrict the server to read-only queries, set the --read-only flag:
node /path/to/supabase-mcp/packages/mcp-server-supabase/dist/transports/stdio.js --read-onlyWe recommend you enable this by default. This prevents write operations on your databases.
The following tools are available to the LLM:
list_tables: Lists all tables within the specified schemasexecute_sql: Executes raw SQL in the database
get_project_url: Gets the API URL for a projectget_anon_key: Gets the anonymous API key for a project
list_edge_functions: Lists all Edge Functions in a projectget_edge_function: Gets details for a specific Edge Functiondeploy_edge_function: Deploys a new Edge Function to a project
get_best_practices: List all available Supabase AI prompts and development guidance
- Model Context Protocol: Learn more about MCP
- PolarDB Supabase Documentation: Learn more about PolarDB features
This project is licensed under Apache 2.0. See the LICENSE file for details.