返回 MCP 目录
public公开dns本地运行

supabase-mcp

Supabase MCP服务器是一个桥接MCP客户端与Supabase服务的中间件,提供数据库操作、存储管理、边缘函数调用等综合功能。

article

README

🚀 Supabase-MCP 使用指南

Supabase-MCP 是一个功能强大的程序,可帮助用户轻松进行数据库操作、文件存储、边缘函数调用和用户管理等。以下将详细介绍其安装、配置、使用方法等内容。

🚀 快速开始

📦 安装指南

要安装此程序,请执行以下命令:

npm install supabase-mcp

⚙️ 配置说明

创建一个配置文件,并将其命名为supabase-mcp.config.js.env,然后添加以下内容:

// 或者 .env 文件:
# 配置 Supabase 项目 ID
SUPABASE_PROJECT_ID=your_project_id
# 配置 Supabase 安排密钥
SUPABASE_ANON_KEY=your_anon_key

💻 使用示例

数据库操作

🔍 查询数据

{
  table: "users",
  columns: ["id", "email", "created_at"],
  where?: Record<string, any>
}

示例

{
  table: "posts",
  columns: ["id", "title", "content"],
  where: { published: true }
}

📥 插入数据

{
  table: "users",
  data: {
    email: "user@example.com",
    password: "securepassword"
  }
}

示例

{
  table: "posts",
  data: {
    title: "Hello World",
    content: "This is my first post.",
    user_id: 1
  }
}

📝 更新数据

{
  table: "users",
  data: {
    password: "newsecurepassword"
  },
  where: { email: "user@example.com" }
}

示例

{
  table: "posts",
  data: { status: "draft" },
  where: { id: 1 }
}

❌ 删除数据

{
  table: "users",
  where: { email: "user@example.com" }
}

示例

{
  table: "posts",
  where: { status: "deleted" }
}

文件存储操作

📤 上传文件

{
  bucket: "uploads",
  path: "images/avatar.jpg",
  file: selectedFile,
  options?: {
    cacheControl?: string;
    contentType?: string;
    upsert?: boolean;
  };
}

示例

{
  bucket: "documents",
  path: "reports/2023.pdf",
  file: fileObject,
  options: {
    contentType: "application/pdf",
    upsert: true
  }
}

📥 下载文件

{
  bucket: "uploads",
  path: "images/avatar.jpg"
}

示例

{
  bucket: "downloads",
  path: "files/report.docx"
}

边缘函数调用

🚀 调用函数

{
  function: "processData",
  params?: {
    key: string,
    value: any
  }[]
}

示例

{
  function: "calculateTotal",
  params: [
    { key: "amount", value: 100 },
    { key: "taxRate", value: 0.15 }
  ]
}

用户管理

👤 创建用户

{
  email: "newuser@example.com",
  password: "securepassword"
}

示例

{
  email: "admin@example.com",
  password: "adminsecure"
}

🚫 错误处理

程序返回的错误信息可能包括以下内容:

  • code: 错误代码
  • message: 错误描述
  • stack?: string:错误堆栈跟踪(如果有)

示例

{
  code: "AUTHENTICATION_FAILED",
  message: "Invalid API key provided."
}

🛠️ 开发相关

🧪 运行测试

要运行测试,请执行以下命令:

npm test supabase-mcp

🏗️ 构建项目

要构建项目,请执行以下命令:

npm run build

📋 代码规范检查

要进行代码规范检查,请执行以下命令:

npm run lint

🤝 贡献指南

如果您希望为该项目做出贡献,请遵循以下步骤:

  1. 叉这个仓库。
  2. 创建一个新的分支用于您的功能:git checkout -b feature/your-feature
  3. 提交您的更改:git commit -m "add your feature"
  4. 推送到叉的仓库:git push origin feature/your-feature
  5. 创建一个拉取请求到主分支。

📄 许可证

本项目受 MIT License 许可保护。

🆘 支持

如果您遇到任何问题,请通过以下方式联系支持团队:

  • 邮件地址:support@supabase-mcp.com
  • 电话号码:+1 (555) 123-4567
help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端