You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex MCP usage is missing from recent lookback windows #478
I’m seeing Codex MCP usage show up in long lookback ranges, but not in recent ones like today, week, or month.
I believe this is a parsing issue in the Codex provider. Recent Codex sessions still contain MCP activity, but the MCP completion event now appears as event_msg with type: "mcp_tool_call_end". Codeburn appears to be counting the surrounding token usage, but not attributing the MCP tool call itself.
What I see:
Codex sessions are detected normally.
Token usage is recorded.
MCP usage is missing from recent windows.
Older history still includes MCP usage.
What I expect:
MCP calls from recent Codex sessions should be attributed the same way as older sessions.
I have a local session example that reproduces this, but I’m not attaching the raw JSONL publicly because it contains workspace and session details. I can share a redacted excerpt if that helps.
If useful, I can also help turn this into a minimal repro snippet with just the relevant event shapes.
Root cause: recent Codex sessions report a completed MCP call as an event_msg with type: "mcp_tool_call_end" rather than a function_call item. The parser only built its tool list from function_call and patch_apply_end events, so the surrounding token usage was still counted but the MCP tool itself was dropped, exactly as you described. Older sessions emitted MCP as function_call items carrying the mcp__ prefix, which is why long windows still showed it.
The fix reads invocation.server / invocation.tool from the event and rebuilds the canonical mcp__<server>__<tool> name. I validated it against real local Codex data: 5 mcp_tool_call_end events that were dropped before are now attributed (with no change to the total call count or token figures).
One note for when you pick up the build: the Codex result cache is bumped (v3 -> v4) as part of this, so previously scanned recent sessions re-parse automatically and the missing MCP usage reappears, no manual cache clear needed.
Thanks for the precise report, the event-shape detail made this quick to pin down.
I still can not get this to work. My assumption is that I am using a CLI approach for MCP lookup, via https://github.com/philschmid/mcp-cli, to save tokens and the context window. With this, I am not activating all my MCP servers in Codex for Codex to see every tool instruction and schema. Only when Codex needs MCP server XYZ will it use the CLI to look up the relevant tool and then fire up the server. A nice and handy way to keep context windows clean, by the way :)
I just wanted you to know, as I see that many MCP CLI tools like this are becoming increasingly popular.
Hi @-christian, this is now fixed on main via #656 (following up on #513).
The root cause was exactly what you described: with a CLI-based MCP setup like philschmid/mcp-cli, Codex never emits a native mcp_tool_call_end event, it just runs a shell command. #513 only handled the native path, so your CLI-wrapped calls stayed invisible in the MCP breakdown.
Recognizes mcp-cli [options] call <server> <tool> invocations (including the bash -lc "..." wrapper and flags like -c ./config) and attributes them as mcp__<server>__<tool>, so they now appear in the MCP breakdown. The command still counts as a shell command too, since it genuinely is one, no double-counting of tokens.
One heads-up: it's currently scoped to the mcp-cli binary specifically. If you (or others) use a different CLI-MCP wrapper, let us know the exact command shape and we can add it. As you noted, these tools are getting popular, so this is a pattern we want to support well.
Thanks again for the precise report and for sticking with it, the detail about the CLI approach was what pinned it down. Enjoy the rest of your summer.
command: ["/bin/zsh", "-lc", "mcp-cli call optimizely-cms-mcp help '{}'"]
It is counted under Bash, but not under MCP. Which kinda makes sense, of course. The #656 mcp-cli call matcher appears present, but this current item_completed/CommandExecution event path is not being passed through it.
The same current Codex event shape also prevents Skills attribution. Skill instructions/files are accessed through response_item → custom_tool_call with name: "exec" (often reading a SKILL.md), rather than an explicit Skill tool call or native read item. Codeburn counts these as Bash, and skills remains empty.
Please consider extracting Skills from current custom_tool_call / item_completed records as well, or otherwise recognize exec reads of SKILL.md.
PS! Using Codex to debug this so I hope it makes sense 😄
Hi @chr-evensen — verified both, fixed on main via #1092 (merged). Thanks for the event-shape detail again; it made this a short investigation.
The skills half reproduced immediately, and your diagnosis was precise. A custom_tool_call payload has no arguments field at all — it carries input. The #656mcp-cli matcher sits inside the branch that parses arguments, so for every exec custom tool it never ran, along with the command/file extraction. On a local 1,397-rollout corpus that's 4,687 exec records skipping the matcher entirely, and Codex skills was empty across all of history.
The item_completed / CommandExecution shape isn't in my rollouts (0 occurrences in those 1,397 files, Codex Desktop and CLI, 0.111 through 0.147-alpha), so I verified it against the shipped Codex binary instead: EventMsg::ItemCompleted → item_completed, and an internally-tagged TurnItem::CommandExecution → CommandExecutionItem { command, cwd, parsed_cmd, exit_code, … }. That's exactly what you described, down to the PascalCase item tag and the argv command. Your setup emits it, mine doesn't — which is why the CLI-wrapped call never reached the matcher for you even after #656.
What #1092 does: all three shapes Codex uses to record a shell command — function_call arguments, the exec custom tool's input program, and the item model's CommandExecution — now feed a single classification pipeline, so mcp-cli call <server> <tool> can't be visible to one and invisible to another again. mcp-cli call optimizely-cms-mcp help '{}' inside ["/bin/zsh","-lc",...] attributes to mcp__optimizely-cms-mcp__help and still counts as Bash, same as before.
Skills: since Codex has no skill tool, a skill load is recognized as a shell read of a SKILL.md — the command must start with a file-reading binary (cat/sed/head/tail/less/more/bat) and the path must end in <name>/SKILL.md. The skill is <name>, the same key the Pi parser uses (#588) and the same vocabulary the Claude parser records, so the Skills breakdown reads the same across providers. A grep that merely mentions a SKILL.md is a search, not a load, and stays Bash. On my corpus that turned an empty Skills dimension into 7 skills over 35 turns, with Bash unchanged at 42,170 and cost, tokens, calls and every daily rollup byte-identical — this is purely a classification change.
Your cached sessions re-parse automatically on upgrade (the Codex result cache and parse version both move), so no manual cache clear.
One caveat worth naming: I could only test the item_completed path against fixtures and the Codex schema, not a real rollout of my own. If it still comes back empty for you after upgrading, a redacted excerpt of just the item_completed line would settle it in minutes.
Activity
iamtoruk commentedon Jun 18, 2026
Fixed in #513 (merged to
main).Root cause: recent Codex sessions report a completed MCP call as an
event_msgwithtype: "mcp_tool_call_end"rather than afunction_callitem. The parser only built its tool list fromfunction_callandpatch_apply_endevents, so the surrounding token usage was still counted but the MCP tool itself was dropped, exactly as you described. Older sessions emitted MCP asfunction_callitems carrying themcp__prefix, which is why long windows still showed it.The fix reads
invocation.server/invocation.toolfrom the event and rebuilds the canonicalmcp__<server>__<tool>name. I validated it against real local Codex data: 5mcp_tool_call_endevents that were dropped before are now attributed (with no change to the total call count or token figures).One note for when you pick up the build: the Codex result cache is bumped (v3 -> v4) as part of this, so previously scanned recent sessions re-parse automatically and the missing MCP usage reappears, no manual cache clear needed.
Thanks for the precise report, the event-shape detail made this quick to pin down.
fix(codex): attribute MCP calls emitted as event_msg/mcp_tool_call_end (
chr-evensen commentedon Jul 2, 2026
Hello, @iamtoruk :)
I still can not get this to work. My assumption is that I am using a CLI approach for MCP lookup, via https://github.com/philschmid/mcp-cli, to save tokens and the context window. With this, I am not activating all my MCP servers in Codex for Codex to see every tool instruction and schema. Only when Codex needs MCP server XYZ will it use the CLI to look up the relevant tool and then fire up the server. A nice and handy way to keep context windows clean, by the way :)
I just wanted you to know, as I see that many MCP CLI tools like this are becoming increasingly popular.
Have a nice summer,
Christian
Merge pull request #656 from getagentseal/fix/codex-cli-mcp-attribution
iamtoruk commentedon Jul 10, 2026
Hi @-christian, this is now fixed on main via #656 (following up on #513).
The root cause was exactly what you described: with a CLI-based MCP setup like philschmid/mcp-cli, Codex never emits a native
mcp_tool_call_endevent, it just runs a shell command. #513 only handled the native path, so your CLI-wrapped calls stayed invisible in the MCP breakdown.What #656 does:
mcp-cli [options] call <server> <tool>invocations (including thebash -lc "..."wrapper and flags like-c ./config) and attributes them asmcp__<server>__<tool>, so they now appear in the MCP breakdown. The command still counts as a shell command too, since it genuinely is one, no double-counting of tokens.One heads-up: it's currently scoped to the
mcp-clibinary specifically. If you (or others) use a different CLI-MCP wrapper, let us know the exact command shape and we can add it. As you noted, these tools are getting popular, so this is a pattern we want to support well.Thanks again for the precise report and for sticking with it, the detail about the CLI approach was what pinned it down. Enjoy the rest of your summer.
fix(codex): attribute CLI-wrapped MCP calls (mcp-cli), and re-parse c…
chr-evensen commentedon Aug 22, 2026
Good morning, @iamtoruk 😄
Still reproducible in Codeburn 0.9.20 with current Codex desktop sessions.
I ran this successful, read-only command:
mcp-cli call optimizely-cms-mcp help '{}'Immediately after,
codeburn report --period today --format jsonreturned:"mcpServers": []The command is persisted in the session as:
event_msgitem_completedCommandExecution["/bin/zsh", "-lc", "mcp-cli call optimizely-cms-mcp help '{}'"]It is counted under Bash, but not under MCP. Which kinda makes sense, of course. The #656 mcp-cli call matcher appears present, but this current
item_completed/CommandExecutionevent path is not being passed through it.The same current Codex event shape also prevents Skills attribution. Skill instructions/files are accessed through
response_item → custom_tool_callwithname: "exec"(often reading aSKILL.md), rather than an explicitSkilltool call or nativereaditem. Codeburn counts these as Bash, andskillsremains empty.Please consider extracting Skills from current
custom_tool_call/item_completedrecords as well, or otherwise recognizeexecreads ofSKILL.md.PS! Using Codex to debug this so I hope it makes sense 😄
Have a great weekend!
Merge pull request #1092 from getagentseal/fix/codex-mcp-skills-attri…
iamtoruk commentedon Aug 22, 2026
Hi @chr-evensen — verified both, fixed on main via #1092 (merged). Thanks for the event-shape detail again; it made this a short investigation.
The skills half reproduced immediately, and your diagnosis was precise. A
custom_tool_callpayload has noargumentsfield at all — it carriesinput. The #656mcp-climatcher sits inside the branch that parsesarguments, so for everyexeccustom tool it never ran, along with the command/file extraction. On a local 1,397-rollout corpus that's 4,687execrecords skipping the matcher entirely, and Codexskillswas empty across all of history.The
item_completed/CommandExecutionshape isn't in my rollouts (0 occurrences in those 1,397 files, Codex Desktop and CLI, 0.111 through 0.147-alpha), so I verified it against the shipped Codex binary instead:EventMsg::ItemCompleted→item_completed, and an internally-taggedTurnItem::CommandExecution→CommandExecutionItem { command, cwd, parsed_cmd, exit_code, … }. That's exactly what you described, down to the PascalCase item tag and the argvcommand. Your setup emits it, mine doesn't — which is why the CLI-wrapped call never reached the matcher for you even after #656.What #1092 does: all three shapes Codex uses to record a shell command —
function_callarguments, theexeccustom tool'sinputprogram, and the item model'sCommandExecution— now feed a single classification pipeline, somcp-cli call <server> <tool>can't be visible to one and invisible to another again.mcp-cli call optimizely-cms-mcp help '{}'inside["/bin/zsh","-lc",...]attributes tomcp__optimizely-cms-mcp__helpand still counts as Bash, same as before.Skills: since Codex has no skill tool, a skill load is recognized as a shell read of a
SKILL.md— the command must start with a file-reading binary (cat/sed/head/tail/less/more/bat) and the path must end in<name>/SKILL.md. The skill is<name>, the same key the Pi parser uses (#588) and the same vocabulary the Claude parser records, so the Skills breakdown reads the same across providers. Agrepthat merely mentions aSKILL.mdis a search, not a load, and stays Bash. On my corpus that turned an empty Skills dimension into 7 skills over 35 turns, with Bash unchanged at 42,170 and cost, tokens, calls and every daily rollup byte-identical — this is purely a classification change.Your cached sessions re-parse automatically on upgrade (the Codex result cache and parse version both move), so no manual cache clear.
One caveat worth naming: I could only test the
item_completedpath against fixtures and the Codex schema, not a real rollout of my own. If it still comes back empty for you after upgrading, a redacted excerpt of just theitem_completedline would settle it in minutes.