MCP 的企业管理身份验证
此功能仅在团队和企业计划中可用,并且需要你的组织已经配置了单点登录 (SSO)。
🌐 This feature is only available on the Team and Enterprise Plans, and requires SSO to already be configured for your organization.
本页面介绍了如何使用 Supabase MCP 服务器 以及将像 Cursor 或 Claude 这样的 AI 工具连接到你的 Supabase 组织和项目。如果你正在自己搭建以 Supabase Auth 支持的 MCP 服务器,请参见 模型上下文协议 (MCP) 身份验证 。
🌐 This page covers using the Supabase MCP Server and connecting AI tools like Cursor or Claude to your Supabase organization and projects. If you're building your own MCP server backed by Supabase Auth, see Model Context Protocol (MCP) Authentication instead.
通常,你们组织的每个成员都需要单独登录并批准他们的 AI 工具连接到 Supabase MCP 服务器。企业管理的身份验证可以省去每个用户的这一步。一旦你的身份提供商(IdP)和 MCP 客户端彼此信任实现单点登录,成员就能自动访问 Supabase MCP 服务器,而无需单独的批准提示。
🌐 Normally, each member of your organization has to individually sign in and approve their AI tool's connection to the Supabase MCP Server. Enterprise-managed authentication removes that per-user step. Once your identity provider (IdP) and MCP client both trust each other for single sign-on, members get access to the Supabase MCP Server automatically, without a separate approval prompt.
这是 Supabase 对 MCP 企业管理授权 扩展的实现,它依赖于由你的 IdP 签发的 ID-JAG(身份断言 JWT 授权凭证)。
🌐 This is Supabase's implementation of the MCP Enterprise-Managed Authorization extension, which relies on an ID-JAG (Identity Assertion JWT Authorization Grant) issued by your IdP.
先决条件 #
🌐 Prerequisites
在成员可以使用企业管理的身份验证之前:
🌐 Before members can use enterprise-managed authentication:
- 必须为你的组织配置 SSO。如果你还没有设置,请参阅 为你的组织启用 SSO。
- 你的身份提供者必须支持为 MCP 的企业管理授权扩展签发 ID-JAG。请与你的 IdP 核实是否可用以及如何启用它。
- MCP 客户端必须获得你们组织的授权。 组织拥有者或管理员只需操作一次,把 MCP 客户端通过标准登录流程连接到 Supabase,并在同意屏幕上为你们组织批准它。批准后的客户端会出现在你们组织设置里的 已授权应用 下,你可以在那里查看或撤销它。
谁参与了 #
🌐 Who's involved
| 角色方 | 作用 |
|---|---|
| 身份提供者 (IdP)(例如 Okta) | 通过 SSO 登录你的成员,并在请求时向 MCP 客户端颁发针对 Supabase 的 ID-JAG |
| MCP 客户端 | 你的成员使用的 AI 工具。它会让成员登录 IdP,获取 ID-JAG,然后再把它提交给 Supabase |
| Supabase | 运行你的客户端最终调用的 MCP 服务器,以及验证 ID-JAG 并颁发调用它所需访问令牌的 OAuth 服务器 |
它是怎么运作的 #
🌐 How it works
- 会员通过你的身份提供者(IdP)登录MCP客户端,使用成员已经在用的相同SSO登录方式,通过OpenID Connect或SAML。身份提供者会返回一个身份令牌给MCP客户端。
- MCP 客户端在 IdP 上用那个身份令牌换取 ID-JAG。 这是客户端向 IdP 发出的一个单独请求(一个 RFC 8693 的令牌交换),请求一个专门针对 Supabase 的令牌。IdP 会先检查自己的策略,然后才发放令牌。
- IdP 将 ID-JAG 返回给 MCP 客户端。
- MCP 客户端将 ID-JAG 提交给 Supabase 的 OAuth 服务器,将其用作 JWT 授权凭证,无需交互式同意屏幕。
- Supabase 验证 ID-JAG,将其与你的 IdP 公钥进行比对,确认成员属于你的组织且拥有匹配的 SSO 身份,同时确认组织所有者或管理员已授权此 MCP 客户端。如果一切正常,Supabase 会发放一个短期有效的访问令牌。
- MCP 客户端使用那个访问令牌调用 Supabase MCP 服务器,就像其他任何已认证的请求一样。
步骤5中的访问令牌无法刷新。每当 MCP 客户端需要新的令牌时,它会重复执行第2到第5步,而且它的访问权限始终限于你们组织现有权限所允许的范围。
🌐 The access token from step 5 can't be refreshed. The MCP client repeats steps 2 through 5 whenever it needs a new one, and its access is always limited to what your organization's existing permissions already allow.
为什么使用企业管理的认证 #
🌐 Why use enterprise-managed authentication
没有它,每个成员都必须手动连接并授权 MCP 客户端访问 Supabase,而且每次访问过期时都要重新操作。在组织规模上,这会导致:
🌐 Without it, every member has to manually connect and authorize the MCP client against Supabase, and do it again whenever access expires. At the scale of an organization, this creates:
- 入职摩擦:新成员必须自己发现并完成审批流程。
- 无中央控制:管理员无法在组织层面查看或撤销MCP客户端的访问权限;它分散在各个用户的单独批准中。
- 访问不一致:通过 MCP 客户端访问的会员身份,不一定会与你的 IdP 已经分配给他们的角色保持同步。
通过企业管理的身份验证,组织的所有者或管理员只需为整个组织授权一次 MCP 客户端。从那以后,访问将遵循你现有的单点登录,无需单独批准,也无需在令牌过期时手动重新连接。
🌐 With enterprise-managed authentication, an organization owner or admin authorizes the MCP client once for the whole organization. From then on, access follows your existing SSO sign-in, with no separate approval and no manual reconnection when a token expires.
配置你的 ID-JAG 发行者 #
🌐 Configuring your ID-JAG issuer
一旦设置了单点登录,组织所有者就可以从你的身份提供者添加 ID-JAG 发行者 URL:
🌐 Once SSO is set up, an organization owner can add the ID-JAG issuer URL from your identity provider:
- 去你组织设置的 SSO 页面。
- 打开高级设置。
- 输入你身份提供者的 IDJAG 发行者 URL。
不像你的 SAML 元数据,发行者 URL 不是 Supabase 可以自动推导的:SAML 断言没有对应的值。你的 IdP 关于 ID-JAG 或 OIDC 的文档会把它列在发布的令牌上的 iss 声明里,通常是用于 OIDC 发现的相同基础 URL。
🌐 Unlike your SAML metadata, the issuer URL isn't something Supabase can derive automatically: SAML assertions don't carry an equivalent value. Your IdP's documentation for ID-JAG or OIDC will list this as the iss claim on the tokens it issues, usually the same base URL used for OIDC discovery.
一旦保存,Supabase 会使用这个 URL 来获取你 IdP 的公钥,并验证你的 MCP 客户端代表你的成员提交的 ID-JAG。
🌐 Once saved, Supabase uses this URL to fetch your IdP's public keys and verify ID-JAGs presented by your MCP client on behalf of your members.
安全注意事项 #
🌐 Security considerations
- 访问总是以用户为范围。 ID-JAG 永远无法授予超出已认证成员权限的访问权限。
- MCP 客户端必须获得明确授权。 仅添加 ID-JAG 发行者并不能授予访问权限;组织所有者或管理员仍然需要通过标准登录流程批准一次。批准的客户端会列在 已授权应用 下。
- 访问令牌是短期的且不可续期的。 没有刷新令牌。
- 在源头撤销访问权限。 要切断整个组织对 MCP 客户端的访问,请从 已授权应用 中移除其授权。要切断单个成员的访问,请在 Supabase 仪表板中将其移除。
下一步 #
🌐 Next steps