You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Since MCP tools are often invoked with different arguments, routing all of them through Code Mode adds an extra layer to simple tool calls. It also leaves the agent with multiple ways to invoke a tool.
I would like a global default for codemode, with the per-server setting taking precedence. This would allow direct tools globally with selected servers opting into Code Mode, or Code Mode globally with selected servers opting out.
Currently, codemode has to be configured separately for every MCP server. A plugin can approximate this with ctx.mcp.transform, but this is a configuration preference and should not require a plugin.
Thanks for the suggestion! You're asking for a global default for MCP codemode, where each server's own codemode setting would still take precedence. That would let you use direct tools by default and opt chosen servers into Code Mode, or the other way round. Maintainers will consider it.
As you mentioned, a plugin can do this until then. Here is a short one. Save it as ~/.config/opencode/plugins/mcp-codemode-default.ts (or put it in .opencode/plugins/ in a project). I haven't type-checked it, so please let us know if it doesn't load:
import{Plugin}from"@opencode/plugin"// Global default for MCP `codemode`. Servers that set `codemode` themselves keep their own value.constDEFAULT_CODEMODE=false// false = direct tools by default, true = Code Mode by defaultexportdefaultPlugin.define({id: "mcp-codemode-default",setup: async(ctx)=>{constfallback: boolean=ctx.options.codemode??DEFAULT_CODEMODEawaitctx.mcp.transform((editor)=>{for(const[,server]ofeditor.list()){if(server.codemode===undefined)server.codemode=fallback}})},})
One caveat: the order in which plugins run decides one case. If this plugin runs before OpenCode's built-in defaults, servers such as Executor would get your global default instead of the built-in codemode: false. Setting codemode on those servers in your config avoids this.
I agree this is really a config preference, so we've kept the request open for a built-in option.
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the suggestion! You're asking for a global default for MCP
codemode, where each server's owncodemodesetting would still take precedence. That would let you use direct tools by default and opt chosen servers into Code Mode, or the other way round. Maintainers will consider it.Related issues and PRs:
codemodefor MCP servers passed through ACPcodemode: falseAs you mentioned, a plugin can do this until then. Here is a short one. Save it as
~/.config/opencode/plugins/mcp-codemode-default.ts(or put it in.opencode/plugins/in a project). I haven't type-checked it, so please let us know if it doesn't load:One caveat: the order in which plugins run decides one case. If this plugin runs before OpenCode's built-in defaults, servers such as Executor would get your global default instead of the built-in
codemode: false. Settingcodemodeon those servers in your config avoids this.I agree this is really a config preference, so we've kept the request open for a built-in option.