
This fix is part of MCP troubleshooting, within The MCP Guide. Still stuck? Request a free MCP readiness review.
When an MCP tool returns a very large result, three things can go wrong: the client caps or moves the output, a transport limit cuts the response off, or the server itself runs out of memory building it. The fastest fix is to make the tool return less per call, with filters, limits or a cursor. As a user of Claude Code you can also raise MAX_MCP_OUTPUT_TOKENS, but the lasting fix sits in the server.
Checked against: Claude Code's MCP output limits, the 2026-07-28 MCP spec pages on tools, pagination and the stdio transport, plus the MCP debugging guide, on 2 November 2026. eSEOspace did not run these steps.
Key Takeaways
- Claude Code warns when a tool's output passes 10,000 tokens and caps it at 25,000 tokens by default.
- Over the cap, Claude Code saves the result to a file and gives Claude the path instead of failing.
- Text results longer than 50,000 characters are saved to a file regardless of
MAX_MCP_OUTPUT_TOKENS, unless the tool declares its own limit. - Claude Code stops reading an HTTP or SSE response over 16 MiB, and that request fails.
- The MCP spec's pagination covers list calls such as
tools/list, not tool results, so tools need their own limit or cursor arguments.
What this error means
Large results hit limits at several layers. The model has a finite context window. The client protects it with token caps. The transport has message size limits. And the server has to hold the full result in memory before it sends it.
You might see a warning about output size, a note that the result was saved to a file, a "connection closed" error, a request timeout, or a server that exits mid-call. On stdio, each message is a single line of JSON. The stdio spec says messages "MUST NOT contain embedded newlines," so a server that pretty-prints a huge object can also break the stream.
Quick fix
- Confirm the cause in the log: size warning, timeout, out-of-memory, or connection closed.
- Ask for less. Narrow the date range, add a filter or request specific fields.
- If you use Claude Code and need more room, start it with a higher limit:
export MAX_MCP_OUTPUT_TOKENS=50000thenclaude. - If you maintain the server, add
limitandcursorarguments to heavy tools and return one page at a time. - Return a link to the full data instead of the data itself, using a
resource_linkcontent item. - Restart the client and repeat the call.
Fix by client / OS
Claude Code
Claude Code's docs set out the limits in detail:
| Limit | Value | What happens |
|---|---|---|
| Warning threshold | 10,000 tokens | Warning shown; fixed |
| Default output cap | 25,000 tokens | Result saved to a file in the session's tool-results folder |
| Text character threshold | 50,000 characters | Saved to a file regardless of MAX_MCP_OUTPUT_TOKENS |
| Per-tool ceiling | Up to 500,000 characters | Set by the server with anthropic/maxResultSizeChars |
| HTTP or SSE response | 16 MiB after decompression | Claude Code stops reading; request fails |
| WebSocket message | 16 MiB | Connection closes; calls in progress fail |
| Error text | About 11,000 characters | Keeps first and last 5,000 characters |
A server can raise the threshold for one tool by adding _meta to its tools/list entry:
{
"name": "get_schema",
"description": "Returns the full database schema",
"_meta": {
"anthropic/maxResultSizeChars": 200000
}
}
The docs say images are still subject to MAX_MCP_OUTPUT_TOKENS. They also describe a startup timeout (MCP_TIMEOUT) and a per-server tool timeout field in .mcp.json, which help when a big result is slow rather than oversized.
Claude Desktop
Claude Desktop does not publish output limits in the pages we checked. Read mcp-server-SERVERNAME.log for the server's stderr. If the server process died, the log usually shows its last error. Reduce the result size on the server side, as below. The config file is ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows.
Cursor and VS Code
Neither Cursor's MCP docs nor the VS Code MCP pages we opened list a tool output size limit. Use their logs to see whether the server crashed or the call timed out, then apply the server fixes below.
Server fixes (any client)
- Paginate inside your tool. The pagination spec covers
resources/list,resources/templates/list,prompts/listandtools/list. For tool results, add your owncursorargument and return a next cursor in the result. Our MCP pagination guide explains the model. - Return links, not blobs. The tools spec lets a tool return a
resource_linkwith a URI the client can fetch later. See MCP content types. - Return structured, trimmed data. Drop unused fields.
structuredContentwith anoutputSchemamakes the shape predictable. - Stream to disk, not memory. Build big exports as files and return their location.
- Never pretty-print over stdio. Serialize each message on one line.
- Log to stderr only. The MCP debugging guide says local servers should not log to stdout.
Where to find the logs
- Claude Code:
/mcpshows server status. Results saved to disk go to the session'stool-resultsdirectory under~/.claude/projects/. - Claude Desktop:
~/Library/Logs/Claude(macOS),%APPDATA%\Claude\logs(Windows),~/.config/Claude/logs(Linux). - Cursor: Output panel, then MCP Logs.
- VS Code: MCP: List Servers, select the server, Show Output.
If it still fails
- Timeouts instead of size errors. Slow queries look like crashes. See MCP request timed out.
- Connection closed mid-call. Usually the process exited. See MCP error -32000 connection closed.
- The tool list itself is huge. Too many tools use context before any call. See too many tools warning.
- Resource limits as a security issue. Unbounded responses can be abused. Our page on MCP resource exhaustion covers safe limits.
Look up any JSON-RPC error code you see with the MCP error code lookup.
Next step
If you run an internal MCP server that returns reports, schemas or exports, design every heavy tool with a limit and a cursor from day one. eSEOspace's MCP development team builds servers this way and can review an existing one.
More in the MCP Guide
Free tools: MCP Error Code Lookup · MCP Config Generator
Latest research: State of MCP: October 2026
Frequently asked questions
What is MAX_MCP_OUTPUT_TOKENS?
It is a Claude Code environment variable that sets the maximum tokens a tool result can take before Claude Code saves it to a file. The default is 25,000. It applies to tools that do not declare their own limit.
Why was my tool result saved to a file?
In Claude Code, a successful text result over the token cap, or over 50,000 characters, is saved to the session's tool-results folder. Claude gets the file path and reads it when needed.
Does MCP pagination fix big tool results?
Not by itself. The spec's cursor pagination applies to list operations such as tools/list. For tool results, your server must accept its own limit or cursor arguments.
Can I raise the 16 MiB limit?
Claude Code's docs give no setting for it. They tell server maintainers to return less data per response, for example by paginating.











