Roo Code MCP error -32000 Connection closed with npx or Docker stdio servers
Roo Code shows "MCP error -32000: Connection closed" when starting a stdio MCP server, such as an npx-based context7 server on Windows or a Docker-based repomix server on Linux. Users reported it on Roo Code 3.20 and later. Is there a workaround?
Originally asked on GitHub: https://github.com/RooCodeInc/Roo-Code/issues/4729
6 answers
Status: a contributor marked the Windows case fixed on 2025-07-10 after MCP-related PRs, but a later commenter said the underlying problem remains when Roo delays an MCP request, such as while waiting for tool approval. Treat it as not fully resolved.
What the thread found:
-
On Windows, wrapping npx with cmd ("command": "cmd", "args": ["/c", "npx", "-y", "@upstash/context7-mcp"]) still failed for the reporter. Only an args variant that ran "cd ./.. && npx" worked, which is a workaround rather than a fix.
-
On Linux with a Docker-based MCP server, one user found the connection closed while Roo waited for approval of the tool. Pre-approving tools with alwaysAllow avoided the error:
json{ "mcpServers": { "repomix": { "command": "docker", "args": ["run", "-i", "--rm", "ghcr.io/yamadashy/repomix", "--mcp"], "alwaysAllow": ["pack_codebase", "pack_remote_repository", "grep_repomix_output", "read_repomix_output", "file_system_read_file", "file_system_read_directory"] } } }With an empty alwaysAllow list, the same server failed with the error.
- A user reported that remote streamable-http and SSE servers worked while stdio servers failed on their setup.
Security note: alwaysAllow skips the approval prompt for the listed tools, so only list tools you trust.
Did this work for you?-
What @helalsoft tried on GitHub (Didn't work)
Ran context7 with command npx and args -y @upstash/context7-mcp on Windows 10 with Node v24.2.0. It failed with the connection closed error.
Source: https://github.com/RooCodeInc/Roo-Code/issues/4729 (opens external site)
Did this work for you?What @helalsoft tried on GitHub (Didn't work)
Used command cmd with args /c npx -y @upstash/context7-mcp. The error still appeared.
Source: https://github.com/RooCodeInc/Roo-Code/issues/4729 (opens external site)
Did this work for you?What @helalsoft tried on GitHub (Worked)
Used cmd with args ["/c", "cd ./.. && npx", "-y", "@upstash/context7-mcp"] to run npx from the parent directory.
Source: https://github.com/RooCodeInc/Roo-Code/issues/4729 (opens external site)
Did this work for you?What @helalsoft tried on GitHub (Didn't work)
Tried the stdio config with type stdio, command cmd, and args /c npx -y @upstash/context7-mcp@latest. The commenter reported it did not solve the issue.
Source: https://github.com/RooCodeInc/Roo-Code/issues/4729#issuecomment-2973896198 (opens external site)
Did this work for you?What @Shakahs tried on GitHub (Worked)
On Linux with the Docker repomix server, set alwaysAllow to a list of read-only tools so no approval prompt was needed. This avoided the error.
Source: https://github.com/RooCodeInc/Roo-Code/issues/4729#issuecomment-2993320137 (opens external site)
Did this work for you?