CS

coleam00/supabase-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

194 stars 96 forks 质量 62 趋势 17MIT

coleam00/supabase-mcp 是从 https://github.com/coleam00/supabase-mcp. 导入的 MCP 服务器候选

概览

coleam00/supabase-mcp 是从 https://github.com/coleam00/supabase-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,提供与 Supabase 数据库交互的工具。该服务器使 AI 助手能够通过标准化接口执行数据库操作。

注意:这个Supabase MCP服务器是作为我AI IDE编码工作流程的演示而创建的。它还在进行中,我会在未来频道的视频中详细介绍。

特色

  • 读取表行:从Supabase表查询数据,可选择过滤、分页和列选择
  • 创建表记录:将新记录插入Supabase表
  • 更新表记录:根据过滤器修改Supabase表中的现有记录
  • 删除表记录:根据筛选器从Supabase表中移除记录

先修条件

  • Docker 或 Docker 桌面
  • Supabase 账户与项目

安装

  1. 克隆仓库:

Docker 设置

  1. 构建 Docker 镜像:

用途

作为MCP服务器运行,使用Docker。

Supabase MCP 服务器可通过模型上下文协议与 AI 助手集成。

  1. 在你的MCP配置中包含以下配置(在Claude Desktop、Windsurf等中)。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Supabase MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with a Supabase database. This server enables AI assistants to perform database operations through a standardized interface.

NOTE: This Supabase MCP server was created as a demonstration of my AI IDE coding workflow. It is still a work in progress which I will expand on in future videos on my channel.

Features

  • Read Table Rows: Query data from Supabase tables with optional filtering, pagination, and column selection
  • Create Table Records: Insert new records into Supabase tables
  • Update Table Records: Modify existing records in Supabase tables based on filters
  • Delete Table Records: Remove records from Supabase tables based on filters

Prerequisites

  • Docker or Docker Desktop
  • Supabase account and project

Installation

  1. Clone the repository:
    git clone https://github.com/coleam00/supabase-mcp.git
    cd supabase-mcp
    

Docker Setup

  1. Build the Docker image:
    docker build -t mcp/supabase .
    

Usage

Running as an MCP Server with Docker

The Supabase MCP server can be integrated with AI assistants using the Model Context Protocol.

  1. Include the below configuration in your MCP config (in Claude Desktop, Windsurf, etc.)

Be sure to build the container with the installation steps first!

{
  "mcpServers": {
    "supabase": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "-e", "SUPABASE_URL", "-e", "SUPABASE_SERVICE_KEY", "mcp/supabase"],
      "env": {
        "SUPABASE_URL": "YOUR-SUPABASE-URL",
        "SUPABASE_SERVICE_KEY": "YOUR-SUPABASE-SERVICE-ROLE-KEY"
      }
    }
  }
}
  1. Replace YOUR-SUPABASE-URL and YOUR-SUPABASE-SERVICE-ROLE-KEY with your actual Supabase credentials.

  2. The AI assistant can now access the Supabase database through the MCP server using the provided tools.

For more information on the Model Context Protocol, visit modelcontextprotocol.io.

Available Tools

Read Table Rows

read_table_rows(
    table_name: str,
    columns: Optional[List[str]] = None,
    filters: Optional[Dict[str, Any]] = None,
    limit: Optional[int] = None,
    offset: Optional[int] = None
)

Example:

# Read active users
read_table_rows(
    table_name="users",
    columns=["id", "name", "email"],
    filters={"is_active": True},
    limit=10,
    offset=0
)

Create Table Records

create_table_records(
    table_name: str,
    records: Union[Dict[str, Any], List[Dict[str, Any]]]
)

Example:

# Create a new user
create_table_records(
    table_name="users",
    records={
        "name": "John Doe",
        "email": "[email protected]",
        "is_active": True
    }
)

Update Table Records

update_table_records(
    table_name: str,
    updates: Dict[str, Any],
    filters: Dict[str, Any]
在 GitHub 查看完整 README

安装

docker run --rm -i -e SUPABASE_URL -e SUPABASE_SERVICE_KEY mcp/supabase
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "supabase": { "command": "docker", "args": ["run", "--rm", "-i", "-e", "SUPABASE_URL", "-e", "SUPABASE_SERVICE_KEY", "mcp/supabase"], "env": { "SUPABASE_URL": "YOUR-SUPABASE-URL", "SUPABASE_SERVICE_KEY": "YOUR-SUPABASE-SERVICE-ROLE-KEY" } } } }