mcp-ssh-manager 3.1.4 → 3.1.5
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 +80 -8
- package/package.json +1 -1
- package/src/config-loader.js +4 -0
- package/src/index.js +3 -2
- package/src/ssh-manager.js +8 -0
package/CLAUDE.md
CHANGED
|
@@ -150,6 +150,7 @@ SSH_SERVER_[NAME]_HOST=hostname
|
|
|
150
150
|
SSH_SERVER_[NAME]_USER=username
|
|
151
151
|
SSH_SERVER_[NAME]_PASSWORD=password # For password auth
|
|
152
152
|
SSH_SERVER_[NAME]_KEYPATH=~/.ssh/key # For SSH key auth
|
|
153
|
+
SSH_SERVER_[NAME]_PASSPHRASE=passphrase # Optional, for passphrase-protected keys
|
|
153
154
|
SSH_SERVER_[NAME]_PORT=22 # Optional
|
|
154
155
|
SSH_SERVER_[NAME]_DEFAULT_DIR=/path # Optional default working directory
|
|
155
156
|
SSH_SERVER_[NAME]_SUDO_PASSWORD=pass # Optional for automated sudo
|
|
@@ -163,6 +164,7 @@ host = "hostname"
|
|
|
163
164
|
user = "username"
|
|
164
165
|
password = "password" # For password auth
|
|
165
166
|
key_path = "~/.ssh/key" # For SSH key auth
|
|
167
|
+
passphrase = "key_passphrase" # Optional, for passphrase-protected keys
|
|
166
168
|
port = 22 # Optional
|
|
167
169
|
default_dir = "/path" # Optional default working directory
|
|
168
170
|
sudo_password = "pass" # Optional for automated sudo
|
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.1.5)
|
|
16
16
|
[](https://claude.ai/code)
|
|
17
17
|
[](https://openai.com/codex)
|
|
18
18
|
[](https://modelcontextprotocol.io)
|
|
@@ -32,17 +32,32 @@ A powerful Model Context Protocol (MCP) server that enables **Claude Code** and
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
## 🎉 What's New in v3.1.
|
|
35
|
+
## 🎉 What's New in v3.1.5
|
|
36
36
|
|
|
37
|
-
**
|
|
37
|
+
**SSH Agent & Passphrase-Protected Keys Support** (Released: March 5, 2026)
|
|
38
38
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
39
|
+
- **🔑 SSH Agent support**: Automatically uses `ssh-agent` when `SSH_AUTH_SOCK` is available — passphrase-protected keys work transparently
|
|
40
|
+
- **🔐 Passphrase configuration**: New `passphrase` field for both `.env` (`SSH_SERVER_FOO_PASSPHRASE`) and TOML (`passphrase = "..."`) formats
|
|
41
|
+
- **🔄 No regression**: Private keys are always passed to the connection alongside the agent — unencrypted keys continue to work even if not loaded in the agent
|
|
42
|
+
|
|
43
|
+
Thanks to [@snjax](https://github.com/snjax) for the original contribution ([#12](https://github.com/bvisible/mcp-ssh-manager/pull/12)).
|
|
41
44
|
|
|
42
45
|
---
|
|
43
46
|
|
|
44
47
|
## Previous Releases
|
|
45
48
|
|
|
49
|
+
### v3.1.4 - Windows SSH Host Support (February 22, 2026)
|
|
50
|
+
|
|
51
|
+
- **🪟 Windows SSH host fix**: Commands no longer fail on Windows hosts running OpenSSH ([#10](https://github.com/bvisible/mcp-ssh-manager/issues/10))
|
|
52
|
+
- New per-server `platform` config field (`SSH_SERVER_FOO_PLATFORM=windows` or `platform = "windows"` in TOML)
|
|
53
|
+
- When `platform=windows`, the Linux `timeout`/`sh -c` command wrapper is skipped and the SSH library's native timeout is used instead
|
|
54
|
+
- All tools (`ssh_execute`, `ssh_tail`, `ssh_monitor`, `ssh_deploy`, `ssh_execute_sudo`, `ssh_group_execute`) are platform-aware
|
|
55
|
+
|
|
56
|
+
### v3.1.2 - Windows Compatibility Fix (February 9, 2026)
|
|
57
|
+
|
|
58
|
+
- **🪟 Windows support**: Fixed crash on Windows where `process.env.HOME` is undefined ([#8](https://github.com/bvisible/mcp-ssh-manager/issues/8))
|
|
59
|
+
- Now uses `os.homedir()` for cross-platform compatibility (Linux, macOS, Windows)
|
|
60
|
+
|
|
46
61
|
### v3.1.0 - Tool Activation System (November 15, 2025)
|
|
47
62
|
|
|
48
63
|
### 🎯 Context Usage Optimization
|
|
@@ -98,7 +113,7 @@ This release adds **12 new MCP tools** transforming SSH Manager into a comprehen
|
|
|
98
113
|
|
|
99
114
|
### Core Features
|
|
100
115
|
- **🔗 Multiple SSH Connections** - Manage unlimited SSH servers from a single interface
|
|
101
|
-
- **🔐 Secure Authentication** - Support for
|
|
116
|
+
- **🔐 Secure Authentication** - Support for password, SSH key, and ssh-agent authentication (including passphrase-protected keys)
|
|
102
117
|
- **📁 File Operations** - Upload and download files between local and remote systems
|
|
103
118
|
- **⚡ Command Execution** - Run commands on remote servers with working directory support
|
|
104
119
|
- **📂 Default Directories** - Set default working directories per server for convenience
|
|
@@ -332,6 +347,7 @@ host = "prod.example.com"
|
|
|
332
347
|
user = "admin"
|
|
333
348
|
password = "secure_password" # or use key_path
|
|
334
349
|
key_path = "~/.ssh/id_rsa" # for SSH key auth (recommended)
|
|
350
|
+
passphrase = "key_passphrase" # optional, for passphrase-protected keys
|
|
335
351
|
port = 22
|
|
336
352
|
default_dir = "/var/www"
|
|
337
353
|
description = "Production server"
|
|
@@ -342,6 +358,14 @@ user = "deploy"
|
|
|
342
358
|
key_path = "~/.ssh/staging_key"
|
|
343
359
|
port = 2222
|
|
344
360
|
default_dir = "/home/deploy/app"
|
|
361
|
+
|
|
362
|
+
[ssh_servers.winhost]
|
|
363
|
+
host = "192.168.1.90"
|
|
364
|
+
user = "svc-ssh"
|
|
365
|
+
key_path = "~/.ssh/winhost_key"
|
|
366
|
+
port = 2222
|
|
367
|
+
platform = "windows"
|
|
368
|
+
description = "Windows host via OpenSSH"
|
|
345
369
|
```
|
|
346
370
|
|
|
347
371
|
💡 **See [examples/codex-ssh-config.example.toml](examples/codex-ssh-config.example.toml) for more complete examples!**
|
|
@@ -539,11 +563,13 @@ SSH_SERVER_[NAME]_HOST=hostname_or_ip
|
|
|
539
563
|
SSH_SERVER_[NAME]_USER=username
|
|
540
564
|
SSH_SERVER_[NAME]_PASSWORD=password # For password auth
|
|
541
565
|
SSH_SERVER_[NAME]_KEYPATH=~/.ssh/key # For SSH key auth
|
|
566
|
+
SSH_SERVER_[NAME]_PASSPHRASE=key_passphrase # Optional, for passphrase-protected keys
|
|
542
567
|
SSH_SERVER_[NAME]_PORT=22 # Optional, defaults to 22
|
|
543
568
|
SSH_SERVER_[NAME]_DEFAULT_DIR=/path/to/dir # Optional, default working directory
|
|
544
569
|
SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
|
|
570
|
+
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
545
571
|
|
|
546
|
-
# Example
|
|
572
|
+
# Example: Linux server
|
|
547
573
|
SSH_SERVER_PRODUCTION_HOST=prod.example.com
|
|
548
574
|
SSH_SERVER_PRODUCTION_USER=admin
|
|
549
575
|
SSH_SERVER_PRODUCTION_PASSWORD=secure_password
|
|
@@ -551,6 +577,14 @@ SSH_SERVER_PRODUCTION_PORT=22
|
|
|
551
577
|
SSH_SERVER_PRODUCTION_DEFAULT_DIR=/var/www/html
|
|
552
578
|
SSH_SERVER_PRODUCTION_DESCRIPTION=Production Server
|
|
553
579
|
SSH_SERVER_PRODUCTION_SUDO_PASSWORD=secure_sudo_pass # Optional, for automated deployments
|
|
580
|
+
|
|
581
|
+
# Example: Windows server (OpenSSH for Windows)
|
|
582
|
+
SSH_SERVER_WINHOST_HOST=192.168.1.90
|
|
583
|
+
SSH_SERVER_WINHOST_USER=svc-ssh
|
|
584
|
+
SSH_SERVER_WINHOST_KEYPATH=~/.ssh/winhost_key
|
|
585
|
+
SSH_SERVER_WINHOST_PORT=2222
|
|
586
|
+
SSH_SERVER_WINHOST_PLATFORM=windows
|
|
587
|
+
SSH_SERVER_WINHOST_DESCRIPTION=Windows host via OpenSSH
|
|
554
588
|
```
|
|
555
589
|
|
|
556
590
|
### Server Management Tool
|
|
@@ -611,6 +645,43 @@ claude mcp list
|
|
|
611
645
|
3. **Limit server access** - Use minimal required permissions
|
|
612
646
|
4. **Rotate credentials** - Update passwords and keys regularly
|
|
613
647
|
|
|
648
|
+
### 🔑 Passphrase-Protected SSH Keys
|
|
649
|
+
|
|
650
|
+
MCP SSH Manager supports passphrase-protected SSH keys in two ways:
|
|
651
|
+
|
|
652
|
+
**Option 1: SSH Agent (recommended)**
|
|
653
|
+
|
|
654
|
+
If your SSH key is loaded into `ssh-agent`, MCP SSH Manager will use it automatically — no configuration changes needed:
|
|
655
|
+
|
|
656
|
+
```bash
|
|
657
|
+
# Add your key to the agent (enter passphrase once)
|
|
658
|
+
ssh-add ~/.ssh/your_key
|
|
659
|
+
|
|
660
|
+
# Verify the key is loaded
|
|
661
|
+
ssh-add -l
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
The server detects the `SSH_AUTH_SOCK` environment variable and connects to the running agent. This is the same mechanism that regular `ssh` uses for GUI passphrase prompts.
|
|
665
|
+
|
|
666
|
+
**Option 2: Passphrase in configuration**
|
|
667
|
+
|
|
668
|
+
You can store the passphrase directly in the server config:
|
|
669
|
+
|
|
670
|
+
`.env` format:
|
|
671
|
+
```env
|
|
672
|
+
SSH_SERVER_MYSERVER_KEYPATH=~/.ssh/id_rsa
|
|
673
|
+
SSH_SERVER_MYSERVER_PASSPHRASE="your_passphrase"
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
TOML format:
|
|
677
|
+
```toml
|
|
678
|
+
[ssh_servers.myserver]
|
|
679
|
+
key_path = "~/.ssh/id_rsa"
|
|
680
|
+
passphrase = "your_passphrase"
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
> **Note:** SSH Agent is preferred over storing passphrases in config files for better security.
|
|
684
|
+
|
|
614
685
|
## 📚 Advanced Usage
|
|
615
686
|
|
|
616
687
|
### Documentation
|
|
@@ -819,7 +890,8 @@ Made with ❤️ for the Claude Code community
|
|
|
819
890
|
### Command Timeout
|
|
820
891
|
- The timeout parameter for SSH commands is advisory only
|
|
821
892
|
- Due to SSH2 library limitations, commands may continue running on the server even after timeout
|
|
822
|
-
-
|
|
893
|
+
- On Linux/macOS hosts, a system `timeout` wrapper is used for reliable command termination
|
|
894
|
+
- **Windows hosts**: Set `PLATFORM=windows` in your server config to skip the Linux `timeout`/`sh -c` wrapper (which is incompatible with Windows OpenSSH)
|
|
823
895
|
|
|
824
896
|
### SSH Sync (rsync)
|
|
825
897
|
- Password authentication requires `sshpass` to be installed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
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
6
|
"type": "module",
|
package/src/config-loader.js
CHANGED
|
@@ -87,6 +87,7 @@ export class ConfigLoader {
|
|
|
87
87
|
user: serverConfig.user || serverConfig.username,
|
|
88
88
|
password: serverConfig.password,
|
|
89
89
|
keyPath: serverConfig.key_path || serverConfig.keypath || serverConfig.ssh_key,
|
|
90
|
+
passphrase: serverConfig.passphrase,
|
|
90
91
|
port: serverConfig.port || 22,
|
|
91
92
|
defaultDir: serverConfig.default_dir || serverConfig.default_directory || serverConfig.cwd,
|
|
92
93
|
sudoPassword: serverConfig.sudo_password,
|
|
@@ -134,6 +135,7 @@ export class ConfigLoader {
|
|
|
134
135
|
user: env[`SSH_SERVER_${match[1]}_USER`],
|
|
135
136
|
password: env[`SSH_SERVER_${match[1]}_PASSWORD`],
|
|
136
137
|
keyPath: env[`SSH_SERVER_${match[1]}_KEYPATH`],
|
|
138
|
+
passphrase: env[`SSH_SERVER_${match[1]}_PASSPHRASE`],
|
|
137
139
|
port: parseInt(env[`SSH_SERVER_${match[1]}_PORT`] || '22'),
|
|
138
140
|
defaultDir: env[`SSH_SERVER_${match[1]}_DEFAULT_DIR`],
|
|
139
141
|
sudoPassword: env[`SSH_SERVER_${match[1]}_SUDO_PASSWORD`],
|
|
@@ -186,6 +188,7 @@ export class ConfigLoader {
|
|
|
186
188
|
|
|
187
189
|
if (server.password) serverConfig.password = server.password;
|
|
188
190
|
if (server.keyPath) serverConfig.key_path = server.keyPath;
|
|
191
|
+
if (server.passphrase) serverConfig.passphrase = server.passphrase;
|
|
189
192
|
if (server.defaultDir) serverConfig.default_dir = server.defaultDir;
|
|
190
193
|
if (server.sudoPassword) serverConfig.sudo_password = server.sudoPassword;
|
|
191
194
|
if (server.description) serverConfig.description = server.description;
|
|
@@ -212,6 +215,7 @@ export class ConfigLoader {
|
|
|
212
215
|
lines.push(`SSH_SERVER_${upperName}_USER=${server.user}`);
|
|
213
216
|
if (server.password) lines.push(`SSH_SERVER_${upperName}_PASSWORD="${server.password}"`);
|
|
214
217
|
if (server.keyPath) lines.push(`SSH_SERVER_${upperName}_KEYPATH=${server.keyPath}`);
|
|
218
|
+
if (server.passphrase) lines.push(`SSH_SERVER_${upperName}_PASSPHRASE="${server.passphrase}"`);
|
|
215
219
|
lines.push(`SSH_SERVER_${upperName}_PORT=${server.port || 22}`);
|
|
216
220
|
if (server.defaultDir) lines.push(`SSH_SERVER_${upperName}_DEFAULT_DIR=${server.defaultDir}`);
|
|
217
221
|
if (server.sudoPassword) lines.push(`SSH_SERVER_${upperName}_SUDO_PASSWORD="${server.sudoPassword}"`);
|
package/src/index.js
CHANGED
|
@@ -165,7 +165,8 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
165
165
|
const __dirname = path.dirname(__filename);
|
|
166
166
|
|
|
167
167
|
// Load environment variables (for backward compatibility)
|
|
168
|
-
|
|
168
|
+
const envFilePath = path.join(__dirname, '..', '.env');
|
|
169
|
+
dotenv.config({ path: envFilePath });
|
|
169
170
|
|
|
170
171
|
// Initialize logger
|
|
171
172
|
logger.info('MCP SSH Manager starting', {
|
|
@@ -176,7 +177,7 @@ logger.info('MCP SSH Manager starting', {
|
|
|
176
177
|
// Load SSH server configuration
|
|
177
178
|
let servers = {};
|
|
178
179
|
configLoader.load({
|
|
179
|
-
envPath:
|
|
180
|
+
envPath: envFilePath,
|
|
180
181
|
tomlPath: process.env.SSH_CONFIG_PATH,
|
|
181
182
|
preferToml: process.env.PREFER_TOML_CONFIG === 'true'
|
|
182
183
|
}).then(loadedServers => {
|
package/src/ssh-manager.js
CHANGED
|
@@ -98,11 +98,19 @@ class SSHManager {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// Use ssh-agent if available (handles passphrase-protected keys transparently)
|
|
102
|
+
if (process.env.SSH_AUTH_SOCK) {
|
|
103
|
+
connConfig.agent = process.env.SSH_AUTH_SOCK;
|
|
104
|
+
}
|
|
105
|
+
|
|
101
106
|
// Add authentication (support both keyPath and keypath for compatibility)
|
|
102
107
|
const keyPath = this.config.keyPath || this.config.keypath;
|
|
103
108
|
if (keyPath) {
|
|
104
109
|
const resolvedKeyPath = keyPath.replace('~', os.homedir());
|
|
105
110
|
connConfig.privateKey = fs.readFileSync(resolvedKeyPath);
|
|
111
|
+
if (this.config.passphrase) {
|
|
112
|
+
connConfig.passphrase = this.config.passphrase;
|
|
113
|
+
}
|
|
106
114
|
} else if (this.config.password) {
|
|
107
115
|
connConfig.password = this.config.password;
|
|
108
116
|
}
|