Skip to content

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

Closed

Description

@mittalsuraj18

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.

Activity

  1. github-actions commented on Sep 4, 2025

    @github-actions
    Contributor

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

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

  2. marcinpz commented on Sep 4, 2025

    @marcinpz

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

  3. mittalsuraj18 commented on Sep 7, 2025

    @mittalsuraj18
    Author

    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.

  4. taqtiqa-mark commented on Sep 27, 2025

    @taqtiqa-mark

    @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
          }
        }
      }
    }
    
  5. mittalsuraj18 commented on Oct 26, 2025

    @mittalsuraj18
    Author

    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.

  6. taqtiqa-mark commented on Oct 26, 2025

    @taqtiqa-mark

    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?

  7. sandipwane commented on Jan 14, 2026

    @sandipwane
    Contributor

    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.

  8. taqtiqa-mark commented on Feb 6, 2026

    @taqtiqa-mark

    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:

  9. github-actions commented on Apr 7, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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