Supabase MCP Server
This MCP server lets you query Supabase tables and generate TypeScript database types.
Query any table in a chosen schema (defaults to
public), optionally selecting specific columns.Filter results with
whereconditions using operators:eq,neq,gt,gte,lt,lte,like,ilike,is.Generate TypeScript types for a Supabase schema, defaulting to
public.Works with local or hosted Supabase projects using service_role credentials.
Enables querying Supabase database tables with filtering options and generating TypeScript types from database schemas
Generates TypeScript type definitions from Supabase database schemas for use in development
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Supabase MCP Server show me the last 10 users from the public.users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Supabase MCP Server
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.
Features
Query Tables: Execute queries on any table with support for:
Schema selection
Column filtering
Where clauses with multiple operators
Pagination
Error handling
Type Generation: Generate TypeScript types for your database:
Support for any schema (public, auth, api, etc.)
Works with both local and remote Supabase projects
Direct output to console
Automatic project reference detection
Related MCP server: SchemaFlow MCP Server
Prerequisites
Node.js 22 or higher
A Supabase project (either local or hosted)
Supabase CLI (for type generation)
Installation
Clone the repository:
git clone https://github.com/yourusername/supabase-mcp-server.git
cd supabase-mcp-serverInstall dependencies:
npm installInstall the Supabase CLI (required for type generation):
# Using Homebrew on macOS or Linux
brew install supabase/tap/supabaseThe server executes the installed supabase binary directly from PATH, without
npx or a shell. Alternatively, install a native CLI binary following the
official Supabase CLI instructions.
Ensure the MCP server process can find the executable on its PATH.
Configuration
Get your Supabase credentials:
For hosted projects:
Go to your Supabase project dashboard
Navigate to Project Settings > API
Copy the Project URL and service_role key (NOT the anon key)
For local projects:
Start your local Supabase instance
Use the local URL (typically http://localhost:54321)
Use your local service_role key
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" > .envBuild the server:
npm run buildIntegration with Claude Desktop
Open Claude Desktop settings:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.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"
}
}
}
}Integration with VSCode Extension
Open VSCode settings:
macOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonLinux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Add the server configuration (same format as Claude Desktop).
Usage Examples
Querying Tables
// 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>Generating Types
// 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>Available Tools
query_table
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 against
generate_types
Generate TypeScript types for your Supabase database schema.
Parameters:
schema(optional): Database schema (defaults to public)
Troubleshooting
Type Generation Issues
Ensure Supabase CLI is installed:
supabase --versionFor local projects:
Make sure your local Supabase instance is running
Verify your service_role key is correct
For hosted projects:
Confirm your project ref is correct (extracted from URL)
Verify you're using the service_role key, not the anon key
Query Issues
Check your schema and table names
Verify column names in select and where clauses
Ensure your service_role key has necessary permissions
Tests
Run npm ci and npm test to build and run the offline MCP integration suite.
Tests use a fake CLI and dummy credentials; they do not connect to a database.
The test fixture currently requires a POSIX environment (Linux or macOS).
Contributing
Fork the repository
Create your feature branch:
git checkout -b feature/my-featureCommit your changes:
git commit -am 'Add my feature'Push to the branch:
git push origin feature/my-featureSubmit a pull request
License
MIT License - see LICENSE file for details
Available Tools
2 toolsgenerate_typesB
Generate TypeScript types for your Supabase database schema
Inputs: schema.
query_tableC
Query a specific table with schema selection and where clause support
Inputs: table (required), schema, select, where.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: generate_types focuses on TypeScript type generation from the database schema, while query_table handles data retrieval from specific tables with filtering. There is no overlap or ambiguity between these functions.
Both tools follow a consistent verb_noun naming pattern (generate_types and query_table), using snake_case throughout. The naming is predictable and readable without any deviations.
With only 2 tools, the server feels under-scoped for a Supabase integration, which typically involves operations like create, update, delete, and schema management beyond just querying and type generation. This limited set may hinder agent workflows.
The server lacks essential CRUD operations (e.g., insert, update, delete) and other Supabase features like authentication or real-time subscriptions, making it severely incomplete for typical database interactions. Agents will face significant gaps in functionality.
Maintenance
Related MCP Connectors
Your Supabase account in natural language: run SQL, apply migrations, manage tables, storage, edge f
Manage Supabase projects end to end across database, auth, storage, realtime, and migrations. Moni…
MCP server for interacting with the Supabase platform
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceImplements the Model Context Protocol to provide LLMs with tools for interacting with Supabase databases, supporting operations like reading, creating, updating, and deleting records with filtering and pagination capabilities.-
- AlicenseNot gradedqualityDmaintenanceProvides AI-IDEs with real-time access to PostgreSQL and Supabase database schemas through the Model Context Protocol, enabling smarter code generation in tools like Cursor, Windsurf, and VS Code + Cline.10MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables interaction with self-hosted Supabase instances, allowing developers to query database schemas, manage migrations, inspect statistics, and interact with Supabase features directly from MCP-compatible development environments.211ISC
- AlicenseNot gradedqualityDmaintenanceConnects AI assistants to Supabase projects to manage databases, execute SQL queries, and handle project configurations. It enables tasks like table management, edge function deployment, and log retrieval through the Model Context Protocol.Apache 2.0