@fkom13/mcp-sftp-orchestrator 11.3.0 β 11.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +6 -0
- package/CHANGELOG.md +174 -0
- package/README.fr.md +230 -243
- package/README.md +268 -286
- package/apis.js +20 -81
- package/atomicJsonStore.js +117 -0
- package/config.js +5 -0
- package/fleet.js +170 -0
- package/groups.js +25 -0
- package/history.js +5 -51
- package/infraTopology.js +336 -0
- package/inventory.js +151 -0
- package/lhm.plugin.json +7 -0
- package/notes.js +3 -87
- package/package.json +8 -6
- package/policies.js +6 -74
- package/projects.js +108 -0
- package/queue.js +83 -14
- package/server.js +821 -90
- package/servers.js +30 -33
- package/sftp.js +168 -60
- package/shellSessions.js +31 -3
- package/snapshotManager.js +3 -7
- package/sourceAdapter.js +54 -1
- package/ssh.js +17 -3
- package/sshPool.js +129 -112
- package/sshTrust.js +214 -0
- package/toolMetadata.js +76 -0
- package/tunnels.js +36 -17
- package/utils.js +210 -1
- package/workSession.js +139 -0
- package/.gencodedoc.yaml +0 -76
- package/ROADMAP.md +0 -21
- package/test_features.js +0 -112
- package/test_mcp.js +0 -55
package/README.md
CHANGED
|
@@ -1,294 +1,273 @@
|
|
|
1
|
-
# π MCP Orchestrator β SSH/SFTP
|
|
1
|
+
# π MCP Orchestrator β Serveur d'orchestration SSH/SFTP
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
> **v11.8.0 Security Refresh** β Les 82 tools publient dΓ©sormais les annotations MCP standard. `infra_overview` reste lΓ©ger sans argument, mais `infra_overview { alias: "..." }` effectue une dΓ©couverte live et corrΓ¨le Nginx/domaines, ports, Docker/Compose et services. Voir `CHANGELOG.md`.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
**Version** : 11.8.0
|
|
7
|
+
**Tools** : 82
|
|
4
8
|
**License** : MIT
|
|
5
|
-
**Node** : >= 18.0.0
|
|
9
|
+
**Node** : >= 18.0.0
|
|
10
|
+
**Changelog** : [CHANGELOG.md](./CHANGELOG.md)
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
Serveur MCP (Model Context Protocol, transport **stdio**) qui donne Γ un agent IA la capacitΓ© dβorchestrer un parc de serveurs : SSH, SFTP, Γ©dition de fichiers locale/remote (hash-safe), diffs cross-server, shell PTY, snapshots dβinfra, notes de protocole, **projets**, **sessions de travail**, inventaire, trust SSH (pubkey), groupes dβalias et audit parc.
|
|
13
|
+
|
|
14
|
+
---
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
- **63 MCP tools** β SSH, SFTP, file ops, monitoring, snapshots, tunnels
|
|
11
|
-
- **Built-in security** β Command blocklist, port allowlist, hash protection
|
|
12
|
-
- **Multi-server** β `task_exec {alias:["vps1","vps2"]}` or `alias:"all"}`
|
|
13
|
-
- **Persistence** β tmux + persistent queue = sessions that survive crashes
|
|
14
|
-
- **Snapshots** β Deduplicated versioning of your critical files
|
|
15
|
-
- **SSH Tunnels** β Local, Remote, SOCKS5 with secured port allowlist
|
|
16
|
-
- **AI Guide** β Built-in manual for the agent (section:index/workflows/audit/security)
|
|
16
|
+
## β¨ Points forts (v11.6)
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
| Domaine | CapacitΓ© |
|
|
19
|
+
|---------|----------|
|
|
20
|
+
| **ExΓ©cution** | `task_exec` multi-serveur / `group:oci` / dry-run destructif / force |
|
|
21
|
+
| **Fichiers** | `file_read` / `file_edit` (chirurgical) / `file_write` + hash + dryRun + backup |
|
|
22
|
+
| **Parc** | notes, `infra_audit`, `fleet_status`, `server_inventory` |
|
|
23
|
+
| **Projets** | registre localβremote + `project_diff` |
|
|
24
|
+
| **Travail** | `work_start` β edits β `work_end` (note dβintervention auto) |
|
|
25
|
+
| **Trust** | `ssh_authorize_key` (pubkey only, dry_run par dΓ©faut) |
|
|
26
|
+
| **SΓ©cu** | secrets masquΓ©s, RO global + **RO par alias**, blocklist, pool SSH robuste |
|
|
19
27
|
|
|
20
28
|
---
|
|
21
29
|
|
|
22
30
|
## π¦ Installation
|
|
23
31
|
|
|
24
|
-
### Via npx (recommended)
|
|
25
|
-
```bash
|
|
26
|
-
npx @fkom13/mcp-sftp-orchestrator
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Via git
|
|
30
32
|
```bash
|
|
31
33
|
git clone https://github.com/fkom13/mcp-sftp-orchestrator.git
|
|
32
|
-
cd mcp
|
|
34
|
+
cd sftp-mcp # ou tools/sftp-mcp
|
|
33
35
|
npm install
|
|
34
36
|
cp .env.example .env
|
|
35
|
-
#
|
|
37
|
+
# Γditer MCP_DATA_DIR et chemins de clΓ©s
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
PrΓ©requis : **Node.js >= 18**
|
|
39
41
|
|
|
40
42
|
---
|
|
41
43
|
|
|
42
|
-
## βοΈ Configuration (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| Variable |
|
|
47
|
-
|
|
48
|
-
| `MCP_DATA_DIR` | `~/.config/mcp-orchestrator` |
|
|
49
|
-
| `MCP_SYNC_TIMEOUT_S` | `120` |
|
|
50
|
-
| `MCP_DEFAULT_CMD_TIMEOUT_S` | `600` |
|
|
51
|
-
| `MCP_INTERACTIVE_CMD_TIMEOUT_S` | `300` |
|
|
52
|
-
| `MCP_MAX_WAIT_TIMEOUT_S` | `600` |
|
|
53
|
-
| `MAX_CONNECTIONS_PER_SERVER` | `5` |
|
|
54
|
-
| `MIN_CONNECTIONS_PER_SERVER` | `1` |
|
|
55
|
-
| `IDLE_TIMEOUT` | `300000` |
|
|
56
|
-
| `KEEP_ALIVE_INTERVAL` | `30000` | SSH
|
|
57
|
-
| `MAX_QUEUE_SIZE` | `1000` |
|
|
58
|
-
| `SAVE_INTERVAL` | `5000` |
|
|
59
|
-
| `MCP_ALLOWED_ROOTS` |
|
|
60
|
-
| `
|
|
44
|
+
## βοΈ Configuration (`.env`)
|
|
45
|
+
|
|
46
|
+
Toutes les variables sont optionnelles.
|
|
47
|
+
|
|
48
|
+
| Variable | DΓ©faut | Description |
|
|
49
|
+
|----------|--------|-------------|
|
|
50
|
+
| `MCP_DATA_DIR` | `~/.config/mcp-orchestrator` | Dossier data (JSON, snapshots, projetsβ¦) |
|
|
51
|
+
| `MCP_SYNC_TIMEOUT_S` | `120` | DΓ©lai (s) avant passage dβune tΓ’che en arriΓ¨re-plan |
|
|
52
|
+
| `MCP_DEFAULT_CMD_TIMEOUT_S` | `600` | Timeout SSH commande (s). `0` = infini |
|
|
53
|
+
| `MCP_INTERACTIVE_CMD_TIMEOUT_S` | `300` | Timeout interactif (s). `0` = infini |
|
|
54
|
+
| `MCP_MAX_WAIT_TIMEOUT_S` | `600` | Timeout max `task_wait` (s) |
|
|
55
|
+
| `MAX_CONNECTIONS_PER_SERVER` | `5` | Pool SSH max / serveur |
|
|
56
|
+
| `MIN_CONNECTIONS_PER_SERVER` | `1` | Pool SSH min / serveur |
|
|
57
|
+
| `IDLE_TIMEOUT` | `300000` | Fermeture connexion inactive (ms) |
|
|
58
|
+
| `KEEP_ALIVE_INTERVAL` | `30000` | Keepalive SSH (ms) |
|
|
59
|
+
| `MAX_QUEUE_SIZE` | `1000` | Taille max queue jobs |
|
|
60
|
+
| `SAVE_INTERVAL` | `5000` | Autosave queue (ms) |
|
|
61
|
+
| `MCP_ALLOWED_ROOTS` | _(vide)_ | Racines autorisΓ©es pour paths locaux (CSV) |
|
|
62
|
+
| `MCP_READONLY` | `false` | `1` = refuse Γ©critures / exec mutantes (global) |
|
|
63
|
+
| `MCP_COMPACT` | `false` | `1` = rΓ©ponses tronquΓ©es (tokens agent) |
|
|
64
|
+
| `MCP_DEBUG` | `false` | Logs dΓ©taillΓ©s stderr |
|
|
65
|
+
|
|
66
|
+
### Fichiers sous `MCP_DATA_DIR`
|
|
67
|
+
|
|
68
|
+
| Fichier | Contenu |
|
|
69
|
+
|---------|---------|
|
|
70
|
+
| `servers.json` | Alias SSH (`host`, `user`, `keyPath`/`password`, `port?`, `readonly?`) |
|
|
71
|
+
| `apis.json` | Catalogue APIs (secrets masquΓ©s en lecture tools) |
|
|
72
|
+
| `queue.json` / `queue.backup.json` | Jobs |
|
|
73
|
+
| `history.json` | Historique tΓ’ches |
|
|
74
|
+
| `server_notes.json` | Protocoles / notes par serveur |
|
|
75
|
+
| `server_groups.json` | Groupes dβalias |
|
|
76
|
+
| `projects.json` | Registre projets |
|
|
77
|
+
| `work_sessions.json` | Sessions de travail |
|
|
78
|
+
| `policies.json` | Blocklist commandes |
|
|
79
|
+
| `tunnels.json` / `tunnel_allowlist.json` | Tunnels SSH |
|
|
80
|
+
| `infra_snapshots/` | Snapshots content-addressable |
|
|
61
81
|
|
|
62
82
|
---
|
|
63
83
|
|
|
64
|
-
## π
|
|
84
|
+
## π Connexion client MCP
|
|
85
|
+
|
|
86
|
+
### Grok / config.toml
|
|
87
|
+
|
|
88
|
+
```toml
|
|
89
|
+
[mcp_servers.orchestrator]
|
|
90
|
+
command = "node"
|
|
91
|
+
args = ["/chemin/absolu/sftp-mcp/server.js"]
|
|
92
|
+
# optionnel:
|
|
93
|
+
# env = { MCP_DATA_DIR = "/chemin/absolu/sftp-mcp/data" }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### OpenCode / Claude Desktop (JSON)
|
|
65
97
|
|
|
66
98
|
```json
|
|
67
99
|
{
|
|
68
100
|
"mcpServers": {
|
|
69
101
|
"orchestrator": {
|
|
70
102
|
"command": "node",
|
|
71
|
-
"args": ["/
|
|
103
|
+
"args": ["/chemin/absolu/sftp-mcp/server.js"],
|
|
72
104
|
"env": {
|
|
73
|
-
"MCP_DATA_DIR": "/
|
|
105
|
+
"MCP_DATA_DIR": "/chemin/absolu/sftp-mcp/data"
|
|
74
106
|
}
|
|
75
107
|
}
|
|
76
108
|
}
|
|
77
109
|
}
|
|
78
110
|
```
|
|
79
111
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## π§° Tool Reference (63 tools)
|
|
83
|
-
|
|
84
|
-
### Help & Diagnostics
|
|
85
|
-
| Tool | Description |
|
|
86
|
-
|------|-------------|
|
|
87
|
-
| `help` | Complete guide: tools, env vars, parameter schemas |
|
|
88
|
-
| `guide` | AI manual: workflows, cheatsheet, audit, security |
|
|
89
|
-
| `system_diagnostics` | Full system diagnostic (queue, pool, servers, APIs) |
|
|
90
|
-
|
|
91
|
-
### Server Management
|
|
92
|
-
| Tool | Description |
|
|
93
|
-
|------|-------------|
|
|
94
|
-
| `server_add` | Add/update a server alias |
|
|
95
|
-
| `server_list` | List all configured servers |
|
|
96
|
-
| `server_remove` | Remove a server alias |
|
|
97
|
-
| `infra_overview` | Fleet-wide overview (roles, services, warnings) |
|
|
98
|
-
| `server_note_set/get/list/remove` | Documented server context |
|
|
99
|
-
|
|
100
|
-
### Security (Blocklist)
|
|
101
|
-
| Tool | Description |
|
|
102
|
-
|------|-------------|
|
|
103
|
-
| `policy_blocklist_list` | List blocked commands |
|
|
104
|
-
| `policy_blocklist_add` | Add a pattern to blocklist |
|
|
105
|
-
| `policy_blocklist_remove` | Remove a pattern from blocklist |
|
|
106
|
-
|
|
107
|
-
### Task Execution
|
|
108
|
-
| Tool | Description |
|
|
109
|
-
|------|-------------|
|
|
110
|
-
| `task_exec` | SSH one-shot. Supports `alias:["vps1","vps2"]` or `alias:"all"` |
|
|
111
|
-
| `task_exec_interactive` | SSH with interactive prompt handling |
|
|
112
|
-
| `task_exec_sequence` | Sequential SSH commands |
|
|
113
|
-
| `task_transfer` | SFTP transfer. Supports `server_to_server` |
|
|
114
|
-
| `task_transfer_multi` | Bulk transfers with glob patterns |
|
|
115
|
-
|
|
116
|
-
### Monitoring
|
|
117
|
-
| Tool | Description |
|
|
118
|
-
|------|-------------|
|
|
119
|
-
| `get_system_resources` | CPU, RAM, Disk metrics |
|
|
120
|
-
| `get_services_status` | systemd, Docker, PM2 status (graceful fallback) |
|
|
121
|
-
| `get_fail2ban_status` | Fail2Ban status |
|
|
122
|
-
| `check_api_health` | HTTP health check |
|
|
123
|
-
|
|
124
|
-
### Logs
|
|
125
|
-
| Tool | Description |
|
|
126
|
-
|------|-------------|
|
|
127
|
-
| `get_pm2_logs` | PM2 logs |
|
|
128
|
-
| `get_docker_logs` | Docker logs |
|
|
129
|
-
| `tail_file` | Tail a remote file |
|
|
130
|
-
|
|
131
|
-
### File Operations (Local + Remote)
|
|
132
|
-
| Tool | Description |
|
|
133
|
-
|------|-------------|
|
|
134
|
-
| `file_read` | Read file + SHA-256 hash (edit protection) |
|
|
135
|
-
| `file_write` | Create/overwrite with `dryRun` and `backup` |
|
|
136
|
-
| `file_edit` | Surgical or full edit + hash protection |
|
|
137
|
-
|
|
138
|
-
### Comparison & Drift Detection
|
|
139
|
-
| Tool | Description |
|
|
140
|
-
|------|-------------|
|
|
141
|
-
| `diff_files` | Compare 2 files (local/remote, cross-server) |
|
|
142
|
-
| `diff_folders` | Compare 2 directories |
|
|
143
|
-
| `compare_all_sources` | Detect drifts across N servers |
|
|
144
|
-
|
|
145
|
-
### Persistent Shell Sessions
|
|
146
|
-
| Tool | Description |
|
|
147
|
-
|------|-------------|
|
|
148
|
-
| `shell_create` | Open a persistent shell (cd/env preserved) |
|
|
149
|
-
| `shell_exec` | Execute in an existing session |
|
|
150
|
-
| `shell_list` / `shell_close` | List/close sessions |
|
|
151
|
-
|
|
152
|
-
### tmux (Surviving Terminal Sessions)
|
|
153
|
-
| Tool | Description |
|
|
154
|
-
|------|-------------|
|
|
155
|
-
| `tmux_create` | Create a persistent tmux session |
|
|
156
|
-
| `tmux_exec` | Send a command to a session |
|
|
157
|
-
| `tmux_read` | Read session buffer |
|
|
158
|
-
| `tmux_list` / `tmux_kill` | List/kill sessions |
|
|
159
|
-
|
|
160
|
-
### SSH Tunnels
|
|
161
|
-
| Tool | Description |
|
|
162
|
-
|------|-------------|
|
|
163
|
-
| `tunnel_create` | Local/remote/SOCKS5 tunnel, persistent via tmux |
|
|
164
|
-
| `tunnel_list` | List active tunnels |
|
|
165
|
-
| `tunnel_close` | Close a tunnel |
|
|
166
|
-
| `tunnel_allowlist_add/remove` | Manage allowed ports |
|
|
167
|
-
|
|
168
|
-
### Snapshots (File Versioning)
|
|
169
|
-
| Tool | Description |
|
|
170
|
-
|------|-------------|
|
|
171
|
-
| `snapshot_create` | Capture file state with deduplication |
|
|
172
|
-
| `snapshot_list` | List snapshots |
|
|
173
|
-
| `snapshot_diff` | Compare 2 snapshots |
|
|
174
|
-
| `snapshot_restore` | Restore (dryRun by default) |
|
|
175
|
-
| `snapshot_delete` | Delete + orphan cleanup |
|
|
176
|
-
|
|
177
|
-
### Queue & Monitoring
|
|
178
|
-
| Tool | Description |
|
|
179
|
-
|------|-------------|
|
|
180
|
-
| `task_queue` | View all active/pending tasks |
|
|
181
|
-
| `task_status` | Task detail by ID |
|
|
182
|
-
| `task_history` | Filterable history |
|
|
183
|
-
| `task_retry` | Retry a failed task |
|
|
184
|
-
| `task_wait` | Wait for a background task |
|
|
185
|
-
| `task_logs` | MCP internal logs |
|
|
186
|
-
| `queue_stats` / `pool_stats` | Queue and SSH pool stats |
|
|
187
|
-
|
|
188
|
-
### API Catalog
|
|
189
|
-
| Tool | Description |
|
|
190
|
-
|------|-------------|
|
|
191
|
-
| `api_add` / `api_list` / `api_remove` | API monitoring catalog |
|
|
192
|
-
| `api_check` | Health check via SSH + curl |
|
|
112
|
+
AprΓ¨s modification du code : recharger le serveur MCP (`/mcps` β `r` ou restart session). VΓ©rifier `system_diagnostics` β `version: "11.8.0"`.
|
|
193
113
|
|
|
194
114
|
---
|
|
195
115
|
|
|
196
|
-
##
|
|
197
|
-
|
|
198
|
-
###
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
116
|
+
## π§° RΓ©fΓ©rence des outils (82)
|
|
117
|
+
|
|
118
|
+
### Diagnostic & audit
|
|
119
|
+
| Outil | Description |
|
|
120
|
+
|-------|-------------|
|
|
121
|
+
| `help` | Guide outils + .env + astuces |
|
|
122
|
+
| `guide` | Manuel IA (workflows, cheatsheet, pitfalls, audit, security) |
|
|
123
|
+
| `system_diagnostics` | Queue, pool, serveurs/APIs **masquΓ©s**, version, readOnly |
|
|
124
|
+
| `infra_audit` | Synthèse parc + projets + notes + crashed |
|
|
125
|
+
| `infra_overview` | Serveurs + notes (vue légère) |
|
|
126
|
+
| `fleet_status` | Ping SSH parallèle (latence, load, disk) |
|
|
127
|
+
| `server_inventory` | Inventaire lΓ©ger (pm2/docker/disk/home, cache 10 min) |
|
|
128
|
+
|
|
129
|
+
### Serveurs & groupes
|
|
130
|
+
| Outil | Description |
|
|
131
|
+
|-------|-------------|
|
|
132
|
+
| `server_add` | CRUD alias (`keyPath` ou `password`, `port`, **`readonly`**) |
|
|
133
|
+
| `server_list` | Liste (passwords masquΓ©s) |
|
|
134
|
+
| `server_remove` | Supprime un alias |
|
|
135
|
+
| `server_group_list/set/remove` | Groupes (`oci`, `contabo`β¦). Usage : `group:oci` ou nom de groupe |
|
|
136
|
+
|
|
137
|
+
### Projets (v11.6)
|
|
138
|
+
| Outil | Description |
|
|
139
|
+
|-------|-------------|
|
|
140
|
+
| `project_list` / `project_get` / `project_set` / `project_remove` | Registre |
|
|
141
|
+
| `project_resolve` | β `{ local, remote, ignore, runtime }` |
|
|
142
|
+
| `project_diff` | Diff localβremote du projet |
|
|
143
|
+
|
|
144
|
+
Exemple `project_set` :
|
|
202
145
|
|
|
203
|
-
|
|
204
|
-
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"name": "p-image",
|
|
149
|
+
"local": { "path": "/home/.../dev-serveur/p-image" },
|
|
150
|
+
"servers": {
|
|
151
|
+
"prod": {
|
|
152
|
+
"alias": "fkomprodmini2_prod",
|
|
153
|
+
"path": "/home/ubuntu/p-image",
|
|
154
|
+
"runtime": { "pm2": "p-image", "port": 5002 },
|
|
155
|
+
"url": "https://pruna.esprit-artificiel.com"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"ignore": ["node_modules", ".git", "data"]
|
|
159
|
+
}
|
|
205
160
|
```
|
|
206
161
|
|
|
207
|
-
###
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
162
|
+
### Sessions de travail (v11.6)
|
|
163
|
+
| Outil | Description |
|
|
164
|
+
|-------|-------------|
|
|
165
|
+
| `work_start` | Ouvre un journal (`alias`, `project`, `tag`, snapshot optionnel) |
|
|
166
|
+
| `work_log` | Event (`file_edit`, `task_exec`, β¦) |
|
|
167
|
+
| `work_list` | Sessions actives (+ historique) |
|
|
168
|
+
| `work_end` | ClΓ΄ture + `server_note` `last_intervention` |
|
|
212
169
|
|
|
213
|
-
###
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
```
|
|
170
|
+
### Trust SSH (v11.6)
|
|
171
|
+
| Outil | Description |
|
|
172
|
+
|-------|-------------|
|
|
173
|
+
| `ssh_authorize_key` | Ajoute une **pubkey** dans `authorized_keys` distant. `dry_run` dΓ©faut. Sources : `string` \| `local_path` \| `alias` |
|
|
218
174
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"target_alias": "fkomprodmini1_prod",
|
|
178
|
+
"source": { "type": "alias", "alias": "vps_contabo" },
|
|
179
|
+
"comment": "fleet-from-contabo",
|
|
180
|
+
"dry_run": true
|
|
181
|
+
}
|
|
223
182
|
```
|
|
224
183
|
|
|
225
|
-
###
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
184
|
+
### Policies
|
|
185
|
+
| Outil | Description |
|
|
186
|
+
|-------|-------------|
|
|
187
|
+
| `policy_blocklist_list/add/remove` | Blocklist commandes (aussi appliquΓ©e Γ shell + sequences) |
|
|
188
|
+
|
|
189
|
+
### Catalogue API
|
|
190
|
+
| Outil | Description |
|
|
191
|
+
|-------|-------------|
|
|
192
|
+
| `api_add` / `api_list` / `api_remove` / `api_check` | Monitoring (clΓ©s masquΓ©es en list) |
|
|
193
|
+
|
|
194
|
+
### ExΓ©cution de tΓ’ches
|
|
195
|
+
| Outil | Description |
|
|
196
|
+
|-------|-------------|
|
|
197
|
+
| `task_exec` | SSH ; alias \| tableau \| `all` \| `group:x` ; dry_run/force destructif |
|
|
198
|
+
| `task_exec_interactive` | Prompts yes/no, menus |
|
|
199
|
+
| `task_exec_sequence` | SΓ©quence sur un serveur (policy par Γ©tape) |
|
|
200
|
+
| `task_transfer` | SFTP upload/download/`server_to_server` |
|
|
201
|
+
| `task_transfer_multi` | Multi + globs |
|
|
202
|
+
|
|
203
|
+
### Files / Diff / Shell / Snapshots
|
|
204
|
+
| Famille | Outils |
|
|
205
|
+
|---------|--------|
|
|
206
|
+
| Files | `file_read`, `file_write`, `file_edit` |
|
|
207
|
+
| Diff | `diff_files`, `diff_folders`, `compare_all_sources` |
|
|
208
|
+
| Shell | `shell_create`, `shell_exec` (+ `skip_policy`), `shell_list`, `shell_close` |
|
|
209
|
+
| Snapshots | `snapshot_create/list/diff/restore/delete` |
|
|
210
|
+
|
|
211
|
+
**Γdition safe** : `file_read` β hash β `file_edit` + `expectedHash` (+ `dryRun` / `backup`).
|
|
212
|
+
|
|
213
|
+
### Notes serveur
|
|
214
|
+
| Outil | Description |
|
|
215
|
+
|-------|-------------|
|
|
216
|
+
| `server_note_set/get/list/remove` | Protocole (description, services, warnings, intervention) |
|
|
217
|
+
|
|
218
|
+
### Monitoring & logs
|
|
219
|
+
| Outil | Description |
|
|
220
|
+
|-------|-------------|
|
|
221
|
+
| `get_system_resources` | CPU / RAM / disque |
|
|
222
|
+
| `get_services_status` | systemd / Docker / PM2 |
|
|
223
|
+
| `get_fail2ban_status` | Fail2Ban |
|
|
224
|
+
| `check_api_health` | HTTP via SSH+curl |
|
|
225
|
+
| `get_pm2_logs` / `get_docker_logs` / `tail_file` | Logs |
|
|
226
|
+
|
|
227
|
+
### Queue
|
|
228
|
+
| Outil | Description |
|
|
229
|
+
|-------|-------------|
|
|
230
|
+
| `task_queue` / `task_status` / `task_history` / `task_wait` / `task_logs` | Suivi |
|
|
231
|
+
| `task_retry` / `task_retry_all` | Relance |
|
|
232
|
+
| `task_purge` | Purge (dry_run dΓ©faut) |
|
|
233
|
+
| `queue_stats` / `pool_stats` | Stats |
|
|
234
|
+
|
|
235
|
+
### Tmux & tunnels
|
|
236
|
+
| Outil | Description |
|
|
237
|
+
|-------|-------------|
|
|
238
|
+
| `tmux_create/exec/read/list/kill` | Sessions tmux distantes |
|
|
239
|
+
| `tunnel_create/list/close` | Tunnels SSH local/remote/socks |
|
|
240
|
+
| `tunnel_allowlist_add/remove` | Ports autorisΓ©s pour tunnels |
|
|
231
241
|
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
# List blocked commands
|
|
235
|
-
policy_blocklist_list
|
|
236
|
-
# β ["rm -rf /", "mkfs*", ...]
|
|
242
|
+
---
|
|
237
243
|
|
|
238
|
-
|
|
239
|
-
task_exec {alias:"vps", cmd:"rm -rf /tmp/cache", skip_policy:true}
|
|
240
|
-
```
|
|
244
|
+
## π Workflows agent recommandΓ©s
|
|
241
245
|
|
|
242
|
-
###
|
|
243
|
-
```bash
|
|
244
|
-
# Read + hash
|
|
245
|
-
file_read {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"}}
|
|
246
|
-
# β content + hash
|
|
247
|
-
|
|
248
|
-
# Edit with protection
|
|
249
|
-
file_edit {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"},
|
|
250
|
-
oldString:"worker_connections 768;",
|
|
251
|
-
newString:"worker_connections 1024;",
|
|
252
|
-
expectedHash:"abc123...",
|
|
253
|
-
backup:true}
|
|
254
|
-
|
|
255
|
-
# Preview without writing
|
|
256
|
-
file_edit {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"},
|
|
257
|
-
oldString:"worker_connections 768;",
|
|
258
|
-
newString:"worker_connections 1024;",
|
|
259
|
-
dryRun:true}
|
|
246
|
+
### DΓ©but de session
|
|
260
247
|
```
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
# Before
|
|
265
|
-
snapshot_create {source:{type:"remote", alias:"vps"}, paths:["/etc/nginx/"], tag:"before-fix"}
|
|
266
|
-
|
|
267
|
-
# After if something broke
|
|
268
|
-
snapshot_restore {snapshotId:"...", target:{type:"remote", alias:"vps"}, dryRun:false, force:true}
|
|
248
|
+
infra_audit (ou infra_overview)
|
|
249
|
+
fleet_status
|
|
250
|
+
project_list / project_resolve
|
|
269
251
|
```
|
|
270
252
|
|
|
271
|
-
###
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
253
|
+
### Chantier sur un projet
|
|
254
|
+
```
|
|
255
|
+
work_start { project: "p-image", alias: "fkomprodmini2_prod", tag: "fix-x", message: "β¦" }
|
|
256
|
+
file_read β file_edit (expectedHash, dryRun puis apply)
|
|
257
|
+
work_log { type: "file_edit", path: "β¦" }
|
|
258
|
+
work_end { summary: "β¦" } β note serveur mise Γ jour
|
|
259
|
+
project_diff { name: "p-image" }
|
|
277
260
|
```
|
|
278
261
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
The orchestrator includes an interactive manual for your AI agent:
|
|
262
|
+
### Commandes longues
|
|
263
|
+
```
|
|
264
|
+
task_exec { timeout: 0, β¦ } β si > syncTimeout β task_wait { id }
|
|
265
|
+
```
|
|
284
266
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
guide section:audit # Full fleet audit in 8 steps
|
|
290
|
-
guide section:security # Blocklist + tunnels
|
|
291
|
-
guide section:pitfalls # Common mistakes
|
|
267
|
+
### Cibles multi-serveurs
|
|
268
|
+
```
|
|
269
|
+
task_exec { alias: "group:oci", cmd: "hostname" }
|
|
270
|
+
task_exec { alias: "all", cmd: "uptime" }
|
|
292
271
|
```
|
|
293
272
|
|
|
294
273
|
---
|
|
@@ -296,79 +275,82 @@ guide section:pitfalls # Common mistakes
|
|
|
296
275
|
## ποΈ Architecture
|
|
297
276
|
|
|
298
277
|
```
|
|
299
|
-
MCP
|
|
278
|
+
Client MCP (stdio)
|
|
300
279
|
β
|
|
301
|
-
server.js βββ
|
|
280
|
+
server.js βββ 82 tools
|
|
302
281
|
β
|
|
303
|
-
βββ queue.js
|
|
304
|
-
βββ ssh.js
|
|
305
|
-
βββ sftp.js
|
|
306
|
-
βββ
|
|
307
|
-
βββ
|
|
308
|
-
βββ
|
|
309
|
-
βββ
|
|
310
|
-
βββ
|
|
311
|
-
βββ
|
|
312
|
-
βββ
|
|
313
|
-
βββ
|
|
314
|
-
βββ
|
|
315
|
-
βββ diffFormatter.js β Diff formatting
|
|
316
|
-
βββ sourceAdapter.js β Local/remote abstraction
|
|
317
|
-
βββ shellSessions.js β Persistent shell sessions
|
|
318
|
-
βββ snapshotManager.js β Versioned snapshots
|
|
319
|
-
βββ notes.js ββββββββ Documented server context
|
|
320
|
-
βββ policies.js ββββ Command blocklist
|
|
321
|
-
βββ tunnels.js ββββββ SSH tunnels (local/remote/SOCKS)
|
|
322
|
-
βββ guide.js ββββββββ AI built-in manual
|
|
323
|
-
βββ diagnose.js βββββ Diagnostics
|
|
282
|
+
βββ queue.js File dβattente persistante + purge/retry
|
|
283
|
+
βββ ssh.js / sshPool ExΓ©cution + pool (retry safe, port configurable)
|
|
284
|
+
βββ sftp.js Transferts (server_to_server via sourceAdapter/pool)
|
|
285
|
+
βββ sourceAdapter.js Local fs | remote SFTP pool
|
|
286
|
+
βββ fileOps.js Read/write/edit + hash + dryRun + backup
|
|
287
|
+
βββ diffEngine.js / compareEngine.js / diffFormatter.js
|
|
288
|
+
βββ shellSessions.js PTY persistants + policy
|
|
289
|
+
βββ snapshotManager.js
|
|
290
|
+
βββ projects.js / workSession.js / inventory.js / groups.js / fleet.js
|
|
291
|
+
βββ sshTrust.js authorized_keys (pubkey only)
|
|
292
|
+
βββ servers.js / apis.js / notes.js / policies.js / tunnels.js
|
|
293
|
+
βββ history.js / guide.js / config.js / utils.js
|
|
324
294
|
```
|
|
325
295
|
|
|
326
|
-
###
|
|
296
|
+
### Cycle de vie dβun job
|
|
327
297
|
|
|
328
298
|
```
|
|
329
|
-
pending β running β completed
|
|
330
|
-
β (
|
|
331
|
-
crashed β
|
|
299
|
+
pending β running β completed | failed | partial
|
|
300
|
+
β (redΓ©marrage MCP pendant running)
|
|
301
|
+
crashed β task_retry β pending
|
|
332
302
|
```
|
|
333
303
|
|
|
334
304
|
---
|
|
335
305
|
|
|
336
|
-
## π
|
|
306
|
+
## π SΓ©curitΓ©
|
|
337
307
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
308
|
+
| MΓ©canisme | DΓ©tail |
|
|
309
|
+
|-----------|--------|
|
|
310
|
+
| Secrets | MasquΓ©s en `api_list` / diagnostics (`***` + 4 derniers car.) |
|
|
311
|
+
| Shell escape | `escapeShellArg` sur curl, logs, chemins |
|
|
312
|
+
| Blocklist | `policies.json` ; shell + sequence inclus ; `skip_policy` pour forcer |
|
|
313
|
+
| RO global | `MCP_READONLY=1` |
|
|
314
|
+
| RO alias | `"readonly": true` dans `servers.json` |
|
|
315
|
+
| Destructif | `task_exec` dry-run si pattern dangereux sans `force:true` |
|
|
316
|
+
| Trust | Pubkey only ; dry_run par dΓ©faut |
|
|
317
|
+
| ClΓ©s | PrΓ©fΓ©rer `keyPath` SSH ; Vaultwarden pour secrets API |
|
|
346
318
|
|
|
347
319
|
---
|
|
348
320
|
|
|
349
321
|
## π§ͺ Tests
|
|
350
322
|
|
|
351
323
|
```bash
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
node
|
|
324
|
+
npm test:unit # p0 + p1 + p16 (43 tests)
|
|
325
|
+
npm test # unit + smoke MCP + features
|
|
326
|
+
node diagnose.js # diagnostic local optionnel
|
|
355
327
|
```
|
|
356
328
|
|
|
329
|
+
| Fichier | Couverture |
|
|
330
|
+
|---------|------------|
|
|
331
|
+
| `test_p0_unit.js` | utils, policies, redact, timeouts, version |
|
|
332
|
+
| `test_p1_unit.js` | groups, purge, destructive, RO env |
|
|
333
|
+
| `test_p16_unit.js` | projects, work session, compact, sshTrust |
|
|
334
|
+
| `test_mcp.js` | smoke SDK |
|
|
335
|
+
| `test_features.js` | queue / pool / globs / prompts |
|
|
336
|
+
|
|
357
337
|
---
|
|
358
338
|
|
|
359
|
-
## π£οΈ
|
|
339
|
+
## π£οΈ Versions rΓ©centes
|
|
360
340
|
|
|
361
|
-
| Version |
|
|
362
|
-
|
|
363
|
-
|
|
|
364
|
-
|
|
|
365
|
-
| 11.
|
|
366
|
-
| 11.
|
|
367
|
-
|
|
|
368
|
-
|
|
|
341
|
+
| Version | Contenu | Snapshot gencodedoc |
|
|
342
|
+
|---------|---------|---------------------|
|
|
343
|
+
| **11.6.1** | Hardening multi-agent: RO transversal, server-to-server dossiers/force, allowed roots anti-symlink, quoting shell/tmux, queue + JSON stores atomiques | β |
|
|
344
|
+
| **11.6.0** | Projets, work sessions, inventory, ssh_authorize_key, RO alias, compact | **#23** (final docs) |
|
|
345
|
+
| 11.4.0 | fleet, infra_audit, groups, retry_all, purge, pool rewrite | #21 |
|
|
346
|
+
| 11.3.0 | Secrets mask, policy shell/seq, port SSH, wait partial | #20 |
|
|
347
|
+
| 10.4β10.0 | file ops, diff, shell, snapshots, notes, guide | #17β19 |
|
|
348
|
+
| 9.x / 8.x | SFTP force, timeouts, interactif, sΓ©cu de base | β |
|
|
349
|
+
|
|
350
|
+
DΓ©tail : **[CHANGELOG.md](./CHANGELOG.md)** Β· plans historiques : `ROADMAP.md`, `ROADMAP_EXTENDED.md`.
|
|
369
351
|
|
|
370
352
|
---
|
|
371
353
|
|
|
372
|
-
## π
|
|
354
|
+
## π Licence
|
|
373
355
|
|
|
374
356
|
MIT β Copyright (c) 2025-2026 Franck (fkom13)
|