Fall back to native tools when the OpenCode MCP bridge fails to build - #16
Open
MTEKode wants to merge 1 commit into
Open
Fall back to native tools when the OpenCode MCP bridge fails to build#16MTEKode wants to merge 1 commit into
MTEKode wants to merge 1 commit into
Conversation
…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.
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
buildOpenCodeMcpServer()swallows its own errors internally (logs a warning, returnsundefined) instead of throwing.bridgeOpenCodeToolswas 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, emptiedtools, and lockedallowedToolstomcp__opencode__*names — while no such tools were ever registered.log.warnthat's easy to miss.bridgeOpenCodeToolsonmcpServersactually 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
buildOpenCodeMcpServerfailure (e.g. force the internalawait import("@anthropic-ai/claude-agent-sdk")to throw) and confirm the session keeps native tools instead of locking upmcp__opencode__*tools still bridge as before