Skip to content

fix(opencode): loosen MCP per-server schemas to preserve extra fields (timeout/oauth)#1773

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issues-20260608-5
Jun 9, 2026
Merged

fix(opencode): loosen MCP per-server schemas to preserve extra fields (timeout/oauth)#1773
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issues-20260608-5

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

#1692 — OpenCode: loosen MCP per-server schemas (timeout / oauth)

OpencodeMcpLocalServerSchema / OpencodeMcpRemoteServerSchema were strict z.object, so documented per-server fields like timeout and oauth were stripped when importing an OpenCode config. This change:

  • Switches both schemas to 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.
  • Passes those extra fields through convertFromOpencodeFormat (the schema change alone is not enough — the converter explicitly picks fields) so timeout, oauth, and future additions actually survive import.

Validation evidence

Test plan

  • pnpm cicheck — green (fmt, oxlint, typecheck, 5988 unit tests, sync-skill-docs, cspell, secretlint).
  • New unit test: an OpenCode config with timeout/oauth on local and remote servers round-trips those fields into the rulesync MCP output.
  • E2E e2e-mcp (opencode) passes.

Linked issues

Note 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):

  • Follow up Cline upstream updates: add Hooks support (v3.36) #1693 (Cline Hooks) — Cline hooks are executable scripts named by hook type (e.g. 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.
  • Follow up Goose upstream updates: AGENTS.md context file and global .gooseignore #1691 (Goose AGENTS.md + global .gooseignore) — the global .gooseignore (~/.config/goose/.gooseignore, confirmed) requires global-ignore plumbing that does not exist (IgnoreProcessor currently throws on global mode), and the AGENTS.md-for-Goose part overlaps the agentsmd target and needs a maintainer call.

🤖 Generated with Claude Code

cm-dyoshikawa and others added 2 commits June 8, 2026 07:41
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>
@dyoshikawa dyoshikawa merged commit 51041d5 into main Jun 9, 2026
9 checks passed
@dyoshikawa dyoshikawa deleted the resolve-scrap-issues-20260608-5 branch June 9, 2026 03:17
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.

Follow up OpenCode upstream updates: loosen MCP per-server schemas (timeout/oauth)

2 participants