教程

面向 AI Agent 的 Supabase MCP 服务器配置

面向 AI Agent 的 Supabase MCP 安全配置指南,覆盖只读模式、项目绑定、功能选择和验证检查。

返回目录

教程

面向 AI Agent 的 Supabase MCP 服务器配置

适合希望 AI Agent 检查 Supabase 项目、schema、文档、日志、分支或存储,同时避免开放生产数据库完整控制权的团队。

SupabaseMCPDatabase AgentsAI AgentsPostgres开发者工具Security
适合场景

适合希望 AI Agent 检查 Supabase 项目、schema、文档、日志、分支或存储,同时避免开放生产数据库完整控制权的团队。

页面类型

教程

属性

Supabase / 数据库 MCP / 只读优先

如何使用

把这个工作流作为起点,再根据自己的流程调整工具、提示词和复核步骤。

概览

Supabase MCP 能显著提升数据库相关 Agent 的能力,因为 Agent 可以检查 schema、读取项目上下文、搜索文档、查看日志并辅助规划迁移。但这也改变了风险等级。数据库 MCP 服务器不只是内容工具,它可能暴露结构、运行信号,某些配置下还可能拥有写入能力。

最安全的起点是只读、绑定项目、限制功能。不要直接把 Agent 接到整个 Supabase 账号,而是绑定到当前任务对应的 project ref。不要开放所有功能,而是只启用工作流需要的最小功能集。不要用真实迁移做第一次测试,而是先跑无破坏性的 schema 或文档查询。

这篇指南适合 Agent 构建者、独立 SaaS 团队和希望获得 Supabase 上下文辅助的开发者。目标不是让 Agent 成为无人审查的数据库管理员,而是建立一套可审计的 MCP 配置。

使用场景

  • 让 AI 编程 Agent 在生成应用代码前,读取表名、字段形状、关系和 RLS 相关上下文。
  • 在 Agent 会话中搜索 Supabase 文档,用于规划 Auth、Storage、Edge Functions、Realtime 或 Postgres 改动。
  • 给调试 Agent 提供日志或项目元数据的只读访问,让它解释故障,而不是直接连接生产写入工具。
  • 建立受控迁移规划流程:Agent 起草 SQL,人工通过团队正常流程审查和执行。

实施步骤

  1. 创建专用凭据. 使用专门用于 MCP 访问的 token 或 OAuth 流程,不要复用过宽的个人凭据。记录凭据所有者、适用项目和撤销方式。
  2. 绑定项目引用. 如果工作流只针对一个项目,就配置具体的 Supabase project ref。项目绑定能避免 Agent 漂移到同一账号下的其他数据库。
  3. 先启用只读. 第一次配置使用只读模式,让 Agent 能检查 schema、文档和元数据,但不能执行 SQL 或修改资源。写入工具应作为后续审批项。
  4. 限制功能分组. 根据任务只开放需要的功能,例如 docs、account、development、debugging、storage 或 branching。功能越少,提示词越容易审查。
  5. 执行安全检查. 让 Agent 输出 schema 摘要、查询文档或解释非敏感日志,再和 Supabase Dashboard 或 SQL Editor 中的信息核对。
  6. 记录写入升级规则. 如果之后启用迁移、存储或分支操作,写明哪些动作需要人工批准,生成 SQL 在哪里审查,失败改动如何回滚。

配置步骤

  1. 第一次连接默认使用 `--read-only`,除非 Agent 只在隔离开发分支中工作。
  2. 单项目任务使用 `--project-ref`,尤其是一个账号下有多个应用或客户项目时。
  3. 通过 `--features` 等功能选择参数缩小工具集合,只暴露 Agent 实际需要的区域。
  4. 不要把不可信 Agent 客户端直接接到有写权限的生产分支。
  5. 用只读查询或文档检索验证服务器,再检查日志中是否有意外工具调用。

快速判断

首选模式只读、绑定项目,并限制在文档或 schema 检查。
常用功能组docs 用于学习,development 用于 schema 上下文,debugging 用于日志,branching 用于安全变更规划。
主要风险拥有过宽数据库工具的 Agent 可能读取或修改超过提示词意图的内容。
成功标志Agent 能准确解释 schema 或文档,首次验证期间没有尝试写入。

常见问题

AI Agent 使用 Supabase MCP 应该只读吗?

第一次配置和大多数连接生产的工作流都应该只读。只有在经过审查的开发环境或受控自动化中才开启写入。

为什么要用 `--project-ref`?

它把 MCP 服务器绑定到一个 Supabase 项目,减少误访问同账号下其他应用的机会。

Agent 可以通过 Supabase MCP 执行迁移吗?

写入配置下可以,但更安全的流程是让 Agent 起草 SQL,由人工按正常迁移流程审查和应用。

相关资源

123 results 0 saved 7 categories 123 resources Updated index

Workflow Directory

Browse curated agents, MCP servers, templates, and workflow examples for real AI automation projects.

AI agent stack research

Find the right AI agents, MCP servers, and workflow templates

Agent Stack Library is a practical directory for people who are building real AI automation systems, not just collecting tool names. The site brings together AI agent frameworks, MCP servers, workflow templates, coding agents, browser automation tools, research workflows, and SaaS operations playbooks so you can compare an entire agent stack before committing to a toolchain.

A useful AI agent stack usually needs more than one model or one chat interface. Teams need a clear workflow, safe tool permissions, repeatable prompts, review checkpoints, and a way to measure whether the output is good enough for production. That is why the directory focuses on use cases such as AI coding agents, MCP server selection, SEO content workflows, browser QA, research assistants, internal tools, and multi-agent orchestration.

If you are evaluating MCP servers for AI agents, start with the task. A coding agent often needs GitHub access, a narrow filesystem scope, a test runner, and browser or DevTools verification. A research agent may need web search, document parsing, citation capture, memory, and a review step. A business operations agent may need CRM, email, calendar, spreadsheet, and audit logs. The best stack is the smallest one that completes the job safely.

AI agent workflow templates

Workflow templates help turn one-off prompts into repeatable systems. Each template should define the trigger, input context, agent role, connected tools, output format, human review step, and success metric. Browse the AI Agent Workflow Templates guide for SEO, coding, research, browser automation, and SaaS operations examples.

MCP servers for AI agents

MCP servers connect agents to browsers, repositories, files, databases, memory, and business apps. Good MCP choices reduce custom integration work, but they also require clear permission boundaries. The Best MCP Servers for AI Agents guide explains how to pick a safe and useful tool stack.

AI coding agent workflow

Coding agents work best when they follow a normal engineering path: issue intake, repo context, plan, patch, tests, UI verification, pull request, and human review. The AI Coding Agent Workflow page gives a practical checklist for scoped code changes.

How to choose an agent stack

Start by deciding what the agent is allowed to do. Read-only workflows are easier to launch because the agent can gather context, summarize findings, and draft recommendations without touching production systems. Write-capable workflows need stricter guardrails: scoped credentials, test environments, logging, rollback procedures, and a human approval point before external actions.

Next, compare tools by workflow fit rather than popularity. An open-source agent framework may be perfect for a developer team that wants full control, while a managed automation platform may be better for operations teams that need quick integrations. A browser automation stack is useful for UI checks and web research, but it should not replace structured APIs when reliable APIs exist.

Finally, measure quality. Track task completion rate, review time, correction rate, cost per run, latency, and whether the output can be reused without heavy manual cleanup. A strong AI agent workflow is not the one with the most tools; it is the one that produces reliable output, exposes failures clearly, and lets humans stay in control where the risk is high.

What each directory category is for

The Agents category covers frameworks, SDKs, and agent products that help teams plan, call tools, manage memory, hand off work, or coordinate multiple specialist agents. Use this category when you are comparing LangGraph-style orchestration, coding agents, research agents, customer support agents, or open-source agent frameworks for a production project.

The MCP Tools category is focused on servers and integrations that let an AI agent interact with the outside world. These pages are useful when you need repository context, browser inspection, file access, databases, calendars, CRMs, or other business systems. Each MCP server should be judged by permission scope, reliability, setup effort, documentation quality, and how clearly failed tool calls are reported.

The Workflows and Templates categories are for readers who already know the job they want to automate. Instead of starting with a tool, start with a repeatable process: SEO content briefing, GitHub issue triage, browser QA, competitive research, sales lead enrichment, or support ticket summarization. From there, pick the smallest agent stack that can collect the right context, run the task, produce a reviewable output, and leave a log for future improvement.