Skip to content

refactor(mcp): OpenCode MCP tool filter follow-ups from #3698 - #3723

Merged
dyoshikawa merged 1 commit into
dyoshikawa:mainfrom
Oscar-Williams:fix/opencode-mcp-3698-followups
Nov 2, 2026
Merged

dyoshikawa merged 1 commit into
dyoshikawa:mainfrom
Oscar-Williams:fix/opencode-mcp-3698-followups

Conversation

@Oscar-Williams

Copy link
Copy Markdown
Contributor

Follow-ups from #3698 for the OpenCode MCP adapter (shared with OpenCode V1 and MiMo Code). Item 1 already landed in #3699; this PR covers items 2–6 only.

Per item

Item Change Evidence
2 Per-call empty Set Hoist OPENCODE_MCP_BUILTIN_TOOL_KEYS: ReadonlySet<string> in src/features/mcp/opencode-mcp.ts (~L234–237, L253) with a short comment that OpenCode's tools map holds only MCP toggles. pnpm exec vitest run src/features/mcp/opencode-mcp.test.ts green on base e72c4ab5 and after (163 → 167 tests).
3 Two-layer orphan filter Comment only above the pre-filter in convertFromOpencodeFormat (~L222–225): sanitized/legacy owner check first; orphanMcpToolFiltersToRulesync still runs for Kilo. No helper refactor. Same focused suite green before/after.
4 Dot → underscore docs Short OpenCode note under MCP Tool Config in docs/reference/file-formats.md (~L1614); src/generated/docs-content.ts regenerated. pnpm cicheck content checks passed after commit.
5 Colliding sanitized server names Comment on findOpencodeToolOwner (~L247–249) plus test should attribute colliding sanitized server names to the first listed server in opencode-mcp.test.ts (~L126–142). New test expects disabledTools on a.b, not a_b; suite green.
6 Test gaps Orphan ./- servers (~L145–163); V2 mcp.servers sanitized keys (~L166–186); regenerate replaces legacy raw keys wholesale (~L188–214); filter fields use toEqual instead of toMatchObject (~L61–62, L119–120). Focused suite 167 passed; full pnpm cicheck 605 files / 16,386 tests passed.

Validation

  • pnpm exec vitest run src/features/mcp/opencode-mcp.test.ts — 167 passed
  • pnpm cicheck — fmt, oxlint, typecheck, tests, docs-content, gitignore, supported-tools, cspell, secretlint passed
  • pnpm build — passed (existing unrelated ineffective dynamic import warning)
  • Local review of the working-tree diff against base: no mid/high/critical findings

Closes #3698

Hoist the empty builtin tool-key set, document the two-layer orphan
filter and first-listed ownership when sanitized server names collide,
note OpenCode tool-name sanitization in the file-formats reference, and
add the tests listed in dyoshikawa#3698 items 2-6.
@dyoshikawa
dyoshikawa merged commit 6e3869d into dyoshikawa:main Nov 2, 2026
7 checks passed
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-ups for OpenCode MCP tool filter key sanitization (PR #3693)

2 participants