Claude Code freezes when processing large MCP responses or files with very long lines
Description
Claude Code appears to freeze/hang when processing large content, particularly:
- Large MCP tool responses
- Files with very long lines (even if line count is low)
Reproduction Steps
- Have an MCP server return a large response (~1.4MB+)
- Or try to read a file that has few lines but very large content per line
- Claude Code becomes unresponsive/freezes
Example File
- Full file size: ~1.4MB
- Line count: 32 lines
- Average per line: ~45KB
Sample excerpt (50KB of the 1.4MB file): https://gist.github.com/miles990/57beaec80bc71728b850f7ca76576f49
The combination of large file size with long lines (rather than many short lines) seems to trigger the freeze.
Expected Behavior
Claude Code should either:
- Handle large content gracefully
- Truncate with a warning message
- Stream the content progressively
- Provide a configurable size limit
Environment
- Claude Code CLI version: latest
- OS: macOS Darwin 25.2.0
- Model: Claude Opus 4.5
Workaround
I've implemented a workaround in my MCP server to detect large responses and truncate them before returning to Claude Code:
// Truncate large content to prevent Claude Code from freezing
const maxContentLength = 50000
if len(content) > maxContentLength {
content = content[:maxContentLength] + "\n\n[Content truncated...]"
}
Additional Context
This issue is particularly problematic for MCP servers that may return large database results or file contents. A built-in content size limit or chunking mechanism would be helpful.
The freeze happens even when the file has very few lines - it seems related to total content size or line length rather than line count.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗