ssh-agent-workspace 1.0.2 → 1.0.4

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 (2) hide show
  1. package/README.md +54 -201
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,69 +1,60 @@
1
1
  # ssh-agent-workspace
2
2
 
3
- > **Persistent SSH workspaces for AI agents.**
4
- >
5
- > Stateful tmux-backed sessions that survive reconnects, MCP restarts, and network drops — with runtime security policies and tool configuration.
6
-
7
3
  <p align="left">
8
4
  <img src="https://img.shields.io/badge/Node.js-≥18-339933?logo=node.js" alt="Node.js ≥18">
9
5
  <img src="https://img.shields.io/badge/MCP-Server-orange" alt="MCP">
10
6
  <img src="https://img.shields.io/badge/Tools-25-blue" alt="25 tools">
11
- <img src="https://img.shields.io/badge/npm-v1.0.0-red?logo=npm" alt="npm">
12
7
  <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT">
13
8
  <img src="https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey" alt="platform">
14
9
  </p>
15
10
 
16
- ---
17
-
18
- ## The Problem
11
+ **Stateful persistent workspace for AI agents over SSH.**
19
12
 
20
- Every SSH MCP server runs commands in a **fresh shell**. That means:
13
+ Unlike traditional SSH MCP servers that execute every command in a fresh shell, SSH Agent Workspace provides a tmux-backed workspace that survives multiple commands, SSH reconnects, MCP restarts, and network interruptions. Your working directory, environment variables, shell history, and running processes remain intact.
21
14
 
22
15
  ```
23
- cwd resets every time
24
- ❌ env vars are gone
25
- ❌ shell history disappears
26
- ❌ vim / htop / docker attach break
27
- ❌ all state evaporates on reconnect
28
- ```
16
+ Traditional SSH MCP
29
17
 
30
- Your AI agent has to `cd`, re-export, re-configure before every single command — wasting tokens, time, and context.
18
+ AI
19
+ └─ ssh exec channel
20
+ └─ command
21
+ └─ state lost every time
22
+
23
+
24
+ SSH Agent Workspace
25
+
26
+ AI
27
+ └─ persistent tmux workspace
28
+ ├─ cwd persists
29
+ ├─ env persists
30
+ ├─ shell history persists
31
+ ├─ running processes persist
32
+ └─ auto recovery
33
+ ```
31
34
 
32
35
  ---
33
36
 
34
- ## What ssh-agent-workspace Does
37
+ ## Why This Exists
38
+
39
+ Most SSH MCP servers use exec channels. Every command starts from scratch:
35
40
 
36
41
  ```
37
- AI Agent
38
-
39
- MCP stdio
40
-
41
- tmux workspace (persistent)
42
- ├─ cwd survives
43
- ├─ env survives
44
- ├─ history survives
45
- ├─ processes survive (vim, htop, docker attach...)
46
- ├─ auto-restore after MCP restart
47
- ├─ auto-restore after SSH drop
48
- ├─ runtime security per host
49
- └─ runtime tool enable/disable
42
+ No persistent cwd — cd /var/www before every command
43
+ ❌ No persistent env vars — re-export forever
44
+ Interactive programs break — vim, htop, docker attach don't work
45
+ ❌ State disappears after reconnect — start over from nothing
50
46
  ```
51
47
 
52
- Your agent gets a **real interactive terminal** not one-off exec commands. It's like giving your AI its own tmux session that never dies.
48
+ SSH Agent Workspace treats SSH as a **persistent workspace** instead of a command runner. Give your AI agent a real terminal that stays alive.
53
49
 
54
50
  ---
55
51
 
56
- ## Comparison
52
+ ## Core Features
57
53
 
58
- | | ssh-agent-workspace | Typical SSH MCP |
59
- |---|---|---|
60
- | **Session model** | Persistent tmux workspace | Throwaway exec channel |
61
- | **cwd / env / history** | Survives everything | Lost after each command |
62
- | **Running processes** | Stay alive (vim, htop, etc.) | Killed immediately |
63
- | **Reconnection** | Auto-restore on startup | Manual reconnect, fresh shell |
64
- | **Prompt detection** | Deterministic custom PS1 | Blind sleep + guess |
65
- | **Per-host security** | runtime `host_security` tool | Env vars only, restart required |
66
- | **Tool management** | runtime `tools_config` (persistent) | None or env vars |
54
+ - **Stateful workspaces** — Persistent tmux-backed sessions. cwd, env, history survive everything.
55
+ - **Automatic recovery** — Reconnect to existing sessions after SSH drops or MCP restarts.
56
+ - **Runtime reconfiguration** Enable/disable tools, update per-host security policies without restart.
57
+ - **Deterministic output** Prompt sentinel-based execution. No sleep-based output guessing.
67
58
 
68
59
  ---
69
60
 
@@ -71,13 +62,11 @@ Your agent gets a **real interactive terminal** — not one-off exec commands. I
71
62
 
72
63
  ### Install
73
64
 
74
- npx auto-downloads and runs the latest version. Or install globally:
75
-
76
65
  ```bash
77
66
  npm install -g ssh-agent-workspace
78
67
  ```
79
68
 
80
- From source:
69
+ Or from source:
81
70
 
82
71
  ```bash
83
72
  git clone https://github.com/ShiroNexo/ssh-agent-workspace.git
@@ -117,156 +106,6 @@ Host bastion
117
106
  → { session_id: "sess_abc", tmux_session: "mcp_prod_x1y2z3" }
118
107
  ```
119
108
 
120
- Your agent now has a persistent workspace on `prod`.
121
-
122
- ---
123
-
124
- ### Add to Your MCP Client
125
-
126
- Pick your client:
127
-
128
- #### OpenCode
129
-
130
- Add to `~/.config/opencode/opencode.json`:
131
-
132
- ```json
133
- {
134
- "$schema": "https://opencode.ai/config.json",
135
- "mcp": {
136
- "workspace": {
137
- "type": "local",
138
- "command": ["npx", "-y", "ssh-agent-workspace"]
139
- }
140
- }
141
- }
142
- ```
143
-
144
- Or via CLI:
145
-
146
- ```bash
147
- opencode mcp add workspace -- npx -y ssh-agent-workspace
148
- ```
149
-
150
- #### Claude Code
151
-
152
- ```bash
153
- claude mcp add workspace -- npx -y ssh-agent-workspace
154
- ```
155
-
156
- Or add to `~/.config/claude-code/claude_code_config.json` or project `.mcp.json`:
157
-
158
- ```json
159
- {
160
- "mcpServers": {
161
- "workspace": {
162
- "command": "npx",
163
- "args": ["-y", "ssh-agent-workspace"],
164
- "autoApprove": [
165
- "mcp__workspace__connect",
166
- "mcp__workspace__exec",
167
- "mcp__workspace__send_input",
168
- "mcp__workspace__read_output",
169
- "mcp__workspace__list_hosts",
170
- "mcp__workspace__list_sessions",
171
- "mcp__workspace__sftp_upload",
172
- "mcp__workspace__sftp_download",
173
- "mcp__workspace__sftp_list"
174
- ]
175
- }
176
- }
177
- }
178
- ```
179
-
180
- **Tip:** The `autoApprove` block lets the agent use those tools without asking permission each time. Add or remove tools based on your comfort level.
181
-
182
- #### Cursor
183
-
184
- Go to `Cursor Settings` → `MCP` → `New MCP Server`. Use this config:
185
-
186
- ```json
187
- {
188
- "mcpServers": {
189
- "workspace": {
190
- "command": "npx",
191
- "args": ["-y", "ssh-agent-workspace"]
192
- }
193
- }
194
- }
195
- ```
196
-
197
- #### Codex (OpenAI)
198
-
199
- ```bash
200
- codex mcp add workspace -- npx -y ssh-agent-workspace
201
- ```
202
-
203
- Or add to `~/.codex/config.toml`:
204
-
205
- ```toml
206
- [mcp_servers.workspace]
207
- command = "npx"
208
- args = ["-y", "ssh-agent-workspace"]
209
- ```
210
-
211
- #### Windsurf
212
-
213
- Add to `~/.codeium/windsurf/mcp_config.json`:
214
-
215
- ```json
216
- {
217
- "mcpServers": {
218
- "workspace": {
219
- "command": "npx",
220
- "args": ["-y", "ssh-agent-workspace"]
221
- }
222
- }
223
- }
224
- ```
225
-
226
- #### Copilot / VS Code
227
-
228
- ```json
229
- {
230
- "mcpServers": {
231
- "workspace": {
232
- "command": "npx",
233
- "args": ["-y", "ssh-agent-workspace"]
234
- }
235
- }
236
- }
237
- ```
238
-
239
- #### Gemini CLI
240
-
241
- ```bash
242
- gemini mcp add workspace npx -y ssh-agent-workspace
243
- ```
244
-
245
- #### Cline
246
-
247
- ```json
248
- {
249
- "mcpServers": {
250
- "workspace": {
251
- "command": "npx",
252
- "args": ["-y", "ssh-agent-workspace"]
253
- }
254
- }
255
- }
256
- ```
257
-
258
- #### Qoder
259
-
260
- ```bash
261
- qodercli mcp add workspace -- npx -y ssh-agent-workspace
262
- ```
263
-
264
- #### Using npx
265
-
266
- All examples above use `npx` which auto-downloads the latest version. No global install needed.
267
-
268
- If you installed globally (`npm install -g ssh-agent-workspace`), replace `"npx"` / `"-y"` / `"ssh-agent-workspace"` with `"ssh-agent-workspace"` as the command directly.
269
-
270
109
  Your agent now has a persistent workspace on `prod`. Running `cd /var/www` once means the agent stays there for every subsequent command.
271
110
 
272
111
  ---
@@ -322,7 +161,8 @@ No restart needed. Changes apply immediately.
322
161
 
323
162
  ## Tools (25)
324
163
 
325
- ### Workspace (9)
164
+ <details>
165
+ <summary><b>Workspace (9 tools)</b></summary>
326
166
 
327
167
  | Tool | Description |
328
168
  |---|---|
@@ -335,45 +175,58 @@ No restart needed. Changes apply immediately.
335
175
  | `disconnect` | Close session. Optionally kill tmux or keep alive |
336
176
  | `list_hosts` | List `~/.ssh/config` aliases |
337
177
  | `list_sessions` | List active workspaces |
178
+ </details>
338
179
 
339
- ### File Transfer (3)
180
+ <details>
181
+ <summary><b>File Transfer (3 tools)</b></summary>
340
182
 
341
183
  | Tool | Description |
342
184
  |---|---|
343
185
  | `sftp_upload` | Upload file to remote |
344
186
  | `sftp_download` | Download file from remote |
345
187
  | `sftp_list` | List remote directory |
188
+ </details>
346
189
 
347
- ### Monitoring (3)
190
+ <details>
191
+ <summary><b>Monitoring (3 tools)</b></summary>
348
192
 
349
193
  | Tool | Description |
350
194
  |---|---|
351
195
  | `connection_status` | SSH liveness + tmux existence |
352
196
  | `health_check` | CPU / RAM / Disk / Load / Uptime |
353
197
  | `tail_log` | Log tail with optional follow |
198
+ </details>
354
199
 
355
- ### DevOps (4)
200
+ <details>
201
+ <summary><b>DevOps (6 tools)</b></summary>
356
202
 
357
203
  | Tool | Description |
358
204
  |---|---|
359
205
  | `deploy` | Upload → backup → chmod → chown → restart |
360
206
  | `backup` | tar.gz archive → download → cleanup |
361
207
  | `sync` | Rsync-lite via SFTP (bidirectional, dry-run) |
362
- | `ssh_tunnel_open` / `ssh_tunnel_list` / `ssh_tunnel_close` | Port forwarding + SOCKS5 |
208
+ | `ssh_tunnel_open` | Local port forward or SOCKS5 proxy |
209
+ | `ssh_tunnel_list` | List active tunnels |
210
+ | `ssh_tunnel_close` | Close tunnel, free port |
211
+ </details>
363
212
 
364
- ### Cluster & Queries (2)
213
+ <details>
214
+ <summary><b>Cluster & Queries (2 tools)</b></summary>
365
215
 
366
216
  | Tool | Description |
367
217
  |---|---|
368
218
  | `group_exec` | Run command across multiple workspaces (parallel/sequential) |
369
219
  | `db_query` | Read-only MySQL / PostgreSQL / MongoDB via SSH |
220
+ </details>
370
221
 
371
- ### Runtime Config (2)
222
+ <details>
223
+ <summary><b>Runtime Config (2 tools)</b></summary>
372
224
 
373
225
  | Tool | Description |
374
226
  |---|---|
375
227
  | `tools_config` | Enable/disable tools at runtime |
376
228
  | `host_security` | Per-host read-only, command allow/denylist |
229
+ </details>
377
230
 
378
231
  **Full reference:** [`docs/TOOLS.md`](docs/TOOLS.md) | **Security:** [`docs/SECURITY.md`](docs/SECURITY.md)
379
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssh-agent-workspace",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Persistent SSH workspaces for AI agents. Stateful tmux-backed sessions that survive reconnects, restarts, and network drops — with runtime security and tool configuration.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",