mcp-ssh-manager 3.8.7 → 4.0.1

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.
Files changed (104) hide show
  1. package/.eslintignore +5 -0
  2. package/.gitattributes +5 -0
  3. package/CHANGELOG.md +371 -6
  4. package/CLAUDE.md +6 -0
  5. package/CODE_OF_CONDUCT.md +18 -0
  6. package/CONTRIBUTING.md +30 -0
  7. package/Formula/ssh-manager.rb +60 -0
  8. package/README.md +484 -964
  9. package/ROADMAP-V4.md +451 -0
  10. package/brand/README.md +43 -0
  11. package/brand/icon.svg +32 -0
  12. package/brand/mark.svg +18 -0
  13. package/brand/wordmark.svg +30 -0
  14. package/cli/app.js +230 -0
  15. package/cli/control.js +116 -0
  16. package/cli/lib/colors.sh +15 -0
  17. package/cli/lib/menu.sh +145 -96
  18. package/cli/portability.js +186 -0
  19. package/cli/ssh-manager +197 -91
  20. package/cli/ssh-manager.js +14 -0
  21. package/cli/style.js +17 -0
  22. package/cli/vault.js +411 -0
  23. package/desktop/ControlPlaneApp.swift +219 -0
  24. package/desktop/build.sh +58 -0
  25. package/desktop/electron/after-pack.cjs +39 -0
  26. package/desktop/electron/electron-builder.yml +148 -0
  27. package/desktop/electron/finalize-artifacts.mjs +83 -0
  28. package/desktop/electron/main.js +815 -0
  29. package/desktop/electron/package-lock.json +3656 -0
  30. package/desktop/electron/package.json +30 -0
  31. package/desktop/electron/prepare-engine.mjs +84 -0
  32. package/desktop/electron/resources/entitlements.mac.plist +22 -0
  33. package/desktop/electron/resources/icon.png +0 -0
  34. package/desktop/electron/resources/trayTemplate.png +0 -0
  35. package/desktop/electron/resources/trayTemplate@2x.png +0 -0
  36. package/desktop/electron/smoke-test.mjs +184 -0
  37. package/dist/ui/app.css +1 -0
  38. package/dist/ui/app.js +501 -0
  39. package/dist/ui/assets/Forum-Regular.woff2 +0 -0
  40. package/dist/ui/assets/JetBrainsMono-Bold.woff2 +0 -0
  41. package/dist/ui/assets/JetBrainsMono-Regular.woff2 +0 -0
  42. package/dist/ui/assets/Karla-Variable.woff2 +0 -0
  43. package/dist/ui/index.html +16 -0
  44. package/docs/DISTRIBUTION.md +136 -0
  45. package/docs/FINAL-TEST-V4.md +209 -0
  46. package/docs/MIGRATION.md +334 -0
  47. package/docs/TESTING-V4.md +119 -0
  48. package/docs/superpowers/specs/2026-10-08-desktop-from-npm-and-cli-design.md +187 -0
  49. package/docs/videos/control-plane.mp4 +0 -0
  50. package/package.json +61 -30
  51. package/scripts/build-interface.mjs +73 -0
  52. package/scripts/capture-screenshots.mjs +191 -0
  53. package/scripts/demo-env.mjs +461 -0
  54. package/scripts/frame-screenshots.py +176 -0
  55. package/scripts/macbook-mockup.py +296 -0
  56. package/scripts/make-tray-icon.py +61 -0
  57. package/scripts/preview-candidate.mjs +291 -0
  58. package/scripts/publish-desktop.mjs +46 -0
  59. package/scripts/record-demo.mjs +229 -0
  60. package/scripts/release-version.mjs +32 -0
  61. package/scripts/render-cli-menu.py +157 -0
  62. package/scripts/requirements-dev.in +12 -0
  63. package/scripts/requirements-dev.txt +424 -0
  64. package/scripts/run-ui-regression.mjs +48 -0
  65. package/scripts/setup-hooks.sh +7 -13
  66. package/scripts/smoke-desktop.mjs +80 -0
  67. package/scripts/test-drag-and-drop.mjs +114 -0
  68. package/scripts/test-first-run.mjs +5 -0
  69. package/scripts/test-import-ui.mjs +5 -0
  70. package/scripts/test-preferences-persist.mjs +5 -0
  71. package/scripts/test-upgrade-from-published.mjs +226 -0
  72. package/scripts/verify-mac-build.sh +153 -0
  73. package/scripts/verify-windows-build.ps1 +15 -0
  74. package/server.json +3 -3
  75. package/skills/README.md +42 -0
  76. package/skills/ssh-incident/SKILL.md +55 -0
  77. package/skills/ssh-operations/SKILL.md +62 -0
  78. package/skills/ssh-restricted/SKILL.md +57 -0
  79. package/src/agent-clients.js +482 -0
  80. package/src/approval.js +291 -0
  81. package/src/audit.js +11 -1
  82. package/src/command-log.js +162 -0
  83. package/src/config-loader.js +119 -4
  84. package/src/config-paths.js +101 -0
  85. package/src/control-plane.js +2730 -0
  86. package/src/desktop-install.js +747 -0
  87. package/src/index.js +179 -213
  88. package/src/live-stream.js +261 -0
  89. package/src/saved-commands.js +150 -0
  90. package/src/secret-store.js +573 -0
  91. package/src/server-aliases.js +8 -7
  92. package/src/server-config-manager.js +33 -7
  93. package/src/server-export.js +106 -0
  94. package/src/server-groups.js +82 -21
  95. package/src/server-import.js +477 -0
  96. package/src/shell-quote.js +9 -2
  97. package/src/ssh-connection.js +155 -0
  98. package/src/ssh-manager.js +186 -13
  99. package/src/tunnel-manager.js +79 -0
  100. package/src/vault-recovery.js +206 -0
  101. package/src/xlsx.js +322 -0
  102. package/docs/images/social-preview.png +0 -0
  103. package/docs/images/social-preview@2x.png +0 -0
  104. package/docs/images/ssh-manager-cli-menu.png +0 -0
package/README.md CHANGED
@@ -1,1216 +1,736 @@
1
- # MCP SSH Manager - SSH Remote Server Management via Model Context Protocol 🚀
1
+ <p align="center">
2
+ <img src="docs/images/icon.png" alt="" width="96">
3
+ </p>
2
4
 
3
- A Model Context Protocol (MCP) server that enables **Claude Code** and **OpenAI Codex** to manage multiple SSH connections. Execute commands, transfer files, manage databases, create backups, monitor health, and automate DevOps tasks across your servers — directly from your AI assistant.
5
+ <p align="center">
6
+ <picture>
7
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/wordmark-dark.png">
8
+ <img src="docs/images/wordmark.png" alt="SSH Manager" width="380">
9
+ </picture>
10
+ </p>
4
11
 
5
- <div align="center">
12
+ <h1 align="center">You give your agents a shell,<br>and you see what they do with it.</h1>
6
13
 
7
- [![npm version](https://img.shields.io/npm/v/mcp-ssh-manager.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/mcp-ssh-manager)
8
- [![npm downloads](https://img.shields.io/npm/dt/mcp-ssh-manager.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/mcp-ssh-manager)
9
- [![Version](https://img.shields.io/badge/Version-3.8.6-brightgreen?style=for-the-badge)](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v3.8.6)
10
- [![Claude Code](https://img.shields.io/badge/Claude_Code-Compatible-5A67D8?style=for-the-badge&logo=anthropic)](https://claude.ai/code)
11
- [![OpenAI Codex](https://img.shields.io/badge/OpenAI_Codex-Compatible-00A67E?style=for-the-badge&logo=openai)](https://openai.com/codex)
12
- [![MCP](https://img.shields.io/badge/MCP-Server-orange?style=for-the-badge)](https://modelcontextprotocol.io)
13
- [![OpenSSF Scorecard](https://img.shields.io/ossf-scorecard/github.com/bvisible/mcp-ssh-manager?style=for-the-badge&label=OpenSSF)](https://scorecard.dev/viewer/?uri=github.com/bvisible/mcp-ssh-manager)
14
- [![License](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](LICENSE)
14
+ <p align="center">
15
+ <b>An MCP server for SSH.</b> Let <b>Claude Code</b>, <b>Claude Desktop</b> and <b>OpenAI Codex</b> (or any MCP client)<br>
16
+ work on your real servers — run commands, move files, query databases, take backups, check health —<br>
17
+ and watch over their shoulder while they do it.
18
+ </p>
15
19
 
16
- [![MCP Toplist](https://mcptoplist.com/badge/glama%2Fbvisible%2Fmcp-ssh-manager.svg)](https://mcptoplist.com/server/glama%2Fbvisible%2Fmcp-ssh-manager)
20
+ <div align="center">
21
+
22
+ [![npm version](https://img.shields.io/npm/v/mcp-ssh-manager.svg?style=flat-square&logo=npm&color=c04500)](https://www.npmjs.com/package/mcp-ssh-manager)
23
+ [![npm downloads](https://img.shields.io/npm/dm/mcp-ssh-manager.svg?style=flat-square&logo=npm&color=c04500)](https://www.npmjs.com/package/mcp-ssh-manager)
24
+ [![Version](https://img.shields.io/badge/release-4.0.1-c04500?style=flat-square)](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1)
25
+ [![Claude Code](https://img.shields.io/badge/Claude_Code-Compatible-5A67D8?style=flat-square&logo=anthropic)](https://claude.ai/code)
26
+ [![OpenAI Codex](https://img.shields.io/badge/OpenAI_Codex-Compatible-00A67E?style=flat-square&logo=openai)](https://openai.com/codex)
27
+ [![MCP](https://img.shields.io/badge/MCP-Server-orange?style=flat-square)](https://modelcontextprotocol.io)
28
+ [![OpenSSF Scorecard](https://img.shields.io/ossf-scorecard/github.com/bvisible/mcp-ssh-manager?style=flat-square&label=OpenSSF)](https://scorecard.dev/viewer/?uri=github.com/bvisible/mcp-ssh-manager)
29
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/15950/badge)](https://www.bestpractices.dev/projects/15950)
30
+ [![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)
17
31
 
18
32
  </div>
19
33
 
20
34
  <p align="center">
21
- <img src="docs/images/ssh-manager-cli-menu.png" alt="ssh-manager interactive CLI menu" width="900">
35
+ <picture>
36
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/control-plane-dark.gif">
37
+ <img src="docs/images/control-plane.gif" alt="An agent asks to run rm -rf on production; the request is refused; a live command streams its output; every server is probed for health" width="900">
38
+ </picture>
22
39
  </p>
23
40
 
24
- ---
25
-
26
- ## 🎉 What's New in v3.8.6
41
+ <p align="center">
42
+ <sub>Twenty seconds, unedited — <a href="docs/videos/control-plane.mp4">watch full size</a>. Real SSH, real SFTP, three throwaway hosts on the loopback.</sub>
43
+ </p>
27
44
 
28
- **🔒 Security release — six advisories fixed. Upgrade.** (Released: October 8, 2026)
45
+ ---
29
46
 
30
- - **🔴 Command injection on your own machine through the default `on-error` hook** (GHSA-759m-wfpq-xmx3) — the connection error, whose text a server chooses, was pasted into a shell command. Any SSH server you connected to could run a command on the machine running mcp-ssh-manager. Hook values now reach commands as shell variables, never as command text, and the default hook writes its log without a shell.
31
- - **🔴 `restricted` mode only checked how a line started** (GHSA-rfxw-26h6-7w42) — `^echo ` let `echo hi; id` through. Every command in a list or pipeline must now match your allowlist; command substitution and writes to files are refused.
32
- - **🔴 `cwd` reached the shell unquoted** (GHSA-37fv-fcpc-j236), past the security policy.
33
- - **🔴 `ssh_db_query` could write** (GHSA-9w6j-vg8f-hp8g, GHSA-q37w-vhpx-q5q9) — `SELECT … INTO OUTFILE`, `SELECT … INTO` a new table, and JavaScript in MongoDB queries. Queries now run in a read-only transaction, and a MongoDB query must be a filter document.
34
- - **🟠 Host keys were never compared** (GHSA-cwg3-pfmm-w8rm) — **a changed host key is now refused**, as OpenSSH does. A server reinstalled since its key was recorded needs `ssh-keygen -R <host>` once.
35
- - `ssh_deploy` and `ssh_backup_schedule` quote every value, and a cron schedule must be a schedule.
47
+ ## The problem, in one line
36
48
 
37
- Hook settings, aliases, the active profile and the logs now live in `~/.ssh-manager/`, readable by you alone, instead of inside the installed package, where every upgrade lost them.
49
+ An MCP SSH server is the most dangerous tool you can hand an agent: a shell on machines that matter. Today, when your agent runs something on production, you find out afterwards — if you find out at all.
38
50
 
39
- [Read full changelog →](CHANGELOG.md#386---2026-10-08) · Previous: [v3.8.5](CHANGELOG.md#385---2026-08-28), three command-injection advisories.
51
+ **This one lets you watch, and lets you say no.** It is also, on the boring days, simply a very good way to let an assistant do the server work you were going to do yourself.
40
52
 
41
53
  ---
42
54
 
43
- ## 🔐 Giving an agent SSH access, safely
44
-
45
- An MCP SSH server is the most dangerous tool you can hand an AI agent: a shell on
46
- machines that matter. This one is built so you decide how far the agent can go —
47
- **per server**, not globally.
55
+ ## Choose your workspace
56
+
57
+ **Desktop application (`4.0.1`):** one installation with its own runtime,
58
+ terminal, file browser and server settings. No separate Node.js or npm
59
+ installation. [Download it](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1):
60
+
61
+ | Platform | File | Signature |
62
+ |---|---|---|
63
+ | macOS, Apple silicon / Intel | `…-arm64.dmg` / `…-x64.dmg` | **Signed and notarized by Apple** — opens normally |
64
+ | Windows x64 / arm64 | `…-setup.exe` | **Not code-signed in 4.0.x.** Windows shows *"Windows protected your PC"*: *More info → Run anyway*. Check the file against the SHA-256 in `release-manifest-win32.json` on the release (`ssh-manager app` does it for you). Signing comes in a later release. |
65
+ | Linux x64 | `.deb`, `.AppImage` | Unsigned, as Linux packages usually are |
66
+
67
+ **Already using npm / the CLI?** `npm update -g mcp-ssh-manager` brings 4.0.1,
68
+ and the V4 engine runs without an interface, from your existing `.env`, TOML or
69
+ process variables — no automatic import, no forced wizard, no approval prompt
70
+ unless you enable one per server. The one behaviour that tightens is **SSH
71
+ host-key verification**; read that section of the
72
+ [upgrade and rollback guide](docs/MIGRATION.md) before upgrading. To stay on 3.8
73
+ for now, pin it: `npm install -g mcp-ssh-manager@3`.
74
+
75
+ **From the engine to the application in one step.** With a V4 engine installed,
76
+ `ssh-manager app` downloads the desktop application of the engine's own version,
77
+ checks it against the release (size and SHA-256 from the release manifest, and
78
+ on macOS Apple's signature and notarization), installs it and opens it — or just
79
+ opens it when it is already there. The browser interface of `ssh-manager control`
80
+ offers the same as one button. Your agents keep using the npm engine; the
81
+ application is the window on top of it. Nothing is downloaded unless you ask.
82
+
83
+ **Without npm at all.** The application carries the engine too, and your AI
84
+ tools can start that one: *Options → AI tools* lists Claude Code, Claude Desktop
85
+ and Codex, says which ssh-manager each one starts (npm's, the application's, or
86
+ none yet) and switches it in one click — no Node, no terminal. The same tab, in
87
+ `ssh-manager control`, shows npm users which version each tool really runs.
88
+ A switch rewrites that tool's one `ssh-manager` entry, keeps its environment
89
+ variables, and takes effect when the tool next starts; switching back is the
90
+ same click.
91
+
92
+ **Updates.** The application checks for a new version at launch and every six
93
+ hours and says so where you will see it: a mark on the sidebar, *Options →
94
+ Updates* (the running version, the one on offer, a *Check now* button, release
95
+ notes) and, once per version, a notification. Downloading is a click, and
96
+ installing is a second one (*Restart to update*) or happens when you quit. The
97
+ npm engine updates with npm, on its own schedule. A change to the interface
98
+ reaches npm users with the next npm release and application users with the next
99
+ application release.
100
+
101
+ ## Up and running with npm
48
102
 
49
- | Mode | What the agent can do |
50
- |---|---|
51
- | `unrestricted` *(default)* | Everything. Same behaviour as any other SSH MCP server. |
52
- | `readonly` | Mutating tools are refused outright — no deploy, no upload, no sudo, no database import. Read commands still work. |
53
- | `restricted` | Every command must match an allow pattern **and** no deny pattern. Anything else is refused before it reaches the host. |
103
+ ```bash
104
+ npm install -g mcp-ssh-manager # or: brew tap bvisible/mcp-ssh-manager https://github.com/bvisible/mcp-ssh-manager && brew install ssh-manager
54
105
 
55
- ```env
56
- SSH_SERVER_PROD_MODE=readonly
57
- SSH_SERVER_STAGING_MODE=restricted
58
- SSH_SERVER_STAGING_ALLOW_PATTERNS=^systemctl (status|restart) myapp$;^tail -n \d+ /var/log/
106
+ ssh-manager server add # guided: host, user, key or password
107
+ claude mcp add ssh-manager mcp-ssh-manager
59
108
  ```
60
109
 
61
- Alongside that:
62
-
63
- - **The sudo password never reaches the remote command line.** It travels on the
64
- SSH channel's stdin, so it is not visible in `ps`, in `/proc/<pid>/cmdline`, or
65
- in an `auditd` trail — unlike the `echo "$pass" | sudo -S` pattern common in
66
- this category ([#34](https://github.com/bvisible/mcp-ssh-manager/issues/34)).
67
- - **Every database argument is shell-quoted** through one centralised helper,
68
- guarded by a 648-combination injection test.
69
- - **Read-only SQL is enforced**, not suggested: `ssh_db_query` refuses anything
70
- that is not a `SELECT`.
71
- - **Vulnerabilities are published, not buried.** See [SECURITY.md](SECURITY.md)
72
- for the reporting process and the advisories already fixed.
73
- - **Reproducible installs**: the lockfile is committed, CI installs with
74
- `npm ci`, and a test enforces that every dependency resolves to
75
- registry.npmjs.org with an integrity hash and no unreviewed install scripts.
76
-
77
- ---
78
-
79
- ## Previous Releases
110
+ That's it. Restart Claude Code and ask it something.
80
111
 
81
112
  <details>
82
- <summary><b>📜 Release history — v3.8.4 down to v1.0.0</b> (click to expand)</summary>
113
+ <summary>Using Codex, a source checkout, or a project-scoped install?</summary>
83
114
 
84
- ### v3.8.4 - Secrets stop reaching the log, CodeQL on every commit (August 28, 2026)
115
+ <br>
85
116
 
86
- - **🔒 The logger no longer writes secrets in clear text** — it writes to `~/.ssh-manager.log` and stderr (which your MCP host captures), so one call site handing it a server config would have persisted a production password. Redaction now happens inside the logger. Also: CodeQL on every push, every action pinned by SHA, and a broken example that never parsed. [Full changelog →](CHANGELOG.md#384---2026-08-28)
117
+ **OpenAI Codex** — same install, then two files. In `~/.codex/config.toml`:
87
118
 
88
- ### v3.8.2 / v3.8.3 - Sudo password leak fixed, MCP Registry, signed releases (August 28, 2026)
89
-
90
- - **🔒 The sudo password no longer reaches the remote command line** ([#34](https://github.com/bvisible/mcp-ssh-manager/issues/34)) — it travelled through `echo "<password>" | sudo -S`, readable in `ps` and `/proc/<pid>/cmdline` by every account on the host. It now goes over the SSH channel's stdin. Also: listed in the **official MCP Registry** as `io.github.bvisible/mcp-ssh-manager`, releases published from CI with **SLSA provenance** and a CycloneDX SBOM, and the per-server security modes documented at last. [Full changelog →](CHANGELOG.md#383---2026-08-28)
119
+ ```toml
120
+ [mcp_servers.ssh-manager]
121
+ command = "mcp-ssh-manager"
122
+ env = { SSH_CONFIG_PATH = "/Users/you/.codex/ssh-config.toml" }
123
+ startup_timeout_ms = 20000
124
+ ```
91
125
 
92
- ### v3.8.1 - Reproducible installs and blocking quality gates (August 28, 2026)
126
+ And your servers in `~/.codex/ssh-config.toml`:
93
127
 
94
- - **Committed lockfile** ([#60](https://github.com/bvisible/mcp-ssh-manager/pull/60) — contributed by [@cudatuda](https://github.com/cudatuda)) plus `npm run test:lockfile` guarding it against drift and tampering. CI installs with `npm ci`; ESLint and the JSDoc typecheck became blocking gates after being purely decorative. [Full changelog →](CHANGELOG.md#381---2026-08-28)
128
+ ```toml
129
+ [ssh_servers.production]
130
+ host = "prod.example.com"
131
+ user = "admin"
132
+ key_path = "~/.ssh/id_rsa"
133
+ default_dir = "/var/www"
134
+ group = "production"
135
+ ```
95
136
 
96
- ### v3.8.0 - Groups in your config, `ssh_sync` on Windows, tunnel crash fix (August 14, 2026)
137
+ Everything below works identically from Codex — same 37 tools, same config fields.
97
138
 
98
- - **👥 New optional `group` field per server** ([#56](https://github.com/bvisible/mcp-ssh-manager/pull/56) — contributed by [@ice616](https://github.com/ice616), requested in [#55](https://github.com/bvisible/mcp-ssh-manager/issues/55)) — tag a server with `group = "production"` and it *is* in that group: `ssh_execute_group` resolves members straight from your `.env`/TOML, union'd with any `.server-groups.json` you already keep. Also: `ssh_sync` fixed from a Windows host ([#59](https://github.com/bvisible/mcp-ssh-manager/pull/59) — contributed by [@2836603852](https://github.com/2836603852)), a tunnel on a busy port no longer takes the whole MCP server down, the `@modelcontextprotocol/sdk` floor raised to `^1.30.0` over three advisories, and JSDoc type-checking added to CI. [Full changelog →](CHANGELOG.md#380---2026-08-14)
139
+ **From source:**
99
140
 
100
- ### v3.7.0 - Per-server SSH agent forwarding (July 13, 2026)
141
+ ```bash
142
+ git clone https://github.com/bvisible/mcp-ssh-manager.git
143
+ cd mcp-ssh-manager && npm install
144
+ cd cli && ./install.sh
145
+ claude mcp add ssh-manager node /absolute/path/to/mcp-ssh-manager/src/index.js
146
+ ```
101
147
 
102
- - **🔗 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)) — the equivalent of OpenSSH's `ForwardAgent yes`, per server: processes on the remote host authenticate to *other* SSH hosts with the keys in your local `ssh-agent`, without copying any private key. Requires a running agent and defaults to `false`. [Full changelog →](CHANGELOG.md#370---2026-07-13)
148
+ The MCP engine needs no build. To use the interface (`ssh-manager control`) from a
149
+ checkout, build it once: `npm run build:ui` (the published package and the desktop
150
+ app already carry it).
103
151
 
104
- ### v3.6.7 - Security: command injection fix in the database helpers (July 11, 2026)
152
+ **Scopes** — `--scope project` writes an `.mcp.json` your team can commit; `--scope user` enables it everywhere for you.
105
153
 
106
- - **🔒 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)
154
+ **Prerequisites** — Node 18+, on Linux, macOS or Windows. `rsync` for `ssh_sync`, `sshpass` only if you sync with password auth (`brew install hudochenkov/sshpass/sshpass`, or `apt-get install sshpass`).
107
155
 
108
- ### v3.6.6 - `SUDO_PASSWORD` / `DEFAULT_DIR` / `ssh_sync` key auth work again (July 11, 2026)
156
+ </details>
109
157
 
110
- - **🔑 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)
158
+ ---
111
159
 
112
- ### v3.6.5 - `ssh_db_query` shell-injection security fix + real row_count (June 30, 2026)
160
+ ## Then just ask
113
161
 
114
- - **🔒 Queries are delivered on stdin via a single-quoted heredoc** ([#44](https://github.com/bvisible/mcp-ssh-manager/pull/44), [#45](https://github.com/bvisible/mcp-ssh-manager/pull/45) — thanks [@technophile77](https://github.com/technophile77)) — the remote shell no longer parses backticks/`$(…)` inside queries (which corrupted backtick identifiers **and** let the "SELECT-only" tool run arbitrary shell commands), and `row_count` now reflects each engine's real output instead of counting wrapper lines. [Full changelog →](CHANGELOG.md#365---2026-06-30)
162
+ No syntax to learn. Your assistant already knows how to use the 37 tools; you talk to it in your own words.
115
163
 
116
- ### v3.6.4 - Internal cleanup + a dead-code quality gate (June 18, 2026)
164
+ | You say | What happens |
165
+ |---|---|
166
+ | *"Why is production slow right now?"* | CPU, memory, disk, load average and the top processes, in one round trip |
167
+ | *"Back up the database before I deploy."* | A compressed, timestamped MySQL/PostgreSQL/MongoDB dump with a retention policy |
168
+ | *"Tail the nginx error log on staging."* | Live output, streamed as it happens |
169
+ | *"Push ./dist to production:/var/www and restart nginx."* | The files out, then the restart — with ownership, permissions and a rollback copy handled |
170
+ | *"Which of my servers is running out of disk?"* | Every server in the group, checked in parallel |
171
+ | *"Open a tunnel to the production database."* | Local port forward, so your GUI client just connects |
172
+ | *"Run `docker ps` on everything tagged production."* | One command, the whole group, sequential or parallel |
117
173
 
118
- - **🧹 Dead-code removal (−343 lines), zero behavioral change** — removed 27 unused exports and 2 duplicate exports; the MCP server and CLI behave identically (command builders/parsers byte-identical, all 37 tools verified end-to-end). A calibrated `knip.json` plus a **blocking** `knip` CI step keep unused code from creeping back. [Full changelog →](CHANGELOG.md#364---2026-06-18)
174
+ <p align="center">
175
+ <img src="docs/images/ssh-manager-cli-menu.png" alt="The ssh-manager CLI home screen: version, server count, configuration file and desktop app state above the menu" width="760">
176
+ </p>
119
177
 
120
- ### v3.6.3 - `ssh_sync` reports the real transfer count (June 18, 2026)
178
+ <p align="center">
179
+ <sub>There is a CLI too, for when you'd rather do it yourself: <code>ssh-manager</code> with no arguments opens this.</sub>
180
+ </p>
121
181
 
122
- - **📊 No more false "No files needed to be transferred"** ([#42](https://github.com/bvisible/mcp-ssh-manager/pull/42) — thanks [@MakksSh](https://github.com/MakksSh)) — fixed rsync `--stats` parsing: `--stats` is always passed now, and rsync 2.x/3.x wording, openrsync's `B` suffix, and locale separators are all handled. [Full changelog →](CHANGELOG.md#363---2026-06-18)
182
+ ---
123
183
 
124
- ### v3.6.2 - Richer tool descriptions (June 9, 2026)
184
+ ## Watch over its shoulder — the control plane
125
185
 
126
- - **📝 All 37 tool descriptions rewritten** — every MCP tool now documents its real behavior (side effects, destructive vs read-only nature, idempotency, sudo/auth requirements, security-mode gating, parameter semantics) instead of a 4-to-10-word summary. Agents now know the consequences before invoking a tool; no behavioral change — only `description` strings changed. [Full changelog →](CHANGELOG.md#362---2026-06-09)
186
+ > **New in 4.0.0.** The application is opt-in: with no vault and no approval enabled, the engine keeps working headlessly, exactly as 3.8.x. See the [migration guide](docs/MIGRATION.md) for host-key verification and recovery behaviour.
127
187
 
128
- ### v3.6.1 - Teardown hygiene follow-up (June 9, 2026)
188
+ ```bash
189
+ ssh-manager control # prints a local URL — or `ssh-manager app` for the desktop app
190
+ ```
129
191
 
130
- - **🔌 Module-level timers no longer pin the event loop** (follow-up to [#41](https://github.com/bvisible/mcp-ssh-manager/pull/41)) — `tunnel-manager.js` and `session-manager.js` registered module-level `setInterval`s that were never `unref()`'d, so importing either module kept Node's event loop alive. Both are now `unref()`'d. [Full changelog →](CHANGELOG.md#361---2026-06-09)
192
+ One thing in two wrappers. `ssh-manager control` runs the whole interface in a browser tab with nothing extra to install; the desktop builds for macOS, Windows and Linux are that same page with the engine inside them, so they need neither Node nor the npm package.
131
193
 
132
- ### v3.6.0 - Live config hot reload + stdio lifecycle fix (June 9, 2026)
194
+ The desktop build adds the two things a browser tab cannot do:
133
195
 
134
- - **♻️ Configuration hot reload** ([#40](https://github.com/bvisible/mcp-ssh-manager/pull/40) — thanks [@EnjoySR](https://github.com/EnjoySR)) — add or edit a server in your `.env`/TOML and the running MCP server picks it up on the next call, no restart. A `ServerConfigManager` reloads lazily on file-signature change (path + `mtime` + size); a failed reload keeps the last known-good config; real `process.env` vars keep top priority. No watcher, no polling.
135
- - **🔌 No more orphaned stdio processes** ([#41](https://github.com/bvisible/mcp-ssh-manager/pull/41) — thanks [@LegendaryGatz](https://github.com/LegendaryGatz)) — a stdio MCP server is torn down by stdin EOF / SIGTERM, not SIGINT; with only a `SIGINT` handler every session leaked a ~83 MB node process. Shutdown is now idempotent across `SIGINT`/`SIGTERM`/`SIGHUP`/stdin-close, timers are `unref()`'d, and the process exits **~10 ms** after teardown instead of never. [Full changelog →](CHANGELOG.md#360---2026-06-09)
196
+ - **It lives in the menu bar.** The icon carries a count when something is waiting, and its menu lists what is blocked on you, which shells and commands are open right now, and your servers — so "is anything waiting on me?" costs a glance instead of a window switch. Closing the window leaves it there rather than quitting.
197
+ - **It posts real system notifications**, with the application's own identity, so macOS and Windows show and route them properly. Destructive requests stay on screen instead of fading after four seconds. macOS asks your permission the first time it needs to.
136
198
 
137
- ### v3.5.1 - Robust SSH ping health-check on Windows/OpenSSH (May 26, 2026)
199
+ <p align="center">
200
+ <img src="docs/images/v4-servers-browser.png" alt="The interface in a browser tab, served by ssh-manager control" width="820">
201
+ </p>
138
202
 
139
- - **🪟 Healthy Windows sessions no longer reported as `Dead`** ([#39](https://github.com/bvisible/mcp-ssh-manager/pull/39) — thanks [@username77](https://github.com/username77)) — the liveness probe ran `echo "ping"` and `cmd.exe` echoed the quotes literally, failing a strict `=== 'ping'` check and needlessly rebuilding live connections. Now uses `echo ping` parsed by a null-safe `isPingAlive(stdout)` helper (CRLF/quote/case-normalized), covered by `tests/test-ssh-ping.js`. [Full changelog →](CHANGELOG.md#351---2026-05-26)
203
+ ### Stop it before it runs
140
204
 
141
- ### v3.5.0 - Per-server security modes — `readonly` / `restricted` + audit log (May 18, 2026)
205
+ <p align="center">
206
+ <img src="docs/images/v4-waiting-app.png" alt="The Waiting screen: a destructive command from an agent, with Refuse and Approve" width="900">
207
+ </p>
142
208
 
143
- A second authorization layer that filters tool invocations **inside the MCP server**, complementing the existing client-side `autoApprove`. Useful when sharing the MCP with a third-party agent, a CI bot, or any client where `ssh_execute` shouldn't be unconditionally trusted.
209
+ The agent pauses and waits. You see the machine, the user, the tool, and the command **in full** — wrapped, never truncated, because half a command is how you approve the wrong thing. A desktop notification fires when something is waiting, because the request that goes unseen is the one that times out and is denied.
144
210
 
145
- - **🔒 Three modes, opt-in per server** (no `MODE` field = identical to v3.4.x):
146
- - **`unrestricted`** (default) — strict no-op. `evaluatePolicy()` early-returns on the first line, zero overhead.
147
- - **`readonly`** — blocks mutating tools (`ssh_upload`, `ssh_deploy`, `ssh_sync`, `ssh_execute_sudo`, `ssh_backup_*`, `ssh_db_import/dump`, plus action-gated `ssh_key_manage accept|remove`, `ssh_alert_setup set`, `ssh_process_manager kill`) AND applies a built-in denylist on `ssh_execute` (rm, mv, dd, mkfs, chmod, chown, sudo, systemctl restart/stop, docker rm/stop, pipe-to-sh, redirect outside `/tmp`, curl|sh, etc.).
148
- - **`restricted`** — every command must match at least one `ALLOW_PATTERNS` regex AND no `DENY_PATTERNS` regex. **DENY wins**. With no `ALLOW_PATTERNS` everything is refused (fail-closed).
149
- - **📝 Audit log** — opt-in JSONL per server (`SSH_SERVER_<N>_AUDIT_LOG=/path/to/audit.jsonl`). Records `ts`, `server`, `tool`, args, `allowed`, `reason` on denial, `exitCode`/`success` on execution. Sensitive arg fields (`password`, `passphrase`, `sudoPassword`, `token`, `secret`, `apikey`) are replaced with `***`.
150
- - **🪄 Command aliases expanded BEFORE policy evaluation** — a `DENY` pattern can't be bypassed via an alias.
151
- - **♻️ Backward-compatible by design** — a v3.4.x `.env` or TOML loads identically. No `MODE` field → zero behavior change. The interactive wizard (`ssh-manager server add`) defaults all three new prompts to skip. All 13 pre-existing tests pass unmodified. New `tests/test-policy.js` adds 26 tests covering modes, DENY > ALLOW precedence, invalid-regex handling, redaction, and the backward-compat fast path. [Full reference →](docs/SECURITY_MODES.md)
211
+ Approval is switched on **from the interface, per server** — not from a file:
152
212
 
153
- ### v3.4.1 - Modern OpenSSH 9.x compatibility (May 16, 2026)
213
+ ```
214
+ Servers → the server → Approval → never (default) | destructive | always
215
+ ```
154
216
 
155
- - **🔐 Expanded SSH algorithm list — handshake against OpenSSH 9.x out of the box** ([#32](https://github.com/bvisible/mcp-ssh-manager/pull/32))
156
- - **KEX**: `curve25519-sha256` (+`@libssh.org`), `diffie-hellman-group15-sha512`, `diffie-hellman-group16-sha512`
157
- - **Server host key**: `rsa-sha2-512`, `rsa-sha2-256` (RFC 8332)
158
- - **Cipher**: `aes128-gcm@openssh.com`, `aes256-gcm@openssh.com`
159
- - **HMAC**: `hmac-sha2-256-etm@openssh.com`, `hmac-sha2-512-etm@openssh.com`, `hmac-sha1-etm@openssh.com`
160
- - Backward-compatible — legacy algorithms preserved at lower preference, older servers (CentOS 7, Debian 10) keep working. Thanks [@YoungHong1992](https://github.com/YoungHong1992).
217
+ Approval is stored in the vault and cannot be overridden by `.env` or process
218
+ variables. Editing connection details preserves it. This prevents accidental
219
+ configuration overrides from disabling the gate; it is not a security boundary
220
+ against a process that already controls your local user account or vault files.
221
+ If you had `SSH_SERVER_*_APPROVAL` set in a file, the engine says
222
+ so on every start rather than quietly leaving you unprotected.
161
223
 
162
- ### v3.4.0 - Windows OpenSSH support + shell-agnostic session sync (May 7, 2026)
224
+ The `destructive` list is deliberately short. A prompt that cries wolf gets clicked through without being read, which is worse than no prompt at all: `systemctl restart` does not interrupt you, `systemctl stop` does.
163
225
 
164
- - **🪟 Windows OpenSSH encoding & syntax fixes** — UTF-16LE base64 PowerShell payloads (Ansible-style) + `Set-Location` replacing `cd && ` ([#31](https://github.com/bvisible/mcp-ssh-manager/pull/31), thanks [@WenKingSu](https://github.com/WenKingSu))
165
- - **🎯 Marker-based SSH session sync** — UUID v4 protocol boundaries with `ECHO: 0` PTY, real `$?` exit codes, no more "Timeout waiting for shell prompt" on custom/slow/AIX shells ([#30](https://github.com/bvisible/mcp-ssh-manager/pull/30), thanks [@MakksSh](https://github.com/MakksSh))
226
+ When a request requires approval, a timeout, unreachable socket or disconnected control plane denies it. If nothing is listening, start `ssh-manager control` or the desktop app before retrying. Servers with approval disabled keep working headlessly.
166
227
 
167
- ### v3.3.0 - ProxyCommand & Critical Fixes (May 2, 2026)
228
+ ### See what it's doing, while it does it
168
229
 
169
- - **🔌 ProxyCommand support** for SOCKS5 / custom proxy commands ([#24](https://github.com/bvisible/mcp-ssh-manager/pull/24))
170
- - **⏱️ `ssh_execute` timeout silently capped at 30 s** — fixed ([#28](https://github.com/bvisible/mcp-ssh-manager/issues/28), [#29](https://github.com/bvisible/mcp-ssh-manager/pull/29))
171
- - **🪟 Windows global install `/bin/bash` shim error** — fixed ([#22](https://github.com/bvisible/mcp-ssh-manager/issues/22), [#23](https://github.com/bvisible/mcp-ssh-manager/pull/23))
172
- - **🔧 `server add` blocked by missing `rsync`** — `rsync` now optional ([#26](https://github.com/bvisible/mcp-ssh-manager/pull/26))
173
- - **🔡 Hyphenated server names silently dropped** — validation hardened ([#25](https://github.com/bvisible/mcp-ssh-manager/issues/25), [#27](https://github.com/bvisible/mcp-ssh-manager/pull/27))
230
+ <p align="center">
231
+ <img src="docs/images/v4-live-app.png" alt="The Live screen: a command still running, expanded to show its coloured output" width="900">
232
+ </p>
174
233
 
175
- ### v3.2.2 - Global Install Fix & CLI Binary (April 7, 2026)
234
+ Output goes through a terminal emulator, not a `<pre>` tag — what your agent ran looks exactly like what you'd have seen had you typed it yourself, colours and all. Each stream keeps a bounded scrollback, so opening the screen mid-command shows what came before instead of starting blank.
176
235
 
177
- - **🔧 Global install fixed**: `.env` path resolution now uses a fallback chain instead of hardcoded `__dirname` — works correctly with `npm install -g` ([#16](https://github.com/bvisible/mcp-ssh-manager/issues/16), [#19](https://github.com/bvisible/mcp-ssh-manager/issues/19))
178
- - Fallback chain: `~/.ssh-manager/.env` → `cwd/.env` → `~/.env` → project `.env`
179
- - Auto-creates `~/.ssh-manager/.env` on first `ssh-manager server add`
180
- - **📦 `ssh-manager` CLI registered as binary**: `npm install -g` now creates both `mcp-ssh-manager` and `ssh-manager` commands ([#18](https://github.com/bvisible/mcp-ssh-manager/issues/18))
181
- - **⚡ Race condition fix**: Server config is now fully loaded before the MCP server accepts requests
236
+ **Nothing here touches the disk.** A stream can carry secrets — a config being catted, a token echoed by a deploy script — so it lives in memory, capped, and disappears with the window.
182
237
 
183
- ### v3.2.0 - ProxyJump / Bastion Host Support (March 18, 2026)
238
+ ### Both filesystems, side by side
184
239
 
185
- - **🔀 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))
186
- - Chain multiple jumps (A → B → C) via recursive connections
187
- - Circular dependency detection prevents infinite loops
188
- - All tools work transparently through jump hosts
189
- - **📦 npx support fixed**: `npx mcp-ssh-manager` now works correctly ([#14](https://github.com/bvisible/mcp-ssh-manager/issues/14))
240
+ <p align="center">
241
+ <img src="docs/images/v4-files-app.png" alt="The file browser: this machine on the left, a server on the right" width="900">
242
+ </p>
190
243
 
191
- ### v3.1.5 - SSH Agent & Passphrase Support (March 5, 2026)
244
+ Drag a file across and it moves directly between your machine and the server through the control plane. The browser never holds the bytes — which is faster, and the only way a multi-gigabyte file works at all.
192
245
 
193
- - **🔑 SSH Agent support**: Automatically uses `ssh-agent` when `SSH_AUTH_SOCK` is available — passphrase-protected keys work transparently
194
- - **🔐 Passphrase configuration**: New `passphrase` field for both `.env` and TOML formats
246
+ ### Health, when you ask for it
195
247
 
196
- Thanks to [@snjax](https://github.com/snjax) for the original contribution ([#12](https://github.com/bvisible/mcp-ssh-manager/pull/12)).
248
+ <p align="center">
249
+ <img src="docs/images/v4-health-app.png" alt="The Health screen: CPU, memory and disk per server, with a threshold crossed" width="900">
250
+ </p>
197
251
 
198
- ### v3.1.4 - Windows SSH Host Support (February 22, 2026)
252
+ **Nothing is probed in the background.** Each check is an SSH handshake, and a dashboard that connects to every production box on a timer is worse than no dashboard. The button is the whole scheduling policy. Thresholds are yours to set, and crossing one is said in words rather than encoded in a colour.
199
253
 
200
- - **🪟 Windows SSH host fix**: Commands no longer fail on Windows hosts running OpenSSH ([#10](https://github.com/bvisible/mcp-ssh-manager/issues/10))
201
- - New per-server `platform` config field (`SSH_SERVER_FOO_PLATFORM=windows` or `platform = "windows"` in TOML)
202
- - When `platform=windows`, the Linux `timeout`/`sh -c` command wrapper is skipped and the SSH library's native timeout is used instead
203
- - All tools (`ssh_execute`, `ssh_tail`, `ssh_monitor`, `ssh_deploy`, `ssh_execute_sudo`, `ssh_group_execute`) are platform-aware
254
+ ### A shell on any machine
204
255
 
205
- ### v3.1.2 - Windows Compatibility Fix (February 9, 2026)
256
+ <p align="center">
257
+ <img src="docs/images/v4-terminal-app.png" alt="The Terminal screen: pick a machine to open a shell on, or manage the commands you keep retyping" width="900">
258
+ </p>
206
259
 
207
- - **🪟 Windows support**: Fixed crash on Windows where `process.env.HOME` is undefined ([#8](https://github.com/bvisible/mcp-ssh-manager/issues/8))
208
- - Now uses `os.homedir()` for cross-platform compatibility (Linux, macOS, Windows)
260
+ Pick a machine, get a shell — the same one an agent gets, with your keyboard on
261
+ it. Useful for the ordinary reasons, and for the one people ask about most:
262
+ running an agent *on* the server rather than pointing one at it.
209
263
 
210
- ### v3.1.0 - Tool Activation System (November 15, 2025)
264
+ **Including this machine.** The desktop application opens a shell on your own
265
+ computer too, with your login shell and everything you have configured in it, so
266
+ you are not switching to a different window to run the local half of the same
267
+ job. Open as many as you like, on any mix of machines: each is a tab across the
268
+ top and an entry in the rail, and switching away leaves it running.
211
269
 
212
- ### 🎯 Context Usage Optimization
213
- - **92% context reduction**: Enable only the tools you need (minimal mode: 5 tools vs all 37)
214
- - **Tool management CLI**: `ssh-manager tools list/configure/enable/disable`
215
- - **6 tool groups**: Core, Sessions, Monitoring, Backup, Database, Advanced
216
- - **Auto-approval export**: Generate Claude Code auto-approval configs
270
+ Beside it, the commands you would rather not retype, saved per server or for all
271
+ of them, and picked from a list inside any shell.
217
272
 
218
- ### v3.0.0 - Enterprise DevOps Platform (October 1, 2025)
273
+ ### And the rest of it
219
274
 
220
- This release adds **12 new MCP tools** transforming SSH Manager into a comprehensive DevOps automation platform:
275
+ <p align="center">
276
+ <img src="docs/images/v4-servers-app.png" alt="The Servers screen: cards grouped by category" width="900">
277
+ </p>
221
278
 
222
- ### 💾 Backup & Restore System (4 tools)
223
- - **Automated backups** for MySQL, PostgreSQL, MongoDB, and file systems
224
- - **Smart scheduling** with cron integration and retention policies
225
- - **One-click restore** with cross-database support
226
- - **Metadata tracking** for audit and compliance
279
+ On the same page: an interactive shell on any server, saved commands you pick from a list instead of retyping, groups you can run one command across, the audit trail of what agents ran and what you decided, and your known host keys.
227
280
 
228
- ### 🏥 Health & Monitoring (4 tools)
229
- - **Real-time health checks** with CPU, RAM, Disk, and Network metrics
230
- - **Service monitoring** for nginx, mysql, docker, and custom services
231
- - **Process management** with CPU/RAM sorting and kill capabilities
232
- - **Alert thresholds** with configurable notifications
281
+ Every screenshot above is the desktop build; each has a browser twin in [`docs/images/`](docs/images/). See [ROADMAP-V4.md](ROADMAP-V4.md) for what is built and what isn't.
233
282
 
234
- ### 🗄️ Database Management (4 tools)
235
- - **Safe database dumps** with compression and selective exports
236
- - **Database imports** with automatic decompression
237
- - **Schema exploration** listing databases, tables, and collections
238
- - **Secure queries** with SQL injection prevention (SELECT-only)
283
+ ---
239
284
 
240
- **📊 Total: 37 MCP Tools** | **🔧 ~4,100 Lines of Code Added** | **✅ Production Ready**
285
+ ## Safe by default
241
286
 
242
- [Read Full Changelog →](CHANGELOG.md#300---2025-10-01)
287
+ Other SSH MCP servers hand the agent a shell and wish you luck. This one assumes you'd like some say in the matter.
243
288
 
244
- </details>
289
+ ### Decide how far it can go — per server
245
290
 
246
- ---
291
+ | Mode | What the agent can do |
292
+ |---|---|
293
+ | `unrestricted` *(default)* | Everything. Same as any other SSH MCP server, zero overhead. |
294
+ | `readonly` | Mutating tools are refused outright — no deploy, no upload, no sudo, no database import. Reads still work. |
295
+ | `restricted` | Every command must match an allow pattern **and** no deny pattern. Anything else is refused before it reaches the host. |
247
296
 
248
- ## 📑 Table of Contents
249
-
250
- - [Features](#-features)
251
- - [Tool Management](#-tool-management--context-optimization)
252
- - [Prerequisites](#-prerequisites)
253
- - [Quick Start - Claude Code](#-quick-start---claude-code)
254
- - [Quick Start - OpenAI Codex](#-quick-start---openai-codex)
255
- - [Available MCP Tools](#-available-mcp-tools)
256
- - [Configuration](#-configuration)
257
- - [Usage Examples](#-usage-examples)
258
- - [Security](#-security-best-practices)
259
- - [Troubleshooting](#-troubleshooting)
260
- - [Known Limitations](#known-limitations)
261
- - [Contributing](#-contributing)
262
- - [License](#-license)
297
+ ```env
298
+ SSH_SERVER_PROD_MODE=readonly
299
+ SSH_SERVER_STAGING_MODE=restricted
300
+ SSH_SERVER_STAGING_ALLOW_PATTERNS=^systemctl (status|restart) myapp$;^tail -n \d+ /var/log/
301
+ SSH_SERVER_PROD_AUDIT_LOG=~/.ssh-manager/audit.jsonl
302
+ ```
263
303
 
264
- ---
304
+ This is a second layer under Claude Code's `autoApprove`, which is all-or-nothing per tool: once `ssh_execute` is approved, anything goes. Useful when you're sharing the MCP with a third-party agent, a CI bot, or working on a client's machine. Full reference in **[docs/SECURITY_MODES.md](docs/SECURITY_MODES.md)**.
265
305
 
266
- ## 🌟 Features
267
-
268
- ### Core Features
269
- - **🔗 Multiple SSH Connections** - Manage unlimited SSH servers from a single interface
270
- - **🔐 Secure Authentication** - Support for password, SSH key, and ssh-agent authentication (including passphrase-protected keys)
271
- - **🔀 ProxyJump / Bastion Host** - Connect to servers behind jump hosts with chained multi-hop support
272
- - **🔌 ProxyCommand / Custom Proxy** - Connect through SOCKS5 proxies or custom proxy commands (ncat, ssh -W, etc.)
273
- - **📁 File Operations** - Upload and download files between local and remote systems
274
- - **⚡ Command Execution** - Run commands on remote servers with working directory support
275
- - **📂 Default Directories** - Set default working directories per server for convenience
276
- - **🎯 Easy Configuration** - Simple `.env` file setup with guided configuration tool
277
-
278
- ### Enterprise DevOps Features (v3.0) 🎉
279
- - **💾 Backup & Restore** - Automated backups for MySQL, PostgreSQL, MongoDB, and files
280
- - **🏥 Health Monitoring** - Real-time server health checks (CPU, RAM, Disk, Services)
281
- - **🗄️ Database Management** - Safe database operations with SQL injection prevention
282
- - **📊 Process Management** - Monitor and control server processes
283
- - **⚠️ Smart Alerts** - Configurable health thresholds and notifications
284
-
285
- ### v2.0 Features
286
- - **🚀 Bash CLI** - Lightning-fast pure Bash CLI for server management
287
- - **📊 Advanced Logging** - Comprehensive logging system with levels and history
288
- - **🔄 Rsync Integration** - Bidirectional file sync with rsync support
289
- - **💻 Persistent Sessions** - Maintain shell context across multiple commands
290
- - **👥 Server Groups** - Execute commands on multiple servers simultaneously
291
- - **🔧 SSH Tunnels** - Local/remote port forwarding and SOCKS proxy support
292
- - **📈 System Monitoring** - Real-time monitoring of CPU, memory, disk, and network
293
- - **🏷️ Server Aliases** - Use short aliases instead of full server names
294
- - **🚀 Smart Deployment** - Automated file deployment with permission handling
295
- - **🔑 Sudo Support** - Execute commands with sudo privileges securely
296
- - **📝 OpenAI Codex Support** - Compatible with OpenAI Codex via TOML configuration
306
+ ### Credentials out of the clear-text `.env`
297
307
 
298
- ---
308
+ ```bash
309
+ ssh-manager vault import # take what you already have, encrypted
310
+ ssh-manager vault list # see it, without ever printing a secret
311
+ ssh-manager vault add prod # add one interactively
312
+ ssh-manager vault backup FILE # a copy that survives a new machine
313
+ ```
299
314
 
300
- ## ⚙️ Tool Management & Context Optimization
315
+ AES-256-GCM, master key in your OS keychain (a `0600` file where there is none — Windows, CI, containers). Only secret *values* are encrypted: hosts, users and modes stay readable, so the file can still be inspected and diffed. GCM is authenticated, so a tampered vault fails loudly instead of handing a wrong password to a production server.
301
316
 
302
- **NEW in v3.1**: Reduce Claude Code context usage by 92% with tool activation management!
317
+ **The key belongs to this machine.** A vault copied to a new laptop is ciphertext nobody can open — `vault backup` writes a copy encrypted under a passphrase you choose, which is what makes the move survivable. Your `.env` is never modified, not by `import`, not by the interface, and a setup half in each is a normal state rather than a broken one. Upgrading changes nothing on its own: see **[docs/MIGRATION.md](docs/MIGRATION.md)**.
303
318
 
304
- MCP SSH Manager includes **37 tools** organized into **6 groups**. By default, all tools are enabled, but you can optimize for your specific workflow:
319
+ ### The unglamorous parts, which are the ones that bite
305
320
 
306
- ### Quick Setup
321
+ - **Your sudo password never reaches the remote command line.** It travels on the SSH channel's stdin, so it isn't visible in `ps`, in `/proc/<pid>/cmdline`, or in an `auditd` trail — unlike the `echo "$pass" | sudo -S` pattern common in this category ([#34](https://github.com/bvisible/mcp-ssh-manager/issues/34)).
322
+ - **Every shell argument is quoted** through one central helper, with a test that drives **340 builder × argument × payload combinations** through a real shell to prove none of them execute.
323
+ - **Read-only SQL is enforced, not suggested.** `ssh_db_query` refuses anything that isn't a `SELECT`.
324
+ - **Vulnerabilities are published, not buried.** [SECURITY.md](SECURITY.md) has the reporting process and every advisory already fixed — including the six in v3.8.6, among them a command injection on the machine running the server, triggered by any SSH server it connects to.
325
+ - **Reproducible installs.** The lockfile is committed, CI installs with `npm ci`, and a test enforces that every dependency resolves to registry.npmjs.org with an integrity hash and no unreviewed install scripts.
307
326
 
308
- ```bash
309
- # Interactive configuration wizard
310
- ssh-manager tools configure
327
+ ---
311
328
 
312
- # View current configuration
313
- ssh-manager tools list
329
+ ## Questions people ask
314
330
 
315
- # Enable/disable specific groups
316
- ssh-manager tools enable monitoring
317
- ssh-manager tools disable backup
318
- ```
331
+ **Can I let an AI agent SSH into my servers safely?**
332
+ Yes, if you decide how far it can go. Per server you can make it read-only, allow only commands that match a pattern, or hold every request (or only the destructive ones) until you approve it in the control plane; credentials can live in an encrypted vault instead of a clear-text `.env`; and every command and decision is logged. See [Safe by default](#safe-by-default).
319
333
 
320
- ### Configuration Modes
334
+ **How do I use Claude Code or Codex with SSH?**
335
+ `npm install -g mcp-ssh-manager`, add a server with `ssh-manager server add`, then `claude mcp add ssh-manager mcp-ssh-manager`. Codex is [set up here](#up-and-running-with-npm). Then ask in plain words: *"why is production slow?"*, *"tail the nginx error log on staging"*.
321
336
 
322
- | Mode | Tools | Context Usage | Best For |
323
- |------|-------|---------------|----------|
324
- | **All** (default) | 37 tools | ~43.5k tokens | Full feature set, most users |
325
- | **Minimal** | 5 tools | ~3.5k tokens | Basic SSH operations only |
326
- | **Custom** | 5-37 tools | Varies | Tailored to your workflow |
337
+ **Does it work with Cursor, Windsurf, Cline or another MCP client?**
338
+ It is a standard stdio MCP server, so any MCP client can run it. Claude Code, Claude Desktop and Codex are the clients documented and tested here. For another one, add what it expects, for example:
327
339
 
328
- ### Tool Groups
340
+ ```json
341
+ { "mcpServers": { "ssh-manager": { "command": "npx", "args": ["-y", "mcp-ssh-manager"] } } }
342
+ ```
329
343
 
330
- - **Core** (5 tools) - Always enabled: list, execute, upload, download, sync
331
- - **Sessions** (4 tools) - Persistent SSH sessions
332
- - **Monitoring** (6 tools) - Health checks, service status, process management
333
- - **Backup** (4 tools) - Database and file backups
334
- - **Database** (4 tools) - MySQL, PostgreSQL, MongoDB operations
335
- - **Advanced** (14 tools) - Deployment, sudo, tunnels, groups, aliases, etc.
344
+ **Do I need Node.js?**
345
+ With npm, yes (Node 18 or later). The desktop application carries its own runtime and engine: install it and connect your AI tools from *Options → AI tools*, with no Node and no npm.
336
346
 
337
- ### Benefits
347
+ **How is this different from other SSH MCP servers?**
348
+ Most hand the agent a shell. This one lets you choose per server how far it goes, can hold requests until you approve them, keeps an audit trail, and has a desktop app and a browser interface to see it all. It also runs without any of that, as a plain engine configured from a `.env` or a TOML file, if that is what you want.
338
349
 
339
- - **92% context reduction** in minimal mode (~40k tokens saved)
340
- - **Fewer approval prompts** in Claude Code
341
- - **Faster loading** and cleaner interface
342
- - **Auto-approval configuration** export for Claude Code
350
+ **Where are my passwords and keys kept?**
351
+ Key files stay where they are. Saved passwords and passphrases can go into the encrypted vault (AES-256-GCM, with the key in your operating system's keychain) rather than a `.env`.
343
352
 
344
- 📖 [**Complete Tool Management Guide →**](docs/TOOL_MANAGEMENT.md)
353
+ **Is it free?**
354
+ Yes, it is MIT-licensed. The source is here, the package is on [npm](https://www.npmjs.com/package/mcp-ssh-manager) and the desktop apps are on the [releases page](https://github.com/bvisible/mcp-ssh-manager/releases).
345
355
 
346
356
  ---
347
357
 
348
- ## 📋 Prerequisites
349
-
350
- - Node.js (v18 or higher)
351
- - npm (comes with Node.js)
352
- - **Platforms**: Linux, macOS, Windows
353
- - **For Claude Code**: Claude Code CLI installed
354
- - **For OpenAI Codex**: Codex CLI configured
355
- - Bash 4.0+ (for CLI management tools)
356
- - rsync (for file synchronization)
357
- - sshpass (optional, for rsync with password authentication)
358
- - macOS: `brew install hudochenkov/sshpass/sshpass`
359
- - Linux: `apt-get install sshpass`
358
+ ## Reference
360
359
 
361
- ## 🚀 Quick Start - Claude Code
362
-
363
- ### 1. Install MCP SSH Manager
364
-
365
- **Option A: Install from npm (recommended)**
360
+ <details>
361
+ <summary><b>All 37 tools</b></summary>
366
362
 
367
- ```bash
368
- # Install globally from npm
369
- npm install -g mcp-ssh-manager
363
+ <br>
370
364
 
371
- # Or install locally
372
- npx mcp-ssh-manager
373
- ```
365
+ **Core** — always enabled
374
366
 
375
- **Option B: Install from source**
367
+ | Tool | What it does |
368
+ |---|---|
369
+ | `ssh_list_servers` | Every configured server, with its group and mode |
370
+ | `ssh_execute` | Run a command. Falls back to the server's `DEFAULT_DIR` when no `cwd` is given |
371
+ | `ssh_upload` / `ssh_download` | Move a single file either way |
372
+ | `ssh_sync` | Bidirectional rsync, with real transfer counts |
376
373
 
377
- ```bash
378
- # Clone and install
379
- git clone https://github.com/bvisible/mcp-ssh-manager.git
380
- cd mcp-ssh-manager
381
- npm install
374
+ **Backup & restore** (v2.1+)
382
375
 
383
- # Install the Bash CLI
384
- cd cli && ./install.sh
376
+ | Tool | What it does |
377
+ |---|---|
378
+ | `ssh_backup_create` | MySQL, PostgreSQL, MongoDB or files — compressed, with metadata and retention |
379
+ | `ssh_backup_list` | Everything available, with size, date and retention |
380
+ | `ssh_backup_restore` | Restore one, including across databases |
381
+ | `ssh_backup_schedule` | Put it on cron, with automatic cleanup |
385
382
 
386
- # Configure your first server
387
- ssh-manager server add
388
- ```
383
+ See the [Backup Guide](docs/BACKUP_GUIDE.md) and [examples/backup-workflow.md](examples/backup-workflow.md).
389
384
 
390
- ### 2. Install to Claude Code
385
+ **Health & monitoring** (v2.2+)
391
386
 
392
- ```bash
393
- # For personal use (current user only)
394
- claude mcp add ssh-manager node /path/to/mcp-ssh-manager/src/index.js
387
+ | Tool | What it does |
388
+ |---|---|
389
+ | `ssh_health_check` | CPU, memory, disk, network, uptime, load — with an overall verdict |
390
+ | `ssh_service_status` | nginx, mysql, docker… on systemd or sysv |
391
+ | `ssh_process_manager` | List, inspect or kill; sort by CPU or memory |
392
+ | `ssh_alert_setup` | Thresholds, and what happens when one is crossed |
393
+ | `ssh_monitor`, `ssh_tail` | Live resource monitoring and log following |
395
394
 
396
- # For team sharing (creates .mcp.json in project)
397
- claude mcp add ssh-manager --scope project node /path/to/mcp-ssh-manager/src/index.js
395
+ **Databases** (v2.3+)
398
396
 
399
- # For all your projects
400
- claude mcp add ssh-manager --scope user node /path/to/mcp-ssh-manager/src/index.js
401
- ```
397
+ | Tool | What it does |
398
+ |---|---|
399
+ | `ssh_db_dump` | MySQL, PostgreSQL, MongoDB; optional gzip, optional table subset |
400
+ | `ssh_db_import` | Import a dump, `.gz` handled automatically |
401
+ | `ssh_db_list` | Databases, or the tables inside one |
402
+ | `ssh_db_query` | **`SELECT` only** — enforced, not suggested |
402
403
 
403
- ### 3. Configure Auto-Approval (Optional but Recommended)
404
+ **Deployment & sessions**
404
405
 
405
- To avoid being prompted for approval on every SSH command, add auto-approve configuration:
406
+ | Tool | What it does |
407
+ |---|---|
408
+ | `ssh_deploy` | Files out, with permissions, backup and restart handled — see the [Deployment Guide](docs/DEPLOYMENT_GUIDE.md) |
409
+ | `ssh_execute_sudo` | Sudo, with the password on stdin rather than the command line |
410
+ | `ssh_session_*` | Persistent shells that keep their context between commands |
411
+ | `ssh_tunnel_*` | Local, remote and SOCKS forwarding |
406
412
 
407
- Edit `~/.config/claude-code/claude_code_config.json`:
413
+ **Organisation**
408
414
 
409
- ```json
410
- {
411
- "mcpServers": {
412
- "ssh-manager": {
413
- "command": "node",
414
- "args": ["/path/to/mcp-ssh-manager/src/index.js"],
415
- "autoApprove": [
416
- "mcp__ssh-manager__ssh_execute",
417
- "mcp__ssh-manager__ssh_list_servers",
418
- "mcp__ssh-manager__ssh_upload",
419
- "mcp__ssh-manager__ssh_download",
420
- "mcp__ssh-manager__ssh_sync",
421
- "mcp__ssh-manager__ssh_alias"
422
- ]
423
- }
424
- }
425
- }
426
- ```
415
+ | Tool | What it does |
416
+ |---|---|
417
+ | `ssh_alias` | Short names for servers |
418
+ | `ssh_command_alias` | Short names for commands you keep retyping |
419
+ | `ssh_group_*`, `ssh_execute_group` | Run one thing across many machines |
420
+ | `ssh_hooks` | Automation hooks around SSH operations — see [Aliases and Hooks](docs/ALIASES_AND_HOOKS.md) |
421
+ | `ssh_profile` | Swap whole sets of aliases and hooks — `default`, `frappe`, `docker`, `nodejs`, or your own |
427
422
 
428
- **Important**: Restart Claude Code after making this change.
423
+ </details>
429
424
 
430
- For full auto-approval of all SSH tools, see the complete list in [examples/claude-code-config.example.json](examples/claude-code-config.example.json).
425
+ <details>
426
+ <summary><b>Spending less context — tool groups</b></summary>
431
427
 
432
- ### 3.5. Security Modes (Optional, v3.5.0+)
428
+ <br>
433
429
 
434
- `autoApprove` is all-or-nothing per tool: once `ssh_execute` is approved, anything goes. If you want a **second layer** that filters what the MCP server actually accepts to run — useful when sharing the MCP with a third-party agent, a CI bot, or a client's server — declare a per-server **security mode**.
430
+ All 37 tools cost roughly **43.5k tokens** of context. Most people don't need all of them.
435
431
 
436
432
  ```bash
437
- # In your .env — three optional fields. Omit them all to keep v3.4.x behavior exactly.
438
- SSH_SERVER_CLIENT_PROD_HOST=client-prod.example.com
439
- SSH_SERVER_CLIENT_PROD_USER=consultant
440
- SSH_SERVER_CLIENT_PROD_KEYPATH=~/.ssh/consultant_ed25519
441
-
442
- SSH_SERVER_CLIENT_PROD_MODE=readonly # unrestricted | readonly | restricted
443
- SSH_SERVER_CLIENT_PROD_AUDIT_LOG=~/.ssh-manager/audit.jsonl # opt-in JSONL audit trail
444
- # For mode=restricted, provide an allowlist of regex (DENY wins over ALLOW):
445
- # SSH_SERVER_CI_ALLOW_PATTERNS="^docker (ps|logs);^kubectl get "
433
+ ssh-manager tools configure # interactive wizard
434
+ ssh-manager tools list # what's on right now
435
+ ssh-manager tools enable monitoring
436
+ ssh-manager tools disable backup
446
437
  ```
447
438
 
448
- - **`unrestricted`** (default, no field needed) — identical to pre-v3.5.0 behavior. Zero overhead.
449
- - **`readonly`** — blocks `ssh_upload`, `ssh_deploy`, `ssh_sync`, `ssh_execute_sudo`, backup/db write tools, and built-in destructive commands (`rm`, `mv`, `sudo`, `systemctl restart`, redirects outside `/tmp`, `curl | sh`, …).
450
- - **`restricted`** — every `ssh_execute` command must match at least one `ALLOW_PATTERNS` regex AND no `DENY_PATTERNS` regex.
451
-
452
- Existing configs are unaffected — no field is mandatory, no behavior changes unless you opt in. See **[docs/SECURITY_MODES.md](docs/SECURITY_MODES.md)** for the full reference, recipes, and limitations.
453
-
454
- ### 4. Start Using!
439
+ | Mode | Tools | Context | Good for |
440
+ |---|---|---|---|
441
+ | **All** *(default)* | 37 | ~43.5k | The full set |
442
+ | **Minimal** | 5 | ~3.5k | Just SSH, and 92% of the context back |
443
+ | **Custom** | 5–37 | varies | Whatever you actually use |
455
444
 
456
- In Claude Code, you can now:
445
+ Groups: **core** (5, always on) · **sessions** (4) · **monitoring** (6) · **backup** (4) · **database** (4) · **advanced** (14).
457
446
 
458
- ```
459
- "List all my SSH servers"
460
- "Execute 'ls -la' on production server" # Uses default directory if set
461
- "Run 'docker ps' on staging"
462
- "Upload config.json to production:/etc/app/config.json"
463
- "Download logs from staging:/var/log/app.log"
464
- ```
447
+ Fewer tools also means fewer approval prompts and a faster start. `ssh-manager tools export-claude` writes the matching auto-approval block.
465
448
 
466
- **With Default Directories:**
467
- If you set `/var/www/html` as default for production, these commands are equivalent:
468
- - `"Run 'ls' on production"` → executes in `/var/www/html`
469
- - `"Run 'ls' on production in /tmp"` → executes in `/tmp` (overrides default)
449
+ 📖 [Complete guide →](docs/TOOL_MANAGEMENT.md)
470
450
 
471
- ---
451
+ </details>
472
452
 
473
- ## 🚀 Quick Start - OpenAI Codex
453
+ <details>
454
+ <summary><b>Bringing servers in from somewhere else</b></summary>
474
455
 
475
- ### 1. Install MCP SSH Manager
456
+ <br>
476
457
 
477
- Same installation as Claude Code (see above), then configure for Codex:
458
+ Nobody starts here. You have a `~/.ssh/config` with forty hosts, or a FileZilla
459
+ site manager, or a spreadsheet a colleague sent you.
478
460
 
479
461
  ```bash
480
- # Set up Codex integration
481
- ssh-manager codex setup
462
+ ssh-manager import ~/.ssh/config # the format is worked out for you
463
+ ssh-manager import --from transmit # or read where a tool keeps its list
464
+ ssh-manager import --template servers.xlsx # or get a form to fill in
465
+ ```
482
466
 
483
- # Migrate existing servers to TOML format (if you have .env servers)
484
- ssh-manager codex migrate
467
+ | Source | How |
468
+ |---|---|
469
+ | **Spreadsheet** (`.xlsx`) | `--template` writes one with the columns filled in and three examples to type over |
470
+ | **CSV** | Comma or semicolon — Excel writes both, depending on where you live |
471
+ | **`~/.ssh/config`** | `Host`, `HostName`, `User`, `Port`, `IdentityFile`, `ProxyJump`. Wildcards are skipped, aliases collapse to one server |
472
+ | **FileZilla** | `sitemanager.xml`. SFTP sites only — an FTP bookmark is not an SSH server |
473
+ | **PuTTY** | An exported `.reg`. A `.ppk` key is refused with the `puttygen` line that converts it |
474
+ | **Termius** | JSON export, groups included |
475
+ | **MobaXterm** | `.mxtsessions`, folder becomes the group |
476
+ | **Transmit** | Its favourites, read directly (macOS) |
477
+
478
+ **Import is additive.** A name you already have comes back as "already
479
+ configured — left alone", never a silent overwrite; `--replace` if that is what
480
+ you want. Two rows with the same name become `web` and `web_2` rather than one.
481
+
482
+ **No password is ever read.** FileZilla keeps them base64-encoded, Transmit in
483
+ the keychain, PuTTY not at all. Copying a credential out of another
484
+ application's store is not a favour — it moves a secret you had forgotten into a
485
+ second place you now have to think about. Hosts, users, ports and key paths come
486
+ across; you are asked for a password once, when you first connect.
487
+
488
+ Going the other way:
485
489
 
486
- # Test the integration
487
- ssh-manager codex test
490
+ ```bash
491
+ ssh-manager export servers.xlsx # or .csv, .env, .toml
488
492
  ```
489
493
 
490
- ### 2. Manual Configuration (Optional)
494
+ Exports carry no passwords, no passphrases, no sudo passwords — an export is a
495
+ file people email each other and commit by accident.
491
496
 
492
- If you prefer manual setup, add to `~/.codex/config.toml`:
497
+ </details>
493
498
 
494
- ```toml
495
- [mcp_servers.ssh-manager]
496
- command = "node"
497
- args = ["/absolute/path/to/mcp-ssh-manager/src/index.js"]
498
- env = { SSH_CONFIG_PATH = "/Users/you/.codex/ssh-config.toml" }
499
- startup_timeout_ms = 20000
500
- ```
499
+ <details>
500
+ <summary><b>Configuration — every field</b></summary>
501
501
 
502
- ### 3. Configure Servers in TOML Format
502
+ <br>
503
503
 
504
- Create or edit `~/.codex/ssh-config.toml`:
504
+ Two interchangeable formats, read by the same loader: `.env` is the usual choice with Claude Code, TOML with Codex (from `SSH_CONFIG_PATH`, or `~/.codex/ssh-config.toml`). Both can coexist — the loader merges them.
505
+
506
+ ```env
507
+ SSH_SERVER_[NAME]_HOST=hostname_or_ip
508
+ SSH_SERVER_[NAME]_USER=username
509
+ SSH_SERVER_[NAME]_PASSWORD=password # or use a key
510
+ SSH_SERVER_[NAME]_KEYPATH=~/.ssh/key
511
+ SSH_SERVER_[NAME]_CERTPATH=~/.ssh/key-cert.pub # optional: OpenSSH certificate for KEYPATH
512
+ SSH_SERVER_[NAME]_PASSPHRASE=key_passphrase # optional
513
+ SSH_SERVER_[NAME]_PORT=22 # optional
514
+ SSH_SERVER_[NAME]_DEFAULT_DIR=/var/www # optional working directory
515
+ SSH_SERVER_[NAME]_SUDO_PASSWORD=… # optional, for automated deploys
516
+ SSH_SERVER_[NAME]_DESCRIPTION=… # optional
517
+ SSH_SERVER_[NAME]_GROUP=production # optional, free-form label
518
+ SSH_SERVER_[NAME]_PLATFORM=windows # optional: linux (default) | windows
519
+ SSH_SERVER_[NAME]_PROXYJUMP=bastion # optional: another server, as jump host
520
+ SSH_SERVER_[NAME]_PROXYCOMMAND=… # optional: ncat, ssh -W, …
521
+ SSH_SERVER_[NAME]_FORWARD_AGENT=true # optional, and a real security trade-off
522
+ SSH_SERVER_[NAME]_ANNOUNCE_AGENT=true # optional: tell this host an AI agent is driving (off by default)
523
+ SSH_SERVER_[NAME]_MODE=readonly # optional: unrestricted | readonly | restricted
524
+ # Approval is NOT a field here — it is set per server from the control plane and
525
+ # stored in the vault, so that a shell on one of your machines cannot switch off
526
+ # the gate that exists to stop it.
527
+ SSH_SERVER_[NAME]_AUDIT_LOG=~/audit.jsonl # optional JSONL trail
528
+ ```
529
+
530
+ The same thing in TOML:
505
531
 
506
532
  ```toml
507
533
  [ssh_servers.production]
508
534
  host = "prod.example.com"
509
535
  user = "admin"
510
- password = "secure_password" # or use key_path
511
- key_path = "~/.ssh/id_rsa" # for SSH key auth (recommended)
512
- passphrase = "key_passphrase" # optional, for passphrase-protected keys
536
+ key_path = "~/.ssh/id_rsa"
513
537
  port = 22
514
538
  default_dir = "/var/www"
515
- group = "production" # optional, free-form label for grouping/import-export
539
+ group = "production"
516
540
  description = "Production server"
517
541
 
518
- [ssh_servers.staging]
519
- host = "staging.example.com"
520
- user = "deploy"
521
- key_path = "~/.ssh/staging_key"
522
- port = 2222
523
- default_dir = "/home/deploy/app"
524
-
525
542
  [ssh_servers.winhost]
526
543
  host = "192.168.1.90"
527
544
  user = "svc-ssh"
528
545
  key_path = "~/.ssh/winhost_key"
529
546
  port = 2222
530
547
  platform = "windows"
531
- description = "Windows host via OpenSSH"
532
-
533
- [ssh_servers.bastion]
534
- host = "bastion.example.com"
535
- user = "jumpuser"
536
- key_path = "~/.ssh/bastion_key"
537
548
 
538
549
  [ssh_servers.internal]
539
550
  host = "10.0.0.5"
540
551
  user = "admin"
541
- key_path = "~/.ssh/internal_key"
542
552
  proxy_jump = "bastion"
543
- description = "Private server behind bastion"
544
- ```
545
-
546
- 💡 **See [examples/codex-ssh-config.example.toml](examples/codex-ssh-config.example.toml) for more complete examples!**
547
-
548
- ### 4. Start Using in Codex!
549
-
550
- In OpenAI Codex, you can now:
551
-
552
- ```
553
- "List my SSH servers"
554
- "Execute 'docker ps' on production"
555
- "Upload file.txt to staging:/tmp/"
556
- "Monitor CPU usage on all servers"
557
- "Download production:/var/log/app.log to ./logs/"
558
- ```
559
-
560
- ### Converting Between Formats
561
-
562
- Switch easily between Claude Code (.env) and Codex (TOML):
563
-
564
- ```bash
565
- # Convert .env to TOML (for Codex)
566
- ssh-manager codex convert to-toml
567
-
568
- # Convert TOML back to .env (for Claude Code)
569
- ssh-manager codex convert to-env
570
- ```
571
-
572
- Both formats can coexist! The system supports both simultaneously.
573
-
574
- ---
575
-
576
- ## 🛠️ Available MCP Tools
577
-
578
- ### Core Tools
579
-
580
- #### `ssh_list_servers`
581
- Lists all configured SSH servers with their details.
582
-
583
- #### `ssh_execute`
584
- Execute commands on remote servers.
585
- - Parameters: `server` (name), `command`, `cwd` (optional working directory)
586
- - **Note**: If no `cwd` is provided, uses the server's default directory if configured
587
-
588
- #### `ssh_upload`
589
- Upload files to remote servers.
590
- - Parameters: `server`, `local_path`, `remote_path`
591
-
592
- #### `ssh_download`
593
- Download files from remote servers.
594
- - Parameters: `server`, `remote_path`, `local_path`
595
-
596
- ### Backup & Restore Tools (v2.1+) 🔄
597
-
598
- #### `ssh_backup_create`
599
- Create backup of database or files on remote server.
600
- - Types: MySQL, PostgreSQL, MongoDB, Files
601
- - Parameters: `server`, `type`, `name`, `database`, `paths`, `retention`
602
- - Automatic compression and metadata tracking
603
- - See [Backup Guide](docs/BACKUP_GUIDE.md) for detailed usage
604
-
605
- #### `ssh_backup_list`
606
- List all available backups on remote server.
607
- - Parameters: `server`, `type` (optional filter)
608
- - Returns backup details with size, date, and retention info
609
-
610
- #### `ssh_backup_restore`
611
- Restore from a previous backup.
612
- - Parameters: `server`, `backupId`, `database`, `targetPath`
613
- - Supports cross-database restoration
614
-
615
- #### `ssh_backup_schedule`
616
- Schedule automatic backups using cron.
617
- - Parameters: `server`, `schedule` (cron format), `type`, `name`
618
- - Automatic cleanup based on retention policy
619
-
620
- ### Health & Monitoring Tools (v2.2+) 🏥
621
-
622
- #### `ssh_health_check`
623
- Perform comprehensive health check on remote server.
624
- - Checks: CPU, Memory, Disk, Network, Uptime, Load average
625
- - Returns overall health status (healthy/warning/critical)
626
- - Optional detailed mode for extended metrics
627
-
628
- #### `ssh_service_status`
629
- Check status of services (nginx, mysql, docker, etc.).
630
- - Parameters: `server`, `services` (array)
631
- - Returns running/stopped status for each service
632
- - Works with both systemd and sysv init systems
633
-
634
- #### `ssh_process_manager`
635
- List, monitor, or kill processes on remote server.
636
- - Actions: list (top processes), kill (terminate), info (details)
637
- - Sort by CPU or memory usage
638
- - Filter processes by name
639
-
640
- #### `ssh_alert_setup`
641
- Configure health monitoring alerts and thresholds.
642
- - Actions: set (configure), get (view), check (test thresholds)
643
- - Configurable CPU, memory, and disk thresholds
644
- - Automatic alert triggering when thresholds exceeded
645
-
646
- ### Database Management Tools (v2.3+) 🗄️
647
-
648
- #### `ssh_db_dump`
649
- Create database dump/backup on remote server.
650
- - Supports: MySQL, PostgreSQL, MongoDB
651
- - Parameters: `server`, `type`, `database`, `outputFile`, `dbUser`, `dbPassword`, `dbHost`, `dbPort`
652
- - Optional: `compress` (gzip), `tables` (specific tables only)
653
- - Returns dump size and location
654
-
655
- #### `ssh_db_import`
656
- Import SQL dump or restore database on remote server.
657
- - Supports: MySQL, PostgreSQL, MongoDB
658
- - Parameters: `server`, `type`, `database`, `inputFile`, `dbUser`, `dbPassword`, `dbHost`, `dbPort`
659
- - Handles compressed (.gz) files automatically
660
- - Optional: `drop` (drop database before restore for MongoDB)
661
-
662
- #### `ssh_db_list`
663
- List databases or tables on remote server.
664
- - Parameters: `server`, `type`, `database` (optional), `dbUser`, `dbPassword`, `dbHost`, `dbPort`
665
- - Without database: lists all databases (filters system DBs)
666
- - With database: lists all tables/collections
667
- - Returns structured list with count
668
-
669
- #### `ssh_db_query`
670
- Execute read-only SQL queries on remote database.
671
- - Parameters: `server`, `type`, `database`, `query`, `dbUser`, `dbPassword`, `dbHost`, `dbPort`
672
- - **Security**: Only SELECT queries allowed for safety
673
- - MongoDB: Use `collection` parameter for find queries
674
- - Returns query results with row count
675
-
676
- ### Deployment Tools (v1.2+)
677
-
678
- #### `ssh_deploy` 🚀
679
- Deploy files with automatic permission and backup handling.
680
- - Parameters: `server`, `files` (array), `options` (owner, permissions, backup, restart)
681
- - Automatically handles permission issues and creates backups
682
-
683
- #### `ssh_execute_sudo` 🔐
684
- Execute commands with sudo privileges.
685
- - Parameters: `server`, `command`, `password` (optional), `cwd` (optional)
686
- - Securely handles sudo password without exposing in logs
687
-
688
- ### Server Management
689
-
690
- #### `ssh_alias` 🏷️
691
- Manage server aliases for easier access.
692
- - Parameters: `action` (add/remove/list), `alias`, `server`
693
- - Example: Create alias "prod" for "production" server
694
-
695
- #### `ssh_command_alias` 📝
696
- Manage command aliases for frequently used commands.
697
- - Parameters: `action` (add/remove/list/suggest), `alias`, `command`
698
- - Aliases loaded from active profile
699
- - Example: Custom aliases for your project
700
-
701
- #### `ssh_hooks` 🎣
702
- Manage automation hooks for SSH operations.
703
- - Parameters: `action` (list/enable/disable/status), `hook`
704
- - Hooks loaded from active profile
705
- - Example: Project-specific validation and automation
706
-
707
- #### `ssh_profile` 📚
708
- Manage configuration profiles for different project types.
709
- - Parameters: `action` (list/switch/current), `profile`
710
- - Available profiles: default, frappe, docker, nodejs
711
- - Example: Switch between different project configurations
712
-
713
- ## 🔧 Configuration
714
-
715
- ### Profiles
716
-
717
- SSH Manager uses profiles to configure aliases and hooks for different project types:
718
-
719
- 1. **Set active profile**:
720
- - Environment variable: `export SSH_MANAGER_PROFILE=frappe`
721
- - Configuration file: `~/.ssh-manager/profile` holds the profile name (switching from your assistant writes it)
722
- - Default: Uses `default` profile if not specified
723
-
724
- 2. **Available profiles**:
725
- - `default` - Basic SSH operations
726
- - `frappe` - Frappe/ERPNext specific
727
- - `docker` - Docker container management
728
- - `nodejs` - Node.js applications
729
- - Create custom profiles in `profiles/` directory
730
-
731
- ### Environment Variables
732
-
733
- Servers are configured in the `.env` file with this pattern:
734
-
735
- ```env
736
- # Server configuration pattern
737
- SSH_SERVER_[NAME]_HOST=hostname_or_ip
738
- SSH_SERVER_[NAME]_USER=username
739
- SSH_SERVER_[NAME]_PASSWORD=password # For password auth
740
- SSH_SERVER_[NAME]_KEYPATH=~/.ssh/key # For SSH key auth
741
- SSH_SERVER_[NAME]_CERTPATH=~/.ssh/key-cert.pub # Optional: OpenSSH user certificate for KEYPATH (needs ssh2 with certificate support; see SSH Certificates)
742
- SSH_SERVER_[NAME]_PASSPHRASE=key_passphrase # Optional, for passphrase-protected keys
743
- SSH_SERVER_[NAME]_PORT=22 # Optional, defaults to 22
744
- SSH_SERVER_[NAME]_DEFAULT_DIR=/path/to/dir # Optional, default working directory
745
- SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
746
- SSH_SERVER_[NAME]_GROUP=production # Optional, free-form label for grouping/import-export
747
- SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
748
- SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
749
- SSH_SERVER_[NAME]_PROXYCOMMAND=command # Optional: custom proxy command (ncat, ssh -W, etc.)
750
- SSH_SERVER_[NAME]_FORWARD_AGENT=true # Optional: forward local ssh-agent to remote (needs SSH_AUTH_SOCK; security risk — see SSH Agent section)
751
-
752
- # Example: Linux server
753
- SSH_SERVER_PRODUCTION_HOST=prod.example.com
754
- SSH_SERVER_PRODUCTION_USER=admin
755
- SSH_SERVER_PRODUCTION_PASSWORD=secure_password
756
- SSH_SERVER_PRODUCTION_PORT=22
757
- SSH_SERVER_PRODUCTION_DEFAULT_DIR=/var/www/html
758
- SSH_SERVER_PRODUCTION_DESCRIPTION=Production Server
759
- SSH_SERVER_PRODUCTION_SUDO_PASSWORD=secure_sudo_pass # Optional, for automated deployments
760
-
761
- # Example: Windows server (OpenSSH for Windows)
762
- SSH_SERVER_WINHOST_HOST=192.168.1.90
763
- SSH_SERVER_WINHOST_USER=svc-ssh
764
- SSH_SERVER_WINHOST_KEYPATH=~/.ssh/winhost_key
765
- SSH_SERVER_WINHOST_PORT=2222
766
- SSH_SERVER_WINHOST_PLATFORM=windows
767
- SSH_SERVER_WINHOST_DESCRIPTION=Windows host via OpenSSH
768
-
769
- # Example: Server behind a bastion/jump host
770
- SSH_SERVER_BASTION_HOST=bastion.example.com
771
- SSH_SERVER_BASTION_USER=jumpuser
772
- SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
773
-
774
- SSH_SERVER_INTERNAL_HOST=10.0.0.5
775
- SSH_SERVER_INTERNAL_USER=admin
776
- SSH_SERVER_INTERNAL_KEYPATH=~/.ssh/internal_key
777
- SSH_SERVER_INTERNAL_PROXYJUMP=bastion
778
- SSH_SERVER_INTERNAL_DESCRIPTION=Private server behind bastion
779
- ```
780
-
781
- ### Server Management Tool
782
-
783
- The Python management tool (`tools/server_manager.py`) provides:
784
-
785
- 1. **List servers** - View all configured servers
786
- 2. **Add server** - Interactive server configuration
787
- 3. **Test connection** - Verify server connectivity
788
- 4. **Remove server** - Delete server configuration
789
- 5. **Update Claude Code** - Configure MCP in Claude Code
790
- 6. **Install dependencies** - Setup required packages
791
-
792
- ## 📁 Project Structure
793
-
794
- ```
795
- mcp-ssh-manager/
796
- ├── src/
797
- │ ├── index.js # Main MCP server (37 tools)
798
- │ ├── ssh-manager.js # SSH connection handling
799
- │ ├── config-loader.js # .env & TOML config loading
800
- │ ├── session-manager.js # Persistent SSH sessions
801
- │ ├── backup-manager.js # Backup & restore
802
- │ ├── health-monitor.js # Health checks & alerts
803
- │ ├── database-manager.js # Database operations
804
- │ ├── tunnel-manager.js # SSH tunnel management
805
- │ ├── server-groups.js # Group operations
806
- │ └── ...
807
- ├── cli/
808
- │ ├── ssh-manager # Bash CLI entrypoint
809
- │ ├── commands/ # CLI command modules
810
- │ └── lib/ # CLI libraries
811
- ├── profiles/ # Configuration profiles (frappe, docker, nodejs...)
812
- ├── examples/ # Example configs
813
- ├── docs/ # Documentation
814
- └── package.json
815
553
  ```
816
554
 
817
- ## 🧪 Testing
555
+ **OpenSSH user certificates** — for servers that trust a certificate authority (`TrustedUserCAKeys`), point `CERTPATH` / `cert_path` at the certificate signed for `KEYPATH` (usually `<key>-cert.pub`). It is read on every connection, so a short-lived certificate renewed on disk needs no restart, and a missing file fails the connection instead of falling back to the bare key. It takes effect once `ssh2` ships certificate support ([mscdex/ssh2#1495](https://github.com/mscdex/ssh2/pull/1495)); until then the plain key is offered, as before. `ssh_sync` uses the system `ssh`, which finds `<key>-cert.pub` next to the key on its own.
818
556
 
819
- ### Test Server Connection
557
+ **Loading order**, highest priority first: process environment → `.env` → the encrypted vault → TOML. A credential you deliberately put in the vault beats one left in a `.env`; an operator overriding for a single run still beats both.
820
558
 
821
- ```bash
822
- python tools/test-connection.py production
823
- ```
559
+ **Profiles** bundle aliases and hooks per project type. Set one with `export SSH_MANAGER_PROFILE=frappe`, or switch from your assistant, which remembers it in `~/.ssh-manager/profile`. Ships with `default`, `frappe`, `docker` and `nodejs`; add your own in `profiles/`. Custom aliases and hooks also live in `~/.ssh-manager/`, so an upgrade keeps them.
824
560
 
825
- ### Verify MCP Installation
561
+ More examples: [examples/codex-ssh-config.example.toml](examples/codex-ssh-config.example.toml).
826
562
 
827
- ```bash
828
- claude mcp list
829
- ```
830
-
831
- ### Check Server Status in Claude Code
832
-
833
- ```
834
- /mcp
835
- ```
836
-
837
- ## 🔒 Security Best Practices
838
-
839
- 1. **Never commit `.env` files** - Always use `.env.example` as template
840
- 2. **Use SSH keys when possible** - More secure than passwords
841
- 3. **Limit server access** - Use minimal required permissions
842
- 4. **Rotate credentials** - Update passwords and keys regularly
843
-
844
- ### 🔑 Passphrase-Protected SSH Keys
845
-
846
- MCP SSH Manager supports passphrase-protected SSH keys in two ways:
847
-
848
- **Option 1: SSH Agent (recommended)**
849
-
850
- If your SSH key is loaded into `ssh-agent`, MCP SSH Manager will use it automatically — no configuration changes needed:
851
-
852
- ```bash
853
- # Add your key to the agent (enter passphrase once)
854
- ssh-add ~/.ssh/your_key
855
-
856
- # Verify the key is loaded
857
- ssh-add -l
858
- ```
859
-
860
- 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.
861
-
862
- **Option 2: Passphrase in configuration**
863
-
864
- You can store the passphrase directly in the server config:
865
-
866
- `.env` format:
867
- ```env
868
- SSH_SERVER_MYSERVER_KEYPATH=~/.ssh/id_rsa
869
- SSH_SERVER_MYSERVER_PASSPHRASE="your_passphrase"
870
- ```
871
-
872
- TOML format:
873
- ```toml
874
- [ssh_servers.myserver]
875
- key_path = "~/.ssh/id_rsa"
876
- passphrase = "your_passphrase"
877
- ```
878
-
879
- > **Note:** SSH Agent is preferred over storing passphrases in config files for better security.
880
-
881
- ### 🔗 SSH Agent Forwarding
882
-
883
- 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.
884
-
885
- 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.
886
-
887
- `.env` format:
888
- ```env
889
- SSH_SERVER_MYSERVER_FORWARD_AGENT=true
890
- ```
891
-
892
- TOML format:
893
- ```toml
894
- [ssh_servers.myserver]
895
- forward_agent = true
896
- ```
897
-
898
- > ⚠️ **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`.
899
-
900
- ### 📜 SSH User Certificates
901
-
902
- If your servers trust an OpenSSH certificate authority (`TrustedUserCAKeys` in `sshd_config`), point `CERTPATH` at the certificate signed for `KEYPATH` (usually `<key>-cert.pub`). The certificate is sent as the identity and the private key signs, like `ssh -i key -o CertificateFile=key-cert.pub`.
903
-
904
- `.env` format:
905
- ```env
906
- SSH_SERVER_MYSERVER_KEYPATH=~/.ssh/id_ed25519
907
- SSH_SERVER_MYSERVER_CERTPATH=~/.ssh/id_ed25519-cert.pub
908
- ```
909
-
910
- TOML format:
911
- ```toml
912
- [ssh_servers.myserver]
913
- key_path = "~/.ssh/id_ed25519"
914
- cert_path = "~/.ssh/id_ed25519-cert.pub"
915
- ```
916
-
917
- - The certificate file is read on every connection, so a short-lived certificate renewed on disk is used on the next connection without restarting the server.
918
- - If `CERTPATH` is set and the file is missing, the connection fails instead of falling back to the bare key.
919
- - `CERTPATH` is ignored without `KEYPATH`. Without `CERTPATH` nothing changes.
920
- - **Requires an `ssh2` release with certificate support** ([mscdex/ssh2#1495](https://github.com/mscdex/ssh2/pull/1495)). With `ssh2` 1.17.0 the option is ignored and the plain key is offered.
921
- - `ssh_sync` uses the system `rsync`/`ssh` and does not use `CERTPATH` yet; OpenSSH picks up `<key>-cert.pub` next to the key on its own.
563
+ </details>
922
564
 
923
- ## 📚 Advanced Usage
565
+ <details>
566
+ <summary><b>Getting to machines you can't reach directly</b></summary>
924
567
 
925
- ### ProxyJump / Bastion Host
568
+ <br>
926
569
 
927
- 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.
570
+ **Through a bastion** — the tunnel is transparent, every tool works as usual:
928
571
 
929
572
  ```env
930
- # Define the bastion server
931
573
  SSH_SERVER_BASTION_HOST=bastion.example.com
932
574
  SSH_SERVER_BASTION_USER=jumpuser
933
575
  SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
934
576
 
935
- # Point the target server to the bastion
936
577
  SSH_SERVER_PRIVATE_HOST=10.0.0.5
937
578
  SSH_SERVER_PRIVATE_USER=admin
938
579
  SSH_SERVER_PRIVATE_PROXYJUMP=bastion
939
580
  ```
940
581
 
941
- Or in TOML:
942
- ```toml
943
- [ssh_servers.bastion]
944
- host = "bastion.example.com"
945
- user = "jumpuser"
946
- key_path = "~/.ssh/bastion_key"
947
-
948
- [ssh_servers.private]
949
- host = "10.0.0.5"
950
- user = "admin"
951
- proxy_jump = "bastion"
952
- ```
582
+ Chains work: if `bastion` itself has a `PROXYJUMP`, it's followed recursively. Circular references are detected and rejected.
953
583
 
954
- **Chained jumps** are supported: if `bastion` itself has a `proxy_jump`, the chain is followed recursively. Circular references are detected and rejected.
955
-
956
- ### ProxyCommand / Custom Proxy
957
-
958
- Connect through SOCKS5 proxies or custom proxy commands. The proxy command executes locally and forwards traffic to the remote host.
584
+ **Through a SOCKS proxy or a custom command** — it runs locally and forwards to the host, with `%h` and `%p` for host and port:
959
585
 
960
586
  ```env
961
- # SOCKS5 proxy via ncat
962
- SSH_SERVER_SOCKS_HOST=target.example.com
963
- SSH_SERVER_SOCKS_USER=admin
964
587
  SSH_SERVER_SOCKS_PROXYCOMMAND="ncat --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p"
965
-
966
- # Windows SSH proxy command
967
- SSH_SERVER_WINPROXY_HOST=internal.example.com
968
- SSH_SERVER_WINPROXY_USER=admin
969
588
  SSH_SERVER_WINPROXY_PROXYCOMMAND="C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p user@jump-host"
970
589
  ```
971
590
 
972
- Or in TOML:
973
- ```toml
974
- [ssh_servers.socks]
975
- host = "target.example.com"
976
- user = "admin"
977
- proxy_command = "ncat --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p"
591
+ **Passphrase-protected keys** — load the key into `ssh-agent` and nothing else is needed; `SSH_AUTH_SOCK` is picked up automatically, the same mechanism plain `ssh` uses. Storing `PASSPHRASE` in the config works too, and is the less good option.
978
592
 
979
- [ssh_servers.winproxy]
980
- host = "internal.example.com"
981
- user = "admin"
982
- proxy_command = "C:\\Windows\\System32\\OpenSSH\\ssh.exe -W %h:%p user@jump-host"
983
- ```
593
+ **Agent forwarding** (`FORWARD_AGENT=true`, off by default, per server) lets a process on the remote host authenticate to *other* hosts with your local keys — `git clone` over SSH on a server without copying a private key there.
984
594
 
985
- The proxy command must be a valid command that reads from stdin and writes to stdout, accepting `%h` and `%p` placeholders for host and port.
595
+ > ⚠️ Anyone who can read the forwarded socket on that host — **root included** — can impersonate you against other hosts for the life of the connection. Only for servers you trust, exactly as `ssh_config(5)` advises.
986
596
 
987
- ### Server Groups
597
+ **Telling your servers an agent is driving** (`ANNOUNCE_AGENT=true` per server, or `SSH_MANAGER_ANNOUNCE_AGENT=true` for all of them; off by default). Every command channel then carries `AI_AGENT=mcp-ssh-manager`, following the [AI_AGENT over SSH convention](https://github.com/mthamil107/whotyped/blob/main/docs/spec/ai-agent-over-ssh.md), so a host that records it can tell a session an agent drives from one a person drives — SSH cannot otherwise: same key, same user either way. Contributed by [@mthamil107](https://github.com/mthamil107) in [#84](https://github.com/bvisible/mcp-ssh-manager/pull/84).
988
598
 
989
- Tag a server with `group` and it becomes part of that group — no extra file to maintain. The label is free-form and travels with the server definition, so it survives an export to (or import from) another tool.
599
+ - **The server has to accept it.** Stock OpenSSH ships `AcceptEnv LANG LC_*` and drops anything else silently. Add `AcceptEnv AI_AGENT` to `sshd_config` and reload; `$AI_AGENT` is then set for every command and shell the agent runs, for a profile, a wrapper or an audit hook to record.
600
+ - **Off by default, for two reasons.** Upgrading must not change what reaches your servers. And the request reaches *every* host whatever its `AcceptEnv` — sshd only declines to store it — so a host you do not control would learn an agent is on the other end, and could shape its output for one. `ANNOUNCE_AGENT=false` keeps one host silent under the global switch.
601
+ - **Covered:** commands, `ssh_tail --follow`, interactive sessions, and `ssh_sync` (via `SendEnv`, supported since OpenSSH 3.9). **Not covered:** SFTP transfers — ssh2 would fail the whole SFTP session on a server that refuses the variable — and port forwards, which have no environment.
602
+ - **A person is never announced.** Everything you do from the control plane — a shell, a file, a health probe, a command across a group — is yours, and reaches the server unlabelled.
603
+
604
+ **Groups** — tag servers and they become a group, with no extra file to maintain:
990
605
 
991
606
  ```env
992
- SSH_SERVER_WEB1_HOST=10.0.0.1
993
- SSH_SERVER_WEB1_USER=deploy
994
607
  SSH_SERVER_WEB1_GROUP=production
995
-
996
- SSH_SERVER_WEB2_HOST=10.0.0.2
997
- SSH_SERVER_WEB2_USER=deploy
998
608
  SSH_SERVER_WEB2_GROUP=production
999
609
  ```
1000
610
 
1001
- Or in TOML:
1002
- ```toml
1003
- [ssh_servers.web1]
1004
- host = "10.0.0.1"
1005
- user = "deploy"
1006
- group = "production"
1007
- ```
1008
-
1009
- Both servers are then reachable as a group:
1010
-
1011
- ```
1012
- Run "uptime" on the production group → ssh_execute_group
1013
- List my server groups → ssh_group_manage (action: list)
1014
- ```
1015
-
1016
- `ssh_list_servers` also reports the group of each server, so you can see membership without opening the config.
611
+ Groups created with `ssh_group_manage` live in `.server-groups.json` and additionally carry execution settings (strategy, delay, stop-on-error). When a name exists in both places, **membership is the union** and the stored settings apply. Names are case-insensitive. A group that exists only through the `group` field is read-only for `ssh_group_manage` — change membership by editing the servers.
1017
612
 
1018
- **How it combines with `ssh_group_manage`:** groups you create with `ssh_group_manage` live in `.server-groups.json` and carry execution settings (strategy, delay, stop-on-error). Groups implied by the `group` field carry membership only. When a name exists on both sides, **membership is the union** — the stored list plus every server tagged with that name — and the stored execution settings apply. Group names are case-insensitive.
1019
-
1020
- A group that exists only through the `group` field is read-only for `ssh_group_manage`: to change who belongs to it, edit the servers' `group` in your `.env`/TOML. Creating a group of the same name with `ssh_group_manage` is still allowed and simply adds stored members and settings on top.
1021
-
1022
- ### Documentation
1023
- - [DEPLOYMENT_GUIDE.md](docs/DEPLOYMENT_GUIDE.md) - Deployment strategies and permission handling
1024
- - [ALIASES_AND_HOOKS.md](docs/ALIASES_AND_HOOKS.md) - Command aliases and automation hooks
1025
- - Real-world examples and best practices
1026
-
1027
- ## 🐛 Troubleshooting
1028
-
1029
- ### Claude Code Crashes / Interruptions
1030
-
1031
- **Symptoms:**
1032
- - Claude shows "Interrupted: What should Claude do instead?"
1033
- - MCP tools execute but Claude stops working
1034
- - Commands succeed but Claude freezes
1035
-
1036
- **Solution:** v3.1.1 includes automatic fixes:
1037
- - ✅ Output auto-truncated to prevent context overflow
1038
- - ✅ Timeout increased to 2 minutes (default), max 5 minutes
1039
- - ✅ Standardized error responses
613
+ </details>
1040
614
 
1041
- **Performance Tuning** (add to `.env`):
1042
- ```bash
1043
- # Reduce output size (default: 10000 characters)
1044
- MCP_SSH_MAX_OUTPUT_LENGTH=5000
615
+ <details>
616
+ <summary><b>When something goes wrong</b></summary>
1045
617
 
1046
- # Increase timeout for slow commands (default: 120000ms)
1047
- MCP_SSH_DEFAULT_TIMEOUT=180000
618
+ <br>
1048
619
 
1049
- # Use compact JSON to save tokens (default: false)
1050
- MCP_SSH_COMPACT_JSON=true
1051
- ```
620
+ **Claude Code freezes or shows "Interrupted"** — almost always an output too large for the context. Output is auto-truncated and the default timeout is two minutes, but you can tune it:
1052
621
 
1053
- **For large outputs:**
1054
- ```bash
1055
- # Instead of: cat huge-log.txt
1056
- # Use: tail -n 100 huge-log.txt
1057
- # Or: grep ERROR huge-log.txt | tail -n 50
622
+ ```env
623
+ MCP_SSH_MAX_OUTPUT_LENGTH=5000 # default 10000 characters
624
+ MCP_SSH_DEFAULT_TIMEOUT=180000 # default 120000 ms
625
+ MCP_SSH_COMPACT_JSON=true # fewer tokens per response
1058
626
  ```
1059
627
 
1060
- See [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) for complete guide.
1061
-
1062
- ### MCP Tools Not Available
1063
-
1064
- 1. Ensure MCP is installed: `claude mcp list`
1065
- 2. Restart Claude Code after installation
1066
- 3. Check server logs for errors
628
+ And prefer `tail -n 100 huge.log` over `cat huge.log` — the same advice you'd give a colleague.
1067
629
 
1068
- ### Connection Failed
630
+ **Tools don't show up** — `claude mcp list`, then restart Claude Code. `/mcp` inside Claude Code shows the live status.
1069
631
 
1070
- 1. Test connection: `ssh-manager server test [server_name]`
1071
- 2. Verify network connectivity
1072
- 3. Check firewall rules
1073
- 4. Ensure SSH service is running on remote server
632
+ **Connection failed** — `ssh-manager server test <name>` first; it tells you whether it's DNS, the firewall, or the credentials.
1074
633
 
1075
- ### Permission Denied
634
+ **Permission denied** — check `chmod 600 ~/.ssh/your_key`, then the username, then what that user is allowed to do on the host.
1076
635
 
1077
- 1. Verify username and password/key
1078
- 2. Check SSH key permissions: `chmod 600 ~/.ssh/your_key`
1079
- 3. Ensure user has necessary permissions on remote server
636
+ Still stuck? [Open an issue](https://github.com/bvisible/mcp-ssh-manager/issues) — include the server's `PLATFORM` and what `ssh-manager server test` said.
1080
637
 
1081
- ## 📚 Usage Examples
638
+ **Known limitations, honestly:**
1082
639
 
1083
- ### Backup & Restore
640
+ - **Command timeouts are advisory.** ssh2 can't kill a remote process; on Linux and macOS hosts a `timeout` wrapper does it properly. On Windows hosts set `PLATFORM=windows` to skip that wrapper, which OpenSSH for Windows doesn't understand.
641
+ - **`ssh_sync` with password auth needs `sshpass`.** Keys are better anyway. On a Windows host, pass native paths like `local:C:\project` — drive-letter and UNC paths are converted to MSYS2 form, and a path already written as `/c/...` is passed through untouched rather than converted twice.
642
+ - **Connections are pooled and reused.** A stale one reconnects on next use; force it with `ssh_connection_status` and the `reconnect` action.
1084
643
 
1085
- ```
1086
- "Backup production MySQL database before deployment"
1087
- "List all backups on production server"
1088
- "Restore backup from yesterday"
1089
- "Schedule daily database backup at 2 AM"
1090
- "Backup website files excluding cache and logs"
1091
- ```
644
+ </details>
1092
645
 
1093
- For detailed backup examples, see [examples/backup-workflow.md](examples/backup-workflow.md) and [docs/BACKUP_GUIDE.md](docs/BACKUP_GUIDE.md).
646
+ <details>
647
+ <summary><b>Working on the project</b></summary>
1094
648
 
1095
- ### Using the Bash CLI
649
+ <br>
1096
650
 
1097
651
  ```bash
1098
- # Basic server management
1099
- ssh-manager server list
1100
- ssh-manager server add
1101
- ssh-manager ssh prod1
652
+ git clone https://github.com/bvisible/mcp-ssh-manager.git
653
+ cd mcp-ssh-manager && npm ci
654
+ ./scripts/setup-hooks.sh # pre-commit checks, including secret detection
1102
655
 
1103
- # File synchronization
1104
- ssh-manager sync push prod1 ./app /var/www/
1105
- ssh-manager sync pull prod1 /var/log/app.log ./
656
+ npm test # 43 suites
657
+ npm run typecheck # JSDoc through tsc, no build step
658
+ npm run test:all # both, plus ./scripts/validate.sh
659
+ npm run test:preview # isolated candidate fixture, restart and cleanup
660
+ ```
1106
661
 
1107
- # SSH tunnels
1108
- ssh-manager tunnel create prod1 local 3307:localhost:3306
1109
- ssh-manager tunnel list
662
+ The layout:
1110
663
 
1111
- # Execute commands
1112
- ssh-manager exec prod1 "docker ps"
664
+ ```
665
+ src/ index.js is the MCP server and its 37 tools; one module per domain
666
+ (ssh-manager, config-loader, session-manager, backup-manager,
667
+ health-monitor, database-manager, tunnel-manager, server-groups…)
668
+ cli/ the Bash CLI, plus the Node wrapper that makes it work on Windows
669
+ ui/ the control plane's React interface (v4)
670
+ desktop/ the Electron build (v4)
671
+ profiles/ frappe, docker, nodejs — and room for yours
672
+ scripts/ validation, and the rig that regenerates every screenshot and the video
673
+ docs/ guides, migration notes, security modes
1113
674
  ```
1114
675
 
1115
- ### Using in Claude Code or OpenAI Codex
1116
-
1117
- Once installed, simply ask your AI assistant:
676
+ Pull requests are welcome — [CONTRIBUTING.md](CONTRIBUTING.md) has the details. Shipping the desktop builds — signing, notarization, and why the Mac App Store is a different product rather than a further step — is in [docs/DISTRIBUTION.md](docs/DISTRIBUTION.md).
1118
677
 
1119
- **Claude Code examples:**
1120
- - "List my SSH servers"
1121
- - "Execute 'df -h' on production server"
1122
- - "Upload this file to staging:/var/www/"
1123
- - "Create an SSH tunnel to access remote MySQL"
1124
- - "Monitor CPU usage on all servers"
1125
- - "Start a persistent session on prod1"
678
+ Nothing in this README's imagery is taken by hand. `scripts/demo-env.mjs` stands up three real ssh2 servers on the loopback with a seeded vault, a pending approval and a live stream; `capture-screenshots.mjs` and `record-demo.mjs` drive Chrome over the DevTools protocol against it; `frame-screenshots.py` draws the browser and application windows, and `macbook-mockup.py` draws the laptop. After a UI change, re-run them rather than editing an image.
1126
679
 
1127
- **OpenAI Codex examples:**
1128
- - "Show my SSH servers"
1129
- - "Run df -h on production"
1130
- - "Upload file.txt to staging:/tmp/"
1131
- - "Check CPU usage on all servers"
680
+ The hero animation ships twice, light and dark, swapped by `<picture>` on `prefers-color-scheme`. A single transparent GIF would have been simpler, but GIF alpha is one bit and transparency defeats its inter-frame compression: the same clip came out at **11.4 MB** transparent against 357 KB on a solid ground.
1132
681
 
1133
- Both AI assistants support the same MCP tools! 🚀
682
+ </details>
1134
683
 
1135
684
  ---
1136
685
 
1137
- ## 🤝 Contributing
686
+ ## What's new
1138
687
 
1139
- We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
688
+ **[4.0.1](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1) — the application tells you about updates.** *Options → Updates*, a mark on the sidebar and a notification once per version, so a new release no longer goes unnoticed in a menu you never open; a tidier Servers toolbar; the interface is built when the package is made rather than committed (what you install is byte for byte the same); and the npm, registry and GitHub descriptions say what V4 is. No change to the engine's behaviour.
1140
689
 
1141
- ### Development Setup
690
+ **[4.0.0](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.0) — the control plane.** See what an agent is running on your servers, with its output, and stop it before it runs. A desktop application for macOS, Windows and Linux, installed from the engine with `ssh-manager app`; an encrypted vault for credentials; human approval per server; a shell on your own machine alongside the remote ones. Everything new is opt-in — an npm install upgraded from 3.8.x keeps behaving as 3.8.x, which [a test installs from the registry and proves](docs/TESTING-V4.md). The Windows application is not code-signed in this release. [What changes and how to go back](docs/MIGRATION.md).
1142
691
 
1143
- 1. Fork the repository
1144
- 2. Clone and install dependencies
1145
- 3. **Setup pre-commit hooks** for code quality:
1146
- ```bash
1147
- ./scripts/setup-hooks.sh
1148
- ```
1149
- 4. Create your feature branch
1150
- 5. Make your changes (hooks will validate on commit)
1151
- 6. Push to your branch
1152
- 7. Open a Pull Request
692
+ **v3.8.7 — a security release; upgrade.** Two advisories fixed: a partial server name or an alias escaped `readonly` and `restricted` mode ([GHSA-mq9f-5385-rjf4](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-mq9f-5385-rjf4)), and `ssh_backup_restore`'s `backupId` ran commands on the server ([GHSA-2wjh-xm9c-7qf9](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-2wjh-xm9c-7qf9)). See the [CHANGELOG](CHANGELOG.md#387---2026-10-25).
1153
693
 
1154
- ### Code Quality
694
+ **v3.8.6 — a security release; upgrade.** Six advisories fixed. The default `on-error` hook let any SSH server you connect to run a command on your machine; `restricted` mode only checked how a line started; `ssh_db_query` could write; host keys were never compared. See the [CHANGELOG](CHANGELOG.md#386---2026-10-08).
1155
695
 
1156
- This project uses automated quality checks:
1157
- - **ESLint** for JavaScript linting
1158
- - **Black** for Python formatting
1159
- - **Flake8** for Python linting
1160
- - **Prettier** for code formatting
1161
- - **Pre-commit hooks** for automated validation
1162
- - **Secret detection** to prevent credential leaks
696
+ **v3.8.5 — a security release.** Three command-injection advisories fixed, one of which defeated `readonly` mode. Upgrade if you use `ssh_backup_*`, `ssh_db_dump`, `ssh_service_status` or `ssh_tail`.
1163
697
 
1164
- Run validation manually: `./scripts/validate.sh`
698
+ - **RCE bypassing `readonly` / `restricted`** ([GHSA-m793-whw6-f537](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-m793-whw6-f537)) — `ssh_service_status` and `ssh_tail` are read-only, so they stay enabled on servers you locked down, and neither quoted its arguments nor consulted the policy layer. A service name like `nginx; id > /tmp/pwned` executed.
699
+ - **RCE through `ssh_db_dump`** ([GHSA-796j-h5q5-jx6p](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-796j-h5q5-jx6p)) — the `stat` run after the dump interpolated the output path raw. The v3.6.7 patch had stopped one line short.
700
+ - **RCE through every `ssh_backup_*` tool** ([GHSA-qwwm-vrm9-4mw8](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-qwwm-vrm9-4mw8)) — `backup-manager.js` had zero shell escaping across its nine builders while `database-manager.js` had 95.
1165
701
 
1166
- ## 📄 License
702
+ Quoting now lives in one module so "did this builder quote its inputs?" has a single answer.
1167
703
 
1168
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
1169
-
1170
- ## 🙏 Acknowledgments
1171
-
1172
- - Built for [Claude Code](https://claude.ai/code)
1173
- - Uses the [Model Context Protocol](https://modelcontextprotocol.io)
1174
- - SSH handling via [node-ssh](https://www.npmjs.com/package/node-ssh)
1175
- - Server management with [Paramiko](https://www.paramiko.org)
704
+ [Full changelog, every release back to v1.0.0 →](CHANGELOG.md)
1176
705
 
1177
706
  ---
1178
707
 
1179
- ## Known Limitations
1180
-
1181
- ### Command Timeout
1182
- - The timeout parameter for SSH commands is advisory only
1183
- - Due to SSH2 library limitations, commands may continue running on the server even after timeout
1184
- - On Linux/macOS hosts, a system `timeout` wrapper is used for reliable command termination
1185
- - **Windows hosts**: Set `PLATFORM=windows` in your server config to skip the Linux `timeout`/`sh -c` wrapper (which is incompatible with Windows OpenSSH)
1186
-
1187
- ### SSH Sync (rsync)
1188
- - Password authentication requires `sshpass` to be installed
1189
- - SSH key authentication is recommended for better security and reliability
1190
- - **Windows MCP hosts**: pass native local paths such as `local:C:\project` or `local:.\project`; `ssh_sync` converts drive-letter and UNC paths to MSYS2 format before launching rsync. Prefer native paths, since Node checks them on disk using Windows path semantics — a path already written as `/c/...` or `//server/share` is passed through to rsync untouched rather than converted twice.
1191
- - Large file transfers may take time and appear to hang - be patient
1192
-
1193
- ### Connection Management
1194
- - Connections are pooled and reused for performance
1195
- - If a connection becomes stale, it will be automatically reconnected on next use
1196
- - Force reconnection by using the `ssh_connection_status` tool with `reconnect` action
708
+ <div align="center">
1197
709
 
1198
- ## 📧 Support
710
+ **[Documentation](docs/)** · **[Changelog](CHANGELOG.md)** · **[Security policy](SECURITY.md)** · **[Roadmap](ROADMAP-V4.md)** · **[Issues](https://github.com/bvisible/mcp-ssh-manager/issues)**
1199
711
 
1200
- For issues, questions, or suggestions:
1201
- - Open an issue on [GitHub Issues](https://github.com/bvisible/mcp-ssh-manager/issues)
1202
- - Check existing issues before creating new ones
712
+ <br>
1203
713
 
1204
- ---
714
+ Built on the [Model Context Protocol](https://modelcontextprotocol.io), with [ssh2](https://github.com/mscdex/ssh2) doing the hard part.
715
+ MIT licensed — see [LICENSE](LICENSE).
1205
716
 
1206
- <div align="center">
717
+ <br>
1207
718
 
1208
719
  Made with ❤️ for the Claude Code community
1209
720
 
1210
- <br/><br/>
721
+ <br><br>
1211
722
 
1212
723
  <a href="https://glama.ai/mcp/servers/@bvisible/mcp-ssh-manager">
1213
724
  <img width="380" height="200" src="https://glama.ai/mcp/servers/@bvisible/mcp-ssh-manager/badge" alt="SSH Manager MCP server" />
1214
725
  </a>
1215
726
 
727
+ [![MCP Toplist](https://mcptoplist.com/badge/glama%2Fbvisible%2Fmcp-ssh-manager.svg)](https://mcptoplist.com/server/glama%2Fbvisible%2Fmcp-ssh-manager)
728
+
1216
729
  </div>
730
+
731
+ ## Validation before a release
732
+
733
+ The [V4 testing guide](docs/TESTING-V4.md) describes the offline suites, real npm
734
+ 3.8.5 → V4 → rollback checks, browser flows, and platform release gates.
735
+ Use the [final V4 test guide](docs/FINAL-TEST-V4.md) to review the actual npm
736
+ package or desktop candidate with a disposable profile before publication.