Skip to main content
Glama

Supabase MCP Server

by Quegenx

Supabase MCP 服务器🚀

TypeScript 苏帕贝斯 PostgreSQL Node.js 微胶囊钙 风帆冲浪

🔥 强大的模型上下文协议 (MCP) 服务器,可通过 Cursor 的 Composer 和 Codeium 的 Cascade 为您的 Supabase PostgreSQL 数据库提供全面的管理控制。此工具提供全面的表操作、记录管理、模式修改等功能,可实现无缝的数据库管理。

📚 目录

🔧 先决条件

  • Node.js >= 16.x

  • npm >= 8.x

  • Supabase 项目包括:

    • 项目 ID

    • 数据库密码

    • PostgreSQL 连接字符串

  • Cursor IDE 或 Codeium 的 Cascade(针对付费用户)

🚀 快速入门

📥 安装

# 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

⚙️ 配置

  1. 安装依赖项并构建项目:

    npm install npm run build
  2. 在 Cursor 的 MCP 设置中,使用以下命令添加服务器:

    /opt/homebrew/bin/node /path/to/dist/index.js postgresql://postgres.[PROJECT-ID]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:5432/postgres

    代替:

    • /path/to/dist/index.js替换为您的实际路径

    • [PROJECT-ID]替换为您的 Supabase 项目 ID

    • [PASSWORD]替换为您的数据库密码

注意:请确保您的数据库凭证安全,切勿将其提交到版本控制中。

🎯 集成

光标 MCP 集成

模型上下文协议 (MCP) 允许您为 Cursor 中的代理 LLM 提供自定义工具。该服务器可以与 Cursor 的 Composer 功能集成,通过自然语言命令直接访问所有数据库管理工具。

在 Cursor 中设置

  1. 打开“光标设置”>“功能”>“MCP”

  2. 点击“+ 添加新的 MCP 服务器”按钮

  3. 填写模态表单:

    • 名称:“Supabase MCP”(或您喜欢的任何昵称)

    • 类型: command (stdio 传输)

    • 命令:包含连接详细信息的完整命令字符串

  4. 首先构建项目:

    npm install npm run build
  5. 获取你的 Node.js 路径:

    # On Mac/Linux which node # On Windows where node
  6. 添加服务器命令:

    /path/to/node /path/to/dist/index.js postgresql://postgres.[PROJECT-ID]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:5432/postgres

    代替:

    • /path/to/node替换为你的实际 Node.js 路径(来自步骤 5)

    • /path/to/dist/index.js替换为您构建的 JavaScript 文件的实际路径

    • [PROJECT-ID]替换为您的 Supabase 项目 ID

    • [PASSWORD]替换为您的数据库密码

  7. 点击“添加服务器”,然后点击右上角的刷新按钮

使用 Cursor 中的工具

当你描述数据库任务时,Composer Agent 会自动检测并使用相关工具。例如:

  • “列出我的数据库中的所有表”

  • “创建一个新的用户表”

  • “为电子邮件列添加索引”

当代理使用工具时,您会看到:

  1. 提示批准/拒绝工具调用

  2. 工具调用参数(可扩展)

  3. 批准后的回应

注意:对于像这样的 stdio 服务器,该命令必须是有效的 shell 命令。如果需要环境变量,请考虑使用包装脚本。

风帆冲浪/级联集成

此 MCP 服务器还支持 Codeium 的 Cascade (Windsurf) 集成。请注意,此功能目前仅适用于付费个人用户(不适用于团队或企业用户)。

使用 Cascade 进行设置

  1. 创建或编辑~/.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" ] } } }
  2. 快速访问配置:

    • 找到 Cascade 输入上方的工具栏

    • 点击锤子图标

    • 点击“配置”打开 mcp_config.json

  3. 在配置中替换:

    • /path/to/node替换为您的实际 Node.js 路径

    • /path/to/dist/index.js替换为您的实际路径

    • [PROJECT-ID]替换为您的 Supabase 项目 ID

    • [PASSWORD]替换为您的数据库密码

  4. 在 Cascade 中:

    • 单击工具栏中的锤子图标

    • 单击“配置”以验证您的设置

    • 点击“刷新”加载 MCP 服务器

    • 单击服务器名称查看可用的工具

Cascade 用户重要须知

  • 仅支持工具功能(无提示或资源)

  • MCP 工具调用无论成功或失败都会消耗积分

  • 不支持图像输出

  • 仅支持 stdio 传输类型

  • 工具调用可以调用任意服务器实现者编写的代码

  • Cascade 不承担 MCP 工具调用失败的责任

✨ 特点

🎯 可用的数据库工具

表管理

  • 表: list_tablescreate_tabledrop_tablerename_table

  • 列: add_columndrop_columnalter_column

  • 记录: fetch_recordscreate_recordupdate_recorddelete_record

索引和约束

  • 索引: list_indexescreate_indexdelete_indexupdate_index

  • 约束: list_constraintsadd_constraintremove_constraintupdate_constraint

数据库函数和触发器

  • 函数: list_functionscreate_functionupdate_functiondelete_function

  • 触发器: list_triggerscreate_triggerupdate_triggerdelete_trigger

安全与访问控制

  • 策略: list_policiescreate_policyupdate_policydelete_policy

  • 角色: list_rolescreate_roleupdate_roledelete_role

存储管理

  • 存储桶: list_bucketscreate_bucketdelete_bucket

  • 文件: delete_filebulk_delete_files

  • 文件夹: list_folders

数据类型和出版物

  • 枚举类型: list_enumerated_typescreate_enumerated_typeupdate_enumerated_typedelete_enumerated_type

  • 出版物: list_publicationscreate_publicationupdate_publicationdelete_publication

实时功能

  • 政策: list_realtime_policiescreate_realtime_policyupdate_realtime_policydelete_realtime_policy

  • 频道: list_realtime_channelsmanage_realtime_channelssend_realtime_messageget_realtime_messages

  • 管理: manage_realtime_statusmanage_realtime_views

用户管理

  • 授权: list_userscreate_userupdate_userdelete_user

直接 SQL 访问

  • 查询: query ——执行自定义 SQL 查询

🚀 主要优点

  • 自然语言控制:通过简单的对话命令管理您的 Supabase 数据库

  • 全面覆盖:全套工具,涵盖表格、记录、索引、功能、安全性等

  • 无缝集成:直接在 Cursor 的 Composer 和 Codeium 的 Cascade 中工作

  • 开发人员友好:减少 IDE 和数据库管理工具之间的上下文切换

  • 安全访问:通过适当的身份验证维护数据库安全

📁 项目结构

supabase-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

💡 使用方法

配置完成后,MCP 服务器将通过 Cursor 的 Composer 提供所有数据库管理工具。只需描述您想要对数据库执行的操作,AI 就会使用相应的命令。

例子:

  • 📋“显示我的数据库中的所有表”

  • ➕“创建一个包含 id、name 和 email 列的新用户表”

  • 🔍“在用户表的电子邮件列上添加索引”

🔒 安全说明

  • 🔐 确保数据库连接字符串的安全

  • ⚠️ 切勿将敏感凭据提交到版本控制

  • 👮 使用适当的访问控制和权限

  • 🛡️ 验证并清理所有输入以防止 SQL 注入

🛠️ 故障排除

常见连接问题

  1. Node.js 路径问题

    • 确保使用正确的 Node.js 路径

    • 在 Mac/Linux 上:使用which node找到正确的路径

    • 在 Windows 上:使用where node查找正确的路径

    • /usr/local/bin/node替换为您的实际 Node.js 路径

  2. 文件路径问题

    • 使用绝对路径而不是相对路径

    • 在 Mac/Linux 上:在项目目录中使用pwd获取完整路径

    • 在 Windows 上:使用cd获取完整路径

    • 例如: /Users/username/projects/supabase-mcp-server/dist/index.js

  3. MCP 未检测工具

    • 点击 Cursor 的 MCP 设置中的刷新按钮

    • 确保服务器正在运行(没有错误消息)

    • 检查你的连接字符串是否正确

    • 验证您的 Supabase 凭据是否有效

  4. 权限问题

    • 确保dist目录存在(运行npm run build

    • 检查文件权限(在 Unix 系统上为chmod +x

    • 使用适当的权限运行npm install

调试模式

在命令前添加DEBUG=true即可查看详细日志:

DEBUG=true /usr/local/bin/node /path/to/dist/index.js [connection-string]

特定平台的说明

Windows 用户

# Use this format for the command "C:\\Program Files\\nodejs\\node.exe" "C:\\path\\to\\dist\\index.js" "postgresql://..."

Linux 用户

# Find Node.js path which node # Make script executable chmod +x /path/to/dist/index.js

如果您��然遇到问题,请打开以下问题

  • 您的操作系统

  • Node.js 版本( node --version

  • 完整错误消息

  • 复现步骤

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。

📄 许可证


-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

一个强大的服务器,通过 Cursor 的 Composer 和 Codeium 的 Cascade 提供对 Supabase PostgreSQL 数据库的管理控制,实现表、记录、模式修改等功能的数据库管理。

  1. 📚 目录
    1. 🔧 先决条件
      1. 🚀 快速入门
        1. 📥 安装
        2. ⚙️ 配置
      2. 🎯 集成
        1. 光标 MCP 集成
        2. 风帆冲浪/级联集成
      3. ✨ 特点
        1. 🎯 可用的数据库工具
        2. 🚀 主要优点
      4. 📁 项目结构
        1. 💡 使用方法
          1. 🔒 安全说明
            1. 🛠️ 故障排除
              1. 常见连接问题
              2. 调试模式
              3. 特定平台的说明
            2. 🤝 贡献
              1. 📄 许可证

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  This server enables interaction with Supabase PostgreSQL databases through the MCP protocol, allowing seamless integration with Cursor and Windsurf IDEs for secure and validated database management.
                  Last updated -
                  12
                  802
                  Apache 2.0
                  • Apple
                  • Linux
                • -
                  security
                  A
                  license
                  -
                  quality
                  An MCP server that connects to Supabase PostgreSQL databases, exposing table schemas as resources and providing tools for data analysis through SQL queries.
                  Last updated -
                  1
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  Enables Cursor and Windsurf to safely interact with Supabase databases by providing tools for database management, SQL query execution, and Supabase Management API access with built-in safety controls.
                  Last updated -
                  10
                  Apache 2.0
                  • Apple
                  • Linux
                • -
                  security
                  -
                  license
                  -
                  quality
                  Enables IDE access to Supabase databases with SQL query execution, schema management, Auth admin operations, and built-in safety controls to prevent accidental destructive actions.
                  Last updated -
                  Apache 2.0

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/Quegenx/supabase-mcp-server'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server