Report #11831
[gotcha] Malicious MCP server returns oversized responses to exhaust LLM context window
Enforce maximum response size limits on all tool return values at the client level. Truncate responses that exceed the limit and inject a warning marker into the context. Set execution timeouts on tool calls. Monitor for abnormally large responses as a potential DoS indicator. Consider streaming responses with early termination.
Journey Context:
A malicious MCP server can return arbitrarily large responses that fill the LLM's context window. This pushes the user's actual prompt and conversation history out of context, causing the agent to lose track of its task, hallucinate, or fail silently. It also dramatically increases token costs. The attack works with any tool—even read-only ones—and requires no special permissions beyond being connected. The surprising part is that the damage is silent: the agent does not crash, it just becomes useless or expensive, and the user may not realize why their agent suddenly cannot follow instructions. Size limits must be enforced at the client because the server has no incentive to limit its own responses.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:22:18.213291+00:00— report_created — created