Uh oh!
There was an error while loading. Please reload this page.
feat: add mcp_lazy mode for on-demand MCP tool loading - #8771
Conversation
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
DeveloperJose
commented
Jan 18, 2026
#8177 also proposes something similar |
xHeaven
commented
Jan 18, 2026
Damn, I completely missed that one. Our solutions differ a bit, I guess it comes down to preference. Also, honestly, I'm not sure I'd call either solution "complete", more like an idea of how this feature could be implemented. |
DeveloperJose
commented
Jan 19, 2026
There was also this one in November that was closed, #4717 Slightly different and with the idea of loading tools for certain turns and then unloading them |
spoons-and-mirrors
commented
Jan 19, 2026
yeah #4717 was a simpler implementation that just worked, maybe not the most feature full approach but did the trick fine. I closed it because it wasn't getting any attention and i wanted to help declutter opencode's growing PR number :D |
xHeaven
commented
Jan 19, 2026
That's probably what's going to happen to this PR, too. This is a great feature - probably not the best implementation -, but it's not getting the attention I would expect for something like this. I'm hoping the core contributors will pick up on it and make a better implementation. |
DeveloperJose
commented
Jan 19, 2026
There's another proposed implementation here https://github.com/famitzsy8/opencode-tool-search-tool By @famitzsy8 If we are going to keep pushing this idea forward we might need to consolidate all the duplicate issues and PRs. |
f1ae801 to
08fa7f7Compareatanasna
commented
Feb 10, 2026
Can you explain how this works with permissions, please? |
KennyDizi
commented
Feb 11, 2026
Looking forward to this PR being merged. |
strawberrymelonpanda
commented
Feb 21, 2026
If you're interested in it, as I am, probably best to just merge it locally. I don't know how OpenCode chooses which PRs to merge, but given the radio silence, I'd say odds aren't great. |
Tier 1 bug fixes: - Fix O(n²) bash output concatenation with StreamingOutput class (anomalyco#9693) - Fix memory leaks in Bus.once, Format, Plugin, ShareNext, Bootstrap (anomalyco#13514) - Fix FileTime race condition using actual file mtime instead of JS clock - Free memory on compaction prune: clear output/attachments/metadata (anomalyco#7049) - Throttle reasoning-delta storage writes to 50ms intervals (anomalyco#11328) - Handle SIGHUP/SIGTERM to prevent orphaned processes (anomalyco#12718) - Add process.once("close") handler for bash tool reliability Tier 2 features: - Support 1M context window for Anthropic models via beta header (anomalyco#14375) - Input-only token counting for compaction with limit.input models - MCP lazy loading: on-demand tool discovery via mcp_search tool (anomalyco#8771) - MCP servers listed in system prompt when lazy mode enabled - StreamingOutput: output_filter regex for build diagnostics - LSP server cleanup callback for temp directory removal - Extract formatSize utility from uninstall to shared util/format - GitHub CI: fix Bus subscription leak in session event handler Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mustafa89
commented
Apr 7, 2026
Any chances of this getting merged ? |
GordianSch
commented
May 21, 2026
Desperately waiting for a merge. |
mustafa89
commented
May 21, 2026
Dont worry. They are currently focusing on adding "ding" sounds on agent completion. Wayy more important than this. |
rutmehta
commented
Aug 5, 2026
can we merge this yet? |
rekram1-node
commented
Aug 18, 2026
We added support for codemode instead of a tool search, you can enable with: OPENCODE_EXPERIMENTAL_CODE_MODE=true v2 of opencode ships with it enabled by default |
Closes#8625.
What does this PR do?
Adds a new
experimental.mcp_lazyconfig option that prevents MCP tools from being loaded into context automatically. Instead, a newmcp_searchtool is provided to discover and call MCP tools on-demand.This reduces context usage for users with many MCP servers configured. When enabled:
mcp_searchtool allows listing, searching, describing, and calling MCP tools/mcpdialogThe injected prompt:
How did you verify your code works?
experimental.mcp_lazy: truein configmcp_searchappears insteadThe tests were manual, there are no actual tests included here.