Skip to content

Too many MCP servers results in continuous compaction #3024

Description

@adithyabsk

Describe the bug

The CLI agent can end up in a degenerate state when you enable too many MCP servers that expand past the available context window of the model in question supporting the harness.

The CLI should detect this state and warn the user. In my case, I ended up with 94k / 128k context window consumed by tools

Affected version

GitHub Copilot CLI 1.0.37.

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on Apr 28, 2026
  2. added
    area:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registry
    area:context-memoryContext window, memory, compaction, checkpoints, and instruction loading
    on Apr 29, 2026
  3. andrii-z4i commented on May 16, 2026

    @andrii-z4i

    Real-world case: 20+ MCP servers configured in ~/.copilot/

    Had a Technical PM hit this exact problem with ~20+ MCP servers configured globally. The symptoms were:

    1. Session startup took extremely long — spawning and handshaking with all MCP servers sequentially
    2. CLI crashes — likely from process/timeout exhaustion during initialization
    3. Severe hallucinations — using Claude Opus
      4.6 (200K context), the tool definitions consumed so much of the context window that the model struggled to focus on the actual task

    The root issue is that there's no guardrail or feedback — no warning at startup like "You have N tools loaded, consuming ~Xk tokens (Y% of context window)". Inexperienced users can install plugins/MCPs freely and silently degrade their experience without understanding why.

    Suggestions:

    • Warn at startup when tool definitions exceed a threshold (e.g., >50% of context window)
    • Show tool token overhead in /env or /context
    • Support MCP profiles (MCP Profiles #2235) so users can activate subsets per project instead of loading everything globally
  4. btsouth commented on Jul 10, 2026

    @btsouth

    Every server loads its full tool definitions into context up front, so the block grows without limit as you add servers.

    Disclosure, I build an open-source gateway (Toolport) that fronts your servers with a couple of meta-tools and loads each tool's schema on demand. That 94k tool block drops to a few hundred tokens no matter how many servers you connect.

    Rough math if useful, https://toolport.app/calculator

  5. copilot-cli-bot commented on Oct 8, 2026

    @copilot-cli-bot

    This appears to be resolved as of GitHub Copilot CLI v1.0.93. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingarea:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registry

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions