Description
ssh_execute wraps all commands with the Linux timeout utility before sending
them to the remote host. When the remote host is Windows (OpenSSH for Windows),
timeout resolves to Windows' TIMEOUT.exe, which is a completely different
program, causing every command to fail.
Steps to Reproduce
- Configure a server pointing to a Windows host running OpenSSH:
SSH_SERVER_MY_WIN_HOST=192.168.1.90, port 2222, user svc-ssh
- Run any command via
ssh_execute:
{ "server": "my_win_host", "command": "whoami" }
Observed Behavior
Every command fails with:
ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.
The server wraps the command as:
timeout 120 sh -c 'whoami'
Windows interprets timeout as TIMEOUT.exe (a user-input wait utility),
and sh does not exist on Windows.
Expected Behavior
Commands should execute successfully on Windows SSH hosts.
Suggested Fix
Skip the timeout + sh -c wrapper for Windows hosts. The SSH library's
built-in timeout (ssh.execCommand(command, { timeout: timeoutMs })) works
cross-platform. The existing rawCommand: true option already bypasses the
wrapper — a per-server config flag (e.g., SSH_SERVER_FOO_PLATFORM=windows)
could trigger this automatically.
Environment
- mcp-ssh-manager: 3.1.3
- Node.js: v24.13.1
- MCP server host OS: Debian Linux 12 (bookworm)
- Remote target OS: Windows 11 (build 26200.7840) with OpenSSH sshd
- Claude Code: 2.1.45
Description
ssh_executewraps all commands with the Linuxtimeoututility before sendingthem to the remote host. When the remote host is Windows (OpenSSH for Windows),
timeoutresolves to Windows'TIMEOUT.exe, which is a completely differentprogram, causing every command to fail.
Steps to Reproduce
SSH_SERVER_MY_WIN_HOST=192.168.1.90, port 2222, usersvc-sshssh_execute:{ "server": "my_win_host", "command": "whoami" }Observed Behavior
Every command fails with:
ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.
The server wraps the command as:
timeout 120 sh -c 'whoami'
Windows interprets timeout as TIMEOUT.exe (a user-input wait utility),
and sh does not exist on Windows.
Expected Behavior
Commands should execute successfully on Windows SSH hosts.
Suggested Fix
Skip the timeout + sh -c wrapper for Windows hosts. The SSH library's
built-in timeout (ssh.execCommand(command, { timeout: timeoutMs })) works
cross-platform. The existing rawCommand: true option already bypasses the
wrapper — a per-server config flag (e.g., SSH_SERVER_FOO_PLATFORM=windows)
could trigger this automatically.
Environment