claude-code - 💡(How to fix) Fix MCP server JSONL logs: timestamp should be first field [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54144Fetched 2026-04-28 06:38:04
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Error Message

{"error":"Server stderr: [idle-manager] started (idle timeout: 30min)\n","timestamp":"2026-04-27T05:31:29.942Z","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"} Timestamp is the primary key when reading logs — it's what you correlate, filter, and sort by. When it appears mid-object after a potentially long error string, the log lines become jagged and unreadable without a JSON pretty-printer. A wall of MCP log output is already dense; burying the timestamp makes it a tool-required read rather than a human-readable one. {"timestamp":"2026-04-27T05:31:29.942Z","error":"Server stderr: ...","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}

Fix Action

Fix

Reorder the key sequence in the MCP log serialiser so timestamp is always the first field. One-line change — just restructure the object literal to { timestamp, ...rest }.

Note: this issue may apply to many other logs in claude and not just MCP logs.... Also to your credit claude is not the only software which shows this issue... I have seen it repeat at scores of other places which tells me that it is an open source library which is doing it... pls patch that as well... TY

Code Example

{"error":"Server stderr: [idle-manager] started (idle timeout: 30min)\n","timestamp":"2026-04-27T05:31:29.942Z","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}

---

{"timestamp":"2026-04-27T05:31:29.942Z","error":"Server stderr: ...","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}
RAW_BUFFERClick to expand / collapse

Problem

The JSONL log files written by Claude Code for MCP servers (at AppData/Local/claude-cli-nodejs/Cache/<project>/mcp-logs-<server>/) emit timestamp as a non-leading field:

{"error":"Server stderr: [idle-manager] started (idle timeout: 30min)\n","timestamp":"2026-04-27T05:31:29.942Z","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}

Why it matters

Timestamp is the primary key when reading logs — it's what you correlate, filter, and sort by. When it appears mid-object after a potentially long error string, the log lines become jagged and unreadable without a JSON pretty-printer. A wall of MCP log output is already dense; burying the timestamp makes it a tool-required read rather than a human-readable one.

Expected format

{"timestamp":"2026-04-27T05:31:29.942Z","error":"Server stderr: ...","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}

Timestamp first, then type/level, then content, then context fields.

Fix

Reorder the key sequence in the MCP log serialiser so timestamp is always the first field. One-line change — just restructure the object literal to { timestamp, ...rest }.

Note: this issue may apply to many other logs in claude and not just MCP logs.... Also to your credit claude is not the only software which shows this issue... I have seen it repeat at scores of other places which tells me that it is an open source library which is doing it... pls patch that as well... TY

extent analysis

TL;DR

Reorder the key sequence in the MCP log serializer to place the timestamp field first.

Guidance

  • Verify the current log format by checking the JSONL log files for the timestamp field position.
  • Identify the log serialization code in Claude Code and apply the suggested one-line change to reorder the object literal to { timestamp, ...rest }.
  • Test the updated log format to ensure the timestamp field appears as the first field in each log entry.
  • Consider reviewing other log types in Claude for similar issues, as this may not be limited to MCP logs.

Example

// Before
{"error":"Server stderr: [idle-manager] started (idle timeout: 30min)\n","timestamp":"2026-04-27T05:31:29.942Z","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}

// After
{"timestamp":"2026-04-27T05:31:29.942Z","error":"Server stderr: [idle-manager] started (idle timeout: 30min)\n","sessionId":"c962fdc3-...","cwd":"C:\path\to\project"}

Notes

This fix assumes that the log serialization code is accessible and modifiable. If the issue is caused by an open-source library, patching that library may require additional steps.

Recommendation

Apply the workaround by reordering the key sequence in the MCP log serializer, as this is a targeted fix for the specific issue described.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix MCP server JSONL logs: timestamp should be first field [1 participants]