Where does the bug appear (feature/product)?
Cursor CLI
Describe the Bug
Summary
cursor-agent reports MCP error -32000: Connection closed for a local stdio MCP server about 2 seconds after it starts the server. The same server connects normally in the Cursor IDE, using the same mcp.json entry. A staff reply in a related thread (Docker MCP servers) says the CLI uses a more aggressive connection timeout than the GUI and that this is a known issue. This report adds Windows details, the observed timing, and the child-process differences.
Environment
OS: Windows 11 Pro 10.0.26200
cursor-agent: 2026.10.19-6bbf2c4
Cursor IDE: 3.26.16
PowerShell: 7.6.6
Docker Desktop: 29.8.2
Node.js: v24.21.0
Config (~/.cursor/mcp.json, redacted)
“mcp-atlassian-cli”: {
“type”: “stdio”,
“command”: “pwsh”,
“args”: [“-NoProfile”, “-File”, “/.cursor/mcp-docker-wrapper.ps1”, “-ImageName”, “/:latest”],
“envFile”: “/.cursor/mcp.env”,
“env”: { “…”: “…” },
“startupTimeoutSec”: 60
}
The wrapper script is required by our organization. It starts a shared, already-running HTTP MCP server on 127.0.0.1:9000, bridges it to stdio, and answers MCP initialize in about 1.4 seconds when run by hand.
Steps to Reproduce
Configure a stdio MCP server as above (any server with a multi-second startup works; the one above is a PowerShell wrapper).
Run agent mcp list-tools in PowerShell.
Expected Behavior
The server connects and its tools are listed, as it does in the IDE. startupTimeoutSec: 60 should give the server up to 60 seconds to start.
Actual
Failed to list tools: Failed to load MCP ‘’: MCP error -32000: Connection closed
The CLI log (%TEMP%\cursor-agent-logs-\session-*.log) shows:
[…07:54:31.881Z] Starting local MCP server “” without MCP sandboxing
[…07:54:33.922Z] MCP OAuth provider initialized (second attempt)
[…07:38:09.441Z] Failed to load MCP server … “errorMessage”:“MCP error -32000: Connection closed”
The failure is logged about 2 seconds after the spawn. The startupTimeoutSec value doesn’t change this.
Observations
The wrapper script answers initialize in about 1.4 seconds when started from a normal PowerShell session with a piped stdin. The IDE’s MCP log for the same server shows Successfully connected to stdio server in 3 to 6 seconds.
Replaying the CLI’s child environment (the values from the CLI’s own debug log) against the wrapper also works. So the environment variables are not the cause.
Inside the CLI-launched process chain, the wrapper’s child Node process (a small stdio bridge) reports process.stdin.isTTY === true and fstat(0) as a character device, not a pipe. The same bridge launched from a normal shell gets a pipe. The Node process then exits within about 1 second without logging an exit, so the MCP handshake never completes.
Adding --approve-mcps --trust makes no difference.
Using command: “C:/Program Files/PowerShell/7/pwsh.exe” instead of “pwsh” makes the CLI report MCP server ‘’ is blocked by team policy. The policy seems to check the command string, so the “pwsh” command is the only one it accepts.
Operating System
Windows 10/11
Version Information
Cursor IDE: 3.26.16
Node.js: v24.21.0
Additional Information
Related
Docker MCP servers: staff confirm the CLI has a more aggressive timeout than the GUI
Cursor-agent MCP load error: same error, macOS, cursor-agent 2025.10.02
CRITICAL BUG: cursor-agent CLI MCP STDIO Transport Failure: CLI hangs on structured content, same family of stdio issues
Does this stop you from using Cursor
Yes - Cursor is unusable