Supabase Mcp

Supabase Mcp

🚀 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
}

示例

{
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
  • 0 关注
  • 0 收藏,34 浏览
  • system 提出于 2025-09-24 14:06

相似服务问题

相关AI产品