The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(connect): add telemetry tracking and command menu actions (#40611)
Pamela Chia076a2529ebf6
diff --git a/apps/docs/features/ui/McpConfigPanel.tsx b/apps/docs/features/ui/McpConfigPanel.tsxindex 629a15537b0..fa954c0c8a0 100644--- a/apps/docs/features/ui/McpConfigPanel.tsx+++ b/apps/docs/features/ui/McpConfigPanel.tsx@@ -19,11 +19,12 @@ import {ScrollArea,} from 'ui'import { Admonition } from 'ui-patterns'-import { McpConfigPanel as McpConfigPanelBase } from 'ui-patterns/McpUrlBuilder'+import { McpConfigPanel as McpConfigPanelBase, type McpClient } from 'ui-patterns/McpUrlBuilder'import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'import { useDebounce } from '~/hooks/useDebounce'import { useIntersectionObserver } from '~/hooks/useIntersectionObserver'import { useProjectsInfiniteQuery } from '~/lib/fetch/projects-infinite'+import { useSendTelemetryEvent } from '~/lib/telemetry'type PlatformType = (typeof PLATFORMS)[number]['value']@@ -260,11 +261,57 @@ function PlatformSelector({export function McpConfigPanel() {const [selectedProject, setSelectedProject] = useState<{ ref: string; name: string } | null>(null)const [selectedPlatform, setSelectedPlatform] = useState<'hosted' | 'local'>('hosted')+ const [selectedClient, setSelectedClient] = useState<McpClient | null>(null)const { theme } = useTheme()+ const sendTelemetryEvent = useSendTelemetryEvent()const isPlatform = selectedPlatform === 'hosted'const project = isPlatform ? selectedProject : null+ const handleCopy = (type?: 'url' | 'json' | 'command') => {+ let connectionType: string+ switch (type) {+ case 'command':+ connectionType = 'Command Line'+ break+ case 'json':+ connectionType = 'JSON'+ break+ case 'url':+ default:+ connectionType = 'MCP URL'+ break+ }++ sendTelemetryEvent({+ action: 'connection_string_copied',+ properties: {+ connectionTab: 'MCP',+ selectedItem: selectedClient?.label,+ connectionType,+ source: 'docs',+ },+ groups: {+ ...(project?.ref && { project: project.ref }),+ } as any,+ })+ }++ const handleInstall = () => {+ if (selectedClient?.label) {+ sendTelemetryEvent({+ action: 'mcp_install_button_clicked',+ properties: {+ client: selectedClient.label,+ source: 'docs',+ },+ groups: {+ ...(project?.ref && { project: project.ref }),+ } as any,+ })+ }+ }+return (<><div className="not-prose">@@ -288,6 +335,9 @@ export function McpConfigPanel() {projectRef={project?.ref}theme={theme as 'light' | 'dark'}isPlatform={isPlatform}+ onCopyCallback={handleCopy}+ onInstallCallback={handleInstall}+ onClientSelect={setSelectedClient}/></div>{isPlatform && (diff --git a/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.tsx b/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.tsxindex a52b21a92f6..057d3b7d70d 100644--- a/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.tsx+++ b/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.tsx@@ -1,5 +1,6 @@import { IS_PLATFORM } from 'common'import { useBranchCommands } from 'components/interfaces/BranchManagement/Branch.Commands'+import { useConnectCommands } from 'components/interfaces/Connect/Connect.Commands'import {useQueryTableCommands,useSnippetCommands,@@ -20,6 +21,7 @@ import { orderCommandSectionsByPriority } from './ordering'export default function StudioCommandMenu() {useApiKeysCommands()useApiUrlCommand()+ useConnectCommands()useProjectLevelTableEditorCommands()useProjectSwitchCommand()useConfigureOrganizationCommand()diff --git a/apps/studio/components/interfaces/Connect/Connect.Commands.tsx b/apps/studio/components/interfaces/Connect/Connect.Commands.tsxnew file mode 100644index 00000000000..6a370317080--- /dev/null+++ b/apps/studio/components/interfaces/Connect/Connect.Commands.tsx@@ -0,0 +1,60 @@+import { Plug } from 'lucide-react'+import { useRouter } from 'next/router'+import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'+import { PROJECT_STATUS } from 'lib/constants'+import type { ICommand } from 'ui-patterns/CommandMenu'+import { useRegisterCommands, useSetCommandMenuOpen } from 'ui-patterns/CommandMenu'+import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'+import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'++export function useConnectCommands() {+ const router = useRouter()+ const setIsOpen = useSetCommandMenuOpen()+ const { data: selectedProject } = useSelectedProjectQuery()+ const isActiveHealthy = selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHY++ useRegisterCommands(+ COMMAND_MENU_SECTIONS.ACTIONS,+ [+ {+ id: 'connect-to-project',+ name: 'Connect to your project',+ action: () => {+ // Open the Connect dialog by setting the showConnect query param+ router.push(+ {+ pathname: router.pathname,+ query: { ...router.query, showConnect: 'true' },+ },+ undefined,+ { shallow: true }+ )+ setIsOpen(false)+ },+ icon: () => <Plug className="rotate-90" />,+ },+ {+ id: 'connect-mcp',+ name: 'Connect via MCP',+ action: () => {+ // Open the Connect dialog with MCP tab+ router.push(+ {+ pathname: router.pathname,+ query: { ...router.query, showConnect: 'true', connectTab: 'mcp' },+ },+ undefined,+ { shallow: true }+ )+ setIsOpen(false)+ },+ icon: () => <Plug className="rotate-90" />,+ },+ ] as ICommand[],+ {+ enabled: !!selectedProject && isActiveHealthy,+ orderSection: orderCommandSectionsByPriority,+ sectionMeta: { priority: 2 },+ }+ )+}diff --git a/apps/studio/components/interfaces/Connect/Connect.tsx b/apps/studio/components/interfaces/Connect/Connect.tsxindex 86c648b9746..3a3eb2ae7cb 100644--- a/apps/studio/components/interfaces/Connect/Connect.tsx+++ b/apps/studio/components/interfaces/Connect/Connect.tsx@@ -411,6 +411,18 @@ export const Connect = () => {)}+ const connectionTabMap: Record<+ string,+ 'App Frameworks' | 'Mobile Frameworks' | 'ORMs'+ > = {+ frameworks: 'App Frameworks',+ mobiles: 'Mobile Frameworks',+ orms: 'ORMs',+ }+ const connectionTab = connectionTabMap[type.key] || 'App Frameworks'+ const selectedFrameworkOrTool =+ connectionObject.find((item) => item.key === selectedParent)?.label || ''+return (<TabsContent_Shadcn_key={`content-${type.key}`}@@ -467,6 +479,8 @@ export const Connect = () => {<ConnectTabContentprojectKeys={projectKeys}filePath={filePath}+ connectionTab={connectionTab}+ selectedFrameworkOrTool={selectedFrameworkOrTool}className="rounded-b-none"/><Panel.Noticediff --git a/apps/studio/components/interfaces/Connect/Connect.types.ts b/apps/studio/components/interfaces/Connect/Connect.types.tsindex 78e379f6a8c..d75a5df614d 100644--- a/apps/studio/components/interfaces/Connect/Connect.types.ts+++ b/apps/studio/components/interfaces/Connect/Connect.types.ts@@ -18,4 +18,6 @@ export interface ContentFileProps {ipv4SupportedForDedicatedPooler: booleandirect?: string}+ connectionTab: 'App Frameworks' | 'Mobile Frameworks' | 'ORMs'+ onCopy?: () => void}diff --git a/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx b/apps/studio/components/interfaces/Connect/ConnectTabContent.tsxindex 3667d93dd48..59dce1062d6 100644--- a/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx+++ b/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx@@ -9,7 +9,8 @@ import { useSupavisorConfigurationQuery } from 'data/database/supavisor-configurimport { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'import { pluckObjectFields } from 'lib/helpers'-import { cn } from 'ui'+import { useTrack } from 'lib/telemetry/track'+import { cn, CopyCallbackContext } from 'ui'import { getAddons } from '../Billing/Subscription/Subscription.utils'import type { projectKeys } from './Connect.types'import { getConnectionStrings } from './DatabaseSettings.utils'@@ -17,6 +18,8 @@ import { getConnectionStrings } from './DatabaseSettings.utils'interface ConnectContentTabProps extends HTMLAttributes<HTMLDivElement> {projectKeys: projectKeysfilePath: string+ connectionTab: 'App Frameworks' | 'Mobile Frameworks' | 'ORMs'+ selectedFrameworkOrTool: stringconnectionStringPooler?: {transactionShared: stringsessionShared: string@@ -28,11 +31,32 @@ interface ConnectContentTabProps extends HTMLAttributes<HTMLDivElement> {}export const ConnectTabContent = forwardRef<HTMLDivElement, ConnectContentTabProps>(- ({ projectKeys, filePath, ...props }, ref) => {+ ({ projectKeys, filePath, connectionTab, selectedFrameworkOrTool, ...props }, ref) => {const { ref: projectRef } = useParams()+ const track = useTrack()const { data: selectedOrg } = useSelectedOrganizationQuery()const allowPgBouncerSelection = useMemo(() => selectedOrg?.plan.id !== 'free', [selectedOrg])+ const handleCopy = () => {+ const trackingProperties: {+ connectionTab: 'App Frameworks' | 'Mobile Frameworks' | 'ORMs'+ selectedItem: string+ connectionType?: string+ lang?: string+ } = {+ connectionTab,+ selectedItem: selectedFrameworkOrTool,+ }++ // Only include connectionType and lang for App Frameworks and Mobile Frameworks+ if (connectionTab !== 'ORMs') {+ trackingProperties.connectionType = 'Framework snippet'+ trackingProperties.lang = filePath.split('/').pop() ?? 'unknown'+ }++ track('connection_string_copied', trackingProperties)+ }+const { data: settings } = useProjectSettingsV2Query({ projectRef })const { data: pgbouncerConfig } = usePgbouncerConfigQuery({ projectRef })const { data: supavisorConfig } = useSupavisorConfigurationQuery({ projectRef })@@ -84,18 +108,23 @@ export const ConnectTabContent = forwardRef<HTMLDivElement, ConnectContentTabProreturn (<div ref={ref} {...props} className={cn('border rounded-lg', props.className)}>- <ContentFile- projectKeys={projectKeys}- filePath={filePath}- connectionStringPooler={{- transactionShared: connectionStringsShared.pooler.uri,- sessionShared: connectionStringsShared.pooler.uri.replace('6543', '5432'),- transactionDedicated: connectionStringsDedicated?.pooler.uri,- sessionDedicated: connectionStringsDedicated?.pooler.uri.replace('6543', '5432'),- ipv4SupportedForDedicatedPooler: !!ipv4Addon,- direct: connectionStringsShared.direct.uri,- }}- />+ <CopyCallbackContext.Provider value={handleCopy}>+ <ContentFile+ projectKeys={projectKeys}+ filePath={filePath}+ connectionTab={connectionTab}+ selectedFrameworkOrTool={selectedFrameworkOrTool}+ connectionStringPooler={{+ transactionShared: connectionStringsShared.pooler.uri,+ sessionShared: connectionStringsShared.pooler.uri.replace('6543', '5432'),+ transactionDedicated: connectionStringsDedicated?.pooler.uri,+ sessionDedicated: connectionStringsDedicated?.pooler.uri.replace('6543', '5432'),+ ipv4SupportedForDedicatedPooler: !!ipv4Addon,+ direct: connectionStringsShared.direct.uri,+ }}+ onCopy={handleCopy}+ />+ </CopyCallbackContext.Provider></div>)}diff --git a/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx b/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsxindex 72ad757d9a8..31b71135184 100644--- a/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx+++ b/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx@@ -209,7 +209,12 @@ export const DatabaseConnectionString = () => {const lang = connectionInfo?.lang ?? 'Unknown'sendEvent({action: 'connection_string_copied',- properties: { connectionType, lang, connectionMethod: connectionStringMethod },+ properties: {+ connectionType,+ lang,+ connectionMethod: connectionStringMethod,+ connectionTab: 'Connection String',+ },groups: { project: projectRef ?? 'Unknown', organization: org?.slug ?? 'Unknown' },})}diff --git a/apps/studio/components/interfaces/Connect/McpTabContent.tsx b/apps/studio/components/interfaces/Connect/McpTabContent.tsxindex bbb9beeb640..941e2e3e8c9 100644--- a/apps/studio/components/interfaces/Connect/McpTabContent.tsx+++ b/apps/studio/components/interfaces/Connect/McpTabContent.tsx@@ -2,8 +2,10 @@ import { IS_PLATFORM, useParams } from 'common'import Panel from 'components/ui/Panel'import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { BASE_PATH } from 'lib/constants'+import { useTrack } from 'lib/telemetry/track'import { useTheme } from 'next-themes'-import { McpConfigPanel } from 'ui-patterns/McpUrlBuilder'+import { useState } from 'react'+import { McpConfigPanel, type McpClient } from 'ui-patterns/McpUrlBuilder'import type { projectKeys } from './Connect.types'export const McpTabContent = ({ projectKeys }: { projectKeys: projectKeys }) => {@@ -37,6 +39,40 @@ const McpTabContentInnerLoaded = ({projectKeys: projectKeys}) => {const { resolvedTheme } = useTheme()+ const track = useTrack()+ const [selectedClient, setSelectedClient] = useState<McpClient | null>(null)++ const handleCopy = (type?: 'url' | 'json' | 'command') => {+ let connectionType: string+ switch (type) {+ case 'command':+ connectionType = 'Command Line'+ break+ case 'json':+ connectionType = 'JSON'+ break+ case 'url':+ default:+ connectionType = 'MCP URL'+ break+ }++ track('connection_string_copied', {+ connectionTab: 'MCP',+ selectedItem: selectedClient?.label,+ connectionType,+ source: 'studio',+ })+ }++ const handleInstall = () => {+ if (selectedClient?.label) {+ track('mcp_install_button_clicked', {+ client: selectedClient.label,+ source: 'studio',+ })+ }+ }return (<McpConfigPanel@@ -45,6 +81,9 @@ const McpTabContentInnerLoaded = ({theme={resolvedTheme as 'light' | 'dark'}isPlatform={IS_PLATFORM}apiUrl={projectKeys.apiUrl ?? undefined}+ onCopyCallback={handleCopy}+ onInstallCallback={handleInstall}+ onClientSelect={setSelectedClient}/>)}diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.tsindex 335e300108d..767ce07df87 100644--- a/packages/common/telemetry-constants.ts+++ b/packages/common/telemetry-constants.ts@@ -69,17 +69,53 @@ export interface ConnectionStringCopiedEvent {action: 'connection_string_copied'properties: {/**- * Method selected by user, e.g. URI, PSQL, SQLAlchemy, etc.+ * Method selected by user, e.g. URI, PSQL, SQLAlchemy, MCP URL, Framework snippet, Command Line, JSON, etc.+ * Required for Connection String, App Frameworks, and Mobile Frameworks tabs*/- connectionType: string+ connectionType?: string/**- * Language of the code block if selected, e.g. bash, go+ * Language of the code block if selected, e.g. bash, go, http, typescript+ * Required for Connection String, App Frameworks, and Mobile Frameworks tabs*/- lang: string+ lang?: string/*** Connection Method, e.g. direct, transaction_pooler, session_pooler+ * Only used for Connection String tab*/- connectionMethod: 'direct' | 'transaction_pooler' | 'session_pooler'+ connectionMethod?: 'direct' | 'transaction_pooler' | 'session_pooler'+ /**+ * Tab from which the connection string was copied+ */+ connectionTab: 'Connection String' | 'App Frameworks' | 'Mobile Frameworks' | 'ORMs' | 'MCP'+ /**+ * Selected framework, tool, or client (e.g., 'Next.js', 'Prisma', 'Cursor')+ */+ selectedItem?: string+ /**+ * Source of the event, either 'studio' or 'docs'+ */+ source?: 'studio' | 'docs'+ }+ groups: TelemetryGroups+}++/**+ * User clicked the MCP install button (one-click installation for Cursor or VS Code).+ *+ * @group Events+ * @source studio, docs+ */+export interface McpInstallButtonClickedEvent {+ action: 'mcp_install_button_clicked'+ properties: {+ /**+ * The MCP client that was selected (e.g., 'Cursor', 'VS Code')+ */+ client: string+ /**+ * Source of the event, either 'studio' or 'docs'+ */+ source?: 'studio' | 'docs'}groups: TelemetryGroups}@@ -2320,6 +2356,7 @@ export type TelemetryEvent =| SignUpEvent| SignInEvent| ConnectionStringCopiedEvent+ | McpInstallButtonClickedEvent| ApiDocsOpenedEvent| ApiDocsCodeCopyButtonClickedEvent| CronJobCreatedEventdiff --git a/packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.tsx b/packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.tsxindex c6463094a94..11ab2f94d13 100644--- a/packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.tsx+++ b/packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.tsx@@ -17,6 +17,8 @@ export interface McpConfigPanelProps {projectRef?: stringinitialSelectedClient?: McpClientonClientSelect?: (client: McpClient) => void+ onCopyCallback?: (type?: 'url' | 'json' | 'command') => void+ onInstallCallback?: () => voidtheme?: 'light' | 'dark'className?: stringisPlatform: boolean // For docs this is controlled by state, for studio by environment variable@@ -28,6 +30,8 @@ export function McpConfigPanel({projectRef,initialSelectedClient,onClientSelect,+ onCopyCallback,+ onInstallCallback,className,theme = 'dark',isPlatform,@@ -93,6 +97,7 @@ export function McpConfigPanel({hideLineNumberslanguage="http"className="max-h-64 overflow-y-auto"+ onCopyCallback={() => onCopyCallback?.('url')}>{mcpUrl}</CodeBlock>@@ -122,6 +127,8 @@ export function McpConfigPanel({basePath={basePath}selectedClient={selectedClient}clientConfig={clientConfig}+ onCopyCallback={onCopyCallback}+ onInstallCallback={onInstallCallback}/></div></div>diff --git a/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx b/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsxindex da996a49ad1..81a39fba1b4 100644--- a/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx+++ b/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx@@ -13,6 +13,8 @@ interface McpConfigurationDisplayProps {className?: stringtheme?: 'light' | 'dark'basePath: string+ onCopyCallback?: (type?: 'url' | 'json' | 'command') => void+ onInstallCallback?: () => void}export function McpConfigurationDisplay({@@ -21,6 +23,8 @@ export function McpConfigurationDisplay({className,theme = 'dark',basePath,+ onCopyCallback,+ onInstallCallback,}: McpConfigurationDisplayProps) {const mcpButtonData = getMcpButtonData({basePath,@@ -40,6 +44,7 @@ export function McpConfigurationDisplay({target="_blank"rel="noopener noreferrer"className="flex items-center gap-2 [&>span]:flex [&>span]:items-center [&>span]:gap-2"+ onClick={onInstallCallback}><Imagesrc={mcpButtonData.imageSrc}@@ -54,7 +59,8 @@ export function McpConfigurationDisplay({</>)}- {selectedClient.primaryInstructions && selectedClient.primaryInstructions(clientConfig)}+ {selectedClient.primaryInstructions &&+ selectedClient.primaryInstructions(clientConfig, onCopyCallback)}{selectedClient.configFile && (<div className="text-xs text-foreground-light">@@ -73,9 +79,11 @@ export function McpConfigurationDisplay({language="json"className="max-h-64 overflow-y-auto"focusable={false}+ onCopyCallback={() => onCopyCallback?.('json')}/>- {selectedClient.alternateInstructions && selectedClient.alternateInstructions(clientConfig)}+ {selectedClient.alternateInstructions &&+ selectedClient.alternateInstructions(clientConfig, onCopyCallback)}{(selectedClient.docsUrl || selectedClient.externalDocsUrl) && (<div className="flex items-center gap-2 text-xs text-foreground-light">diff --git a/packages/ui-patterns/src/McpUrlBuilder/constants.tsx b/packages/ui-patterns/src/McpUrlBuilder/constants.tsxindex e507b6266c6..1dae9d1bc06 100644--- a/packages/ui-patterns/src/McpUrlBuilder/constants.tsx+++ b/packages/ui-patterns/src/McpUrlBuilder/constants.tsx@@ -108,7 +108,7 @@ export const MCP_CLIENTS: McpClient[] = [},}},- alternateInstructions: () => (+ alternateInstructions: (_config, _onCopy) => (<p className="text-xs text-foreground-light">Windsurf does not currently support remote MCP servers over HTTP transport. You need to usethe mcp-remote package as a proxy.@@ -131,7 +131,7 @@ export const MCP_CLIENTS: McpClient[] = [},}},- primaryInstructions: (_config) => {+ primaryInstructions: (_config, onCopy) => {const config = _config as ClaudeCodeMcpConfigconst command = `claude mcp add --scope project --transport http supabase "${config.mcpServers.supabase.url}"`return (@@ -146,17 +146,24 @@ export const MCP_CLIENTS: McpClient[] = [// This is a no-op but the CodeBlock component is designed to output// inline code if no className is givenclassName="block"+ onCopyCallback={() => onCopy?.('command')}/></div>)},- alternateInstructions: () => (+ alternateInstructions: (_config, onCopy) => (<div className="space-y-2"><p className="text-xs text-foreground-light">After configuring the MCP server, you need to authenticate. In a regular terminal (not theIDE extension) run:</p>- <CodeBlock value="claude /mcp" language="bash" focusable={false} className="block" />+ <CodeBlock+ value="claude /mcp"+ language="bash"+ focusable={false}+ className="block"+ onCopyCallback={() => onCopy?.('command')}+ /><p className="text-xs text-foreground-light">Select the "supabase" server, then "Authenticate" to begin the authentication flow.</p>diff --git a/packages/ui-patterns/src/McpUrlBuilder/types.ts b/packages/ui-patterns/src/McpUrlBuilder/types.tsindex bf24a7ddc8c..02f867a6002 100644--- a/packages/ui-patterns/src/McpUrlBuilder/types.ts+++ b/packages/ui-patterns/src/McpUrlBuilder/types.ts@@ -13,8 +13,14 @@ export interface McpClient {configFile?: stringgenerateDeepLink?: (config: McpClientConfig) => string | nulltransformConfig?: (config: McpClientBaseConfig) => McpClientConfig- primaryInstructions?: (config: McpClientConfig) => React.ReactNode- alternateInstructions?: (config: McpClientConfig) => React.ReactNode+ primaryInstructions?: (+ config: McpClientConfig,+ onCopy?: (type?: 'url' | 'json' | 'command') => void+ ) => React.ReactNode+ alternateInstructions?: (+ config: McpClientConfig,+ onCopy?: (type?: 'url' | 'json' | 'command') => void+ ) => React.ReactNode}export interface McpUrlBuilderConfig {diff --git a/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx b/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsxindex 109a9590dbf..154715866c1 100644--- a/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx+++ b/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx@@ -8,12 +8,15 @@import { useTheme } from 'next-themes'import { Highlight, Language, Prism, themes } from 'prism-react-renderer'-import { PropsWithChildren, useEffect, useRef, useState } from 'react'+import { PropsWithChildren, createContext, useContext, useEffect, useRef, useState } from 'react'import { copyToClipboard } from '../../lib/utils'import { cn } from './../../lib/utils/cn'import { Button } from './../Button'import { dart } from './prism'+// Context for copy callback - can be provided by parent components+export const CopyCallbackContext = createContext<(() => void) | undefined>(undefined)+dart(Prism)const prism = {@@ -41,6 +44,7 @@ export const SimpleCodeBlock = ({const { resolvedTheme } = useTheme()const [showCopied, setShowCopied] = useState(false)const target = useRef(null)+ const contextOnCopy = useContext(CopyCallbackContext)let highlightLines: any = []useEffect(() => {@@ -62,7 +66,9 @@ export const SimpleCodeBlock = ({copyToClipboard(code)}setShowCopied(true)- onCopy?.()+ // Use prop onCopy if provided, otherwise fall back to context+ const copyCallback = onCopy || contextOnCopy+ copyCallback?.()}return (