claude-code - 💡(How to fix) Fix Per-session MCP server profiles [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45293Fetched 2026-04-09 08:08:44
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Fix Action

Fix / Workaround

Workarounds tried

RAW_BUFFERClick to expand / collapse

Problem

MCP server connections are global -- toggling a server on/off affects all concurrent sessions. Different session types need different MCP servers:

  • School/admin sessions need Google Workspace + Asana
  • Code/research sessions need none (or just Playwright)
  • Newsletter sessions need Constant Contact

With multiple concurrent sessions (common on Team plans), there's no way to optimize per session. Unneeded MCP tool schemas inflate the system prompt (~300 tokens per tool, ~50 tools for Google Workspace alone), increasing cost and -- on Windows -- correlating with higher surrogate bug bricking rates (#44230).

Proposed solution

Per-session or per-project MCP profiles. Possible approaches:

  1. Project-level .claude/settings.json with an mcpServers section that overrides global connections
  2. Named profiles (e.g., claude --mcp-profile school) that map to predefined server sets
  3. Session-start flag (e.g., claude --mcp google-workspace,asana) to connect only specified servers

Workarounds tried

  • ENABLE_TOOL_SEARCH=auto:5 defers some tools (Playwright, claude.ai integrations) but not locally-connected MCP servers like Google Workspace
  • Manual /mcp toggling between sessions -- doesn't scale with concurrent sessions
  • Accepting the overhead -- works but wastes ~4,000+ tokens/turn on sessions that don't need MCP

Environment

Windows 11, Team plan, Remote Control + CLI, typically 2-3 concurrent sessions.

extent analysis

TL;DR

Implementing per-session or per-project MCP profiles is likely to resolve the issue of unneeded MCP tool schemas inflating the system prompt.

Guidance

  • Consider using a project-level .claude/settings.json file with an mcpServers section to override global connections for specific projects.
  • Explore the named profiles approach (e.g., claude --mcp-profile school) to map to predefined server sets for different session types.
  • Evaluate the session-start flag (e.g., claude --mcp google-workspace,asana) to connect only specified servers for each session.
  • Verify the effectiveness of each approach by monitoring the system prompt size and surrogate bug bricking rates.

Example

No code snippet is provided as the issue does not contain explicit code references.

Notes

The proposed solutions may require modifications to the existing MCP server connection management system. It is essential to test and validate each approach to ensure they meet the specific requirements of different session types.

Recommendation

Apply a workaround by implementing named profiles (e.g., claude --mcp-profile school) to map to predefined server sets, as this approach seems to be a flexible and scalable solution for managing MCP servers across different session types.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING