MCP server logs (mcp-logs-*) grow unbounded with no way to disable or cap (filled disk with 242 GB)

Open 💬 1 comment Opened Jun 18, 2026 by cloth-worlds

Summary

Claude Code writes per-project MCP server debug logs to ~/Library/Caches/claude-cli-nodejs/<project>/mcp-logs-<server>/*.jsonl. These logs are append-only, never rotated, never size-capped, and never pruned, and there is no documented setting, CLI flag, or environment variable to disable or cap them. On my machine they silently grew to 242 GB and filled my disk to 100%.

Environment

  • Claude Code: 2.1.181
  • OS: macOS (Darwin 25.5.0), Apple Silicon
  • Several MCP servers configured, used across ~10 projects

What happened

  • ~/Library/Caches/claude-cli-nodejs/ reached 242 GB, which was effectively my entire ~/Library/Caches (258 GB) and the sole reason my 460 GB disk hit 100% (2 GB free).
  • Individual session log files were 1.7–2.0 GB each.
  • Accumulation rate was roughly ~10 GB/day over ~3 weeks.
  • The files are the full MCP JSON-RPC message traffic logged verbatim.

Why it gets so large

I use custom MCP servers whose tools return large payloads inline as base64-encoded images, segmentation masks, embeddings, and video/OCR results. Every request/response is logged verbatim, and base64 inflates binary by ~33%. A single session doing vision/embedding work writes multiple GB per server. Multiplied across servers and projects over weeks, it snowballs to hundreds of GB.

Why existing knobs don't help

  • These mcp-logs-* files are not documented in the env-vars or settings references.
  • cleanupPeriodDays only prunes chat transcripts/history, not these MCP logs.
  • MAX_MCP_OUTPUT_TOKENS caps what is sent to the model, not what is written to disk.
  • No --debug/--mcp-debug flag was enabled; this logging happens by default.

Requests

  1. A supported way to disable MCP message logging (settings.json field and/or env var).
  2. Size cap and/or rotation for the mcp-logs-* directories (e.g. max bytes per server/project, or age-based pruning that actually covers these files).
  3. Truncate large payloads in the logs (e.g. elide/clip base64 blobs over N bytes) so debug logging stays useful without writing gigabytes of binary.
  4. Document the ~/Library/Caches/claude-cli-nodejs/.../mcp-logs-* location and its retention behavior.

Workaround I'm using

A launchd agent that runs daily and deletes mcp-logs-*/*.jsonl older than 1 day. This caps growth, but a built-in control would be far better.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗