feat: add OpenCode MCP client configuration#95
Conversation
OpenCode uses a distinct config format with "mcp" as the servers property, "local"/"remote" type values, a combined command array, and "environment" for env vars. This adds full support via a custom builder following the same pattern as Goose and Codex.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d849fe646
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function isOpenCodeMCPConfig( | ||
| config: OpenCodeMCPConfig | MCPServersRecord | ||
| ): config is OpenCodeMCPConfig { | ||
| return typeof config === 'object' && config !== null && 'mcp' in config; |
There was a problem hiding this comment.
Distinguish wrapped and flat OpenCode config shapes
getNormalizedServersConfig accepts either a wrapped { mcp: ... } object or a flat MCPServersRecord, but this guard only checks whether the key mcp exists. A flat servers map can validly include a server named mcp (for example when includeRootObject: false and serverName is "mcp"), in which case the function misclassifies the input as wrapped and then normalizes server fields (type, command, etc.) as if they were server entries, producing corrupted normalized output.
Useful? React with 👍 / 👎.
steve-calvert-glean
left a comment
There was a problem hiding this comment.
Looks good. The only thing you need to do is regenerate the CLIENTS.md, for which there is an npm command in package.json.
Summary
mcpas the servers property,local/remotetype values, a combinedcommandarray, andenvironmentfor env varsChanges
configs/opencode.json— client config defining transports, paths, and property mappingsOpenCodeConfigBuilder— custom builder with stdio (local), HTTP (remote), and normalization logicschemas.ts— added'opencode'toClientIdSchema, validation schemas, andvalidateGeneratedConfigtypes.ts— addedOpenCodeMCPConfiginterface, updatedMCPConfig,ConfigForClient,ServersKeyForClientconstants.ts— addedOPENCODEtoCLIENT,CLIENT_DISPLAY_NAME, andgetDisplayName()registry.ts— imported config and registered builderbuilders/index.ts,src/index.ts— added exportsTest plan
npm run build— clean buildnpm run typecheck— no type errorsnpm run test— all 313 tests passnpm run test:all— full lint + typecheck + test suite passes