Skip to content

Fall back to native tools when the OpenCode MCP bridge fails to build - #16

Open
MTEKode wants to merge 1 commit into
openchamber:mainfrom
MTEKode:fix/bridge-tools-fallback-on-mcp-failure
Open

Fall back to native tools when the OpenCode MCP bridge fails to build#16
MTEKode wants to merge 1 commit into
openchamber:mainfrom
MTEKode:fix/bridge-tools-fallback-on-mcp-failure

Conversation

@MTEKode

@MTEKode MTEKode commented Sep 9, 2026

Copy link
Copy Markdown

Summary

  • buildOpenCodeMcpServer() swallows its own errors internally (logs a warning, returns undefined) instead of throwing.
  • bridgeOpenCodeTools was computed independently of that result (!isMetaRequest && openCodeTools.length > 0), so a failed MCP build still triggered the "Built-in Claude Code tools are disabled, use only mcp__opencode__*" system prompt, emptied tools, and locked allowedTools to mcp__opencode__* names — while no such tools were ever registered.
  • Net effect: the agent is left with zero filesystem access (no Read/Write/Edit/Bash, no working substitute), and the failure is silent — only a log.warn that's easy to miss.
  • Fix: gate bridgeOpenCodeTools on mcpServers actually being truthy, so a failed bridge build falls back to Claude Code's native built-in tools instead of a full silent lockout.

Test plan

  • Reproduce a buildOpenCodeMcpServer failure (e.g. force the internal await import("@anthropic-ai/claude-agent-sdk") to throw) and confirm the session keeps native tools instead of locking up
  • Confirm the normal path (MCP builds successfully) is unaffected — mcp__opencode__* tools still bridge as before

…ils to build

buildOpenCodeMcpServer() swallows its own errors (logs a warning and
returns undefined) instead of throwing, but bridgeOpenCodeTools was
computed independently of that result. When the MCP server failed to
build, the session still appended the "Built-in Claude Code tools are
disabled, use only mcp__opencode__*" system prompt, emptied `tools`,
and locked `allowedTools` to mcp__opencode__* names — while no such
tools were ever registered. The agent was left with no filesystem
access at all (no Read/Write/Edit/Bash, and no working substitute).

Gate bridgeOpenCodeTools on mcpServers actually being truthy so a
failed bridge build falls back to Claude Code's native built-in tools
instead of a silent full lockout.
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.

1 participant