Controlling MCP Result Size And Context Pressure
Reduce Claude Code context pressure from MCP tools using MAX_MCP_OUTPUT_TOKENS, anthropic/maxResultSizeChars annotations, tool search deferral, alwaysLoad discipline, and pagination patterns from official MCP documentation.
Open the source and read safety notes before installing.
Safety notes
- Raising output limits increases context cost and may hide the need to paginate server responses.
- alwaysLoad: true on large servers loads every tool schema at session start—use sparingly.
- Truncated MCP output can omit fields needed for security review; verify critical data separately.
Privacy notes
- Large MCP payloads may contain secrets; shrinking output does not redact—sanitize at the server.
- Tool search defers schemas but invoked tools still return full results into context.
- Shared CI logs pasted through MCP can expose internal URLs in truncated previews.
Prerequisites
- One or more MCP servers returning large JSON, logs, or file dumps.
- Ability to set environment variables for Claude Code sessions.
- Optional access to MCP server source to add pagination or size annotations.
- Understanding of your project's context budget for long sessions.
Schema details
- Install type
- copy
- Reading time
- 8 min
- Difficulty score
- 55
- Troubleshooting
- Yes
- Breaking changes
- No
Full copyable content
When MCP tools flood context, set MAX_MCP_OUTPUT_TOKENS, prefer servers with maxResultSizeChars, enable tool search defaults, and avoid alwaysLoad on large tool catalogs unless every turn needs them.About this resource
TL;DR
Claude Code warns when MCP tool output exceeds 10,000 tokens. Control pressure with
MAX_MCP_OUTPUT_TOKENS, server-side anthropic/maxResultSizeChars, tool search
deferral, and careful alwaysLoad settings.
Prerequisites & Requirements
- {"task": "Large-output tools identified", "description": "Servers returning logs, queries, or file dumps are listed"}
- {"task": "Env access", "description": "You can export variables before launching Claude Code"}
- {"task": "Server ownership", "description": "Know whether you can patch MCP server pagination"}
- {"task": "Context budget", "description": "Team agrees on acceptable MCP share of the window"}
Core Concepts Explained
Default warning at 10k tokens
MCP documentation states Claude Code displays a warning when MCP tool output exceeds 10,000 tokens, signaling context pressure.
MAX_MCP_OUTPUT_TOKENS
Set the environment variable to raise or lower the cap—for example
MAX_MCP_OUTPUT_TOKENS=50000. Applies to tools without their own declared limit.
maxResultSizeChars annotation
Tools that set anthropic/maxResultSizeChars use that value for text content
independently of the env var. Prefer server-side annotations over globally
raising limits.
Tool search deferral
Tool search loads MCP tool definitions on demand, keeping session-start context
lower when many servers are configured. ENABLE_TOOL_SEARCH=auto uses a 10%
context threshold mode.
alwaysLoad tradeoff
Setting alwaysLoad: true forces a server's tools into context every turn—only
for small always-needed toolsets.
Step-by-Step Implementation Guide
Reproduce the warning. Note which MCP tool triggers the 10k token alert.
Try server pagination first. Ask the server author to page large responses.
Add maxResultSizeChars if you maintain the server.
Tune MAX_MCP_OUTPUT_TOKENS temporarily while paginating—document the value in team runbooks.
Review alwaysLoad flags. Disable on catalog servers with dozens of tools.
Confirm tool search is on. Default deferral helps multi-server setups.
Monitor
/context. Verify MCP share drops after changes.
Configuration Examples
export MAX_MCP_OUTPUT_TOKENS=25000
claude
{
"mcpServers": {
"analytics": {
"type": "stdio",
"command": "analytics-mcp",
"alwaysLoad": false
}
}
}
Troubleshooting
Warning persists after raising env var
Check whether the tool declares anthropic/maxResultSizeChars or returns images
subject to token limits separately.
Claude cannot complete task with truncated output
Paginate server responses or split tools instead of only raising limits.
Context still tight with few tools
Inspect alwaysLoad servers and upfront built-in tools; use tool search auto mode.
Source Verification Notes
Verified against Claude Code MCP documentation on 2026-06-16: 10k token
warning, MAX_MCP_OUTPUT_TOKENS, anthropic/maxResultSizeChars, tool search
defaults, ENABLE_TOOL_SEARCH=auto, and alwaysLoad behavior.
Duplicate Check
Complements sparse-context-setup-for-large-codebases (general context strategy)
and MCP threat-model guides. No guides entry documents MCP output token limits
and tool search deferral together.
References
- Claude Code MCP - https://code.claude.com/docs/en/mcp
Source citations
Add this badge to your README
Show that Controlling MCP Result Size And Context Pressure is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/guides/controlling-mcp-result-size-and-context-pressure)How it compares
Controlling MCP Result Size And Context Pressure side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Controlling MCP Result Size And Context Pressure Reduce Claude Code context pressure from MCP tools using MAX_MCP_OUTPUT_TOKENS, anthropic/maxResultSizeChars annotations, tool search deferral, alwaysLoad discipline, and pagination patterns from official MCP documentation. Open dossier | Claude Code MCP Server Setup Guide Connect existing MCP servers to Claude Code with claude mcp add: stdio, HTTP, and SSE transports, local/project/user scopes, .mcp.json, and /mcp OAuth. Open dossier | Auditing MCP Client Configuration Before Team Rollout Source-backed checklist for reviewing Claude Code MCP client configuration before a team rollout, covering scopes, transports, commands, secrets, allowlists, denylists, approvals, and rollback. Open dossier | OAuth Patterns For MCP Server Authentication Implement OAuth patterns for MCP servers in Claude Code: Dynamic Client Registration, pre-configured client IDs, oauth.scopes pins, authServerMetadataUrl overrides, and keychain token storage from official MCP documentation. Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Category | guides | guides | guides | guides |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | kiannidev | JSONbored | YB0y | kiannidev |
| Added | 2026-06-16 | 2025-10-27 | 2026-06-10 | 2026-06-16 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Raising output limits increases context cost and may hide the need to paginate server responses. alwaysLoad: true on large servers loads every tool schema at session start—use sparingly. Truncated MCP output can omit fields needed for security review; verify critical data separately. | ✓Local stdio servers run their command with your user privileges, and remote servers expose model-controlled tools, so connect only servers you trust and review the command, URL, and headers first. | ✓Local stdio MCP servers execute commands with the user's privileges, so review the exact command, arguments, package runner, file paths, and network behavior before sharing a config. Remote MCP servers can expose model-controlled tools for production systems; require least-privilege scopes, explicit approval for write tools, and a rollback path before team rollout. Do not rely on server names alone for enforcement because names are user-assigned labels; use command or URL allowlist entries when policy must control what actually runs. | ✓Pin oauth.scopes to least privilege; widen only when tools return insufficient_scope. Client secrets belong in keychain/credentials storage—not committed .mcp.json. Static Authorization headers bypass OAuth discovery—verify tokens separately. |
| Privacy notes | ✓Large MCP payloads may contain secrets; shrinking output does not redact—sanitize at the server. Tool search defers schemas but invoked tools still return full results into context. Shared CI logs pasted through MCP can expose internal URLs in truncated previews. | ✓Server URLs, command paths, header names, and tool results can expose internal hosts and private data; keep API keys and tokens out of shared `.mcp.json` and use environment-variable expansion or `/mcp` OAuth instead. | ✓MCP client configuration can reveal server URLs, internal hostnames, command paths, environment-variable names, header names, OAuth client IDs, and tool availability. Do not store API keys, bearer tokens, client secrets, tenant IDs, or personal credentials in shared `.mcp.json`, managed-mcp.json, PR bodies, issue comments, logs, or screenshots. Tool arguments, tool results, resources, prompts, logs, traces, and OAuth metadata can expose private repositories, tickets, databases, user identities, and workspace data. | ✓OAuth tokens in keychain still grant server access—revoke via /mcp Clear authentication. Redirect URIs must match registered localhost callback ports exactly. |
| Prerequisites |
|
|
|
|
| Install | — | — | — | — |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.