@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.fr.md
CHANGED
|
@@ -1,276 +1,273 @@
|
|
|
1
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)
|
|
11
|
+
|
|
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
|
+
---
|
|
6
15
|
|
|
7
|
-
|
|
16
|
+
## ✨ Points forts (v11.6)
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 |
|
|
17
27
|
|
|
18
28
|
---
|
|
19
29
|
|
|
20
30
|
## 📦 Installation
|
|
21
31
|
|
|
22
|
-
### Via npx (recommandé)
|
|
23
|
-
```bash
|
|
24
|
-
npx @fkom13/mcp-sftp-orchestrator
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Via git
|
|
28
32
|
```bash
|
|
29
33
|
git clone https://github.com/fkom13/mcp-sftp-orchestrator.git
|
|
30
|
-
cd mcp
|
|
34
|
+
cd sftp-mcp # ou tools/sftp-mcp
|
|
31
35
|
npm install
|
|
32
36
|
cp .env.example .env
|
|
33
|
-
# Éditer
|
|
37
|
+
# Éditer MCP_DATA_DIR et chemins de clés
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
Prérequis : Node.js >= 18
|
|
40
|
+
Prérequis : **Node.js >= 18**
|
|
37
41
|
|
|
38
42
|
---
|
|
39
43
|
|
|
40
|
-
## ⚙️ Configuration (
|
|
44
|
+
## ⚙️ Configuration (`.env`)
|
|
41
45
|
|
|
42
|
-
Toutes les variables sont optionnelles.
|
|
46
|
+
Toutes les variables sont optionnelles.
|
|
43
47
|
|
|
44
48
|
| Variable | Défaut | Description |
|
|
45
49
|
|----------|--------|-------------|
|
|
46
|
-
| `MCP_DATA_DIR` | `~/.config/mcp-orchestrator` | Dossier
|
|
47
|
-
| `MCP_SYNC_TIMEOUT_S` | `120` | Délai
|
|
48
|
-
| `MCP_DEFAULT_CMD_TIMEOUT_S` | `600` | Timeout SSH
|
|
49
|
-
| `MCP_INTERACTIVE_CMD_TIMEOUT_S` | `300` | Timeout
|
|
50
|
-
| `MCP_MAX_WAIT_TIMEOUT_S` | `600` | Timeout
|
|
51
|
-
| `MAX_CONNECTIONS_PER_SERVER` | `5` |
|
|
52
|
-
| `MIN_CONNECTIONS_PER_SERVER` | `1` |
|
|
53
|
-
| `IDLE_TIMEOUT` | `300000` |
|
|
54
|
-
| `KEEP_ALIVE_INTERVAL` | `30000` |
|
|
55
|
-
| `MAX_QUEUE_SIZE` | `1000` |
|
|
56
|
-
| `SAVE_INTERVAL` | `5000` |
|
|
57
|
-
| `
|
|
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 |
|
|
58
81
|
|
|
59
82
|
---
|
|
60
83
|
|
|
61
|
-
## 🔌 Connexion
|
|
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)
|
|
62
97
|
|
|
63
98
|
```json
|
|
64
99
|
{
|
|
65
100
|
"mcpServers": {
|
|
66
101
|
"orchestrator": {
|
|
67
102
|
"command": "node",
|
|
68
|
-
"args": ["/chemin/
|
|
103
|
+
"args": ["/chemin/absolu/sftp-mcp/server.js"],
|
|
69
104
|
"env": {
|
|
70
|
-
"MCP_DATA_DIR": "/chemin/
|
|
105
|
+
"MCP_DATA_DIR": "/chemin/absolu/sftp-mcp/data"
|
|
71
106
|
}
|
|
72
107
|
}
|
|
73
108
|
}
|
|
74
109
|
}
|
|
75
110
|
```
|
|
76
111
|
|
|
112
|
+
Après modification du code : recharger le serveur MCP (`/mcps` → `r` ou restart session). Vérifier `system_diagnostics` → `version: "11.8.0"`.
|
|
113
|
+
|
|
77
114
|
---
|
|
78
115
|
|
|
79
|
-
## 🧰 Référence des
|
|
116
|
+
## 🧰 Référence des outils (82)
|
|
80
117
|
|
|
81
|
-
###
|
|
118
|
+
### Diagnostic & audit
|
|
82
119
|
| Outil | Description |
|
|
83
120
|
|-------|-------------|
|
|
84
|
-
| `help` | Guide
|
|
85
|
-
| `guide` | Manuel IA
|
|
86
|
-
| `system_diagnostics` |
|
|
87
|
-
|
|
88
|
-
|
|
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
|
|
89
130
|
| Outil | Description |
|
|
90
131
|
|-------|-------------|
|
|
91
|
-
| `server_add` |
|
|
92
|
-
| `server_list` |
|
|
93
|
-
| `server_remove` |
|
|
94
|
-
| `
|
|
95
|
-
| `server_note_set/get/list/remove` | Contexte documenté de chaque serveur |
|
|
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 |
|
|
96
136
|
|
|
97
|
-
###
|
|
137
|
+
### Projets (v11.6)
|
|
98
138
|
| Outil | Description |
|
|
99
139
|
|-------|-------------|
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
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 |
|
|
103
143
|
|
|
104
|
-
|
|
105
|
-
| Outil | Description |
|
|
106
|
-
|-------|-------------|
|
|
107
|
-
| `task_exec` | SSH one-shot. Supporte `alias:["vps1","vps2"]` ou `alias:"all"` |
|
|
108
|
-
| `task_exec_interactive` | SSH avec gestion des prompts interactifs |
|
|
109
|
-
| `task_exec_sequence` | Séquence de commandes SSH |
|
|
110
|
-
| `task_transfer` | Transfert SFTP. Supporte `server_to_server` direct |
|
|
111
|
-
| `task_transfer_multi` | Transferts multiples avec patterns glob |
|
|
144
|
+
Exemple `project_set` :
|
|
112
145
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
+
}
|
|
160
|
+
```
|
|
120
161
|
|
|
121
|
-
###
|
|
162
|
+
### Sessions de travail (v11.6)
|
|
122
163
|
| Outil | Description |
|
|
123
164
|
|-------|-------------|
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
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` |
|
|
127
169
|
|
|
128
|
-
###
|
|
170
|
+
### Trust SSH (v11.6)
|
|
129
171
|
| Outil | Description |
|
|
130
172
|
|-------|-------------|
|
|
131
|
-
| `
|
|
132
|
-
| `file_write` | Créer/écraser avec `dryRun` et `backup` |
|
|
133
|
-
| `file_edit` | Édition chirurgicale ou complète + protection hash |
|
|
173
|
+
| `ssh_authorize_key` | Ajoute une **pubkey** dans `authorized_keys` distant. `dry_run` défaut. Sources : `string` \| `local_path` \| `alias` |
|
|
134
174
|
|
|
135
|
-
|
|
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
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Policies
|
|
136
185
|
| Outil | Description |
|
|
137
186
|
|-------|-------------|
|
|
138
|
-
| `
|
|
139
|
-
| `diff_folders` | Comparer 2 dossiers |
|
|
140
|
-
| `compare_all_sources` | Détecter les drifts sur N serveurs |
|
|
187
|
+
| `policy_blocklist_list/add/remove` | Blocklist commandes (aussi appliquée à shell + sequences) |
|
|
141
188
|
|
|
142
|
-
###
|
|
189
|
+
### Catalogue API
|
|
143
190
|
| Outil | Description |
|
|
144
191
|
|-------|-------------|
|
|
145
|
-
| `
|
|
146
|
-
| `shell_exec` | Exécuter dans une session existante |
|
|
147
|
-
| `shell_list` / `shell_close` | Lister/fermer les sessions |
|
|
192
|
+
| `api_add` / `api_list` / `api_remove` / `api_check` | Monitoring (clés masquées en list) |
|
|
148
193
|
|
|
149
|
-
###
|
|
194
|
+
### Exécution de tâches
|
|
150
195
|
| Outil | Description |
|
|
151
196
|
|-------|-------------|
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
|
|
157
|
-
|
|
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
|
|
158
214
|
| Outil | Description |
|
|
159
215
|
|-------|-------------|
|
|
160
|
-
| `
|
|
161
|
-
| `tunnel_list` | Lister les tunnels actifs |
|
|
162
|
-
| `tunnel_close` | Fermer un tunnel |
|
|
163
|
-
| `tunnel_allowlist_add/remove` | Gérer les ports autorisés |
|
|
216
|
+
| `server_note_set/get/list/remove` | Protocole (description, services, warnings, intervention) |
|
|
164
217
|
|
|
165
|
-
###
|
|
218
|
+
### Monitoring & logs
|
|
166
219
|
| Outil | Description |
|
|
167
220
|
|-------|-------------|
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
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 |
|
|
173
226
|
|
|
174
|
-
###
|
|
227
|
+
### Queue
|
|
175
228
|
| Outil | Description |
|
|
176
229
|
|-------|-------------|
|
|
177
|
-
| `task_queue`
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
| `queue_stats` / `pool_stats` | Statistiques queue et pool SSH |
|
|
184
|
-
|
|
185
|
-
### Gestion des APIs
|
|
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
|
|
186
236
|
| Outil | Description |
|
|
187
237
|
|-------|-------------|
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
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 |
|
|
190
241
|
|
|
191
242
|
---
|
|
192
243
|
|
|
193
|
-
## 📖
|
|
244
|
+
## 📖 Workflows agent recommandés
|
|
194
245
|
|
|
195
|
-
###
|
|
196
|
-
```bash
|
|
197
|
-
# Une commande sur plusieurs serveurs
|
|
198
|
-
task_exec {alias:["vps1","vps2","vps3"], cmd:"uptime"}
|
|
199
|
-
|
|
200
|
-
# Tout le parc
|
|
201
|
-
task_exec {alias:"all", cmd:"df -h /"}
|
|
246
|
+
### Début de session
|
|
202
247
|
```
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
tunnel_create {name:"proxy", type:"socks", listen_port:1080, via:"vps_paris"}
|
|
207
|
-
# → Navigateur → SOCKS5 127.0.0.1:1080 → VPS Paris
|
|
248
|
+
infra_audit (ou infra_overview)
|
|
249
|
+
fleet_status
|
|
250
|
+
project_list / project_resolve
|
|
208
251
|
```
|
|
209
252
|
|
|
210
|
-
###
|
|
211
|
-
```bash
|
|
212
|
-
tunnel_create {name:"crm", type:"local", listen_port:8080, target:"127.0.0.1:3100", via:"vps_prod"}
|
|
213
|
-
# → http://localhost:8080 → CRM en production
|
|
253
|
+
### Chantier sur un projet
|
|
214
254
|
```
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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" }
|
|
220
260
|
```
|
|
221
261
|
|
|
222
|
-
###
|
|
223
|
-
```bash
|
|
224
|
-
tmux_create {alias:"vps", name:"build", start_cmd:"npm run build"}
|
|
225
|
-
tmux_read {alias:"vps", session:"build"}
|
|
226
|
-
tmux_kill {alias:"vps", session:"build"}
|
|
262
|
+
### Commandes longues
|
|
227
263
|
```
|
|
228
|
-
|
|
229
|
-
### Blocklist (sécurité)
|
|
230
|
-
```bash
|
|
231
|
-
# Voir les commandes bloquées
|
|
232
|
-
policy_blocklist_list
|
|
233
|
-
# → ["rm -rf /", "mkfs*", ...]
|
|
234
|
-
|
|
235
|
-
# Contournement conscient
|
|
236
|
-
task_exec {alias:"vps", cmd:"rm -rf /tmp/cache", skip_policy:true}
|
|
264
|
+
task_exec { timeout: 0, … } → si > syncTimeout → task_wait { id }
|
|
237
265
|
```
|
|
238
266
|
|
|
239
|
-
###
|
|
240
|
-
```bash
|
|
241
|
-
# Lire + hash
|
|
242
|
-
file_read {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"}}
|
|
243
|
-
# → content + hash
|
|
244
|
-
|
|
245
|
-
# Éditer avec protection
|
|
246
|
-
file_edit {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"},
|
|
247
|
-
oldString:"worker_connections 768;",
|
|
248
|
-
newString:"worker_connections 1024;",
|
|
249
|
-
expectedHash:"abc123...",
|
|
250
|
-
backup:true}
|
|
251
|
-
|
|
252
|
-
# Preview sans écrire
|
|
253
|
-
file_edit {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"},
|
|
254
|
-
oldString:"worker_connections 768;",
|
|
255
|
-
newString:"worker_connections 1024;",
|
|
256
|
-
dryRun:true}
|
|
267
|
+
### Cibles multi-serveurs
|
|
257
268
|
```
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
# Avant
|
|
262
|
-
snapshot_create {source:{type:"remote", alias:"vps"}, paths:["/etc/nginx/"], tag:"before-fix"}
|
|
263
|
-
|
|
264
|
-
# Après si problème
|
|
265
|
-
snapshot_restore {snapshotId:"...", target:{type:"remote", alias:"vps"}, dryRun:false, force:true}
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Drift detection (comparaison multi-serveur)
|
|
269
|
-
```bash
|
|
270
|
-
compare_all_sources {sources:[
|
|
271
|
-
{type:"remote", alias:"vps1", path:"/etc/nginx/nginx.conf", label:"prod"},
|
|
272
|
-
{type:"remote", alias:"vps2", path:"/etc/nginx/nginx.conf", label:"staging"}
|
|
273
|
-
]}
|
|
269
|
+
task_exec { alias: "group:oci", cmd: "hostname" }
|
|
270
|
+
task_exec { alias: "all", cmd: "uptime" }
|
|
274
271
|
```
|
|
275
272
|
|
|
276
273
|
---
|
|
@@ -280,90 +277,80 @@ compare_all_sources {sources:[
|
|
|
280
277
|
```
|
|
281
278
|
Client MCP (stdio)
|
|
282
279
|
│
|
|
283
|
-
server.js ───
|
|
280
|
+
server.js ─── 82 tools
|
|
284
281
|
│
|
|
285
|
-
├── queue.js
|
|
286
|
-
├── ssh.js
|
|
287
|
-
├── sftp.js
|
|
288
|
-
├──
|
|
289
|
-
├──
|
|
290
|
-
├──
|
|
291
|
-
├──
|
|
292
|
-
├──
|
|
293
|
-
├──
|
|
294
|
-
├──
|
|
295
|
-
├──
|
|
296
|
-
├──
|
|
297
|
-
├── diffFormatter.js ─ Formatage des diffs
|
|
298
|
-
├── sourceAdapter.js ─ Abstraction local/remote
|
|
299
|
-
├── shellSessions.js ─ Sessions shell persistantes
|
|
300
|
-
├── snapshotManager.js ─ Snapshots versionnés
|
|
301
|
-
├── notes.js ──────── Contexte documenté des serveurs
|
|
302
|
-
├── policies.js ──── Blocklist de commandes
|
|
303
|
-
├── tunnels.js ────── Tunnels SSH (local/remote/SOCKS)
|
|
304
|
-
├── guide.js ──────── Manuel IA intégré
|
|
305
|
-
└── 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
|
|
306
294
|
```
|
|
307
295
|
|
|
308
|
-
### Cycle de vie d
|
|
296
|
+
### Cycle de vie d’un job
|
|
309
297
|
|
|
310
298
|
```
|
|
311
|
-
pending → running → completed
|
|
312
|
-
↓ (
|
|
313
|
-
crashed →
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
## 📚 Manuel IA intégré (guide)
|
|
319
|
-
|
|
320
|
-
L'orchestrator embarque un manuel interactif pour l'agent IA :
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
guide section:index # Table des matières
|
|
324
|
-
guide section:workflows # Recettes copier-coller
|
|
325
|
-
guide section:cheatsheet # Table outil → usage
|
|
326
|
-
guide section:audit # Audit complet du parc en 8 étapes
|
|
327
|
-
guide section:security # Blocklist + tunnels
|
|
328
|
-
guide section:pitfalls # Pièges à éviter
|
|
299
|
+
pending → running → completed | failed | partial
|
|
300
|
+
↓ (redémarrage MCP pendant running)
|
|
301
|
+
crashed → task_retry → pending
|
|
329
302
|
```
|
|
330
303
|
|
|
331
304
|
---
|
|
332
305
|
|
|
333
306
|
## 🔒 Sécurité
|
|
334
307
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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 |
|
|
342
318
|
|
|
343
319
|
---
|
|
344
320
|
|
|
345
321
|
## 🧪 Tests
|
|
346
322
|
|
|
347
323
|
```bash
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
node
|
|
324
|
+
npm test:unit # p0 + p1 + p16 (43 tests)
|
|
325
|
+
npm test # unit + smoke MCP + features
|
|
326
|
+
node diagnose.js # diagnostic local optionnel
|
|
351
327
|
```
|
|
352
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
|
+
|
|
353
337
|
---
|
|
354
338
|
|
|
355
|
-
## 🛣️
|
|
339
|
+
## 🛣️ Versions récentes
|
|
356
340
|
|
|
357
|
-
| Version |
|
|
358
|
-
|
|
359
|
-
|
|
|
360
|
-
|
|
|
361
|
-
| 11.
|
|
362
|
-
| 11.3.0 |
|
|
363
|
-
|
|
|
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`.
|
|
364
351
|
|
|
365
352
|
---
|
|
366
353
|
|
|
367
354
|
## 📄 Licence
|
|
368
355
|
|
|
369
|
-
MIT — Copyright (c) 2025-2026 Franck (fkom13)
|
|
356
|
+
MIT — Copyright (c) 2025-2026 Franck (fkom13)
|