Supabase MCP
Enables querying Supabase databases and generating TypeScript types through the Model Context Protocol interface, supporting features like schema selection, column filtering, and pagination.
Enables querying Supabase databases and generating TypeScript types through the Model Context Protocol interface, supporting features like schema selection, column filtering, and pagination.
A Model Context Protocol (MCP) server for interacting with Supabase databases. This server provides tools for querying tables and generating TypeScript types through the MCP interface.
Error handling
Type Generation: Generate TypeScript types for your database:
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
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
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%Claudeclaude_desktop_config.json
Linux: ~/.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"
}
}
}
}
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
%APPDATA%CodeUserglobalStoragesaoudrizwan.claude-devsettingscline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Add the server configuration (same format as Claude Desktop).
// Query with schema selection and where clause
<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 types for public 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 query
- select
(optional): Comma-separated list of columns
- where
(optional): Array of conditions with:
- column
: Column name
- operator
: One of: eq, neq, gt, gte, lt, lte, like, ilike, is
- value
: Value to compare against
Generate 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:
Verify your service_role key is correct
For hosted projects:
git checkout -b feature/my-feature
git commit -am 'Add my feature'
git push origin feature/my-feature
MIT License - see LICENSE file for details
[
{
"description": "Query a specific table with schema selection and where clause support",
"inputSchema": {
"properties": {
"schema": {
"description": "Database schema (optional, defaults to public)",
"type": "string"
},
"select": {
"description": "Comma-separated list of columns to select (optional, defaults to *)",
"type": "string"
},
"table": {
"description": "Name of the table to query",
"type": "string"
},
"where": {
"description": "Array of where conditions (optional)",
"items": {
"properties": {
"column": {
"description": "Column name",
"type": "string"
},
"operator": {
"description": "Comparison operator",
"enum": [
"eq",
"neq",
"gt",
"gte",
"lt",
"lte",
"like",
"ilike",
"is"
],
"type": "string"
},
"value": {
"description": "Value to compare against",
"type": "any"
}
},
"required": [
"column",
"operator",
"value"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"table"
],
"type": "object"
},
"name": "query_table"
},
{
"description": "Generate TypeScript types for your Supabase database schema",
"inputSchema": {
"properties": {
"schema": {
"description": "Database schema (optional, defaults to public)",
"type": "string"
}
},
"type": "object"
},
"name": "generate_types"
}
]