This MCP server for Supabase enables you to interact with Supabase databases by querying tables and generating TypeScript types. It provides a standardized way to access your data through Claude's Model Context Protocol interface, making database operations more accessible through AI-powered tools.
Clone the repository:
git clone https://github.com/yourusername/supabase-mcp-server.git
cd supabase-mcp-server
Install dependencies:
npm install
Install the Supabase CLI (required for type generation):
# Using npm
npm install -g supabase
# Or using Homebrew on macOS
brew install supabase/tap/supabase
Get your Supabase credentials:
For hosted projects:
For local projects:
Configure environment variables:
# Create a .env file (this will be ignored by git)
echo "SUPABASE_URL=your_project_url
SUPABASE_KEY=your_service_role_key" > .env
Build the server:
npm run build
Open Claude Desktop settings file at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
Add the server configuration:
{
"mcpServers": {
"supabase": {
"command": "node",
"args": ["/absolute/path/to/supabase-mcp-server/build/index.js"],
"env": {
"SUPABASE_URL": "your_project_url",
"SUPABASE_KEY": "your_service_role_key"
}
}
}
}
Open VSCode settings file at:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Add the server configuration (same format as Claude Desktop).
Query tables with schema selection, column filtering, and where clauses:
<use_mcp_tool>
<server_name>supabase</server_name>
<tool_name>query_table</tool_name>
<arguments>
{
"schema": "public",
"table": "users",
"select": "id,name,email",
"where": [
{
"column": "is_active",
"operator": "eq",
"value": true
}
]
}
</arguments>
</use_mcp_tool>
Generate TypeScript types for your database schema:
<use_mcp_tool>
<server_name>supabase</server_name>
<tool_name>generate_types</tool_name>
<arguments>
{
"schema": "public"
}
</arguments>
</use_mcp_tool>
Query a specific table with schema selection and where clause support.
Parameters:
schema
(optional): Database schema (defaults to public)table
(required): Name of the table to queryselect
(optional): Comma-separated list of columnswhere
(optional): Array of conditions with:
column
: Column nameoperator
: One of: eq, neq, gt, gte, lt, lte, like, ilike, isvalue
: Value to compare againstGenerate TypeScript types for your Supabase database schema.
Parameters:
schema
(optional): Database schema (defaults to public)Ensure Supabase CLI is installed:
supabase --version
For local projects:
For hosted projects:
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.