Skip to content

feat: add OpenCode support to MCP clients - #41825

Merged
awaseem merged 2 commits into
masterfrom
aliwaseem/fe-2350-add-opencode-support-to-mcp-clients
Jan 13, 2026
Merged

awaseem merged 2 commits into
masterfrom
aliwaseem/fe-2350-add-opencode-support-to-mcp-clients

Conversation

@awaseem

@awaseem awaseem commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

Resolves FE-2350

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Feature add opencode MCP using opencode ♾️

Summary by CodeRabbit

  • New Features

    • Added OpenCode MCP server integration support, enabling users to configure and connect OpenCode servers with authentication flows and configuration options.
    • Extended MCP configuration system to support multiple server types with their respective authentication methods.
  • Documentation

    • Improved Factory MCP server setup instructions for clarity.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add OpenCodeMcpConfig interface and type guard
- Add OpenCode to MCP_CLIENTS array with remote config
- Include OAuth authentication instructions
- Add OpenCode icons with correct naming convention
- Fix duplicate JSON config display by removing primaryInstructions

Resolves FE-2350
@vercel

vercel Bot commented Jan 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Jan 9, 2026 11:32pm
studio-self-hosted Ready Ready Preview, Comment Jan 9, 2026 11:32pm
studio-staging Ready Ready Preview, Comment Jan 9, 2026 11:32pm
5 Skipped Deployments
Project Deployment Review Updated (UTC)
cms Ignored Ignored Jan 9, 2026 11:32pm
studio Ignored Ignored Jan 9, 2026 11:32pm
design-system Skipped Skipped Jan 9, 2026 11:32pm
ui-library Skipped Skipped Jan 9, 2026 11:32pm
zone-www-dot-com Skipped Skipped Jan 9, 2026 11:32pm

@supabase

supabase Bot commented Jan 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jan 9, 2026
@coderabbitai

coderabbitai Bot commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • apps/studio/public/img/mcp-clients/opencode-dark-icon.svg is excluded by !**/*.svg
  • apps/studio/public/img/mcp-clients/opencode-icon.svg is excluded by !**/*.svg

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes add support for a new OpenCode MCP client by introducing configuration type definitions and integrating it into the MCP URL builder system with appropriate configuration handlers and authentication instructions.

Changes

Cohort / File(s) Summary
OpenCode MCP Client Type Support
packages/ui-patterns/src/McpUrlBuilder/types.ts
Introduced OpenCodeMcpConfig interface with nested mcp.supabase.url structure; extended McpClientConfig union to include OpenCodeMcpConfig; added isOpenCodeMcpConfig type guard; updated getMcpUrl function to handle OpenCodeMcpConfig by returning the nested URL
OpenCode MCP Client Integration
packages/ui-patterns/src/McpUrlBuilder/constants.tsx
Added OpenCode MCP client entry to MCP_CLIENTS array with configFile and externalDocsUrl; implemented transformConfig logic using OpenCodeMcpConfig; added alternateInstructions detailing authentication flow; minor Factory instructions wording adjustment
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. While it mentions the issue reference and change type, it lacks current behavior, new behavior, and additional context sections from the template. Add sections for 'What is the current behavior?' with issue links and 'What is the new behavior?' with details of the OpenCode MCP integration changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add OpenCode support to MCP clients' accurately summarizes the main change - adding OpenCode as a new MCP client with its configuration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor grammer updates here

Comment on lines +398 to +399
Restart Factory or type <code>/mcp</code> within droid to complete OAuth authentication
flow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor grammer updates here

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/ui-patterns/src/McpUrlBuilder/constants.tsx (1)

410-422: Consider direct URL access for consistency.

The transformConfig implementation uses getMcpUrl(config) to extract the URL, while all other MCP clients in this file directly access config.mcpServers.supabase.url. Both approaches work correctly, but using direct access would maintain consistency with the established pattern.

♻️ Suggested refactor for consistency
    transformConfig: (config): OpenCodeMcpConfig => {
-     const mcpUrl = getMcpUrl(config)
      return {
        $schema: 'https://opencode.ai/config.json',
        mcp: {
          supabase: {
            type: 'remote',
-           url: mcpUrl,
+           url: config.mcpServers.supabase.url,
            enabled: true,
          },
        },
      }
    },
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 32460f4 and 8e4c4e7.

⛔ Files ignored due to path filters (2)
  • apps/docs/public/img/mcp-clients/opencode-dark-icon.svg is excluded by !**/*.svg
  • apps/docs/public/img/mcp-clients/opencode-icon.svg is excluded by !**/*.svg
📒 Files selected for processing (2)
  • packages/ui-patterns/src/McpUrlBuilder/constants.tsx
  • packages/ui-patterns/src/McpUrlBuilder/types.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.

Applied to files:

  • packages/ui-patterns/src/McpUrlBuilder/types.ts
  • packages/ui-patterns/src/McpUrlBuilder/constants.tsx
📚 Learning: 2026-01-07T07:36:26.799Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41758
File: packages/api-types/types/platform.d.ts:5391-5392
Timestamp: 2026-01-07T07:36:26.799Z
Learning: packages/api-types/types/platform.d.ts is auto-generated by openapi-typescript and must not be edited directly; documentation changes (e.g., for max_table_sync_workers) should be made in the OpenAPI spec and then types regenerated.

Applied to files:

  • packages/ui-patterns/src/McpUrlBuilder/constants.tsx
🧬 Code graph analysis (1)
packages/ui-patterns/src/McpUrlBuilder/constants.tsx (3)
packages/ui-patterns/src/McpUrlBuilder/types.ts (2)
  • OpenCodeMcpConfig (136-145)
  • getMcpUrl (194-214)
packages/ui-patterns/src/McpUrlBuilder/index.ts (1)
  • getMcpUrl (12-12)
packages/ui-patterns/src/McpUrlBuilder/utils/getMcpUrl.ts (1)
  • getMcpUrl (18-55)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck
🔇 Additional comments (6)
packages/ui-patterns/src/McpUrlBuilder/types.ts (3)

136-145: LGTM - Well-defined configuration interface.

The OpenCodeMcpConfig interface clearly defines the structure for OpenCode MCP configuration with appropriate types. The nested structure with $schema, type: 'remote', and optional enabled field follows good configuration practices.


183-185: LGTM - Type guard implementation is correct.

The type guard follows the established pattern used by other MCP config type guards in this file and correctly identifies OpenCode configurations by checking for distinctive properties.


207-209: LGTM - URL extraction correctly implemented.

The getMcpUrl handler properly extracts the URL from the OpenCode configuration structure, matching the nested mcp.supabase.url path defined in the OpenCodeMcpConfig interface.

packages/ui-patterns/src/McpUrlBuilder/constants.tsx (3)

10-10: LGTM - Import correctly added.

The OpenCodeMcpConfig type is properly imported alongside other MCP config types.


384-384: LGTM - Improved instruction clarity.

The wording adjustments to Factory's instructions enhance conciseness and readability without changing the functional content.

Also applies to: 398-402


404-440: OpenCode MCP client implementation is correct.

The icon files exist in the repository (opencode-icon.svg and opencode-dark-icon.svg), the configuration follows the established naming pattern used by other MCP clients, and the OAuth authentication instructions in alternateInstructions are clear and appropriate. The implementation is ready for merge.

@awaseem
awaseem requested a review from a team as a code owner January 9, 2026 23:25
@github-actions

github-actions Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  67 passed
skipped  4 skipped

Details

stats  71 tests across 12 suites
duration  7 minutes, 48 seconds
commit  5172037

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@ChrisChinchilla ChrisChinchilla removed the documentation Improvements or additions to documentation label Jan 12, 2026

@alaister alaister left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@awaseem
awaseem merged commit 56eb4f0 into master Jan 13, 2026
@awaseem
awaseem deleted the aliwaseem/fe-2350-add-opencode-support-to-mcp-clients branch January 13, 2026 01:26
@github-actions

github-actions Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1768267729)

Score Average Improvements Regressions
Completeness 100% (+40pp) 2 🟢 -
Conciseness 0% (+0pp) - -
Goal Completion 90% (+20pp) 2 🟢 -
SQL Validity 100% (+0pp) - -
Tool Usage 60% (-10pp) 1 🟢 1 🔴
Time_to_first_token 0.26tok (+0.11tok) - 5 🔴
Llm_calls 8 (-0.4) 1 🟢 3 🔴
Tool_calls 4.6 (+0.2) 1 🟢 1 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 60102.4tok (-25881.2tok) 4 🟢 1 🔴
Prompt_cached_tokens 43366.4tok (-16486.4tok) 1 🟢 4 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 6700tok (+1918tok) 1 🟢 4 🔴
Completion_reasoning_tokens 4812.8tok (+844.8tok) 1 🟢 4 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 66802.4tok (-23963.2tok) 4 🟢 1 🔴
Estimated_cost 0.02$ (+0$) 1 🟢 4 🔴
Duration 53.05s (+8.42s) 3 🟢 2 🔴
Llm_duration 105.34s (+16.6s) 3 🟢 2 🔴

awaseem added a commit that referenced this pull request Aug 24, 2026
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Docs update: adds [fx](https://fx.sh) to the MCP client list, following
the same pattern as the recently added Warp (#48838), GitHub Copilot CLI
(#46150) and OpenCode (#41825) clients.

fx is a native coding agent and an MCP client. It supports Streamable
HTTP and the full OAuth flow (metadata discovery, PKCE, Dynamic Client
Registration fallback, refresh), so it connects to the hosted Supabase
MCP server without a proxy.

## What is the current behavior?

fx is not in the client list, so users have to hand-write the config. fx
keys servers under `mcp` rather than `mcpServers` and names the
transport `http`, which is easy to get wrong by adapting another
client's snippet.

## What is the new behavior?

fx appears in the **AI Agent CLI** group, in both the docs page and the
dashboard's Connect panel. It renders as:

> **fx**
>
> Add this configuration to `~/.fx/mcp.json`:
>
> ```json
> {
>   "mcp": {
>     "supabase": {
>       "type": "http",
>       "url": "https://mcp.supabase.com/mcp"
>     }
>   }
> }
> ```
>
> fx reads MCP servers only from this profile, so a file inside a
repository cannot add one. If a session is already open, apply the
change with `/mcp reload`.
>
> Then authenticate from the fx shell. This opens your browser to
complete the OAuth flow:
>
> ```bash
> /mcp auth supabase --open
> ```
>
> Confirm the server is connected with `/mcp list`.
>
> For more details, see [MCP
configuration](https://fx.sh/docs/capabilities/mcp) in fx.

fx is configured by file only, so it gets an `alternate` instruction
block and no `install` command, matching Cursor, VS Code, Warp and
Antigravity.

## Additional context

The config above was verified end to end against the hosted server: the
OAuth flow completes and `/mcp list` reports the server connected.

Two notes on the diff:

- **`types.ts`** gains an `FxMcpConfig` interface, a type guard and a
branch in `getMcpUrl`. fx's shape is not covered by any existing
interface (`OpenCodeMcpConfig` is the other `mcp`-rooted one, but
carries `$schema` and `type: 'remote'`). Since `getMcpUrl` throws on an
unrecognized shape and runs for every client with instructions, the
guard is required rather than cosmetic. Antigravity (#43597) and
OpenCode (#41825) added their shapes the same way.
- **Tests.** `utils/getMcpIconSrc.test.ts` gains a case for the new dark
icon variant, alongside the existing cursor and perplexity cases.
`types.test.ts` is new and checks that every client's `transformConfig`
output round-trips back through `getMcpUrl`, which is what guards the
throw above. Happy to drop either if you'd rather keep the diff to the
usual shape for a client addition.

Prettier passes with the repo config, `tsc --noEmit` is clean, and both
test files pass.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added fx as a supported MCP client in the MCP URL builder.
* Added profile-based setup guidance, OAuth authentication instructions,
connection verification, and documentation links.
  * Added light and dark fx icons for improved visual support.
* **Bug Fixes**
  * Improved MCP URL detection for fx configurations.
* **Tests**
  * Added coverage for MCP URL extraction and dark-mode icon selection.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Ali Waseem <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants