claude-code - 💡(How to fix) Fix [BUG] claude.ai marketplace MCP server instructions inject into context on every session regardless of Tool Search [2 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#48680Fetched 2026-04-16 06:53:54
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Problem Tool Search defers MCP tool schemas, but MCP server instruction blocks (system prompt injections from claude.ai marketplace servers) load unconditionally on every session start. These are separate mechanisms, and Tool Search does not affect the instruction context.

With several Claude. ai marketplace servers configured (e.g., Figma, Slack), instruction injection alone accounts for 30–55% of context consumed on a fresh window — before any user input.

What Should Happen?

Expected: MCP server instructions load on demand or are scoped to sessions where the server is actually used
Actual: All instruction blocks inject on startup regardless of whether the server is needed

Error Messages/Logs

Steps to Reproduce

Steps to reproduce

  1. Configure 3+ Claude.AI marketplace MCP servers
  2. Open a fresh Claude Code window
  3. Note the context percentage shown in the status bar before sending any message

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

v2.1.109

Platform

Claude Code CLI

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Related: #47645 covers the tool schema side of the same symptom — this is the instruction/prompt side, which requires a separate fix.

extent analysis

TL;DR

The issue can be mitigated by implementing a mechanism to load MCP server instructions on demand or scope them to sessions where the server is actually used.

Guidance

  • Investigate the current implementation of MCP server instruction loading to understand why it's happening unconditionally on every session start.
  • Consider adding a check to load MCP server instructions only when the corresponding server is actually used or configured.
  • Review the related issue #47645 to ensure that the fix for the tool schema side of the symptom does not introduce any conflicts with the instruction/prompt side.
  • Analyze the performance impact of loading MCP server instructions on demand versus the current unconditional loading approach.

Example

No code snippet can be provided without more information about the current implementation.

Notes

The issue is specific to the Claude Code CLI on macOS, and the fix may need to be adapted for other platforms or versions.

Recommendation

Apply a workaround to load MCP server instructions on demand, as this approach is likely to reduce the context consumption on fresh window startup.

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