Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(studio): warn that scoped tokens don't support the MCP server (#48849)

kemal.earth124ff77ad082
diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/NewScopedTokenFormReview.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/NewScopedTokenFormReview.tsx
index e3f70e6b2c6..da7ac1d7f58 100644
--- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/NewScopedTokenFormReview.tsx
+++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/NewScopedTokenFormReview.tsx
@@ -13,8 +13,8 @@ import {
type RiskLevel,
} from '../../AccessToken.permissions'
import { useOrgAndProjectData } from '../../hooks/useOrgAndProjectData'
+import { McpUnsupportedWarning } from '../McpUnsupportedWarning'
import { EXPIRY_OPTIONS, type TokenFormValues } from './NewScopedTokenForm.utils'
-import { InlineLinkClassName } from '@/components/ui/InlineLink'
import {
getEnabledEndpointsForCapability,
getEnabledMcpTools,
@@ -257,18 +257,7 @@ export const NewScopedTokenFormReview = ({
<div className="flex flex-col gap-3">
<h3 className="text-sm">MCP tools</h3>
- <p className="text-xs text-foreground-light">
- Need a token for the Supabase MCP server or full access to your account?{' '}
- <button
- type="button"
- className={InlineLinkClassName}
- onClick={onSelectLegacyToken}
- tabIndex={0}
- >
- Create a legacy token
- </button>
- .
- </p>
+ <McpUnsupportedWarning onSelectLegacyToken={onSelectLegacyToken} />
{mcpTools.length === 0 ? (
<p className="text-xs text-foreground-light">
No MCP tools are enabled by the selected capabilities.
diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/ResourceAccessStep.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/ResourceAccessStep.tsx
index 9d9b92dd55a..bbc4e224e88 100644
--- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/ResourceAccessStep.tsx
+++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/ResourceAccessStep.tsx
@@ -248,7 +248,7 @@ export const ResourceAccessStep = ({
mode="combobox"
label="Select organizations"
badgeLimit="wrap"
- showIcon={false}
+ showIcon={true}
deletableBadge
className="w-full"
ref={field.ref}
diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/McpUnsupportedWarning.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/McpUnsupportedWarning.tsx
new file mode 100644
index 00000000000..0e3b7ee6332
--- /dev/null
+++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/McpUnsupportedWarning.tsx
@@ -0,0 +1,40 @@
+import { Admonition } from 'ui-patterns/Admonition'
+
+import { InlineLinkClassName } from '@/components/ui/InlineLink'
+
+// Temporary warning: scoped tokens can't be used with the Supabase MCP server yet.
+// Tracked by Linear DESIGN-479, blocked on the AI-1025 FGA guard migration.
+// Remove once that lands: delete this module, then the two call sites (NewScopedTokenFormReview, ViewTokenSheet).
+
+export const MCP_UNSUPPORTED_WARNING_TITLE =
+ "Scoped tokens don't currently work with the Supabase MCP server"
+export const MCP_UNSUPPORTED_WARNING_DESCRIPTION = 'Support for scoped tokens is coming soon.'
+
+interface McpUnsupportedWarningProps {
+ onSelectLegacyToken?: () => void
+}
+
+export const McpUnsupportedWarning = ({ onSelectLegacyToken }: McpUnsupportedWarningProps) => (
+ <Admonition
+ type="warning"
+ title={MCP_UNSUPPORTED_WARNING_TITLE}
+ description={
+ onSelectLegacyToken ? (
+ <p>
+ {MCP_UNSUPPORTED_WARNING_DESCRIPTION} If you need a full-access token for the MCP server,{' '}
+ <button
+ type="button"
+ className={InlineLinkClassName}
+ onClick={onSelectLegacyToken}
+ tabIndex={0}
+ >
+ create a legacy token
+ </button>
+ .
+ </p>
+ ) : (
+ MCP_UNSUPPORTED_WARNING_DESCRIPTION
+ )
+ }
+ />
+)
diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx
index c066ac9f34a..81774c998fc 100644
--- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx
+++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx
@@ -302,7 +302,8 @@ describe('NewScopedTokenSheet', () => {
fireEvent.click(await screen.findByRole('option', { name: 'Read' }))
fireEvent.click(await screen.findByRole('button', { name: 'Review access' }))
// The review step's own legacy-token link switches back into legacy mode
- await user.click(await screen.findByText('Create a legacy token'))
+ await screen.findByText("Scoped tokens don't currently work with the Supabase MCP server")
+ await user.click(await screen.findByText('create a legacy token'))
await screen.findByText('Access tokens can be used to control your whole account')
await screen.findByRole('button', { name: 'Generate token' })
expect(screen.queryByRole('button', { name: 'Review access' })).toBeNull()
diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx
index edb9183e456..b3b47b792df 100644
--- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx
+++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx
@@ -14,6 +14,7 @@ import {
import { useCapabilitySummary } from '../hooks/useCapabilitySummary'
import { useOrgAndProjectData } from '../hooks/useOrgAndProjectData'
import { useTokenAccessEvaluation } from '../hooks/useTokenAccessEvaluation'
+import { McpUnsupportedWarning } from './McpUnsupportedWarning'
import { CapabilityCategoryList, ResourceSummaryItem, RiskLevelSummary } from './TokenSummaryRows'
import { DocsButton } from '@/components/ui/DocsButton'
import { useGetEnabledEndpointsForCapability } from '@/data/scoped-access-tokens/permission-scope-map-query'
@@ -349,6 +350,7 @@ export function ViewTokenSheet({ visible, tokenId, onClose }: ViewTokenSheetProp
<div className="flex flex-col gap-3">
<h3 className="text-sm">MCP tools</h3>
+ <McpUnsupportedWarning />
{mcpTools.length === 0 ? (
<p className="text-xs text-foreground-light">
No MCP tools are enabled by the selected capabilities.