Supabase 扩展
本教程介绍如何将 Supabase MCP 服务器 添加为 zai 扩展,以便与你的 Supabase 项目交互、管理表、查询数据、部署 Edge Functions,并直接与你的 Supabase 后端交互。
快速安装
- zai Desktop
- zai CLI
使用 zai configure 添加 Remote Extension (Streamable HTTP) 扩展类型,配置如下:
端点 URL
https://mcp.supabase.com/mcp
配置
Supabase 远程 MCP
Supabase MCP 服务器由 Supabase 托管,并提供基于 OAuth 的身份验证。连接时,你会被重定向到 supabase.com 登录自己的账户。
- zai Desktop
- zai CLI
- Launch the installer
- Click
Yesto confirm the installation - Click the button in the top-left to open the sidebar
- Navigate to the chat
- Run the
configurecommand:
zai configure
- Choose to add a
Remote Extension (Streamable HTTP).
┌ zai-configure
│
◇ What would you like to configure?
│ Add Extension
│
◆ What type of extension would you like to add?
│ ○ Built-in Extension
│ ○ Command-line Extension
│ ● Remote Extension (Streamable HTTP) (Connect to a remote extension via MCP Streamable HTTP)
└
- Give your extension a name.
┌ zai-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Remote Extension (Streamable HTTP)
│
◆ What would you like to call this extension?
│ Supabase
└
- Enter the Streamable HTTP endpoint URI.
┌ zai-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Remote Extension (Streamable HTTP)
│
◇ What would you like to call this extension?
│ Supabase
│
◆ What is the Streamable HTTP endpoint URI?
│ https://mcp.supabase.com/mcp
└
- Enter the number of seconds zai should wait for actions to complete before timing out. Default is
300seconds.
┌ zai-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Remote Extension (Streamable HTTP)
│
◇ What would you like to call this extension?
│ Supabase
│
◇ What is the Streamable HTTP endpoint URI?
│ https://mcp.supabase.com/mcp
│
◆ Please set the timeout for this tool (in secs):
│ 300
└
- Enter a description for this extension.
┌ zai-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Remote Extension (Streamable HTTP)
│
◇ What would you like to call this extension?
│ Supabase
│
◇ What is the Streamable HTTP endpoint URI?
│ https://mcp.supabase.com/mcp
│
◇ Please set the timeout for this tool (in secs):
│ 300
│
◆ Enter a description for this extension:
│ 将你的 Supabase 项目连接到 AI 助手。直接从 MCP 客户端管理表、查询数据、部署 Edge Functions,并与你的 Supabase 后端交互。
└
- Choose
Nowhen asked to add custom headers.
┌ zai-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Remote Extension (Streamable HTTP)
│
◇ What would you like to call this extension?
│ Supabase
│
◇ What is the Streamable HTTP endpoint URI?
│ https://mcp.supabase.com/mcp
│
◇ Please set the timeout for this tool (in secs):
│ 300
│
◇ Enter a description for this extension:
│ 将你的 Supabase 项目连接到 AI 助手。直接从 MCP 客户端管理表、查询数据、部署 Edge Functions,并与你的 Supabase 后端交互。
│
◆ Would you like to add custom headers?
│ No
│
└ Added Supabase extension
OAuth 流程
首次通过 zai 连接 Supabase MCP 服务器时,浏览器会打开一个 OAuth 窗口。请按照提示授权访问你的 Supabase 项目。
安全提示
Supabase MCP 服务器会授予对你数据库以及项目管理能力的访问权限。在执行之前,请务必审查 LLM 请求的操作,并确认你当前工作在正确的环境(development、staging、production)中。
使用示例
示例 1:列出你的 Supabase 项目
概览你的所有 Supabase 项目及其配置。
zai 提示词
List all my Supabase projects
zai 输出
桌面版
Here are your Supabase projects:
1. my project (ID: abc123xyz789defg)
- Region: US West 1
- Created: October 30, 2025
- Status: ACTIVE_HEALTHY
- Database: PostgreSQL 17.6.1.031 (Engine v17)
- Host: db.abc123xyz789defg.supabase.co
2. new project (ID: jkl456mno012pqrs)
- Region: US West 1
- Created: October 31, 2025
- Status: INACTIVE
- Database: PostgreSQL 17.6.1.032 (Engine v17)
- Host: db.jkl456mno012pqrs.supabase.co
Would you like more detailed information about any specific project?
示例 2:查询数据库表
发现并查询 Supabase 项目中的表。
zai 提示词
What tables exist in my project?
zai 输出
桌面版
Tables in my project (public schema):
1. users
- RLS Enabled: Yes
- Row count: 150
- Columns: id (uuid), email (text), name (text), created_at (timestamptz), role (text)
- Primary Key: id
- Foreign Keys: Referenced by posts.user_id, profiles.user_id
2. posts
- RLS Enabled: Yes
- Row count: 342
- Columns: id (uuid), user_id (uuid), title (text), content (text), created_at (timestamptz)
- Primary Key: id
- Foreign Keys: References users.id, referenced by comments.post_id
3. comments
- RLS Enabled: Yes
- Row count: 1089
- Columns: id (uuid), post_id (uuid), user_id (uuid), content (text), created_at (timestamptz)
- Primary Key: id
- Foreign Keys: References posts.id, references users.id
4. profiles
- RLS Enabled: Yes
- Row count: 150
- Columns: id (uuid), user_id (uuid), bio (text), avatar_url (text), updated_at (timestamptz)
- Primary Key: id
- Foreign Keys: References users.id
5. categories
- RLS Enabled: No
- Row count: 12
- Columns: id (uuid), name (text), description (text), created_at (timestamptz)
- Primary Key: id
Would you like to query data from any of these tables?
示例 3:部署 Edge Function
直接通过 zai 部署和管理 Supabase Edge Functions。
zai 提示词
Deploy a new Edge Function called 'hello-world' that returns a simple JSON response
zai 输出
桌面版
Edge Function deployed successfully!
Function Name: hello-world
Version: 1
Status: ACTIVE
Function ID: c4e03748-3e72-45e2-bdca-03f7e4800874
Project: my project (tabowbdrhvtlvzvfyinw)
Entrypoint: index.ts
JWT Verification: Enabled
Created: November 8, 2025
Function code:
~~~typescript
Deno.serve(async (req) => {
return new Response(
JSON.stringify({ message: "Hello World!" }),
{ headers: { "Content-Type": "application/json" } },
)
})
~~~
Endpoint:
https://tabowbdrhvtlvzvfyinw.supabase.co/functions/v1/hello-world
You can test the function by sending a request to the endpoint above.
其他资源
欲了解更多关于 Supabase MCP 服务器及其能力的信息,请访问: