ssh-agent-workspace 1.0.3 → 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.
- package/README.md +33 -206
- 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
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
Traditional SSH MCP
|
|
17
|
+
|
|
18
|
+
AI
|
|
19
|
+
└─ ssh exec channel
|
|
20
|
+
└─ command
|
|
21
|
+
└─ state lost every time
|
|
29
22
|
|
|
30
|
-
|
|
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
|
-
##
|
|
37
|
+
## Why This Exists
|
|
38
|
+
|
|
39
|
+
Most SSH MCP servers use exec channels. Every command starts from scratch:
|
|
35
40
|
|
|
36
41
|
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
52
|
+
## Core Features
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
69
|
+
Or from source:
|
|
81
70
|
|
|
82
71
|
```bash
|
|
83
72
|
git clone https://github.com/ShiroNexo/ssh-agent-workspace.git
|
|
@@ -117,168 +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
|
-
<details>
|
|
127
|
-
<summary><b>OpenCode</b></summary>
|
|
128
|
-
|
|
129
|
-
Add to `~/.config/opencode/opencode.json`:
|
|
130
|
-
|
|
131
|
-
```json
|
|
132
|
-
{
|
|
133
|
-
"$schema": "https://opencode.ai/config.json",
|
|
134
|
-
"mcp": {
|
|
135
|
-
"workspace": {
|
|
136
|
-
"type": "local",
|
|
137
|
-
"command": ["npx", "-y", "ssh-agent-workspace"]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Or via CLI:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
opencode mcp add workspace -- npx -y ssh-agent-workspace
|
|
147
|
-
```
|
|
148
|
-
</details>
|
|
149
|
-
|
|
150
|
-
<details>
|
|
151
|
-
<summary><b>Claude Code</b></summary>
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
claude mcp add workspace -- npx -y ssh-agent-workspace
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Or add to `~/.config/claude-code/claude_code_config.json` or project `.mcp.json`:
|
|
158
|
-
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"mcpServers": {
|
|
162
|
-
"workspace": {
|
|
163
|
-
"command": "npx",
|
|
164
|
-
"args": ["-y", "ssh-agent-workspace"],
|
|
165
|
-
"autoApprove": [
|
|
166
|
-
"mcp__workspace__connect",
|
|
167
|
-
"mcp__workspace__exec",
|
|
168
|
-
"mcp__workspace__send_input",
|
|
169
|
-
"mcp__workspace__read_output",
|
|
170
|
-
"mcp__workspace__list_hosts",
|
|
171
|
-
"mcp__workspace__list_sessions",
|
|
172
|
-
"mcp__workspace__sftp_upload",
|
|
173
|
-
"mcp__workspace__sftp_download",
|
|
174
|
-
"mcp__workspace__sftp_list"
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
> **Tip:** The `autoApprove` block lets the agent use those tools without asking permission each time. Add or remove tools based on your comfort level.
|
|
182
|
-
</details>
|
|
183
|
-
|
|
184
|
-
<details>
|
|
185
|
-
<summary><b>Cursor</b></summary>
|
|
186
|
-
|
|
187
|
-
Go to `Cursor Settings` → `MCP` → `New MCP Server`. Use this config:
|
|
188
|
-
|
|
189
|
-
```json
|
|
190
|
-
{
|
|
191
|
-
"mcpServers": {
|
|
192
|
-
"workspace": {
|
|
193
|
-
"command": "npx",
|
|
194
|
-
"args": ["-y", "ssh-agent-workspace"]
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
</details>
|
|
200
|
-
|
|
201
|
-
<details>
|
|
202
|
-
<summary><b>Codex (OpenAI)</b></summary>
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
codex mcp add workspace -- npx -y ssh-agent-workspace
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Or add to `~/.codex/config.toml`:
|
|
209
|
-
|
|
210
|
-
```toml
|
|
211
|
-
[mcp_servers.workspace]
|
|
212
|
-
command = "npx"
|
|
213
|
-
args = ["-y", "ssh-agent-workspace"]
|
|
214
|
-
```
|
|
215
|
-
</details>
|
|
216
|
-
|
|
217
|
-
<details>
|
|
218
|
-
<summary><b>Windsurf</b></summary>
|
|
219
|
-
|
|
220
|
-
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
221
|
-
|
|
222
|
-
```json
|
|
223
|
-
{
|
|
224
|
-
"mcpServers": {
|
|
225
|
-
"workspace": {
|
|
226
|
-
"command": "npx",
|
|
227
|
-
"args": ["-y", "ssh-agent-workspace"]
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
</details>
|
|
233
|
-
|
|
234
|
-
<details>
|
|
235
|
-
<summary><b>Copilot / VS Code</b></summary>
|
|
236
|
-
|
|
237
|
-
```json
|
|
238
|
-
{
|
|
239
|
-
"mcpServers": {
|
|
240
|
-
"workspace": {
|
|
241
|
-
"command": "npx",
|
|
242
|
-
"args": ["-y", "ssh-agent-workspace"]
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
</details>
|
|
248
|
-
|
|
249
|
-
<details>
|
|
250
|
-
<summary><b>Gemini CLI</b></summary>
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
gemini mcp add workspace npx -y ssh-agent-workspace
|
|
254
|
-
```
|
|
255
|
-
</details>
|
|
256
|
-
|
|
257
|
-
<details>
|
|
258
|
-
<summary><b>Cline</b></summary>
|
|
259
|
-
|
|
260
|
-
```json
|
|
261
|
-
{
|
|
262
|
-
"mcpServers": {
|
|
263
|
-
"workspace": {
|
|
264
|
-
"command": "npx",
|
|
265
|
-
"args": ["-y", "ssh-agent-workspace"]
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
</details>
|
|
271
|
-
|
|
272
|
-
<details>
|
|
273
|
-
<summary><b>Qoder</b></summary>
|
|
274
|
-
|
|
275
|
-
```bash
|
|
276
|
-
qodercli mcp add workspace -- npx -y ssh-agent-workspace
|
|
277
|
-
```
|
|
278
|
-
</details>
|
|
279
|
-
|
|
280
|
-
> **Using npx** means no global install needed. npx auto-downloads the latest version. If you installed globally (`npm install -g ssh-agent-workspace`), replace `"npx"` / `"-y"` / `"ssh-agent-workspace"` with `"ssh-agent-workspace"` as the command directly.
|
|
281
|
-
|
|
282
109
|
Your agent now has a persistent workspace on `prod`. Running `cd /var/www` once means the agent stays there for every subsequent command.
|
|
283
110
|
|
|
284
111
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssh-agent-workspace",
|
|
3
|
-
"version": "1.0.
|
|
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",
|