The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add OpenCode support to MCP clients (#41825)
Ali Waseem56eb4f01a632
diff --git a/apps/docs/public/img/mcp-clients/opencode-dark-icon.svg b/apps/docs/public/img/mcp-clients/opencode-dark-icon.svgnew file mode 100644index 00000000000..b79c7332e20--- /dev/null+++ b/apps/docs/public/img/mcp-clients/opencode-dark-icon.svg@@ -0,0 +1 @@+<svg width='240' height='300' viewBox='0 0 240 300' fill='none' xmlns='http://www.w3.org/2000/svg'><g clip-path='url(#clip0_1401_86283)'><mask id='mask0_1401_86283' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='240' height='300'><path d='M240 0H0V300H240V0Z' fill='white'/></mask><g mask='url(#mask0_1401_86283)'><path d='M180 240H60V120H180V240Z' fill='#4B4646'/><path d='M180 60H60V240H180V60ZM240 300H0V0H240V300Z' fill='#F1ECEC'/></g></g><defs><clipPath id='clip0_1401_86283'><rect width='240' height='300' fill='white'/></clipPath></defs></svg>\ No newline at end of filediff --git a/apps/docs/public/img/mcp-clients/opencode-icon.svg b/apps/docs/public/img/mcp-clients/opencode-icon.svgnew file mode 100644index 00000000000..b79140a5070--- /dev/null+++ b/apps/docs/public/img/mcp-clients/opencode-icon.svg@@ -0,0 +1 @@+<svg width='240' height='300' viewBox='0 0 240 300' fill='none' xmlns='http://www.w3.org/2000/svg'><g clip-path='url(#clip0_1401_86274)'><mask id='mask0_1401_86274' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='240' height='300'><path d='M240 0H0V300H240V0Z' fill='white'/></mask><g mask='url(#mask0_1401_86274)'><path d='M180 240H60V120H180V240Z' fill='#CFCECD'/><path d='M180 60H60V240H180V60ZM240 300H0V0H240V300Z' fill='#211E1E'/></g></g><defs><clipPath id='clip0_1401_86274'><rect width='240' height='300' fill='white'/></clipPath></defs></svg>\ No newline at end of filediff --git a/apps/studio/public/img/mcp-clients/opencode-dark-icon.svg b/apps/studio/public/img/mcp-clients/opencode-dark-icon.svgnew file mode 100644index 00000000000..b79c7332e20--- /dev/null+++ b/apps/studio/public/img/mcp-clients/opencode-dark-icon.svg@@ -0,0 +1 @@+<svg width='240' height='300' viewBox='0 0 240 300' fill='none' xmlns='http://www.w3.org/2000/svg'><g clip-path='url(#clip0_1401_86283)'><mask id='mask0_1401_86283' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='240' height='300'><path d='M240 0H0V300H240V0Z' fill='white'/></mask><g mask='url(#mask0_1401_86283)'><path d='M180 240H60V120H180V240Z' fill='#4B4646'/><path d='M180 60H60V240H180V60ZM240 300H0V0H240V300Z' fill='#F1ECEC'/></g></g><defs><clipPath id='clip0_1401_86283'><rect width='240' height='300' fill='white'/></clipPath></defs></svg>\ No newline at end of filediff --git a/apps/studio/public/img/mcp-clients/opencode-icon.svg b/apps/studio/public/img/mcp-clients/opencode-icon.svgnew file mode 100644index 00000000000..b79140a5070--- /dev/null+++ b/apps/studio/public/img/mcp-clients/opencode-icon.svg@@ -0,0 +1 @@+<svg width='240' height='300' viewBox='0 0 240 300' fill='none' xmlns='http://www.w3.org/2000/svg'><g clip-path='url(#clip0_1401_86274)'><mask id='mask0_1401_86274' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='240' height='300'><path d='M240 0H0V300H240V0Z' fill='white'/></mask><g mask='url(#mask0_1401_86274)'><path d='M180 240H60V120H180V240Z' fill='#CFCECD'/><path d='M180 60H60V240H180V60ZM240 300H0V0H240V300Z' fill='#211E1E'/></g></g><defs><clipPath id='clip0_1401_86274'><rect width='240' height='300' fill='white'/></clipPath></defs></svg>\ No newline at end of filediff --git a/packages/ui-patterns/src/McpUrlBuilder/constants.tsx b/packages/ui-patterns/src/McpUrlBuilder/constants.tsxindex 564d9f791b8..b8d38e495c0 100644--- a/packages/ui-patterns/src/McpUrlBuilder/constants.tsx+++ b/packages/ui-patterns/src/McpUrlBuilder/constants.tsx@@ -7,6 +7,7 @@ import type {GooseMcpConfig,McpClient,McpFeatureGroup,+ OpenCodeMcpConfig,VSCodeMcpConfig,WindsurfMcpConfig,} from './types'@@ -380,7 +381,7 @@ export const MCP_CLIENTS: McpClient[] = [const command = `droid mcp add supabase ${mcpUrl} --type http`return (<div className="space-y-2">- <p className="text-xs text-foreground-light">Add the Supabase MCP server to Factory:</p>+ <p className="text-xs text-foreground-light">Add Supabase MCP server to Factory:</p><CodeBlockvalue={command}language="bash"@@ -394,8 +395,45 @@ export const MCP_CLIENTS: McpClient[] = [alternateInstructions: (config, onCopy) => (<div className="space-y-2"><p className="text-xs text-foreground-light">- Restart Factory or type <code>/mcp</code> within droid to complete the OAuth- authentication flow.+ Restart Factory or type <code>/mcp</code> within droid to complete OAuth authentication+ flow.+ </p>+ </div>+ ),+ },+ {+ key: 'opencode',+ label: 'OpenCode',+ icon: 'opencode',+ configFile: '~/.config/opencode/opencode.json',+ externalDocsUrl: 'https://opencode.ai/docs/mcp-servers/',+ transformConfig: (config): OpenCodeMcpConfig => {+ const mcpUrl = getMcpUrl(config)+ return {+ $schema: 'https://opencode.ai/config.json',+ mcp: {+ supabase: {+ type: 'remote',+ url: mcpUrl,+ enabled: true,+ },+ },+ }+ },+ alternateInstructions: (config, onCopy) => (+ <div className="space-y-2">+ <p className="text-xs text-foreground-light">+ After adding the configuration, run the following command to authenticate:+ </p>+ <CodeBlock+ value="opencode mcp auth supabase"+ language="bash"+ focusable={false}+ className="block"+ onCopyCallback={() => onCopy('command')}+ />+ <p className="text-xs text-foreground-light">+ This will open your browser to complete the OAuth authentication flow.</p></div>),diff --git a/packages/ui-patterns/src/McpUrlBuilder/types.ts b/packages/ui-patterns/src/McpUrlBuilder/types.tsindex bc06b0fb4b6..6a2dee54424 100644--- a/packages/ui-patterns/src/McpUrlBuilder/types.ts+++ b/packages/ui-patterns/src/McpUrlBuilder/types.ts@@ -133,6 +133,17 @@ export interface GeminiMcpConfig {}}+export interface OpenCodeMcpConfig {+ $schema: string+ mcp: {+ supabase: {+ type: 'remote'+ url: string+ enabled?: boolean+ }+ }+}+// Union of all possible config typesexport type McpClientConfig =| ClaudeCodeMcpConfig@@ -143,6 +154,7 @@ export type McpClientConfig =| GeminiMcpConfig| GooseMcpConfig| McpClientBaseConfig+ | OpenCodeMcpConfig| OtherMcpConfig| VSCodeMcpConfig| WindsurfMcpConfig@@ -168,6 +180,10 @@ export function isGeminiMcpConfig(config: McpClientConfig): config is GeminiMcpC)}+export function isOpenCodeMcpConfig(config: McpClientConfig): config is OpenCodeMcpConfig {+ return '$schema' in config && 'mcp' in config && 'supabase' in config.mcp+}+export function isMcpServersConfig(config: McpClientConfig): config is McpClientBaseConfig | ClaudeCodeMcpConfig | FactoryMcpConfig {@@ -188,6 +204,9 @@ export function getMcpUrl(config: McpClientConfig): string {if (isGeminiMcpConfig(config)) {return config.mcpServers.supabase.httpUrl}+ if (isOpenCodeMcpConfig(config)) {+ return config.mcp.supabase.url+ }if (isMcpServersConfig(config)) {return config.mcpServers.supabase.url}