Claude Code: MCP tool output is too large (MAX_MCP_OUTPUT_TOKENS)
The error
Why it happens
Claude Code warns when an MCP tool returns more than 10,000 tokens and limits tool output to 25,000 tokens by default to protect your context window. Separately, successful text results longer than 50,000 characters are saved to a file whatever the token limit is, unless the server raises that tool's own limit.
How to fix it
- Ask for less
Most servers have paging or filter options (a page number, a row limit, a narrower query). Asking for smaller results is usually the best fix. - Raise the limit if you really need more
SetMAX_MCP_OUTPUT_TOKENSwhen you start Claude Code. The 10,000-token warning stays the same.MAX_MCP_OUTPUT_TOKENS=50000 claude - Long-running tools: set a per-server timeout
Add atimeoutin milliseconds to the server's entry in.mcp.json(values under 1000 are ignored).{ "mcpServers": { "big-server": { "command": "npx", "args": ["-y", "@example/mcp-server"], "timeout": 600000 } } }
Related servers
Context7
Upstash Context7: up-to-date library documentation for AI coding agents (local @upstash/context7-mcp or hosted mcp.context7.com/mcp). Version 4.9.0 (N
GitHub
GitHub's official MCP server for repositories, issues, pull requests, Actions and more (local Docker image or the hosted api.githubcopilot.com/mcp/ en
MongoDB
Official MongoDB MCP server for MongoDB databases and Atlas clusters. Version 3.4.0 (Nov 24, 2026) can infer a collection's schema from its validator,
Sources
- https://code.claude.com/docs/en/mcp
- [BUG] MCP tool results: undocumented ~50,000-character persist-to-disk threshold (character-based, not lifted by MAX_MCP_OUTPUT_TOKENS, message says "tokens") (GitHub issue, 1 comments)
- [FEATURE] : Tunable Context Retention / MCP Tool-Result Eviction (GitHub issue, 9 comments)