feat: add ProxyCommand support for SOCKS5 and custom proxy connections#24
feat: add ProxyCommand support for SOCKS5 and custom proxy connections#24majordave wants to merge 2 commits intobvisible:mainfrom
Conversation
Adds SSH ProxyCommand support to MCP SSH Manager alongside existing ProxyJump functionality. Supports SOCKS5 proxies, custom proxy commands, and Windows SSH proxy commands with proper error handling and cleanup. Configuration formats: - .env: SSH_SERVER_*_PROXYCOMMAND - TOML: proxy_command field Examples use generic placeholders (user@jump-host) for documentation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…arsing
- Reconvert CLAUDE.md from CRLF to LF and restore trailing newline so the
diff only shows the 4 intentional lines (not the full 212-line rewrite)
- Replace naive whitespace split of the proxy command with spawn({ shell: true }),
matching OpenSSH ProxyCommand semantics so quoted args, pipes and shell
metacharacters work as users expect
- Forward proxy stderr to the MCP server's stderr for debugging
- Guard resolve/reject against double-settle on exit after successful spawn
- Include proxyCommand presence in the connection log
|
Thanks for the PR! I pushed a follow-up commit (7f91e58) addressing two points that came up during review: 1. 2. Proxy command argument parsing Also included in the same commit:
Local testing I ran:
I don't have a live SOCKS5 proxy to point at a real server, so could you re-run your SOCKS5 / Windows |
Summary
Adds SSH ProxyCommand support to MCP SSH Manager alongside existing ProxyJump functionality. This enables connections through:
ncat --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p)ssh -W %h:%p bastion)Changes
src/index.js- AddedcreateProxyCommandSocket()function (lines 389-432) to execute proxy commands and create socket connectionssrc/config-loader.js- AddedproxyCommandparsing for both TOML (proxy_command) and .env (SSH_SERVER_*_PROXYCOMMAND) formatsFeatures
%h/%pplaceholdersC:\Windows\System32\OpenSSH\ssh.exe -W %h:%p user@host)Testing
The implementation has been tested with:
All proxy command executions follow the same security model as existing SSH connections.
Configuration Examples
.env format:
TOML format:
Why This Matters
Many corporate environments require proxy connections for SSH access. While ProxyJump handles bastion hosts, ProxyCommand is essential for:
This completes the SSH proxy support alongside the existing ProxyJump feature.
References
Follows the contribution pattern from: 423857d