fix(opencode): loosen MCP per-server schemas to preserve extra fields (timeout/oauth)#1773
Merged
Merged
Conversation
OpenCode's MCP per-server schemas were strict z.object, so documented-but-unmodeled fields like timeout and oauth were stripped on import. Switch OpencodeMcpLocalServerSchema / OpencodeMcpRemoteServerSchema to z.looseObject (per the project's frequently-changing tool-config convention) and pass unknown extra fields through convertFromOpencodeFormat so they survive import round-tripping. Closes #1692 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…den key handling Address review findings on PR #1773: - Export direction (convertToOpencodeFormat) now preserves OpenCode-supported per-server extras (timeout, oauth) via an explicit allow-list, so an OpenCode -> rulesync -> OpenCode round-trip keeps them. The import side stays a generic passthrough (its source is OpenCode's own format), while export uses an allow-list because rulesync mcp.json is a multi-tool superset and must not leak other tools' keys (e.g. kiroAutoApprove, alwaysAllow, trust) into opencode.json. - Add enabledTools/disabledTools to OPENCODE_KNOWN_SERVER_KEYS and spread extraFields first so converter-derived fields always win on key collision, preventing a stray same-named key on a server object from clobbering computed values. - Add an export/round-trip test covering timeout/oauth preservation back to OpenCode format. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#1692 — OpenCode: loosen MCP per-server schemas (
timeout/oauth)OpencodeMcpLocalServerSchema/OpencodeMcpRemoteServerSchemawere strictz.object, so documented per-server fields liketimeoutandoauthwere stripped when importing an OpenCode config. This change:z.looseObject(matching the project guideline favoring loose objects for frequently-changing tool config), so unknown/extra fields are no longer dropped at parse time.convertFromOpencodeFormat(the schema change alone is not enough — the converter explicitly picks fields) sotimeout,oauth, and future additions actually survive import.Validation evidence
timeout,oauth): https://opencode.ai/docs/mcp-serversTest plan
pnpm cicheck— green (fmt, oxlint, typecheck, 5988 unit tests, sync-skill-docs, cspell, secretlint).timeout/oauthon local and remote servers round-trips those fields into the rulesync MCP output.e2e-mcp(opencode) passes.Linked issues
timeout/oauth) #1692Note on the other two newest scrap issues
This batch resolves only #1692 because the other two newest open scrap issues are larger, dedicated efforts rather than bounded fixes (details posted as comments on each):
PreToolUse) under.clinerules/hooks/(project) /~/Documents/Cline/Rules/Hooks/(global), each reading JSON on stdin and returning JSON — not the single JSON-config shape every existing rulesync hooks adapter emits. A correct adapter needs multi-file emission + executable bits, so it warrants its own design.AGENTS.mdcontext file and global.gooseignore#1691 (GooseAGENTS.md+ global.gooseignore) — the global.gooseignore(~/.config/goose/.gooseignore, confirmed) requires global-ignore plumbing that does not exist (IgnoreProcessorcurrently throws on global mode), and theAGENTS.md-for-Goose part overlaps theagentsmdtarget and needs a maintainer call.🤖 Generated with Claude Code