Skip to content

Shield the stdio JSONRPC channel from app stdout writes#33

Merged
marksibrahim merged 1 commit into
facebookresearch:mainfrom
taj-gillin:taj/fix-mcp-stdout-leak
Jun 11, 2026
Merged

Shield the stdio JSONRPC channel from app stdout writes#33
marksibrahim merged 1 commit into
facebookresearch:mainfrom
taj-gillin:taj/fix-mcp-stdout-leak

Conversation

@taj-gillin

Copy link
Copy Markdown
Contributor

The MCP stdio transport uses stdout (fd 1) for protocol frames, but the served OpenApps app prints to stdout while handling requests (e.g. re-seeding a DB on navigation). Those prints interleave with the JSONRPC frames, desync the stream, and hang the client mid-episode. Wrap sys.stdout for the stdio transport so the real binary buffer still carries protocol frames while all text writes are redirected to stderr.

The MCP stdio transport uses stdout (fd 1) for protocol frames, but the
served OpenApps app prints to stdout while handling requests (e.g. re-seeding
a DB on navigation). Those prints interleave with the JSONRPC frames, desync
the stream, and hang the client mid-episode. Wrap sys.stdout for the stdio
transport so the real binary buffer still carries protocol frames while all
text writes are redirected to stderr.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 11, 2026
@marksibrahim

Copy link
Copy Markdown
Contributor

Thanks for fixing this Taj!

@marksibrahim marksibrahim merged commit 1352b0e into facebookresearch:main Jun 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants