claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Having multiple MCP servers running Eats into Context Window

Open vanman2024 opened this issue 5 months ago • 5 comments

Environment

  • Platform (select one):

    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [x] Other: Claude Code (local CLI with multiple MCP servers)
  • Claude CLI version:

  • Operating System: Ubuntu 22.04 (inside WSL)

  • Terminal: VS Code integrated terminal

Bug Description

When running multiple Claude MCP servers simultaneously (e.g., ~20 local MCP server processes), the context window in Claude Code rapidly depletes. Context usage starts between ~8%–18% but quickly consumes the entire available context after only ~5 prompts, making the session unusable. This occurs even if the prompts themselves are short.

Steps to Reproduce

  1. Start ~20 local MCP server instances connected to Claude Code.
  2. Open a Claude Code session in your terminal or VS Code.
  3. Begin sending prompts as normal.
  4. Observe the context percentage in Claude Code; note how it increases rapidly with each prompt, even if prompt size is small.
  5. After ~5 prompts, context window reaches 100% consumed, forcing session reset.

Expected Behavior

The context window should remain stable or grow proportionally to the actual prompt/response size, not inflate excessively due to multiple MCP servers running. Running multiple MCP processes should not artificially bloat context usage.

Actual Behavior

Context window usage grows dramatically and unexpectedly when many MCP servers are active. This results in the session maxing out context capacity far sooner than expected, requiring frequent resets to continue using Claude Code effectively.

Additional Context

  • Behavior confirmed when running ~20 MCP servers locally.
  • Issue not observed with only a few MCP servers (<5) running concurrently.

vanman2024 avatar Jul 05 '25 22:07 vanman2024