Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
When a stdio MCP server returns a response larger than ~8 KB, the MCP call hangs indefinitely in Cursor (shows “Running…” forever, never resolves). The MCP server process stays alive but is permanently blocked inside write() on its stdout.
Root cause (confirmed via macOS sample(1) profiler + lsof):
Cursor spawns stdio MCP servers with stdio: [“pipe”,“pipe”,…]. On macOS, anonymous pipes have a fixed 8 KB kernel send buffer (not configurable, unlike Linux). When the MCP server writes a response > 8 KB to stdout, the first 8 KB fills the kernel pipe buffer and the server’s write() syscall blocks waiting for Cursor to drain the pipe. Cursor’s Node.js stream (child.stdout.on(“data”, …)) is in paused mode by default and buffers up to readableHighWaterMark (16 KB) before emitting data — so it doesn’t drain the pipe in time. This causes a deadlock: the server is blocked writing, Cursor is waiting for the JSON-RPC response that will never arrive.
Isolation test: using a hand-rolled Python stdio MCP client (instead of Cursor) against the exact same server, a 22 KB response returns in 0.38s with zero issues. Cursor is the only variable.
Relevant code in cursor-mcp/dist/main.js:
this._process.stdout?.on(“data”, e => {
this._readBuffer.append(e);
this.processReadBuffer();
})
The stream is never put into flowing mode via resume(), so the pipe drains too slowly.
Steps to Reproduce
- Set up any stdio MCP server that returns a JSON response > 8 KB (e.g. a search/query tool that returns documents with full content)
- Call it from Cursor Agent
- Observe: the call shows “Running…” forever and never returns
- Check with
ps aux | grep <mcp-server>: the process is alive but CPU=0%, blocked in write() - Verify with macOS
sample <pid>: the blocked thread stack shows_Py_read/writesyscall permanently parked
Reliable repro: any MCP knowledge base search that returns > 8 KB of JSON content (e.g. search with 2+ results where each hit contains full document text) hangs 100% of the time.
Expected Behavior
The MCP tool call should return the result immediately. The stdio transport should not block when the response is larger than the macOS pipe buffer (8 KB).
Operating System
MacOS
Version Information
Version: 3.1.17
Commit: fce1e9ab7844f9ea35793da01e634aa7e50bce90
Arch: arm64
macOS: 15.5 (24F74)
Additional Information
Suggested fix (one-liner in cursor-mcp/dist/main.js, after the process is spawned):
this._process.stdout?.resume();
This puts the Node.js readable stream into flowing mode so it continuously drains the pipe kernel buffer without waiting for readableHighWaterMark to be reached.
Workaround applied on MCP server side: strip large fields from the JSON response to keep it under 8 KB. This is fragile and loses data; the fix should be on the Cursor side.
This bug does NOT affect non-macOS systems (Linux pipes are configurable/larger), nor does it affect HTTP/SSE MCP transports. It is specific to stdio transport on macOS.
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor