Skip to content

mcp: codemode:false still folds server's execute tool into Code Mode execute instead of exposing it natively #53527

Closed as not planned

Description

@andomeder

Description

A remote MCP server (executor) configured with codemode: false per the v2 docs exposes 6 of its 7 tools natively (executor_skills, executor_resume, the four executor_*artifact* tools) but its execute tool is dropped - it never appears as executor_execute. The model instead gets Code Mode's own execute, whose catalog only contains native namespaces (browser, opencode): tools.search({query:'spotify'}) returns {items: [], remaining: 0, next: null} and direct paths fail with Unknown tool ... Did you mean tools.browser.files.get. The served execute description still embeds the server's ## Available integrations list, advertising tools that search can never return.

Expected: with codemode: false, all 7 server tools are on the native list as <server>_<tool> per the docs ("expose tools directly instead of through Code Mode"), including executor_execute, which reaches the server's own sandbox.

Actual: fingerprints proving the in-session execute is not the server's sandbox:

in-session execute server (raw MCP control session, same endpoint)
search envelope {items, remaining, next} {items, total, hasMore, nextOffset}
emit undefined function
search('spotify') 0 results 50 results (spotify.org.localSpotify...)
unknown-tool suggestions tools.browser.* / tools.opencode.* only server envelope errors

Regression window: config unchanged since 2026-09-21. It worked through 2026-10-02 on @opencode-ai/cli@next, which logged configuration compatibility diagnostic ... path=["mcp","servers","executor","codemode"] kind=unsupported action="Omitted native setting that cannot be represented in V1" - the flag was dropped, Code Mode stayed on, and tools.executor.execute was reachable. After switching to @opencode/cli 2.0.23 (2026-10-05) and 2.0.24 (2026-10-06 11:07), the flag is honored and the server's execute is lost.

Control: codemode: true works - the catalog contains tools.executor.execute and nesting await tools.executor.execute({code}) reaches the real sandbox (typeof emit → "function"), with live integration calls verified end-to-end. Interim workaround applied: keep codemode: true and nest.

Plugins

none

OpenCode version

v2.0.24 (channel: latest, bun global @opencode/cli; reporter previously on @opencode-ai/cli@next)

Steps to reproduce

  1. Add a remote MCP server with "codemode": false whose tools/list returns 7 tools including one named execute.
  2. Start a session and list tools: 6 <server>_* tools appear, <server>_execute does not, a generic execute does.
  3. Inside execute: tools.search({query:'spotify',limit:3}) → 0 results, envelope {items, remaining, next}.
  4. Control: open a raw MCP session (initialize + tools/call execute) against the same endpoint → same query returns 50 results, envelope {items, total, hasMore, nextOffset}.
  5. Set the server to "codemode": true and run opencode reload → executor (7 tools) appears in the catalog and nested calls work.

Screenshot and/or share link

No screenshot. Related, possibly the inverse side of the same bug: #51849 (connected MCP tools unavailable in Code Mode; there codemode: false is the working workaround, while here the false path is what drops the server's execute).

Operating System

Arch-based (kernel 7.2.5-3-omarchy, x64)

Terminal

kitty

Activity

  1. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    This issue does not fully meet our contributing guidelines.

    What needs to be fixed:

    • Use the Bug Report template’s required Description field. The report currently puts its description under Summary and omits that required field.

    Please edit this issue to address the above within 72 hours, or it will be automatically closed.


    This issue might be a duplicate of an existing issue. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    This issue still does not fully meet the Bug Report template requirement: the report is under "Summary", but the required "Description" field is missing. Please use the Bug Report template’s "Description" field with the existing report content. The needs:compliance label remains until that is updated.

  3. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    Thanks for updating the issue with a clear description, reproduction steps, and system information!

  4. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    I couldn't reproduce this on v2.0.24 (your version) or on the current latest, v2.0.29, so I'm closing it.

    Setup: a remote streamable-HTTP MCP server named executor with "codemode": false. Its tools/list returns 7 tools: execute, skills, resume, and four artifact_* tools. I also pointed the model at a mock OpenAI-compatible provider that logs the exact tools array OpenCode sends.

    Result on both versions: after the MCP server finishes connecting, the request includes all 7 tools as direct tools next to Code Mode's own execute:

    executor_artifact_delete, executor_artifact_get, executor_artifact_list, executor_artifact_put,
    executor_execute, executor_resume, executor_skills, ..., execute
    

    A model call to executor_execute({code: "typeof emit"}) went to the MCP server's own execute handler and returned its response, not OpenCode's Code Mode sandbox. On the registration path, executor_execute only collides with the reserved bare execute name when there's no namespace, so it isn't filtered out.

    Two things that could explain what you saw:

    • With codemode: false, the server's MCP instructions go into the system prompt verbatim (<mcp_instructions>). If those instructions say "use the execute tool…" and list integrations, a model can call OpenCode's generic execute instead of executor_execute. That would explain the {items, remaining, next} envelope, the empty search results, and the tools.browser/tools.opencode suggestions. A model listing its own tools isn't reliable evidence of what was sent, so check the provider request or the tool call name in the transcript.
    • On a cold start (the first prompt after a fresh location/service start, or opencode run --standalone), I saw a request go out with the server's instructions but none of its tools. That affects all of the server's tools at once, not just execute, so it doesn't match "6 of 7". It may be related to mcp: Code Mode tool calls fail with Unknown tool for connected servers (codemode:false works) #51849.

    If you can still reproduce this, please reopen with the provider request's tool names (or a session export showing the executor_* tool list without executor_execute) and the server's tools/list entry for execute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions