Repository navigation
Windows/Codex: MCP tool calls close transport while CLI/stdio init work; update -y still prompts for binary variant #1182
Description
Summary
On Windows, codebase-memory-mcp itself appears functional: CLI graph queries work, the current project can be indexed, and a raw stdio MCP initialize request returns a valid response. However, Codex MCP tool calls in the same session fail immediately with Transport closed.
While trying to update/recover the tool, I also hit non-interactive/help-mode issues in codebase-memory-mcp update:
codebase-memory-mcp update -ystill prompts for the binary variant.codebase-memory-mcp update --helpenters the update flow instead of printing help.- Piping a variant choice with
"1" | codebase-memory-mcp update -ytimed out.
Related but not exact duplicates found:
- constant timeouts #474 reports Windows/Codex timeouts, but does not isolate CLI success + raw stdio initialize success + tool-call transport closure.
- Windows stdio MCP handshake hangs — stdout only flushes on stdin EOF (v0.8.1) #513 and Windows: MCP server hangs on initialize when launched by Hermes/AnyIO stdio client #635 cover stdio initialize hangs, but in this case raw stdio initialize succeeds.
uninstall --helpperforms a real uninstall — unknown flags silently ignored, no confirmation before destructive removal #1038 covers mutating subcommands ignoring--help; this report addsupdate -yvariant prompting and piped-input timeout.
Environment
- OS: Windows x64
- Shell: PowerShell
- MCP client: Codex Desktop / Codex CLI config
- Codex version metadata:
0.144.5 - Binary:
C:\Users\wchao\.local\bin\codebase-memory-mcp.exe - codebase-memory-mcp version:
0.9.0 - Config entry:
[mcp_servers.codebase-memory-mcp]
command = "C:/Users/wchao/.local/bin/codebase-memory-mcp.exe"Reproduction and Observed Results
A. Codex MCP tool calls fail, but CLI and raw stdio initialize work
-
In Codex, call a codebase-memory MCP tool such as
search_graph,get_architecture,get_graph_schema, orindex_repository. -
Observed Codex-side failure:
tool call failed for `codebase-memory-mcp/search_graph`
Caused by:
Transport closed
- Direct CLI calls on the same machine work:
codebase-memory-mcp.exe cli index_repository --repo-path D:\1-QRS\qorder_pr\codex-SpiroSerach --name D-1-QRS-qorder_pr-codex-SpiroSerach --mode fast --persistence false
codebase-memory-mcp.exe cli index_status --project D-1-QRS-qorder_pr-codex-SpiroSerach
codebase-memory-mcp.exe cli search_graph --project D-1-QRS-qorder_pr-codex-SpiroSerach --query NomadPerlaPscProvider --limit 1Example successful CLI result:
{"project":"D-1-QRS-qorder_pr-codex-SpiroSerach","nodes":8105,"edges":31240,"status":"ready",...}
- Raw stdio MCP initialize also works. Sending a newline-delimited JSON-RPC initialize request to
codebase-memory-mcp.exereturns:
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","serverInfo":{"name":"codebase-memory-mcp","version":"0.9.0"},"capabilities":{"tools":{"listChanged":false}}}}So the failure does not look like a basic missing binary, corrupt index, or stdio initialize failure.
B. Sandbox/write-triggered failure may poison the Codex MCP session
A subagent found that index_repository needs to write under:
C:\Users\wchao\.cache\codebase-memory-mcp
When this write is blocked or fails during the dump phase, Codex reports Transport closed. After that, other Codex MCP tool calls in the same task continue to fail with Transport closed even after the index is rebuilt successfully via CLI. Restarting the individual MCP child processes did not restore the current Codex task's MCP bridge.
C. update -y still prompts
Running:
codebase-memory-mcp update -ystill prompts:
Which binary variant do you want?
1) standard - MCP server only
2) ui - MCP server + embedded graph visualization
Choose (1/2):
Because there is no stdin in some automation contexts, this fails with:
error: failed to read input
D. update --help enters update flow
Running:
codebase-memory-mcp update --helpentered the update path and prompted/cancelled instead of printing usage and exiting.
E. Piped variant choice timed out
Running:
"1" | codebase-memory-mcp update -ytimed out after ~184 seconds in this environment.
Expected Behavior
MCP transport
- If a tool handler fails due to filesystem permissions or index dump errors, return a JSON-RPC tool error instead of closing stdio.
- After a failed
index_repository, subsequent MCP tool calls in the same client session should not remain permanently broken if the server can still initialize and CLI calls work. - If this is a Codex client incompatibility, it would help to document required Codex config/sandbox permissions or emit a clear diagnostic.
Update CLI
update -yshould be fully non-interactive.- If a binary variant is required,
-yshould either preserve the installed variant, choose a documented default, accept an explicit flag such as--standard/--ui, or fail fast with a clear non-interactive error. update --help/update -hshould print usage and exit without mutation.- Piped stdin should be consumed or rejected clearly, not hang indefinitely.
Actual Behavior
- Codex MCP tool calls fail with
Transport closed. - Direct CLI queries and raw stdio initialize succeed.
- Rebuilding the current project index via CLI restores CLI graph functionality but does not restore Codex MCP tool calls in the already-running task.
update -ystill prompts for variant.update --helpenters update flow.- Piped variant selection timed out.
Workaround
- Use
codebase-memory-mcp.exe cli ...directly for query/index operations when Codex MCP bridge is broken. - Rebuild the current project index via CLI after failed update attempts:
codebase-memory-mcp.exe cli index_repository --repo-path D:\1-QRS\qorder_pr\codex-SpiroSerach --name D-1-QRS-qorder_pr-codex-SpiroSerach --mode fast --persistence false- Avoid non-interactive
codebase-memory-mcp updateon Windows for now. - Restarting/reopening the Codex task may be required to force the Codex MCP client to re-handshake.
Notes
This may be a compatibility issue between recent Codex MCP bridge/session handling and codebase-memory-mcp failure behavior, rather than a pure server startup bug. The key isolation is: CLI works, raw stdio initialize works, but Codex tool calls continue to fail with Transport closed after a failed tool invocation.
Activity
DeusData commentedon Jul 22, 2026
Thanks for the unusually thorough isolation. This is now a high-priority
0.9.1-rcWindows/Codex integration bug under #395. We will treat the MCP transport closure and the non-interactive update behavior as separate acceptance paths inside the report: a tool failure must return a JSON-RPC error without poisoning the session, whileupdate -yandupdate --helpmust remain genuinely non-interactive. No further reporter action is needed right now.ChrisRoyse commentedon Jul 23, 2026
Additional grounded reproduction on native Windows x64 with Codex (2026-07-23): the installed binary reports
codebase-memory-mcp devand remains live (codebase-memory-mcp.exe), but repeated MCP calls toget_architecture,detect_changes,list_projects, andsearch_graphall fail immediately with the sameTransport closedenvelope. The failure persists across unrelated work and retries; the server process itself is still present, so this is not a missing-binary condition. I did not restart or replace the process because that would destroy the current-session evidence. This blocks architecture/blast-radius/ADR reads forC-code-Astrolabe; filesystem/Git inspection remains functional.DeusData commentedon Jul 24, 2026
Thanks for preserving the live process state. The
devversion string means this is not a stockv0.9.0release binary, but the fact that the process remains alive while unrelated MCP tools all return the same immediateTransport closedenvelope narrows this to session or transport teardown rather than a missing executable. We will require the RED to keep the server process alive and prove that one failed tool call cannot poison subsequent calls.DeusData commentedon Aug 4, 2026
A likely fix for the transport-close half of this report just landed on main: #1424 (merged as 2cf4235, thanks @ahmadgamal15-art) sets Windows stdio to binary mode in the MCP server loop. Until then, CRLF translation could desync Content-Length framing on native Windows stdio — which presents exactly as the client closing the transport after init while CLI calls work. Once the next 0.9.1 build is out (we'll note it here), could you retest the Codex MCP path on it? The
update -yvariant-prompt half of this report is a separate item and stays open regardless.DeusData commentedon Oct 19, 2026
Thank you for separating CLI/initialize success from session transport failure. The earlier Windows framing change still needs confirmation in the affected Codex path; I have no new result to add. The update prompting/help behavior remains a separate concern and should not be considered resolved by a transport improvement.