Skip to content

[CLI] Fix Node 26 MCP Timeout#23

Open
rasulkireev wants to merge 1 commit into
masterfrom
rasul/fix-node26-mcp-get-sse-timeout
Open

[CLI] Fix Node 26 MCP Timeout#23
rasulkireev wants to merge 1 commit into
masterfrom
rasul/fix-node26-mcp-get-sse-timeout

Conversation

@rasulkireev

@rasulkireev rasulkireev commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Users on Node 26 can now run live Readwise/Reader CLI commands again. 0.5.8 fixed --version and converted the old indefinite hang into a timeout, but actual MCP discovery/tool calls could still fail with MCP error -32001: Request timed out before commands were registered.

Issue

After the MCP SDK initializes, it opens an optional long-lived GET /mcp SSE stream for server-to-client messages. On Node v26.4.0, leaving that stream open causes later MCP POSTs (listTools / callTool) to stall until the CLI timeout fires. This is client-transport behavior: the same production MCP server and token work when that optional GET stream is skipped.

Fix

The CLI now opts out of the optional GET SSE stream by returning a local 405 Method Not Allowed, which the SDK explicitly treats as "SSE stream not supported." Normal MCP POST requests still go to the server unchanged. This is appropriate for the current CLI because commands are one-shot request/response flows and do not consume unsolicited server-push messages.

Repro / Validation

  • Master, Node v26.4.0: reader-list-documents --refresh failed after ~32s with MCP error -32001 and then unknown command.
  • This branch, Node v26.4.0: --refresh --help, readwise-list-highlights, reader-list-documents, and reader-search-documents all exited 0 against production MCP in ~2-4s.
  • Compatibility smoke: reader-list-documents --refresh exited 0 on Node 22 and Node 24.
  • Checks: npm test (15/15), npm run build, node dist/index.js --version, node dist/index.js --help.
  • TDD check after the fact: the new MCP fetch tests fail on master and pass on this branch.

Ship Risk

Low. The change only affects the CLI's optional GET SSE setup path; read/write tool calls still use the same POST transport. The main caveat is future CLI functionality that might require server-initiated MCP messages would need to revisit this opt-out. Local rekindled MCP E2E was not run because rekindled-mcp2 was not running in this workspace; production read-only MCP smoke did pass.

Related

Related: #10


Compound Engineering
GPT--5

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.

1 participant