mcp-ssh-manager 3.1.5 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +2 -0
- package/README.md +72 -8
- package/package.json +4 -1
- package/src/config-loader.js +4 -0
- package/src/index.js +47 -2
- package/src/ssh-manager.js +19 -1
- package/context-test.txt +0 -1
package/CLAUDE.md
CHANGED
|
@@ -155,6 +155,7 @@ SSH_SERVER_[NAME]_PORT=22 # Optional
|
|
|
155
155
|
SSH_SERVER_[NAME]_DEFAULT_DIR=/path # Optional default working directory
|
|
156
156
|
SSH_SERVER_[NAME]_SUDO_PASSWORD=pass # Optional for automated sudo
|
|
157
157
|
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
158
|
+
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
### TOML Format
|
|
@@ -169,6 +170,7 @@ port = 22 # Optional
|
|
|
169
170
|
default_dir = "/path" # Optional default working directory
|
|
170
171
|
sudo_password = "pass" # Optional for automated sudo
|
|
171
172
|
platform = "windows" # Optional: "linux" (default) or "windows"
|
|
173
|
+
proxy_jump = "bastion" # Optional: name of another server to use as jump host
|
|
172
174
|
```
|
|
173
175
|
|
|
174
176
|
## Key Implementation Details
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A powerful Model Context Protocol (MCP) server that enables **Claude Code** and
|
|
|
12
12
|
[](https://www.npmjs.com/package/mcp-ssh-manager)
|
|
13
13
|
[](https://github.com/bvisible/mcp-ssh-manager)
|
|
14
14
|
[](https://modelcontextprotocol.io)
|
|
15
|
-
[](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v3.2.0)
|
|
16
16
|
[](https://claude.ai/code)
|
|
17
17
|
[](https://openai.com/codex)
|
|
18
18
|
[](https://modelcontextprotocol.io)
|
|
@@ -32,20 +32,28 @@ A powerful Model Context Protocol (MCP) server that enables **Claude Code** and
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
## 🎉 What's New in v3.
|
|
35
|
+
## 🎉 What's New in v3.2.0
|
|
36
36
|
|
|
37
|
-
**SSH
|
|
37
|
+
**SSH ProxyJump / Bastion Host Support & npx Fix** (Released: March 18, 2026)
|
|
38
38
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
- **🔀 ProxyJump support**: Connect to servers behind bastion/jump hosts with a simple `PROXYJUMP` config field ([#15](https://github.com/bvisible/mcp-ssh-manager/issues/15))
|
|
40
|
+
- Chain multiple jumps (A → B → C) via recursive connections
|
|
41
|
+
- Circular dependency detection prevents infinite loops
|
|
42
|
+
- All tools work transparently through jump hosts (execute, upload, download, sync...)
|
|
43
|
+
- Jump connections are pooled and reused like direct connections
|
|
44
|
+
- **📦 npx support fixed**: Added `bin` field to `package.json` — `npx mcp-ssh-manager` now works correctly ([#14](https://github.com/bvisible/mcp-ssh-manager/issues/14))
|
|
44
45
|
|
|
45
46
|
---
|
|
46
47
|
|
|
47
48
|
## Previous Releases
|
|
48
49
|
|
|
50
|
+
### v3.1.5 - SSH Agent & Passphrase Support (March 5, 2026)
|
|
51
|
+
|
|
52
|
+
- **🔑 SSH Agent support**: Automatically uses `ssh-agent` when `SSH_AUTH_SOCK` is available — passphrase-protected keys work transparently
|
|
53
|
+
- **🔐 Passphrase configuration**: New `passphrase` field for both `.env` and TOML formats
|
|
54
|
+
|
|
55
|
+
Thanks to [@snjax](https://github.com/snjax) for the original contribution ([#12](https://github.com/bvisible/mcp-ssh-manager/pull/12)).
|
|
56
|
+
|
|
49
57
|
### v3.1.4 - Windows SSH Host Support (February 22, 2026)
|
|
50
58
|
|
|
51
59
|
- **🪟 Windows SSH host fix**: Commands no longer fail on Windows hosts running OpenSSH ([#10](https://github.com/bvisible/mcp-ssh-manager/issues/10))
|
|
@@ -114,6 +122,7 @@ This release adds **12 new MCP tools** transforming SSH Manager into a comprehen
|
|
|
114
122
|
### Core Features
|
|
115
123
|
- **🔗 Multiple SSH Connections** - Manage unlimited SSH servers from a single interface
|
|
116
124
|
- **🔐 Secure Authentication** - Support for password, SSH key, and ssh-agent authentication (including passphrase-protected keys)
|
|
125
|
+
- **🔀 ProxyJump / Bastion Host** - Connect to servers behind jump hosts with chained multi-hop support
|
|
117
126
|
- **📁 File Operations** - Upload and download files between local and remote systems
|
|
118
127
|
- **⚡ Command Execution** - Run commands on remote servers with working directory support
|
|
119
128
|
- **📂 Default Directories** - Set default working directories per server for convenience
|
|
@@ -366,6 +375,18 @@ key_path = "~/.ssh/winhost_key"
|
|
|
366
375
|
port = 2222
|
|
367
376
|
platform = "windows"
|
|
368
377
|
description = "Windows host via OpenSSH"
|
|
378
|
+
|
|
379
|
+
[ssh_servers.bastion]
|
|
380
|
+
host = "bastion.example.com"
|
|
381
|
+
user = "jumpuser"
|
|
382
|
+
key_path = "~/.ssh/bastion_key"
|
|
383
|
+
|
|
384
|
+
[ssh_servers.internal]
|
|
385
|
+
host = "10.0.0.5"
|
|
386
|
+
user = "admin"
|
|
387
|
+
key_path = "~/.ssh/internal_key"
|
|
388
|
+
proxy_jump = "bastion"
|
|
389
|
+
description = "Private server behind bastion"
|
|
369
390
|
```
|
|
370
391
|
|
|
371
392
|
💡 **See [examples/codex-ssh-config.example.toml](examples/codex-ssh-config.example.toml) for more complete examples!**
|
|
@@ -568,6 +589,7 @@ SSH_SERVER_[NAME]_PORT=22 # Optional, defaults to 22
|
|
|
568
589
|
SSH_SERVER_[NAME]_DEFAULT_DIR=/path/to/dir # Optional, default working directory
|
|
569
590
|
SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
|
|
570
591
|
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
592
|
+
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
|
|
571
593
|
|
|
572
594
|
# Example: Linux server
|
|
573
595
|
SSH_SERVER_PRODUCTION_HOST=prod.example.com
|
|
@@ -585,6 +607,17 @@ SSH_SERVER_WINHOST_KEYPATH=~/.ssh/winhost_key
|
|
|
585
607
|
SSH_SERVER_WINHOST_PORT=2222
|
|
586
608
|
SSH_SERVER_WINHOST_PLATFORM=windows
|
|
587
609
|
SSH_SERVER_WINHOST_DESCRIPTION=Windows host via OpenSSH
|
|
610
|
+
|
|
611
|
+
# Example: Server behind a bastion/jump host
|
|
612
|
+
SSH_SERVER_BASTION_HOST=bastion.example.com
|
|
613
|
+
SSH_SERVER_BASTION_USER=jumpuser
|
|
614
|
+
SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
|
|
615
|
+
|
|
616
|
+
SSH_SERVER_INTERNAL_HOST=10.0.0.5
|
|
617
|
+
SSH_SERVER_INTERNAL_USER=admin
|
|
618
|
+
SSH_SERVER_INTERNAL_KEYPATH=~/.ssh/internal_key
|
|
619
|
+
SSH_SERVER_INTERNAL_PROXYJUMP=bastion
|
|
620
|
+
SSH_SERVER_INTERNAL_DESCRIPTION=Private server behind bastion
|
|
588
621
|
```
|
|
589
622
|
|
|
590
623
|
### Server Management Tool
|
|
@@ -684,6 +717,37 @@ passphrase = "your_passphrase"
|
|
|
684
717
|
|
|
685
718
|
## 📚 Advanced Usage
|
|
686
719
|
|
|
720
|
+
### ProxyJump / Bastion Host
|
|
721
|
+
|
|
722
|
+
Connect to servers behind a bastion or jump host. The connection is tunneled through the jump server transparently — all tools (execute, upload, download, sync) work as usual.
|
|
723
|
+
|
|
724
|
+
```env
|
|
725
|
+
# Define the bastion server
|
|
726
|
+
SSH_SERVER_BASTION_HOST=bastion.example.com
|
|
727
|
+
SSH_SERVER_BASTION_USER=jumpuser
|
|
728
|
+
SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
|
|
729
|
+
|
|
730
|
+
# Point the target server to the bastion
|
|
731
|
+
SSH_SERVER_PRIVATE_HOST=10.0.0.5
|
|
732
|
+
SSH_SERVER_PRIVATE_USER=admin
|
|
733
|
+
SSH_SERVER_PRIVATE_PROXYJUMP=bastion
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
Or in TOML:
|
|
737
|
+
```toml
|
|
738
|
+
[ssh_servers.bastion]
|
|
739
|
+
host = "bastion.example.com"
|
|
740
|
+
user = "jumpuser"
|
|
741
|
+
key_path = "~/.ssh/bastion_key"
|
|
742
|
+
|
|
743
|
+
[ssh_servers.private]
|
|
744
|
+
host = "10.0.0.5"
|
|
745
|
+
user = "admin"
|
|
746
|
+
proxy_jump = "bastion"
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
**Chained jumps** are supported: if `bastion` itself has a `proxy_jump`, the chain is followed recursively. Circular references are detected and rejected.
|
|
750
|
+
|
|
687
751
|
### Documentation
|
|
688
752
|
- [DEPLOYMENT_GUIDE.md](docs/DEPLOYMENT_GUIDE.md) - Deployment strategies and permission handling
|
|
689
753
|
- [ALIASES_AND_HOOKS.md](docs/ALIASES_AND_HOOKS.md) - Command aliases and automation hooks
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "MCP SSH Manager: Model Context Protocol server for SSH remote server management. Control SSH connections from Claude Code and OpenAI Codex - execute commands, transfer files, database operations, backups, health monitoring, and DevOps automation. NEW: Tool activation system reduces context usage by 92%",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mcp-ssh-manager": "src/index.js"
|
|
8
|
+
},
|
|
6
9
|
"type": "module",
|
|
7
10
|
"scripts": {
|
|
8
11
|
"start": "node src/index.js",
|
package/src/config-loader.js
CHANGED
|
@@ -93,6 +93,7 @@ export class ConfigLoader {
|
|
|
93
93
|
sudoPassword: serverConfig.sudo_password,
|
|
94
94
|
description: serverConfig.description,
|
|
95
95
|
platform: serverConfig.platform ? serverConfig.platform.toLowerCase() : undefined,
|
|
96
|
+
proxyJump: serverConfig.proxy_jump,
|
|
96
97
|
source: 'toml'
|
|
97
98
|
});
|
|
98
99
|
}
|
|
@@ -141,6 +142,7 @@ export class ConfigLoader {
|
|
|
141
142
|
sudoPassword: env[`SSH_SERVER_${match[1]}_SUDO_PASSWORD`],
|
|
142
143
|
description: env[`SSH_SERVER_${match[1]}_DESCRIPTION`],
|
|
143
144
|
platform: (env[`SSH_SERVER_${match[1]}_PLATFORM`] || '').toLowerCase() || undefined,
|
|
145
|
+
proxyJump: env[`SSH_SERVER_${match[1]}_PROXYJUMP`],
|
|
144
146
|
source: 'env'
|
|
145
147
|
};
|
|
146
148
|
|
|
@@ -193,6 +195,7 @@ export class ConfigLoader {
|
|
|
193
195
|
if (server.sudoPassword) serverConfig.sudo_password = server.sudoPassword;
|
|
194
196
|
if (server.description) serverConfig.description = server.description;
|
|
195
197
|
if (server.platform) serverConfig.platform = server.platform;
|
|
198
|
+
if (server.proxyJump) serverConfig.proxy_jump = server.proxyJump;
|
|
196
199
|
|
|
197
200
|
config.ssh_servers[name] = serverConfig;
|
|
198
201
|
}
|
|
@@ -221,6 +224,7 @@ export class ConfigLoader {
|
|
|
221
224
|
if (server.sudoPassword) lines.push(`SSH_SERVER_${upperName}_SUDO_PASSWORD="${server.sudoPassword}"`);
|
|
222
225
|
if (server.description) lines.push(`SSH_SERVER_${upperName}_DESCRIPTION="${server.description}"`);
|
|
223
226
|
if (server.platform) lines.push(`SSH_SERVER_${upperName}_PLATFORM=${server.platform}`);
|
|
227
|
+
if (server.proxyJump) lines.push(`SSH_SERVER_${upperName}_PROXYJUMP=${server.proxyJump}`);
|
|
224
228
|
lines.push('');
|
|
225
229
|
}
|
|
226
230
|
|
package/src/index.js
CHANGED
|
@@ -225,6 +225,9 @@ const KEEPALIVE_INTERVAL = 5 * 60 * 1000;
|
|
|
225
225
|
// Map to store keepalive intervals
|
|
226
226
|
const keepaliveIntervals = new Map();
|
|
227
227
|
|
|
228
|
+
// Map to track proxy jump dependencies (target -> jump server)
|
|
229
|
+
const jumpDependencies = new Map();
|
|
230
|
+
|
|
228
231
|
// Load server configuration (backward compatibility wrapper)
|
|
229
232
|
function loadServerConfig() {
|
|
230
233
|
// This function is kept for backward compatibility
|
|
@@ -339,6 +342,9 @@ function closeConnection(serverName) {
|
|
|
339
342
|
// Remove timestamp
|
|
340
343
|
connectionTimestamps.delete(normalizedName);
|
|
341
344
|
|
|
345
|
+
// Clean up jump dependency tracking
|
|
346
|
+
jumpDependencies.delete(normalizedName);
|
|
347
|
+
|
|
342
348
|
logger.logConnection(serverName, 'closed');
|
|
343
349
|
}
|
|
344
350
|
|
|
@@ -398,7 +404,45 @@ async function getConnection(serverName) {
|
|
|
398
404
|
const ssh = new SSHManager(serverConfig);
|
|
399
405
|
|
|
400
406
|
try {
|
|
401
|
-
|
|
407
|
+
if (serverConfig.proxyJump) {
|
|
408
|
+
const jumpServerName = serverConfig.proxyJump.toLowerCase();
|
|
409
|
+
|
|
410
|
+
// Validate jump server exists
|
|
411
|
+
if (!servers[jumpServerName]) {
|
|
412
|
+
throw new Error(
|
|
413
|
+
`Proxy jump server "${serverConfig.proxyJump}" not found. ` +
|
|
414
|
+
`Available servers: ${Object.keys(servers).join(', ')}`
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Detect circular proxy jumps
|
|
419
|
+
const visited = new Set([normalizedName]);
|
|
420
|
+
let current = jumpServerName;
|
|
421
|
+
while (current) {
|
|
422
|
+
if (visited.has(current)) {
|
|
423
|
+
throw new Error(`Circular proxy jump detected: ${[...visited, current].join(' -> ')}`);
|
|
424
|
+
}
|
|
425
|
+
visited.add(current);
|
|
426
|
+
current = servers[current]?.proxyJump?.toLowerCase() || null;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Connect to jump server (recursive — handles chained jumps)
|
|
430
|
+
const jumpSSH = await getConnection(serverConfig.proxyJump);
|
|
431
|
+
|
|
432
|
+
// Create forwarded stream through the jump server
|
|
433
|
+
const stream = await jumpSSH.forwardOut(
|
|
434
|
+
'127.0.0.1', 0,
|
|
435
|
+
serverConfig.host, serverConfig.port || 22
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
// Connect target through the forwarded stream
|
|
439
|
+
await ssh.connect({ sock: stream });
|
|
440
|
+
jumpDependencies.set(normalizedName, jumpServerName);
|
|
441
|
+
ssh.jumpConnection = jumpSSH;
|
|
442
|
+
} else {
|
|
443
|
+
await ssh.connect();
|
|
444
|
+
}
|
|
445
|
+
|
|
402
446
|
connections.set(normalizedName, ssh);
|
|
403
447
|
connectionTimestamps.set(normalizedName, Date.now());
|
|
404
448
|
|
|
@@ -408,7 +452,8 @@ async function getConnection(serverName) {
|
|
|
408
452
|
logger.logConnection(serverName, 'established', {
|
|
409
453
|
host: serverConfig.host,
|
|
410
454
|
port: serverConfig.port,
|
|
411
|
-
method: serverConfig.password ? 'password' : 'key'
|
|
455
|
+
method: serverConfig.password ? 'password' : 'key',
|
|
456
|
+
proxyJump: serverConfig.proxyJump || null
|
|
412
457
|
});
|
|
413
458
|
|
|
414
459
|
// Execute post-connect hook
|
package/src/ssh-manager.js
CHANGED
|
@@ -16,9 +16,10 @@ class SSHManager {
|
|
|
16
16
|
this.cachedHomeDir = null;
|
|
17
17
|
this.autoAcceptHostKey = config.autoAcceptHostKey || false;
|
|
18
18
|
this.hostKeyVerification = config.hostKeyVerification !== false; // Default true
|
|
19
|
+
this.jumpConnection = null;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
async connect() {
|
|
22
|
+
async connect(options = {}) {
|
|
22
23
|
return new Promise((resolve, reject) => {
|
|
23
24
|
this.client.on('ready', () => {
|
|
24
25
|
this.connected = true;
|
|
@@ -115,6 +116,11 @@ class SSHManager {
|
|
|
115
116
|
connConfig.password = this.config.password;
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
// Use provided stream for proxy jump connections
|
|
120
|
+
if (options.sock) {
|
|
121
|
+
connConfig.sock = options.sock;
|
|
122
|
+
}
|
|
123
|
+
|
|
118
124
|
this.client.connect(connConfig);
|
|
119
125
|
});
|
|
120
126
|
}
|
|
@@ -452,6 +458,18 @@ class SSHManager {
|
|
|
452
458
|
}
|
|
453
459
|
}
|
|
454
460
|
|
|
461
|
+
async forwardOut(srcAddr, srcPort, dstAddr, dstPort) {
|
|
462
|
+
if (!this.connected) {
|
|
463
|
+
throw new Error('Not connected to SSH server');
|
|
464
|
+
}
|
|
465
|
+
return new Promise((resolve, reject) => {
|
|
466
|
+
this.client.forwardOut(srcAddr, srcPort, dstAddr, dstPort, (err, stream) => {
|
|
467
|
+
if (err) reject(err);
|
|
468
|
+
else resolve(stream);
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
455
473
|
async ping() {
|
|
456
474
|
try {
|
|
457
475
|
const result = await this.execCommand('echo "ping"', { timeout: 5000 });
|
package/context-test.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Server: production, Error: test-error
|