Supabase数据库
STDIOSupabase数据库管理MCP服务器
Supabase数据库管理MCP服务器
🔥 A powerful Model Context Protocol (MCP) server that provides full administrative control over your Supabase PostgreSQL database through both Cursor's Composer and Codeium's Cascade. This tool enables seamless database management with comprehensive features for table operations, record management, schema modifications, and more.
# Clone the repository git clone https://github.com/Quegenx/supabase-mcp-server.git cd supabase-mcp-server # Install dependencies npm install # Build the project npm run build
Install dependencies and build the project:
npm install npm run build
In Cursor's MCP settings, add the server with this command:
/opt/homebrew/bin/node /path/to/dist/index.js postgresql://postgres.[PROJECT-ID]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:5432/postgres
Replace:
/path/to/dist/index.js with your actual path[PROJECT-ID] with your Supabase project ID[PASSWORD] with your database passwordNote: Keep your database credentials secure and never commit them to version control.
The Model Context Protocol (MCP) allows you to provide custom tools to agentic LLMs in Cursor. This server can be integrated with Cursor's Composer feature, providing direct access to all database management tools through natural language commands.
Open Cursor Settings > Features > MCP
Click the "+ Add New MCP Server" button
Fill in the modal form:
command (stdio transport)Build the project first:
npm install npm run build
Get your Node.js path:
# On Mac/Linux which node # On Windows where node
Add the server command:
/path/to/node /path/to/dist/index.js postgresql://postgres.[PROJECT-ID]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:5432/postgres
Replace:
/path/to/node with your actual Node.js path (from step 5)/path/to/dist/index.js with your actual path to the built JavaScript file[PROJECT-ID] with your Supabase project ID[PASSWORD] with your database passwordClick "Add Server" and then click the refresh button in the top right corner
The Composer Agent will automatically detect and use relevant tools when you describe your database tasks. For example:
When the agent uses a tool, you'll see:
Note: For stdio servers like this one, the command should be a valid shell command. If you need environment variables, consider using a wrapper script.
This MCP server also supports Codeium's Cascade (Windsurf) integration. Note that this feature is currently only available for paying individual users (not available for Teams or Enterprise users).
Create or edit ~/.codeium/windsurf/mcp_config.json:
{ "mcpServers": { "supabase-mcp": { "command": "/path/to/node", "args": [ "/path/to/dist/index.js", "postgresql://postgres.[PROJECT-ID]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" ] } } }
Quick access to config:
Replace in the configuration:
/path/to/node with your actual Node.js path/path/to/dist/index.js with your actual path[PROJECT-ID] with your Supabase project ID[PASSWORD] with your database passwordIn Cascade:
list_tables, create_table, drop_table, rename_tableadd_column, drop_column, alter_columnfetch_records, create_record, update_record, delete_recordlist_indexes, create_index, delete_index, update_indexlist_constraints, add_constraint, remove_constraint, update_constraintlist_functions, create_function, update_function, delete_functionlist_triggers, create_trigger, update_trigger, delete_triggerlist_policies, create_policy, update_policy, delete_policylist_roles, create_role, update_role, delete_rolelist_buckets, create_bucket, delete_bucketdelete_file, bulk_delete_fileslist_folderslist_enumerated_types, create_enumerated_type, update_enumerated_type, delete_enumerated_typelist_publications, create_publication, update_publication, delete_publicationlist_realtime_policies, create_realtime_policy, update_realtime_policy, delete_realtime_policylist_realtime_channels, manage_realtime_channels, send_realtime_message, get_realtime_messagesmanage_realtime_status, manage_realtime_viewslist_users, create_user, update_user, delete_userquery - Execute custom SQL queriessupabase-mcp-server/
├── dist/                    # Compiled JavaScript files
│   ├── index.d.ts          # TypeScript declarations
│   └── index.js            # Main JavaScript file
├── src/                    # Source code
│   └── index.ts           # Main TypeScript file
├── package.json           # Project configuration
├── package-lock.json      # Dependency lock file
└── tsconfig.json         # TypeScript configuration
Once configured, the MCP server provides all database management tools through Cursor's Composer. Simply describe what you want to do with your database, and the AI will use the appropriate commands.
Examples:
Node.js Path Issues
which node to find the correct pathwhere node to find the correct path/usr/local/bin/node with your actual Node.js pathFile Path Issues
pwd in the project directory to get the full pathcd to get the full path/Users/username/projects/supabase-mcp-server/dist/index.jsMCP Not Detecting Tools
Permission Issues
dist directory exists (run npm run build)chmod +x on Unix systems)npm install with appropriate permissionsAdd DEBUG=true before your command to see detailed logs:
DEBUG=true /usr/local/bin/node /path/to/dist/index.js [connection-string]
# Use this format for the command "C:\\Program Files\\nodejs\\node.exe" "C:\\path\\to\\dist\\index.js" "postgresql://..."
# Find Node.js path which node # Make script executable chmod +x /path/to/dist/index.js
If you're still experiencing issues, please open an issue with:
node --version)Contributions are welcome! Please feel free to submit a Pull Request.