Skip to content

Commit e3d021e

Browse files
authored
docs(mcp): improve Claude Code setup/authorization instructions (supabase#40101)
* docs: prefer project config for Claude Code * docs: prefer CLI for Claude Code MCP installation * docs: authentication instructions for Claude Code * docs: update MCP authentication admonition Not all clients automatically prompt login, and we now preselect the correct organization for project scoped MCP servers. * fix: disable `contentEditable` on claude code codeblocks
1 parent 3ebc95e commit e3d021e

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

apps/docs/features/ui/McpConfigPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function McpConfigPanel() {
294294
<Admonition type="note" title="Authentication" className="mt-3">
295295
<p>
296296
{
297-
"Your MCP client will automatically prompt you to login to Supabase during setup. This will open a browser window where you can login to your Supabase account and grant access to the MCP client. Be sure to choose the organization that contains the project you wish to work with. In the future, we'll offer more fine grain control over these permissions."
297+
"Some MCP clients will automatically prompt you to login during setup, while others may require manual authentication steps. Either authentication method will open a browser window where you can login to your Supabase account and grant organization access to the MCP client. In the future, we'll offer more fine grain control over these permissions."
298298
}
299299
</p>
300300
<p>

packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,16 @@ export function McpConfigurationDisplay({
5454
</>
5555
)}
5656

57+
{selectedClient.primaryInstructions && selectedClient.primaryInstructions(clientConfig)}
58+
5759
{selectedClient.configFile && (
5860
<div className="text-xs text-foreground-light">
59-
{mcpButtonData ? 'Or add' : 'Add'} this configuration to{' '}
61+
{selectedClient.primaryInstructions
62+
? 'Alternatively, add'
63+
: mcpButtonData
64+
? 'Or add'
65+
: 'Add'}{' '}
66+
this configuration to{' '}
6067
<code className="px-1 py-0.5 bg-surface-200 rounded">{selectedClient.configFile}</code>:
6168
</div>
6269
)}

packages/ui-patterns/src/McpUrlBuilder/constants.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const MCP_CLIENTS: McpClient[] = [
119119
key: 'claude-code',
120120
label: 'Claude Code',
121121
icon: 'claude',
122-
configFile: '~/.claude.json',
122+
configFile: '.mcp.json',
123123
externalDocsUrl: 'https://docs.anthropic.com/en/docs/claude-code/mcp',
124124
transformConfig: (config): ClaudeCodeMcpConfig => {
125125
return {
@@ -131,24 +131,37 @@ export const MCP_CLIENTS: McpClient[] = [
131131
},
132132
}
133133
},
134-
alternateInstructions: (_config) => {
134+
primaryInstructions: (_config) => {
135135
const config = _config as ClaudeCodeMcpConfig
136-
const command = `claude mcp add --transport http supabase "${config.mcpServers.supabase.url}"`
136+
const command = `claude mcp add --scope project --transport http supabase "${config.mcpServers.supabase.url}"`
137137
return (
138138
<div className="space-y-2">
139139
<p className="text-xs text-foreground-light">
140-
Alternatively, add the MCP server using the command line:
140+
Add the MCP server to your project config using the command line:
141141
</p>
142142
<CodeBlock
143143
value={command}
144144
language="bash"
145+
focusable={false}
145146
// This is a no-op but the CodeBlock component is designed to output
146147
// inline code if no className is given
147148
className="block"
148149
/>
149150
</div>
150151
)
151152
},
153+
alternateInstructions: () => (
154+
<div className="space-y-2">
155+
<p className="text-xs text-foreground-light">
156+
After configuring the MCP server, you need to authenticate. In a regular terminal (not the
157+
IDE extension) run:
158+
</p>
159+
<CodeBlock value="claude /mcp" language="bash" focusable={false} className="block" />
160+
<p className="text-xs text-foreground-light">
161+
Select the "supabase" server, then "Authenticate" to begin the authentication flow.
162+
</p>
163+
</div>
164+
),
152165
},
153166
]
154167

packages/ui-patterns/src/McpUrlBuilder/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface McpClient {
1313
configFile?: string
1414
generateDeepLink?: (config: McpClientConfig) => string | null
1515
transformConfig?: (config: McpClientBaseConfig) => McpClientConfig
16+
primaryInstructions?: (config: McpClientConfig) => React.ReactNode
1617
alternateInstructions?: (config: McpClientConfig) => React.ReactNode
1718
}
1819

0 commit comments

Comments
 (0)