supabase-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSupabase Automation via Rube MCP
通过Rube MCP实现Supabase自动化
Automate Supabase operations including database queries, table schema inspection, SQL execution, project and organization management, storage buckets, edge functions, and service health monitoring through Composio's Supabase toolkit.
通过Composio的Supabase工具包,自动化Supabase的各类操作,包括数据库查询、表架构检查、SQL执行、项目与组织管理、存储桶、边缘函数及服务健康监控。
Prerequisites
前提条件
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Supabase connection via with toolkit
RUBE_MANAGE_CONNECTIONSsupabase - Always call first to get current tool schemas
RUBE_SEARCH_TOOLS
- 必须已连接Rube MCP(确保可用)
RUBE_SEARCH_TOOLS - 通过使用
RUBE_MANAGE_CONNECTIONS工具包建立有效的Supabase连接supabase - 请始终先调用以获取当前工具架构
RUBE_SEARCH_TOOLS
Setup
配置步骤
Get Rube MCP: Add as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
https://rube.app/mcp- Verify Rube MCP is available by confirming responds
RUBE_SEARCH_TOOLS - Call with toolkit
RUBE_MANAGE_CONNECTIONSsupabase - If connection is not ACTIVE, follow the returned auth link to complete Supabase authentication
- Confirm connection status shows ACTIVE before running any workflows
获取Rube MCP:在客户端配置中添加作为MCP服务器。无需API密钥——只需添加该端点即可使用。
https://rube.app/mcp- 通过确认可响应,验证Rube MCP是否可用
RUBE_SEARCH_TOOLS - 调用并指定工具包为
RUBE_MANAGE_CONNECTIONSsupabase - 如果连接状态不是ACTIVE,请按照返回的认证链接完成Supabase身份验证
- 在运行任何工作流之前,确认连接状态显示为ACTIVE
Core Workflows
核心工作流
1. Query and Manage Database Tables
1. 查询与管理数据库表
When to use: User wants to read data from tables, inspect schemas, or perform CRUD operations
Tool sequence:
- - List projects to find the target project_ref [Prerequisite]
SUPABASE_LIST_ALL_PROJECTS - - List all tables and views in the database [Prerequisite]
SUPABASE_LIST_TABLES - - Get detailed column types, constraints, and relationships [Prerequisite for writes]
SUPABASE_GET_TABLE_SCHEMAS - - Query rows with filtering, sorting, and pagination [Required for reads]
SUPABASE_SELECT_FROM_TABLE - - Execute arbitrary SQL for complex queries, inserts, updates, or deletes [Required for writes]
SUPABASE_BETA_RUN_SQL_QUERY
Key parameters for SELECT_FROM_TABLE:
- : 20-character lowercase project reference
project_ref - : Table or view name to query
table - : Comma-separated column list (supports nested selections and JSON paths like
select)profile->avatar_url - : Array of filter objects with
filters,column,operatorvalue - : Sort expression like
ordercreated_at.desc - : Max rows to return (minimum 1)
limit - : Rows to skip for pagination
offset
PostgREST filter operators:
- ,
eq: Equal / not equalneq - ,
gt,gte,lt: Comparison operatorslte - ,
like: Pattern matching (case-sensitive / insensitive)ilike - : IS check (for null, true, false)
is - : In a list of values
in - ,
cs: Contains / contained by (arrays)cd - ,
fts,plfts,phfts: Full-text search variantswfts
Key parameters for RUN_SQL_QUERY:
- : Project reference (20 lowercase letters, pattern
ref)^[a-z]{20}$ - : Valid PostgreSQL SQL statement
query - : Boolean to force read-only transaction (safer for SELECTs)
read_only
Pitfalls:
- must be exactly 20 lowercase letters (a-z only, no numbers or hyphens)
project_ref - is read-only; use
SELECT_FROM_TABLEfor INSERT, UPDATE, DELETE operationsRUN_SQL_QUERY - For PostgreSQL array columns (text[], integer[]), use or
ARRAY['item1', 'item2']syntax, NOT JSON array syntax'{"item1", "item2"}''["item1", "item2"]' - SQL identifiers that are case-sensitive must be double-quoted in queries
- Complex DDL operations may timeout (~60 second limit); break into smaller queries
- ERROR 42P01 "relation does not exist" usually means unquoted case-sensitive identifiers
- ERROR 42883 "function does not exist" means you are calling non-standard helpers; prefer information_schema queries
适用场景:用户需要从表中读取数据、检查架构或执行CRUD操作
工具执行顺序:
- - 列出所有项目以找到目标project_ref [前置要求]
SUPABASE_LIST_ALL_PROJECTS - - 列出数据库中的所有表和视图 [前置要求]
SUPABASE_LIST_TABLES - - 获取详细的列类型、约束及关联关系 [写入操作前置要求]
SUPABASE_GET_TABLE_SCHEMAS - - 带筛选、排序和分页的行查询 [读取操作必需]
SUPABASE_SELECT_FROM_TABLE - - 执行任意SQL以完成复杂查询、插入、更新或删除操作 [写入操作必需]
SUPABASE_BETA_RUN_SQL_QUERY
SELECT_FROM_TABLE关键参数:
- : 20个字符的小写项目引用ID
project_ref - : 要查询的表或视图名称
table - : 逗号分隔的列列表(支持嵌套选择和JSON路径,如
select)profile->avatar_url - : 筛选对象数组,包含
filters、column、operatorvalue - : 排序表达式,如
ordercreated_at.desc - : 返回的最大行数(最小值为1)
limit - : 分页时要跳过的行数
offset
PostgREST筛选运算符:
- ,
eq: 等于 / 不等于neq - ,
gt,gte,lt: 比较运算符lte - ,
like: 模式匹配(区分大小写 / 不区分大小写)ilike - : IS检查(用于null、true、false)
is - : 在值列表中
in - ,
cs: 包含 / 被包含(数组类型)cd - ,
fts,plfts,phfts: 全文搜索变体wfts
RUN_SQL_QUERY关键参数:
- : 项目引用ID(20个小写字母,格式
ref)^[a-z]{20}$ - : 有效的PostgreSQL SQL语句
query - : 布尔值,强制开启只读事务(对SELECT操作更安全)
read_only
注意事项:
- 必须是恰好20个小写字母(仅a-z,无数字或连字符)
project_ref - 仅支持只读操作;请使用
SELECT_FROM_TABLE执行INSERT、UPDATE、DELETE操作RUN_SQL_QUERY - 对于PostgreSQL数组列(text[]、integer[]),请使用或
ARRAY['item1', 'item2']语法,而非JSON数组语法'{"item1", "item2"}''["item1", "item2"]' - 区分大小写的SQL标识符在查询中必须用双引号包裹
- 复杂DDL操作可能超时(约60秒限制);请拆分为更小的查询
- ERROR 42P01 "relation does not exist"通常意味着未用双引号包裹区分大小写的标识符
- ERROR 42883 "function does not exist"意味着你调用了非标准辅助函数;优先使用information_schema查询
2. Manage Projects and Organizations
2. 管理项目与组织
When to use: User wants to list projects, inspect configurations, or manage organizations
Tool sequence:
- - List all organizations (IDs and names) [Required]
SUPABASE_LIST_ALL_ORGANIZATIONS - - Get detailed org info by slug [Optional]
SUPABASE_GETS_INFORMATION_ABOUT_THE_ORGANIZATION - - List org members with roles and MFA status [Optional]
SUPABASE_LIST_MEMBERS_OF_AN_ORGANIZATION - - List all projects with metadata [Required]
SUPABASE_LIST_ALL_PROJECTS - - Get database configuration [Optional]
SUPABASE_GETS_PROJECT_S_POSTGRES_CONFIG - - Get authentication configuration [Optional]
SUPABASE_GETS_PROJECT_S_AUTH_CONFIG - - Get API keys (sensitive -- handle carefully) [Optional]
SUPABASE_GET_PROJECT_API_KEYS - - Check service health [Optional]
SUPABASE_GETS_PROJECT_S_SERVICE_HEALTH_STATUS
Key parameters:
- : Project reference for project-specific tools
ref - : Organization slug (URL-friendly identifier) for org tools
slug - : Array of services for health check:
services,auth,db,db_postgres_user,pg_bouncer,pooler,realtime,reststorage
Pitfalls:
- returns both
LIST_ALL_ORGANIZATIONSandid;slugexpectsLIST_MEMBERS_OF_AN_ORGANIZATION, notslugid - returns live secrets -- NEVER log, display, or persist full key values
GET_PROJECT_API_KEYS - requires a non-empty
GETS_PROJECT_S_SERVICE_HEALTH_STATUSarray; empty array causes invalid_request errorservices - Config tools may return 401/403 if token lacks required scope; handle gracefully rather than failing the whole workflow
适用场景:用户需要列出项目、检查配置或管理组织
工具执行顺序:
- - 列出所有组织(ID和名称)[必需]
SUPABASE_LIST_ALL_ORGANIZATIONS - - 通过slug获取组织详细信息 [可选]
SUPABASE_GETS_INFORMATION_ABOUT_THE_ORGANIZATION - - 列出组织成员及其角色和MFA状态 [可选]
SUPABASE_LIST_MEMBERS_OF_AN_ORGANIZATION - - 列出所有项目及其元数据 [必需]
SUPABASE_LIST_ALL_PROJECTS - - 获取数据库配置 [可选]
SUPABASE_GETS_PROJECT_S_POSTGRES_CONFIG - - 获取身份验证配置 [可选]
SUPABASE_GETS_PROJECT_S_AUTH_CONFIG - - 获取API密钥(敏感信息——请谨慎处理)[可选]
SUPABASE_GET_PROJECT_API_KEYS - - 检查服务健康状态 [可选]
SUPABASE_GETS_PROJECT_S_SERVICE_HEALTH_STATUS
关键参数:
- : 项目特定工具所需的项目引用ID
ref - : 组织工具所需的组织slug(URL友好标识符)
slug - : 健康检查的服务数组:
services、auth、db、db_postgres_user、pg_bouncer、pooler、realtime、reststorage
注意事项:
- 会返回
LIST_ALL_ORGANIZATIONS和id;slug需要的是LIST_MEMBERS_OF_AN_ORGANIZATION而非slugid - 返回的是可用的密钥——切勿记录、显示或持久化完整密钥值
GET_PROJECT_API_KEYS - 需要非空的
GETS_PROJECT_S_SERVICE_HEALTH_STATUS数组;空数组会导致invalid_request错误services - 如果令牌缺少必要的权限范围,配置工具可能返回401/403错误;请优雅处理而非终止整个工作流
3. Inspect Database Schema
3. 检查数据库架构
When to use: User wants to understand table structure, columns, constraints, or generate types
Tool sequence:
- - Find the target project [Prerequisite]
SUPABASE_LIST_ALL_PROJECTS - - Enumerate all tables and views with metadata [Required]
SUPABASE_LIST_TABLES - - Get detailed schema for specific tables [Required]
SUPABASE_GET_TABLE_SCHEMAS - - Generate TypeScript types from schema [Optional]
SUPABASE_GENERATE_TYPE_SCRIPT_TYPES
Key parameters for LIST_TABLES:
- : Project reference
project_ref - : Array of schema names to search (e.g.,
schemas); omit for all non-system schemas["public"] - : Include views alongside tables (default true)
include_views - : Include row count estimates and sizes (default true)
include_metadata - : Include pg_catalog, information_schema, etc. (default false)
include_system_schemas
Key parameters for GET_TABLE_SCHEMAS:
- : Project reference
project_ref - : Array of table names (max 20 per request); supports schema prefix like
table_names,public.usersauth.users - : Include foreign key info (default true)
include_relationships - : Include index info (default true)
include_indexes - : Cleaner output by hiding null fields (default true)
exclude_null_values
Key parameters for GENERATE_TYPE_SCRIPT_TYPES:
- : Project reference
ref - : Comma-separated schema names (default
included_schemas)"public"
Pitfalls:
- Table names without schema prefix assume schema
public - and
row_countfrom LIST_TABLES may be null for views or recently created tables; treat as unknown, not zerosize_bytes - GET_TABLE_SCHEMAS has a max of 20 tables per request; batch if needed
- TypeScript types include all tables in specified schemas; cannot filter individual tables
适用场景:用户需要了解表结构、列、约束或生成类型定义
工具执行顺序:
- - 找到目标项目 [前置要求]
SUPABASE_LIST_ALL_PROJECTS - - 枚举所有表和视图及其元数据 [必需]
SUPABASE_LIST_TABLES - - 获取特定表的详细架构 [必需]
SUPABASE_GET_TABLE_SCHEMAS - - 从架构生成TypeScript类型 [可选]
SUPABASE_GENERATE_TYPE_SCRIPT_TYPES
LIST_TABLES关键参数:
- : 项目引用ID
project_ref - : 要搜索的架构名称数组(例如
schemas);留空则包含所有非系统架构["public"] - : 包含视图(默认true)
include_views - : 包含行计数估算和大小(默认true)
include_metadata - : 包含pg_catalog、information_schema等系统架构(默认false)
include_system_schemas
GET_TABLE_SCHEMAS关键参数:
- : 项目引用ID
project_ref - : 表名称数组(每次请求最多20个);支持架构前缀,如
table_names、public.usersauth.users - : 包含外键信息(默认true)
include_relationships - : 包含索引信息(默认true)
include_indexes - : 隐藏空字段以简化输出(默认true)
exclude_null_values
GENERATE_TYPE_SCRIPT_TYPES关键参数:
- : 项目引用ID
ref - : 逗号分隔的架构名称(默认
included_schemas)"public"
注意事项:
- 不带架构前缀的表名称默认使用架构
public - 返回的
LIST_TABLES和row_count对于视图或新建表可能为null;请视为未知值而非0size_bytes - 每次请求最多支持20个表;如有需要请分批处理
GET_TABLE_SCHEMAS - TypeScript类型会包含指定架构中的所有表;无法过滤单个表
4. Manage Edge Functions
4. 管理边缘函数
When to use: User wants to list, inspect, or work with Supabase Edge Functions
Tool sequence:
- - Find the project reference [Prerequisite]
SUPABASE_LIST_ALL_PROJECTS - - List all edge functions with metadata [Required]
SUPABASE_LIST_ALL_FUNCTIONS - - Get detailed info for a specific function [Optional]
SUPABASE_RETRIEVE_A_FUNCTION
Key parameters:
- : Project reference
ref - Function slug for RETRIEVE_A_FUNCTION
Pitfalls:
- returns metadata only, not function code or logs
LIST_ALL_FUNCTIONS - and
created_atmay be epoch milliseconds; convert to human-readable timestampsupdated_at - These tools cannot create or deploy edge functions; they are read-only inspection tools
- Permission errors may occur without org/project admin rights
适用场景:用户需要列出、检查Supabase边缘函数
工具执行顺序:
- - 找到项目引用ID [前置要求]
SUPABASE_LIST_ALL_PROJECTS - - 列出所有边缘函数及其元数据 [必需]
SUPABASE_LIST_ALL_FUNCTIONS - - 获取特定函数的详细信息 [可选]
SUPABASE_RETRIEVE_A_FUNCTION
关键参数:
- : 项目引用ID
ref - RETRIEVE_A_FUNCTION所需的函数slug
注意事项:
- 仅返回元数据,不包含函数代码或日志
LIST_ALL_FUNCTIONS - 和
created_at可能为毫秒级时间戳;请转换为人类可读的时间格式updated_at - 这些工具无法创建或部署边缘函数;仅支持只读检查
- 若无组织/项目管理员权限,可能会出现权限错误
5. Manage Storage Buckets
5. 管理存储桶
When to use: User wants to list storage buckets or manage file storage
Tool sequence:
- - Find the project reference [Prerequisite]
SUPABASE_LIST_ALL_PROJECTS - - List all storage buckets [Required]
SUPABASE_LISTS_ALL_BUCKETS
Key parameters:
- : Project reference
ref
Pitfalls:
- returns bucket list only, not bucket contents or access policies
LISTS_ALL_BUCKETS - For file uploads, handles CORS preflight for TUS resumable uploads only
SUPABASE_RESUMABLE_UPLOAD_SIGN_OPTIONS_WITH_ID - Direct file operations may require using with the Supabase storage API
proxy_execute
适用场景:用户需要列出存储桶或管理文件存储
工具执行顺序:
- - 找到项目引用ID [前置要求]
SUPABASE_LIST_ALL_PROJECTS - - 列出所有存储桶 [必需]
SUPABASE_LISTS_ALL_BUCKETS
关键参数:
- : 项目引用ID
ref
注意事项:
- 仅返回存储桶列表,不包含桶内容或访问策略
LISTS_ALL_BUCKETS - 对于文件上传,仅处理TUS可恢复上传的CORS预检
SUPABASE_RESUMABLE_UPLOAD_SIGN_OPTIONS_WITH_ID - 直接文件操作可能需要结合Supabase存储API使用
proxy_execute
Common Patterns
通用模式
ID Resolution
ID解析
- Project reference: -- extract
SUPABASE_LIST_ALL_PROJECTSfield (20 lowercase letters)ref - Organization slug: -- use
SUPABASE_LIST_ALL_ORGANIZATIONS(notslug) for downstream org toolsid - Table names: -- enumerate available tables before querying
SUPABASE_LIST_TABLES - Schema discovery: -- inspect columns and constraints before writes
SUPABASE_GET_TABLE_SCHEMAS
- 项目引用ID: 通过提取
SUPABASE_LIST_ALL_PROJECTS字段(20个小写字母)ref - 组织slug: 通过获取
SUPABASE_LIST_ALL_ORGANIZATIONS(而非slug)以用于后续组织工具id - 表名称: 通过枚举可用表后再进行查询
SUPABASE_LIST_TABLES - 架构发现: 通过在写入操作前检查列和约束
SUPABASE_GET_TABLE_SCHEMAS
Pagination
分页
- : Uses
SUPABASE_SELECT_FROM_TABLE+offsetpagination. Increment offset by limit until fewer rows than limit are returned.limit - : May paginate for large accounts; follow cursors/pages until exhausted.
SUPABASE_LIST_ALL_PROJECTS - : May paginate for large databases.
SUPABASE_LIST_TABLES
- : 使用
SUPABASE_SELECT_FROM_TABLE+offset分页。将offset按limit递增,直到返回的行数少于limitlimit - : 对于大型账户可能会分页;请跟随游标/页面直到获取全部数据
SUPABASE_LIST_ALL_PROJECTS - : 对于大型数据库可能会分页
SUPABASE_LIST_TABLES
SQL Best Practices
SQL最佳实践
- Always use or
SUPABASE_GET_TABLE_SCHEMASbefore writing SQLSUPABASE_LIST_TABLES - Use for SELECT queries to prevent accidental mutations
read_only: true - Quote case-sensitive identifiers: not
SELECT * FROM "MyTable"SELECT * FROM MyTable - Use PostgreSQL array syntax for array columns: not
ARRAY['a', 'b']['a', 'b'] - Break complex DDL into smaller statements to avoid timeouts
- 编写SQL前请务必使用或
SUPABASE_GET_TABLE_SCHEMASSUPABASE_LIST_TABLES - 对于SELECT查询,请使用以防止意外修改
read_only: true - 区分大小写的标识符请加双引号:而非
SELECT * FROM "MyTable"SELECT * FROM MyTable - 数组列请使用PostgreSQL数组语法:而非
ARRAY['a', 'b']['a', 'b'] - 将复杂DDL拆分为更小的语句以避免超时
Known Pitfalls
已知注意事项
ID Formats
ID格式
- Project references are exactly 20 lowercase letters (a-z): pattern
^[a-z]{20}$ - Organization identifiers come as both (UUID) and
id(URL-friendly string); tools vary in which they acceptslug - requires
LIST_MEMBERS_OF_AN_ORGANIZATION, notslugid
- 项目引用ID必须是恰好20个小写字母(a-z):格式
^[a-z]{20}$ - 组织标识符包含(UUID)和
id(URL友好字符串);不同工具对其要求不同slug - 需要的是
LIST_MEMBERS_OF_AN_ORGANIZATION而非slugid
SQL Execution
SQL执行
- has ~60 second timeout for complex operations
BETA_RUN_SQL_QUERY - PostgreSQL array syntax required: or
ARRAY['item'], NOT JSON syntax'{"item"}''["item"]' - Case-sensitive identifiers must be double-quoted in SQL
- ERROR 42P01: relation does not exist (check quoting and schema prefix)
- ERROR 42883: function does not exist (use information_schema instead of custom helpers)
- 对复杂操作有约60秒的超时限制
BETA_RUN_SQL_QUERY - 必须使用PostgreSQL数组语法:或
ARRAY['item'],而非JSON语法'{"item"}''["item"]' - 区分大小写的标识符在SQL中必须用双引号包裹
- ERROR 42P01: relation does not exist(检查引号和架构前缀)
- ERROR 42883: function does not exist(使用information_schema而非自定义辅助函数)
Sensitive Data
敏感数据
- returns service-role keys -- NEVER expose full values
GET_PROJECT_API_KEYS - Auth config tools exclude secrets but may still contain sensitive configuration
- Always mask or truncate API keys in output
- 返回服务角色密钥——切勿暴露完整密钥值
GET_PROJECT_API_KEYS - 身份验证配置工具会排除密钥,但仍可能包含敏感配置信息
- 在输出中请始终掩码或截断API密钥
Schema Metadata
架构元数据
- and
row_countfromsize_bytescan be null; do not treat as zeroLIST_TABLES - System schemas are excluded by default; set to see them
include_system_schemas: true - Views appear alongside tables unless
include_views: false
- 返回的
LIST_TABLES和row_count可能为null;请勿视为0size_bytes - 默认排除系统架构;设置以查看
include_system_schemas: true - 除非设置,否则视图会与表一同显示
include_views: false
Rate Limits and Permissions
速率限制与权限
- Enrichment tools (API keys, configs) may return 401/403 without proper scopes; skip gracefully
- Large table listings may require pagination
- fails with empty
GETS_PROJECT_S_SERVICE_HEALTH_STATUSarray -- always specify at least oneservices
- 增强工具(如API密钥、配置)若无足够权限范围可能返回401/403错误;请优雅跳过而非终止
- 大型表列表可能需要分页
- 在
GETS_PROJECT_S_SERVICE_HEALTH_STATUS数组为空时会失败——请始终至少指定一个服务services
Quick Reference
快速参考
| Task | Tool Slug | Key Params |
|---|---|---|
| List organizations | | (none) |
| Get org info | | |
| List org members | | |
| List projects | | (none) |
| List tables | | |
| Get table schemas | | |
| Query table | | |
| Run SQL | | |
| Generate TS types | | |
| Postgres config | | |
| Auth config | | |
| Get API keys | | |
| Service health | | |
| List edge functions | | |
| Get edge function | | |
| List storage buckets | | |
| List DB branches | | |
| 任务 | 工具Slug | 关键参数 |
|---|---|---|
| 列出组织 | | 无 |
| 获取组织信息 | | |
| 列出组织成员 | | |
| 列出项目 | | 无 |
| 列出表 | | |
| 获取表架构 | | |
| 查询表 | | |
| 执行SQL | | |
| 生成TS类型 | | |
| Postgres配置 | | |
| 身份验证配置 | | |
| 获取API密钥 | | |
| 服务健康状态 | | |
| 列出边缘函数 | | |
| 获取边缘函数 | | |
| 列出存储桶 | | |
| 列出数据库分支 | | |