Back to MCP directory
publicPublicdnsLocal runtime

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

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client