published fresh until

Claude Code MCP output over 25000 tokens: what to set

Summary As of October 2026, start Claude Code with MAX_MCP_OUTPUT_TOKENS=50000 claude to raise the 25,000-token default, and make the MCP tool paginate or filter so one response stays smaller.

Not for designing list pagination in an MCP server, see mcp-server-pagination-tools-resources-prompts-list-nextcursor

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

MCP tool "<name>" response (N tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size. First action: raise the limit for one session with MAX_MCP_OUTPUT_TOKENS=50000 claude, and fix the cause in the MCP server by returning less per call (filters, a limit parameter, pagination).

Do first: MAX_MCP_OUTPUT_TOKENS=50000 claude.

Not for: how an MCP server should page its own list results (see mcp-server-pagination-tools-resources-prompts-list-nextcursor).

Evidence status: the variable name, default, warning threshold and file-saving rule are from the official Claude Code MCP page, checked 2026-10-30. The error string comes from a public issue. No lab run; raising the limit is untested here.

Diagnostic: MCP tool "<name>" response (N tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size.

Verbatim example from a public report: MCP tool "chrome_screenshot" response (137411 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size. (issue 9152, opened 2025-10-08 by nickyli98, closed as a duplicate of 4002).

What the docs say

  • Claude Code "limits output to 25,000 tokens by default."
  • It "displays a warning when MCP tool output exceeds 10,000 tokens"; per the docs this warning threshold is fixed and not changed by the variable.
  • The variable is MAX_MCP_OUTPUT_TOKENS; the docs' example value is MAX_MCP_OUTPUT_TOKENS=50000.
  • Separately, text results longer than 50,000 characters are saved to a file "regardless of this variable", unless the server raises the tool's own limit. The file goes in the session's tool-results directory under ~/.claude/projects/, and the conversation gets a message naming the file path instead; Claude reads the file when needed. A server author can raise one tool's threshold (up to 500,000 characters) with _meta["anthropic/maxResultSizeChars"] in tools/list, independent of the variable.

Do first

1. Set the variable when you start Claude Code, in the same shell:

MAX_MCP_OUTPUT_TOKENS=50000 claude

2. Re-run the tool call. A larger value costs more context per call, so raise it only as far as needed. 3. Then reduce what the tool returns: ask for fewer rows or fields, add a limit or filter argument, and page through results. The error text itself suggests pagination, filtering or limit parameters. If you own the server, see mcp-server-pagination-tools-resources-prompts-list-nextcursor.

Images and screenshots

Issue 9152 asked for base64 image data to be exempt from the text-token limit; the page shows no maintainer answer or workaround and it was closed as a duplicate. Per the docs, tools that return image data are still subject to MAX_MCP_OUTPUT_TOKENS (the per-tool maxResultSizeChars does not apply to image data), so raise the variable or return a smaller screenshot (region or lower resolution) from the server.

Related variables from the same docs page

  • MCP_TIMEOUT: server startup timeout; the example is MCP_TIMEOUT=10000 claude for 10 seconds.
  • MCP_TOOL_TIMEOUT: tool-call timeout across servers; the docs say the default is about 28 hours when unset. A per-server timeout in milliseconds in a .mcp.json entry overrides it for that server only (values below 1000 are ignored).

Evidence

Issue 9152 gives the exact error string and a real failing case (137,411 tokens against 25,000). It contains no fix. The docs are the source for the variable.

Limits

Untested: persistence of the variable in a settings env block, and the exact spill-to-file behavior. The docs state the 50,000-character rule is character-based, whatever the token count. Issue 9152 was on v2.0.10, so its error string may be version-bound. checked 2026-10-30.

Started from a post by @Anthropic (Claude Code docs), packaged by the editor. Original post

Subjects

More in claude code

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code MCP output over 25000 tokens: what to set
Summary: As of October 2026, start Claude Code with MAX_MCP_OUTPUT_TOKENS=50000 claude to raise the 25,000-token default, and make the MCP tool paginate or filter so one response stays smaller.
Copy for agent
get the whatworks thread claude-code-mcp-tool-output-exceeds-25000-tokens-max-mcp-output-tokens and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-mcp-tool-output-exceeds-25000-tokens-max-mcp-output-tokens
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks