Feature Request: Tool to list and manage MCP servers to reduce context window #1602

Open
opened 2026-02-16 17:31:43 -05:00 by yindo · 8 comments
Owner

Originally created by @mittalsuraj18 on GitHub (Sep 4, 2025).

Originally assigned to: @adamdotdevin on GitHub.

Feature Request: MCP Server Management Tool

Problem

When we add a lot of global MCP servers, the context window blows up significantly since they need to be included in every single call to the models. However, we might not need all MCP servers for every particular project, leading to unnecessary context consumption.

Benefits

  • Improved performance for projects that don't need all global MCP servers
  • Better context window management
  • More granular control over MCP server usage
  • Allows user to keep all mcp servers in a global file thereby not worrying about project specific mcps.

Use Case

Users working on specific projects (e.g., web development, data analysis) shouldn't have to load MCP servers for unrelated domains (e.g., Kubernetes, AWS tools) if they're not needed for that particular project.

Originally created by @mittalsuraj18 on GitHub (Sep 4, 2025). Originally assigned to: @adamdotdevin on GitHub. ## Feature Request: MCP Server Management Tool ### Problem When we add a lot of global MCP servers, the context window blows up significantly since they need to be included in every single call to the models. However, we might not need all MCP servers for every particular project, leading to unnecessary context consumption. ### Benefits - Improved performance for projects that don't need all global MCP servers - Better context window management - More granular control over MCP server usage - Allows user to keep all mcp servers in a global file thereby not worrying about project specific mcps. ### Use Case Users working on specific projects (e.g., web development, data analysis) shouldn't have to load MCP servers for unrelated domains (e.g., Kubernetes, AWS tools) if they're not needed for that particular project.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 4, 2025):

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

  • #514: Option to Enable / Disable MCP Servers (via TUI) - requests runtime toggle of MCP servers via TUI to avoid bloating context with unnecessary servers
  • #1899: Command to show available mcp servers - requests a /mcp command to show all configured MCP servers
  • #567: feature request: mcp slash command - requests /mcp command to configure MCP servers

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 4, 2025): This issue might be a duplicate of existing issues. Please check: - #514: Option to Enable / Disable MCP Servers (via TUI) - requests runtime toggle of MCP servers via TUI to avoid bloating context with unnecessary servers - #1899: Command to show available mcp servers - requests a /mcp command to show all configured MCP servers - #567: feature request: mcp slash command - requests /mcp command to configure MCP servers Feel free to ignore if none of these address your specific case.
Author
Owner

@marcinpz commented on GitHub (Sep 4, 2025):

What about using MCP zero idea? https://arxiv.org/abs/2506.01056

@marcinpz commented on GitHub (Sep 4, 2025): What about using MCP zero idea? https://arxiv.org/abs/2506.01056
Author
Owner

@mittalsuraj18 commented on GitHub (Sep 7, 2025):

mcp zero look like the idea. mcp-hub still pollutes the entire context with all the tools. integrating mcp-hub did decrease the startup time and i've moved all the tool there. so thats a plus.

@mittalsuraj18 commented on GitHub (Sep 7, 2025): mcp zero look like the idea. mcp-hub still pollutes the entire context with all the tools. integrating mcp-hub did decrease the startup time and i've moved all the tool there. so thats a plus.
Author
Owner

@taqtiqa-mark commented on GitHub (Sep 27, 2025):

@mittalsuraj18 can you say how https://opencode.ai/docs/agents/#tools is not fit for purpose. Specifically, turning off mymcp_:

{
  "agent": {
    "readonly": {
      "tools": {
        "mymcp_*": false,
        "write": false,
        "edit": false
      }
    }
  }
}
@taqtiqa-mark commented on GitHub (Sep 27, 2025): @mittalsuraj18 can you say how https://opencode.ai/docs/agents/#tools is not fit for purpose. Specifically, turning off `mymcp_`: ``` { "agent": { "readonly": { "tools": { "mymcp_*": false, "write": false, "edit": false } } } } ```
Author
Owner

@mittalsuraj18 commented on GitHub (Oct 26, 2025):

Soory for the late reply.
@taqtiqa-mark that would work but it would require us to carefully manage agents and the tools exposed to them.

What we need is, exposure to all the tools without polluting the context windows.

@mittalsuraj18 commented on GitHub (Oct 26, 2025): Soory for the late reply. @taqtiqa-mark that would work but it would require us to carefully manage agents and the tools exposed to them. What we need is, exposure to all the tools without polluting the context windows.
Author
Owner

@taqtiqa-mark commented on GitHub (Oct 26, 2025):

What we need is, exposure to all the tools without polluting the context windows.

Ahh okay, I think I see. Apologies.

Essentially you need to use:

  • Commands: A command invokes a sub-agent.
  • Sub-Agents: A subagent configures the tool list to its required set, as well as setting model etc.

I believe the docs cover your exact use case?

https://opencode.ai/docs/mcp-servers/#per-agent

If you have a large number of MCP servers you may want to only enable them per agent and disable them globally. To do this:

  • Disable it as a tool globally.
  • In your agent config enable the MCP server as a tool.

@mittalsuraj18, not sure if that covers what you wanted.

There is another workaround, which I use: Context specific configuration files.
But this only feels natural in a containerized setting, which is my case.

HTH?

@taqtiqa-mark commented on GitHub (Oct 26, 2025): > What we need is, exposure to all the tools without polluting the context windows. Ahh okay, I think I see. Apologies. Essentially you need to use: - Commands: A command invokes a sub-agent. - Sub-Agents: A subagent configures the tool list to its required set, as well as setting model etc. I believe the docs cover your exact use case? https://opencode.ai/docs/mcp-servers/#per-agent > If you have a large number of MCP servers you may want to only enable them per agent and disable them globally. To do this: > > - Disable it as a tool globally. > - In your [agent config](https://opencode.ai/docs/agents#tools) enable the MCP server as a tool. @mittalsuraj18, not sure if that covers what you wanted. There is another workaround, which I use: Context specific configuration files. But this only feels natural in a containerized setting, which is my case. HTH?
Author
Owner

@sandipwane commented on GitHub (Jan 14, 2026):

Anthropic just released a server-side Tool Search Tool (beta) that solves this exact problem with deferred tool loading. We could implement a similar client-side version for OpenCode that works across all providers.

@sandipwane commented on GitHub (Jan 14, 2026): Anthropic just released a [server-side Tool Search Tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) (beta) that solves this exact problem with deferred tool loading. We could implement a similar client-side version for OpenCode that works across all providers.
Author
Owner

@taqtiqa-mark commented on GitHub (Feb 5, 2026):

In the spirit of calling out excellent engineering and design....

I've found that the Pi Coding Agent is more robust and, for me has none of the issues that I've encountered in OC, or has an elegant way to resolve them.... I'm dropping out of OC issues:

@taqtiqa-mark commented on GitHub (Feb 5, 2026): In the spirit of calling out excellent engineering and design.... I've found that the Pi Coding Agent is more robust and, for me has none of the issues that I've encountered in OC, or has an elegant way to resolve them.... I'm dropping out of OC issues: - [Pi Coding Agent](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent) - [Overview](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) - [Example development session](https://www.youtube.com/watch?v=ANQ1IYsFM2s)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1602