Skip to content

Codex export misses MCP/skill usage despite MCP events in session logs #496

Closed

Description

@martinmclee

Summary

CodeBurn reports mcpServers/mcpInventory/mcpBreakdown as empty for sessions that clearly contain MCP and skill tool activity, even though the raw .codex/sessions JSONL has MCP/skill invocations.

Repro (local machine)

  1. Run:
codeburn export --format json --from 2026-06-17 --to 2026-06-17 --output $env:TEMP\codeburn-issue-repro-2026-06-17.json

Observed output includes:

Exported (2026-06-17 to 2026-06-17) to: C:\Users\User\AppData\Local\Temp\codeburn-issue-repro-2026-06-17.json

And the exported JSON does not contain MCP fields (mcpBreakdown, mcpServers, or mcpInventory).

  1. Repeat a date that I know has MCP usage (session files with node_repl invocations):
codeburn export --format json --from 2026-05-18 --to 2026-05-18 --output $env:TEMP\codeburn-issue-repro-2026-05-18.json

Observed: MCP_FIELDS_MISSING

Evidence of MCP in raw logs

Raw session line sample (actual payloads exist):
C:\Users\User\.codex\sessions\2026\05\18\rollout-2026-05-18T15-31-52-019e39ff-981e-77f2-b8c2-559543a87024.jsonl

  • MCP tool discovery is present (tool_search_output, namespace mcp__node_repl__, mcp__codex_apps__github) around line 33.
  • MCP function call is present with response_item/function_call, namespace mcp__node_repl__ around line 37.
  • Matching event_msg payload.type is mcp_tool_call_end around line 39 with invocation.server=node_repl and invocation.tool=js.

Parser gap in installed codeburn

From C:\Users\User\AppData\Roaming\npm\node_modules\codeburn\dist\main.js:

  • Parsing branch only handles:
    • entry.type === response_item && entry.payload?.type === function_call
    • entry.type === event_msg && entry.payload?.type === patch_apply_end
  • No explicit branch for mcp_tool_call_end to synthesize MCP calls.
  • Tool mapping (toolNameMap2) currently contains only built-ins (exec_command, read_file, write_file, etc.) and not MCP names like mcp__node_repl__.*.
  • mcpBreakdown exists and is accumulated later, so it only helps if MCP calls are successfully added to call records.

Expected

codeburn export should include non-empty MCP/skill inventory/usage stats when sessions contain MCP/skill tool events.

Actual

mcpBreakdown, mcpInventory, and mcpServers are empty despite MCP/skill activity in source logs.

If useful, I can provide a minimal patch suggestion: add mcp_tool_call_end handling into the ingestion loop and normalize MCP namespace/tool into call.mcpTools.

Activity

  1. iamtoruk commented on Jun 18, 2026

    @iamtoruk
    Member

    Fixed across two PRs (both merged to main):

    Parsing (#513): recent Codex sessions report completed MCP calls as an event_msg with type: "mcp_tool_call_end" rather than a function_call item, and the parser had no branch for it, exactly as you diagnosed from dist/main.js. It now reads invocation.server/invocation.tool and rebuilds the canonical mcp__<server>__<tool> name. The Codex result cache was bumped (v3 -> v4) so previously scanned sessions re-parse automatically.

    Export (#514): the export schema itself never surfaced MCP, the tools section is built from extractCoreTools, which strips mcp__ names, and there was no separate MCP section. Added an mcp block to the JSON export and an mcp.csv to the CSV export, sourced from per-session MCP usage (server -> calls, with share).

    Validated on real local Codex data:

    mcp: [{"Server":"node_repl","Calls":5,"Share (%)":100}]
    

    where before the parse fix it was empty.

    One thing intentionally left as a follow-up: mcpInventory (the MCP/skill tools that were available, vs the ones actually invoked). For Codex that comes from tool_search_output events, and our inventory extraction currently only understands Claude's tool-loading format, so it still reports empty for Codex. That needs its own parser change and validation, happy to track it separately if the available-tools list is useful to you.

    Thanks for the detailed report, the dist/main.js branch analysis and the exact event shapes made both fixes fast to pin down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions