Summary
The read_claude_sessions MCP tool fails to find JSONL session files even when they exist at the expected path on disk.
Observed Behaviour
When calling read_claude_sessions with a known session UUID (e.g. 288721) and a project path, the tool returns no results or an error — despite the JSONL file existing at the expected location.
Workaround: use jq directly on the JSONL files:
jq '.' ~/.claude/projects/<project-key>/<session-uuid>.jsonl
Root Cause (suspected)
Claude Code stores JSONL session files under an internal project key derived from the working directory path:
~/.claude/projects/-home-sinh-git-repos-andafin-infrastructure-andafin-data-dashboard/<uuid>.jsonl
The path transformation replaces / with - and prepends -. The read_claude_sessions tool likely does not apply this transformation when resolving the project path to a directory key, so it looks in the wrong location.
Steps to Reproduce
- Have an active Claude Code session in any project directory
- Note the session UUID from the JSONL filename
- Call
read_claude_sessions with session_id=<uuid> and project_path=<absolute-path>
- Observe: tool returns empty or error despite file existing
Expected Behaviour
Tool correctly maps project_path=/home/sinh/git-repos/andafin/... to the internal key -home-sinh-git-repos-andafin-... and finds the JSONL file.
Environment
- Discovered: 2026-02-25 during MCP consolidation session (andafin-data-dashboard)
- Session log reference:
2026-02-25-288721-andafin-mcp-consolidation.md
- Claude Code version: claude-opus-4-6
Fix Suggestion
In the path resolution logic, add a transformation step:
def project_path_to_key(path: str) -> str:
# /home/sinh/git-repos/foo → -home-sinh-git-repos-foo
return path.replace("/", "-")
Then look up ~/.claude/projects/<key>/ for JSONL files.
Summary
The
read_claude_sessionsMCP tool fails to find JSONL session files even when they exist at the expected path on disk.Observed Behaviour
When calling
read_claude_sessionswith a known session UUID (e.g.288721) and a project path, the tool returns no results or an error — despite the JSONL file existing at the expected location.Workaround: use
jqdirectly on the JSONL files:Root Cause (suspected)
Claude Code stores JSONL session files under an internal project key derived from the working directory path:
The path transformation replaces
/with-and prepends-. Theread_claude_sessionstool likely does not apply this transformation when resolving the project path to a directory key, so it looks in the wrong location.Steps to Reproduce
read_claude_sessionswithsession_id=<uuid>andproject_path=<absolute-path>Expected Behaviour
Tool correctly maps
project_path=/home/sinh/git-repos/andafin/...to the internal key-home-sinh-git-repos-andafin-...and finds the JSONL file.Environment
2026-02-25-288721-andafin-mcp-consolidation.mdFix Suggestion
In the path resolution logic, add a transformation step:
Then look up
~/.claude/projects/<key>/for JSONL files.