mcp-ssh-manager 3.6.7 → 3.7.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/CHANGELOG.md +12 -1
- package/CLAUDE.md +2 -0
- package/README.md +34 -9
- package/package.json +3 -2
- package/src/config-loader.js +14 -0
- package/src/ssh-manager.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,22 @@ All notable changes to MCP SSH Manager will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.7.0] - 2026-07-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Per-server SSH agent forwarding (`ForwardAgent`)** ([#53](https://github.com/bvisible/mcp-ssh-manager/pull/53) — requested by [@raphaelbahat](https://github.com/raphaelbahat) in [#52](https://github.com/bvisible/mcp-ssh-manager/issues/52))
|
|
13
|
+
- New opt-in option, `SSH_SERVER_<NAME>_FORWARD_AGENT=true` (`.env`) or `forward_agent = true` (TOML), enabling the equivalent of OpenSSH's `ForwardAgent yes` on a per-server basis. Processes on the remote host can then authenticate to other SSH hosts using the keys held in the operator's local `ssh-agent` (e.g. `git` over SSH), without copying any private key to the server.
|
|
14
|
+
- Requires a running local agent (`SSH_AUTH_SOCK`); the flag is ignored when no agent is present. `ForwardAgent` is set only alongside a valid agent, since `ssh2` throws otherwise. Because `ssh2`'s connection-level `agentForward` forwards on every exec/shell channel, no per-command change is needed.
|
|
15
|
+
- A `parseBool()` helper coerces the `.env` string value so `FORWARD_AGENT=false` is not treated as truthy; only `true`/`1`/`yes`/`on` enable it.
|
|
16
|
+
- **Defaults to `false`.** Documented in the README (*SSH Agent Forwarding*) and CLAUDE.md with the standard security warning (a root user on the remote host can use the forwarded agent for the life of the connection).
|
|
17
|
+
- Tests: `tests/test-agent-forward.js` verifies the `connect()` wiring across the on/off/absent/no-agent states; `tests/test-config-field-names.js` gains `forwardAgent` coverage including `.env` boolean coercion and a TOML export round-trip.
|
|
18
|
+
|
|
8
19
|
## [3.6.7] - 2026-07-11
|
|
9
20
|
|
|
10
21
|
### Security
|
|
11
22
|
|
|
12
|
-
- **Command injection in the database command builders** ([#51](https://github.com/bvisible/mcp-ssh-manager/pull/51) — responsibly disclosed by **Ugur Ozer
|
|
23
|
+
- **Command injection in the database command builders** ([#51](https://github.com/bvisible/mcp-ssh-manager/pull/51) — responsibly disclosed by **Ugur Ozer, Aeon AI Risk Management** (http://airiskmanagement.ca), see [#48](https://github.com/bvisible/mcp-ssh-manager/issues/48))
|
|
13
24
|
- Every `ssh_db_*` tool argument — `database`, `table`, `collection`, output/input file paths, and the `user` / `host` / `port` / `password` connection fields — arrives from tool-call parameters and was interpolated straight into a **shell-evaluated** command string in `src/database-manager.js`. A crafted value (`$(…)`, backticks, `; cmd`, `| cmd`, `&& cmd`, bare `> file`) executed arbitrary commands on the configured SSH target, under the account the MCP server uses.
|
|
14
25
|
- The strongest path is **`ssh_db_list`**: it is classified read-only, so it stayed **allowed in the `readonly` and `restricted`** per-server security modes while still reaching an injectable builder — bypassing the boundary those modes promise.
|
|
15
26
|
- The v3.6.5 heredoc fix (#44) only hardened `ssh_db_query`'s query **text**; the `list` / `dump` / `import` / `restore` builders and the query builders' **connection flags** were untouched.
|
package/CLAUDE.md
CHANGED
|
@@ -157,6 +157,7 @@ SSH_SERVER_[NAME]_SUDO_PASSWORD=pass # Optional for automated sudo
|
|
|
157
157
|
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
158
158
|
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
|
|
159
159
|
SSH_SERVER_[NAME]_PROXYCOMMAND=command # Optional: custom proxy command (ncat, ssh -W, etc.)
|
|
160
|
+
SSH_SERVER_[NAME]_FORWARD_AGENT=true # Optional: forward local ssh-agent to remote (needs SSH_AUTH_SOCK; security risk)
|
|
160
161
|
```
|
|
161
162
|
|
|
162
163
|
### TOML Format
|
|
@@ -173,6 +174,7 @@ sudo_password = "pass" # Optional for automated sudo
|
|
|
173
174
|
platform = "windows" # Optional: "linux" (default) or "windows"
|
|
174
175
|
proxy_jump = "bastion" # Optional: name of another server to use as jump host
|
|
175
176
|
proxy_command = "command" # Optional: custom proxy command (ncat, ssh -W, etc.)
|
|
177
|
+
forward_agent = true # Optional: forward local ssh-agent to remote (needs SSH_AUTH_SOCK; security risk)
|
|
176
178
|
```
|
|
177
179
|
|
|
178
180
|
## Key Implementation Details
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A Model Context Protocol (MCP) server that enables **Claude Code** and **OpenAI
|
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/mcp-ssh-manager)
|
|
8
8
|
[](https://www.npmjs.com/package/mcp-ssh-manager)
|
|
9
|
-
[](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v3.7.0)
|
|
10
10
|
[](https://claude.ai/code)
|
|
11
11
|
[](https://openai.com/codex)
|
|
12
12
|
[](https://modelcontextprotocol.io)
|
|
@@ -20,23 +20,28 @@ A Model Context Protocol (MCP) server that enables **Claude Code** and **OpenAI
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
## 🎉 What's New in v3.
|
|
23
|
+
## 🎉 What's New in v3.7.0
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**🔗 Per-server SSH agent forwarding (`ForwardAgent`)** (Released: July 13, 2026)
|
|
26
26
|
|
|
27
|
-
- **
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- **No configuration or API change** — shell-quoting is transparent for normal database/table/file names.
|
|
27
|
+
- **New opt-in `FORWARD_AGENT` / `forward_agent` option** ([#53](https://github.com/bvisible/mcp-ssh-manager/pull/53) — requested by [@raphaelbahat](https://github.com/raphaelbahat) in [#52](https://github.com/bvisible/mcp-ssh-manager/issues/52)) — enable the equivalent of OpenSSH's `ForwardAgent yes` per server, so processes on the remote host can authenticate to *other* SSH hosts using the keys in your **local** `ssh-agent` (e.g. `git clone` over SSH on a remote server using your local GitHub key), without copying any private key to the server.
|
|
28
|
+
- **Safe by construction** — requires a running local agent (`SSH_AUTH_SOCK`); the flag is ignored when no agent is present, so it never breaks a connection. Boolean parsing treats only `true`/`1`/`yes`/`on` as enabled — `FORWARD_AGENT=false` stays off.
|
|
29
|
+
- **⚠️ Defaults to `false`** — agent forwarding lets anyone with root on the remote host use your loaded keys for the life of the connection, so enable it only for servers you trust. See the new *SSH Agent Forwarding* section in the docs.
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
```env
|
|
32
|
+
SSH_SERVER_MYSERVER_FORWARD_AGENT=true
|
|
33
|
+
```
|
|
33
34
|
|
|
34
|
-
[Read full changelog →](CHANGELOG.md#
|
|
35
|
+
[Read full changelog →](CHANGELOG.md#370---2026-07-13)
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
38
39
|
## Previous Releases
|
|
39
40
|
|
|
41
|
+
### v3.6.7 - Security: command injection fix in the database helpers (July 11, 2026)
|
|
42
|
+
|
|
43
|
+
- **🔒 Every `ssh_db_*` argument is now shell-quoted** ([#51](https://github.com/bvisible/mcp-ssh-manager/pull/51) — responsibly disclosed by **Ugur Ozer, Aeon AI Risk Management** (http://airiskmanagement.ca), see [#48](https://github.com/bvisible/mcp-ssh-manager/issues/48)) — caller-controlled values (`ssh_db_list` most notably, which stayed allowed in `readonly`/`restricted` modes) were interpolated into shell-evaluated strings, allowing arbitrary command execution on the SSH target. A centralized `shellQuote()` now wraps every value across all 15 builders, guarded by a 648-combination injection test. [Full changelog →](CHANGELOG.md#367---2026-07-11)
|
|
44
|
+
|
|
40
45
|
### v3.6.6 - `SUDO_PASSWORD` / `DEFAULT_DIR` / `ssh_sync` key auth work again (July 11, 2026)
|
|
41
46
|
|
|
42
47
|
- **🔑 camelCase config field reads** ([#50](https://github.com/bvisible/mcp-ssh-manager/pull/50) — thanks [@egoan82](https://github.com/egoan82)) — since the v3.0.0 ConfigLoader refactor, `ssh_execute_sudo` ignored `SUDO_PASSWORD`, `DEFAULT_DIR` was ignored by `ssh_execute`/`ssh_group_execute`/`ssh_list_servers`, and `ssh_sync` never passed the configured SSH key to rsync. All aligned with the loader's camelCase fields, with a regression test locking the loader output shape. [Full changelog →](CHANGELOG.md#366---2026-07-11)
|
|
@@ -674,6 +679,7 @@ SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
|
|
|
674
679
|
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
|
|
675
680
|
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
|
|
676
681
|
SSH_SERVER_[NAME]_PROXYCOMMAND=command # Optional: custom proxy command (ncat, ssh -W, etc.)
|
|
682
|
+
SSH_SERVER_[NAME]_FORWARD_AGENT=true # Optional: forward local ssh-agent to remote (needs SSH_AUTH_SOCK; security risk — see SSH Agent section)
|
|
677
683
|
|
|
678
684
|
# Example: Linux server
|
|
679
685
|
SSH_SERVER_PRODUCTION_HOST=prod.example.com
|
|
@@ -804,6 +810,25 @@ passphrase = "your_passphrase"
|
|
|
804
810
|
|
|
805
811
|
> **Note:** SSH Agent is preferred over storing passphrases in config files for better security.
|
|
806
812
|
|
|
813
|
+
### 🔗 SSH Agent Forwarding
|
|
814
|
+
|
|
815
|
+
Enable per-server agent forwarding (the equivalent of OpenSSH's `ForwardAgent yes`) so processes on the remote host can authenticate to *other* SSH hosts using the keys in your **local** `ssh-agent` — e.g. `git clone` over SSH on a remote server using your local GitHub key, without copying any private key to the server.
|
|
816
|
+
|
|
817
|
+
It is **opt-in per server** and defaults to `false`. It requires a running local agent (`SSH_AUTH_SOCK` present); when the agent is unavailable the flag is simply ignored.
|
|
818
|
+
|
|
819
|
+
`.env` format:
|
|
820
|
+
```env
|
|
821
|
+
SSH_SERVER_MYSERVER_FORWARD_AGENT=true
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
TOML format:
|
|
825
|
+
```toml
|
|
826
|
+
[ssh_servers.myserver]
|
|
827
|
+
forward_agent = true
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
> ⚠️ **Security warning:** agent forwarding lets any process that can read the forwarded agent socket on the remote host — including anyone with **root** there — use your loaded keys to impersonate you against other hosts *for the life of the connection*. Only enable it for servers you trust, mirroring the same caution `ssh_config(5)` advises for `ForwardAgent`.
|
|
831
|
+
|
|
807
832
|
## 📚 Advanced Usage
|
|
808
833
|
|
|
809
834
|
### ProxyJump / Bastion Host
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.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
6
|
"bin": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"setup": "npm install && pip install -r tools/requirements.txt",
|
|
14
14
|
"configure": "python tools/server-manager.py",
|
|
15
15
|
"test-connection": "python tools/test-connection.py",
|
|
16
|
-
"test": "npm run test:profiles && npm run test:aliases && npm run test:hooks && npm run test:tools && npm run test:policy && npm run test:ping && npm run test:config && npm run test:fieldnames && npm run test:lifecycle && npm run test:sync && npm run test:dbquoting && npm run test:dbinjection && npm run test:dbrowcount",
|
|
16
|
+
"test": "npm run test:profiles && npm run test:aliases && npm run test:hooks && npm run test:tools && npm run test:policy && npm run test:ping && npm run test:config && npm run test:fieldnames && npm run test:agentforward && npm run test:lifecycle && npm run test:sync && npm run test:dbquoting && npm run test:dbinjection && npm run test:dbrowcount",
|
|
17
17
|
"test:profiles": "node tests/test-profiles.js",
|
|
18
18
|
"test:aliases": "node tests/test-command-aliases.js",
|
|
19
19
|
"test:hooks": "node tests/test-hooks.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"test:ping": "node tests/test-ssh-ping.js",
|
|
23
23
|
"test:config": "node tests/test-server-config-manager.js",
|
|
24
24
|
"test:fieldnames": "node tests/test-config-field-names.js",
|
|
25
|
+
"test:agentforward": "node tests/test-agent-forward.js",
|
|
25
26
|
"test:lifecycle": "node tests/test-lifecycle.js",
|
|
26
27
|
"test:sync": "node tests/test-sync-stats.js",
|
|
27
28
|
"test:dbquoting": "node tests/test-database-query-quoting.js",
|
package/src/config-loader.js
CHANGED
|
@@ -32,6 +32,16 @@ function normalizeMode(raw, serverName) {
|
|
|
32
32
|
return normalized;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// Parse a boolean-ish config value. Accepts native booleans (TOML) and the
|
|
36
|
+
// strings "true"/"1"/"yes"/"on" (case-insensitive) from .env, where every value
|
|
37
|
+
// is a string. Everything else — "false", "0", "", undefined — is false, so an
|
|
38
|
+
// opt-in flag never turns on by accident.
|
|
39
|
+
function parseBool(raw) {
|
|
40
|
+
if (raw === true) return true;
|
|
41
|
+
if (typeof raw !== 'string') return false;
|
|
42
|
+
return ['true', '1', 'yes', 'on'].includes(raw.trim().toLowerCase());
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
export class ConfigLoader {
|
|
36
46
|
constructor() {
|
|
37
47
|
this.servers = new Map();
|
|
@@ -138,6 +148,7 @@ export class ConfigLoader {
|
|
|
138
148
|
platform: serverConfig.platform ? serverConfig.platform.toLowerCase() : undefined,
|
|
139
149
|
proxyJump: serverConfig.proxy_jump,
|
|
140
150
|
proxyCommand: serverConfig.proxy_command || serverConfig.proxycommand,
|
|
151
|
+
forwardAgent: parseBool(serverConfig.forward_agent),
|
|
141
152
|
mode,
|
|
142
153
|
allowPatterns: tomlAllow,
|
|
143
154
|
denyPatterns: tomlDeny,
|
|
@@ -208,6 +219,7 @@ export class ConfigLoader {
|
|
|
208
219
|
platform: (env[`SSH_SERVER_${match[1]}_PLATFORM`] || '').toLowerCase() || undefined,
|
|
209
220
|
proxyJump: env[`SSH_SERVER_${match[1]}_PROXYJUMP`],
|
|
210
221
|
proxyCommand: env[`SSH_SERVER_${match[1]}_PROXYCOMMAND`],
|
|
222
|
+
forwardAgent: parseBool(env[`SSH_SERVER_${match[1]}_FORWARD_AGENT`]),
|
|
211
223
|
mode,
|
|
212
224
|
allowPatterns: envAllow,
|
|
213
225
|
denyPatterns: envDeny,
|
|
@@ -266,6 +278,8 @@ export class ConfigLoader {
|
|
|
266
278
|
if (server.platform) serverConfig.platform = server.platform;
|
|
267
279
|
if (server.proxyJump) serverConfig.proxy_jump = server.proxyJump;
|
|
268
280
|
if (server.proxyCommand) serverConfig.proxy_command = server.proxyCommand;
|
|
281
|
+
// Only emit when opted in, so generated TOML stays clean by default.
|
|
282
|
+
if (server.forwardAgent) serverConfig.forward_agent = true;
|
|
269
283
|
// Only emit security fields if they diverge from defaults — keeps generated
|
|
270
284
|
// TOML files clean for users who never opted in.
|
|
271
285
|
if (server.mode && server.mode !== 'unrestricted') serverConfig.mode = server.mode;
|
package/src/ssh-manager.js
CHANGED
|
@@ -152,6 +152,13 @@ class SSHManager {
|
|
|
152
152
|
// Use ssh-agent if available (handles passphrase-protected keys transparently)
|
|
153
153
|
if (process.env.SSH_AUTH_SOCK) {
|
|
154
154
|
connConfig.agent = process.env.SSH_AUTH_SOCK;
|
|
155
|
+
// Opt-in per-server agent forwarding. ssh2 requires `agent` to be set,
|
|
156
|
+
// so we only enable it inside this block — otherwise ssh2 throws at
|
|
157
|
+
// connect. With allowAgentFwd on, every exec/shell channel forwards the
|
|
158
|
+
// agent automatically, so no per-command change is needed.
|
|
159
|
+
if (this.config.forwardAgent) {
|
|
160
|
+
connConfig.agentForward = true;
|
|
161
|
+
}
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
// Add authentication (support both keyPath and keypath for compatibility)
|