Menu

AI

MCP Server Crashes or Fails on Large Responses: How to Fix It (Claude Code, Claude Desktop, Cursor)

Fix MCP tool calls that crash, truncate or get saved to a file when results are big. Covers Claude Code output limits, the 16 MiB cap, pagination and resource links.

By: Irina ShvayaNovember 2, 2026

MCP Server Crashes or Fails on Large Responses: How to Fix It (Claude Code, Claude Desktop, Cursor)

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

  1. Confirm the cause in the log: size warning, timeout, out-of-memory, or connection closed.
  2. Ask for less. Narrow the date range, add a filter or request specific fields.
  3. If you use Claude Code and need more room, start it with a higher limit: export MAX_MCP_OUTPUT_TOKENS=50000 then claude.
  4. If you maintain the server, add limit and cursor arguments to heavy tools and return one page at a time.
  5. Return a link to the full data instead of the data itself, using a resource_link content item.
  6. Restart the client and repeat the call.

Fix by client / OS

Claude Code

Claude Code's docs set out the limits in detail:

LimitValueWhat happens
Warning threshold10,000 tokensWarning shown; fixed
Default output cap25,000 tokensResult saved to a file in the session's tool-results folder
Text character threshold50,000 charactersSaved to a file regardless of MAX_MCP_OUTPUT_TOKENS
Per-tool ceilingUp to 500,000 charactersSet by the server with anthropic/maxResultSizeChars
HTTP or SSE response16 MiB after decompressionClaude Code stops reading; request fails
WebSocket message16 MiBConnection closes; calls in progress fail
Error textAbout 11,000 charactersKeeps 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/list and tools/list. For tool results, add your own cursor argument 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_link with a URI the client can fetch later. See MCP content types.
  • Return structured, trimmed data. Drop unused fields. structuredContent with an outputSchema makes 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: /mcp shows server status. Results saved to disk go to the session's tool-results directory 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

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.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.