Skip to content

fix(mcp): prevent AutoCommit stdout from corrupting MCP stdio JSON-RPC - #95

Open
vinilana wants to merge 1 commit into
mainfrom
cursor/fix-mcp-stdio-autocommit-logs-e785
Open

vinilana wants to merge 1 commit into
mainfrom
cursor/fix-mcp-stdio-autocommit-logs-e785

Conversation

@vinilana

Copy link
Copy Markdown
Owner

Summary

Completing a PREVC phase triggers autoCommitPhase, which previously logged success/skip messages with console.info (stdout). MCP stdio uses stdout exclusively for JSON-RPC framing, so hosts saw Unexpected token 'A', "[AutoCommit"... and dropped the transport.

Changes

  • Route [AutoCommit] skip/success diagnostics to console.error (stderr) in PlanUpdateOrchestrator.
  • Add installMcpStdioProtocolGuard() and invoke it from AIContextMCPServer.start() so console.log / console.info / console.debug are redirected to stderr for the whole MCP serve lifetime.
  • Add regression tests for the auto-commit logging contract and the stdio guard.
  • Document under [Unreleased] in CHANGELOG.md.

Validation

  • npm run build
  • npm test -- --runInBand

Fixes #89

Open in Web Open in Cursor 

Route phase auto-commit diagnostics to stderr and install an MCP stdio console guard so console.log/info/debug cannot corrupt the transport. Adds regression tests.

Co-authored-by: Vinicius Lana <viniciuslanadev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP stdio corruption: AutoCommit logs to stdout break JSON-RPC on PREVC phase completion (v1.1.1)

2 participants