ftp-deploy-mcp 0.0.0-stage → 0.3.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 (89) hide show
  1. package/CHANGELOG.fr.md +468 -0
  2. package/CHANGELOG.md +415 -0
  3. package/CONTRIBUTING.fr.md +120 -0
  4. package/CONTRIBUTING.md +111 -0
  5. package/LICENSE +21 -0
  6. package/LICENSE.fr.md +26 -0
  7. package/README.fr.md +518 -0
  8. package/README.md +501 -2
  9. package/SECURITY.fr.md +99 -0
  10. package/SECURITY.md +94 -0
  11. package/docs/AGENT-PERFORMANCE.fr.md +144 -0
  12. package/docs/AGENT-PERFORMANCE.md +133 -0
  13. package/docs/ERROR-CONTRACT.fr.md +141 -0
  14. package/docs/ERROR-CONTRACT.md +137 -0
  15. package/docs/LANGUAGES.fr.md +68 -0
  16. package/docs/LANGUAGES.md +62 -0
  17. package/docs/RELEASE.fr.md +462 -0
  18. package/docs/RELEASE.md +435 -0
  19. package/docs/RESOURCE-BOUNDS.fr.md +144 -0
  20. package/docs/RESOURCE-BOUNDS.md +132 -0
  21. package/docs/SCRIPTED-EVALUATIONS.fr.md +190 -0
  22. package/docs/SCRIPTED-EVALUATIONS.md +181 -0
  23. package/docs/SECURITY-MODEL.fr.md +262 -0
  24. package/docs/SECURITY-MODEL.md +236 -0
  25. package/docs/STATE-STORAGE.fr.md +236 -0
  26. package/docs/STATE-STORAGE.md +231 -0
  27. package/docs/TRANSFERS.fr.md +140 -0
  28. package/docs/TRANSFERS.md +123 -0
  29. package/docs/WORKFLOW-MODEL.fr.md +63 -0
  30. package/docs/WORKFLOW-MODEL.md +62 -0
  31. package/evaluations/README.fr.md +95 -0
  32. package/evaluations/README.md +92 -0
  33. package/evaluations/fixture/README.txt +3 -0
  34. package/evaluations/fixture/catalog/alpha.txt +4 -0
  35. package/evaluations/fixture/catalog/bravo.txt +4 -0
  36. package/evaluations/fixture/catalog/charlie.txt +4 -0
  37. package/evaluations/fixture/catalog/delta.txt +4 -0
  38. package/evaluations/fixture/catalog/echo.txt +4 -0
  39. package/evaluations/fixture/catalog/foxtrot.txt +4 -0
  40. package/evaluations/fixture/reports/checks.txt +4 -0
  41. package/evaluations/fixture/reports/release.txt +3 -0
  42. package/evaluations/read-only.fr.xml +42 -0
  43. package/evaluations/read-only.xml +42 -0
  44. package/ftp-servers.example.json +27 -0
  45. package/install.cmd +29 -0
  46. package/install.sh +18 -0
  47. package/package.json +88 -4
  48. package/server.json +35 -0
  49. package/src/adapters/ftp.js +392 -0
  50. package/src/adapters/sftp.js +647 -0
  51. package/src/admission.js +15 -0
  52. package/src/atomic-write.js +131 -0
  53. package/src/clients.js +212 -0
  54. package/src/config.js +629 -0
  55. package/src/durable/confirmation.js +88 -0
  56. package/src/durable/engine.js +696 -0
  57. package/src/durable/plan.js +238 -0
  58. package/src/durable/schemas.js +206 -0
  59. package/src/durable/state.js +317 -0
  60. package/src/durable/status.js +175 -0
  61. package/src/durable-tools.js +94 -0
  62. package/src/errors.js +88 -0
  63. package/src/filezilla.js +260 -0
  64. package/src/i18n.js +58 -0
  65. package/src/index.js +175 -0
  66. package/src/local-path.js +130 -0
  67. package/src/locales/en.js +152 -0
  68. package/src/locales/errors.en.js +22 -0
  69. package/src/locales/errors.fr.js +22 -0
  70. package/src/locales/fr.js +152 -0
  71. package/src/locales/runtime.en.js +259 -0
  72. package/src/locales/runtime.fr.js +259 -0
  73. package/src/operations.js +276 -0
  74. package/src/redact.js +105 -0
  75. package/src/remote-path.js +101 -0
  76. package/src/scanner.js +103 -0
  77. package/src/setup.js +888 -0
  78. package/src/state/codec.mjs +103 -0
  79. package/src/state/index.mjs +1 -0
  80. package/src/state/io.mjs +173 -0
  81. package/src/state/records.mjs +60 -0
  82. package/src/state/store.mjs +360 -0
  83. package/src/state/writer.mjs +250 -0
  84. package/src/tool-registry.js +464 -0
  85. package/src/tools.js +1226 -0
  86. package/src/transfers.js +425 -0
  87. package/src/workflow/budget.mjs +83 -0
  88. package/src/workflow/events.mjs +199 -0
  89. package/src/workflow/model.mjs +179 -0
package/README.md CHANGED
@@ -1,3 +1,502 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <img src="https://raw.githubusercontent.com/alebgl77/ftp-deploy-mcp/main/assets/logo.svg" width="96" alt="ftp-deploy-mcp logo">
4
+
5
+ # ftp-deploy-mcp
6
+
7
+ **The deploy button for AI coding agents.**
8
+
9
+ Give Claude Code, Claude Desktop, Cursor, Windsurf, Trae, Antigravity, or any
10
+ MCP client a focused way to list, read, upload, download, and deploy files on
11
+ your own FTP, FTPS, and SFTP servers.
12
+
13
+ The stdio server implements MCP revision `2026-07-28` through the stable
14
+ modular TypeScript SDK v2 and retains the SDK's legacy negotiation path for
15
+ older MCP clients.
16
+
17
+ *Version française → [README.fr.md](./README.fr.md)*
18
+
19
+ CLI and MCP language: English by default; use `--lang fr` or `FTP_MCP_LANG=fr`.
20
+ [Language scope and precedence](./docs/LANGUAGES.md).
21
+
22
+ [![CI](https://github.com/alebgl77/ftp-deploy-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/alebgl77/ftp-deploy-mcp/actions/workflows/ci.yml)
23
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
24
+ [![Node >=22](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](./package.json)
25
+ [![MCP compatible](https://img.shields.io/badge/MCP-compatible-8A2BE2.svg)](https://modelcontextprotocol.io)
26
+
27
+ <img src="https://raw.githubusercontent.com/alebgl77/ftp-deploy-mcp/main/assets/banner-en.png" width="100%" alt="ftp-deploy-mcp — Controlled deployment for your AI agents; FTP, FTPS, SFTP over MCP stdio">
28
+
29
+ </div>
30
+
31
+ Purpose-built deployment controls keep credentials out of tool responses,
32
+ support read-only servers and dry runs, and limit local file access with
33
+ `localRoot`. The repository is covered by an extensive end-to-end suite that
34
+ runs against local FTP and SFTP servers. There is no telemetry.
35
+
36
+ > **Availability:** install from source today. The npm package has **not been
37
+ > published yet**, so `npx -y ftp-deploy-mcp` is unavailable. The project still
38
+ > lists publication in the Official MCP Registry as pending; registry-based
39
+ > installation is not offered here. GitHub source releases are
40
+ > separate from npm and Official MCP Registry publication. Existing Glama and
41
+ > MCP Index pages are discovery listings, not proof of an installable package.
42
+ > This checkout has version 0.3.1. Find published source versions on
43
+ > [GitHub Releases](https://github.com/alebgl77/ftp-deploy-mcp/releases/latest);
44
+ > the published GitHub release v0.3.0 remains unchanged.
45
+
46
+ ## Documentation
47
+
48
+ | Document | English | Français |
49
+ |---|---|---|
50
+ | Overview and installation | [README](./README.md) | [README](./README.fr.md) |
51
+ | Changes | [Changelog](./CHANGELOG.md) | [Modifications](./CHANGELOG.fr.md) |
52
+ | Contributing | [Guide](./CONTRIBUTING.md) | [Guide](./CONTRIBUTING.fr.md) |
53
+ | Security policy | [Policy](./SECURITY.md) | [Politique](./SECURITY.fr.md) |
54
+ | Security model | [Model](./docs/SECURITY-MODEL.md) | [Modèle](./docs/SECURITY-MODEL.fr.md) |
55
+ | Release process | [Guide](./docs/RELEASE.md) | [Guide](./docs/RELEASE.fr.md) |
56
+ | Agent evaluation | [Instructions](./evaluations/README.md) | [Instructions](./evaluations/README.fr.md) |
57
+ | Agent performance and client integration | [Guide](./docs/AGENT-PERFORMANCE.md) | [Guide](./docs/AGENT-PERFORMANCE.fr.md) |
58
+ | Scripted MCP conformance | [Guide](./docs/SCRIPTED-EVALUATIONS.md) | [Guide](./docs/SCRIPTED-EVALUATIONS.fr.md) |
59
+ | CLI and MCP languages | [Guide](./docs/LANGUAGES.md) | [Guide](./docs/LANGUAGES.fr.md) |
60
+ | MCP error contract | [Contract](./docs/ERROR-CONTRACT.md) | [Contrat](./docs/ERROR-CONTRACT.fr.md) |
61
+ | Verified staged transfers | [Guide](./docs/TRANSFERS.md) | [Guide](./docs/TRANSFERS.fr.md) |
62
+ | Scan and admission limits | [Limits](./docs/RESOURCE-BOUNDS.md) | [Limites](./docs/RESOURCE-BOUNDS.fr.md) |
63
+ | Durable state storage | [Library](./docs/STATE-STORAGE.md) | [Bibliothèque](./docs/STATE-STORAGE.fr.md) |
64
+ | Durable workflow model | [Model](./docs/WORKFLOW-MODEL.md) | [Modèle](./docs/WORKFLOW-MODEL.fr.md) |
65
+ | MIT license | [Canonical text](./LICENSE) | [Informative translation](./LICENSE.fr.md) |
66
+
67
+ ## Architecture and scenarios
68
+
69
+ Explore the current and target architecture diagrams and illustrative scenarios
70
+ in the bilingual [interactive HTML guide](https://github.com/alebgl77/ftp-deploy-mcp/blob/main/site/index.html).
71
+ The guide and its
72
+ [English](https://github.com/alebgl77/ftp-deploy-mcp/blob/main/site/README.md) / [French](https://github.com/alebgl77/ftp-deploy-mcp/blob/main/site/README.fr.md)
73
+ build instructions are in the repository, outside the npm package. After
74
+ cloning, open `site/index.html` locally and use its language selector.
75
+
76
+ The README banners were generated with ChatGPT Image. Their
77
+ [provenance and exact prompts](https://github.com/alebgl77/ftp-deploy-mcp/blob/main/assets/provenance/README.md)
78
+ document their illustrative role; they are not a certification.
79
+
80
+ ## First source install
81
+
82
+ 1. Install a supported Node.js version: 22, 24 or 26 (minimum: 22).
83
+ 2. Run `git clone https://github.com/alebgl77/ftp-deploy-mcp.git`, then
84
+ `cd ftp-deploy-mcp`.
85
+ 3. Run `npm ci --omit=dev --ignore-scripts`.
86
+ 4. Run `npm run setup`, then edit the generated server config: set an absolute
87
+ `localRoot`, replace credentials, and configure the SFTP host-key pin or the
88
+ FTP/FTPS safety acknowledgments described below.
89
+ 5. Restart the MCP client and try a dry run:
90
+
91
+ ```text
92
+ Call ftp_deploy with:
93
+ {"server":"prod","local_dir":"dist","remote_dir":"/","dry_run":true}
94
+ ```
95
+
96
+ Windows users can run `install.cmd` and macOS/Linux users can run
97
+ `./install.sh` instead of steps 3–4. Review every generated server entry before
98
+ the first connection.
99
+
100
+ For a tagged version, check out that exact tag before installing. `npm ci` uses
101
+ the sole authoritative `package-lock.json`, with six exact direct pins and the
102
+ reviewed graph. Keep it with the sources. `--ignore-scripts` disables automatic
103
+ dependency lifecycle scripts; setup is a separate, explicit action.
104
+
105
+ The v0.3.1 source installation asset is named
106
+ `ftp-deploy-mcp-0.3.1-source.tar.gz`: 90 files, including that lockfile. Once its
107
+ publication and checksums are verified, extract it in a fresh directory:
108
+
109
+ ```bash
110
+ tar --ignore-zeros -xzf ftp-deploy-mcp-0.3.1-source.tar.gz
111
+ cd package
112
+ npm ci --omit=dev --ignore-scripts
113
+ node src/index.js setup
114
+ ```
115
+
116
+ This installation archive excludes repository tests and maintainer scripts;
117
+ GitHub's automatic source ZIP/tar contains the complete repository. The separate
118
+ npm `.tgz` contains 89 files without a lockfile and remains unqualified: an actual
119
+ npm consumer changed ten production dependencies. It provides no locked-install
120
+ guarantee. See the [release guide](./docs/RELEASE.md) for verification and limits.
121
+
122
+ ## Protocol and security matrix
123
+
124
+ | Protocol | Transport identity | Remote-root behavior | Recommended use |
125
+ |---|---|---|---|
126
+ | **SFTP** | Encrypted. `hostKeySha256` is required unless `allowUnknownHostKey: true` explicitly accepts impersonation risk. | `realpath`/`lstat` checks refuse symlink components and keep operations below `root`. A malicious or changing server can still create a race between validation and use. | Preferred. Pin a fingerprint verified out of band. |
127
+ | **FTPS** | Encrypted when certificate verification succeeds. `insecureTLS: true` also requires `allowInsecure: true` and disables MITM protection. | A client-side sub-root cannot be a reliable anti-symlink jail. `root` other than `/` is refused unless `allowUnsafeRemoteRoot: true`. | Use a dedicated, server-side chrooted account whose visible root is `/`. |
128
+ | **FTP** | Plaintext. Refused unless `allowInsecure: true` accepts interception and credential exposure. | Same limitation as FTPS: the real boundary is the server account/chroot, not lexical client path checks. | Legacy-only, on a trusted network, with a dedicated chrooted account. |
129
+
130
+ All three protocols also enforce `localRoot` for `ftp_upload`, `ftp_deploy`,
131
+ and `ftp_download`. This limits which local files the MCP server can access.
132
+
133
+ ## What you get
134
+
135
+ - Ten focused MCP tools for server discovery, testing, listing, reading,
136
+ uploading, recursive deploys, downloading, creating directories, renaming,
137
+ and deleting.
138
+ - Multiple named servers in one local configuration.
139
+ - Gitignore-like deploy exclusions, dry-run, and per-server `readOnly` mode.
140
+ - FileZilla import, an interactive setup wizard, and a read-only `doctor`
141
+ command.
142
+ - Credentials loaded locally from the config, environment variables, or SSH
143
+ keys and never intentionally returned to the model.
144
+
145
+ ## Server configuration
146
+
147
+ An explicit configuration path is authoritative:
148
+
149
+ 1. `--config <path>`
150
+ 2. `FTP_MCP_CONFIG`, when `--config` is absent
151
+
152
+ An empty, missing, unreadable, or invalid explicit configuration reports an
153
+ error without falling back to another file. The MCP tools remain available
154
+ to report the configuration problem. `--config` requires a path argument.
155
+
156
+ Without either selector, the first configuration found wins:
157
+
158
+ 1. `./ftp-servers.json`
159
+ 2. `~/.ftp-mcp/servers.json`
160
+
161
+ The teaching example below is JSON with comments. Real configuration files
162
+ must be strict JSON; start from
163
+ [ftp-servers.example.json](./ftp-servers.example.json).
164
+
165
+ ```jsonc
166
+ {
167
+ "defaultServer": "prod",
168
+ "stateDir": "/home/alice/.local/state/ftp-deploy-mcp",
169
+ "requirePlan": true,
170
+ "servers": {
171
+ "prod": {
172
+ "protocol": "sftp",
173
+ "host": "ssh.example.com",
174
+ "port": 22,
175
+ "user": "deploy",
176
+ "password": "${ENV:PROD_PASSWORD}",
177
+ "privateKeyPath": "~/.ssh/id_ed25519",
178
+ "passphrase": "${ENV:PROD_KEY_PASSPHRASE}",
179
+ "localRoot": "/home/alice/projects/site",
180
+ "root": "/var/www/site",
181
+ "hostKeySha256": "SHA256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
182
+ "readOnly": false
183
+ }
184
+ }
185
+ }
186
+ ```
187
+
188
+ Replace the all-`A` fingerprint; it is deliberately non-functional for a real
189
+ host. Use `hostKeySha256` as an array during a controlled key rotation:
190
+
191
+ ```json
192
+ "hostKeySha256": [
193
+ "SHA256:old_verified_43_character_base64_value_here",
194
+ "SHA256:new_verified_43_character_base64_value_here"
195
+ ]
196
+ ```
197
+
198
+ The illustrative labels above show the shape but are not valid pins. Each real
199
+ entry is exactly `SHA256:` plus 43 characters of unpadded base64.
200
+
201
+ ### Field reference
202
+
203
+ | Field | Applies to | Meaning |
204
+ |---|---|---|
205
+ | `stateDir` | top level | Optional absolute, normalized durable-state directory, canonically disjoint from every `localRoot`. Enabling it advertises the four durable workflow tools. |
206
+ | `requirePlan` | top level | With `stateDir`, defaults to `true`. Blocks legacy remote mutators except `ftp_deploy` dry runs; `false` retains them under the same persistent alias lock. |
207
+ | `stateLimits` | top level | Optional strict durable quotas for state, backups, plans, operations, plan files/bytes, journal bytes/events, and backup files. |
208
+ | `protocol` | all | Required: `ftp`, `ftps`, or `sftp`. |
209
+ | `host` / `port` / `user` | all | Connection endpoint and account. Default ports are 21, 990 for implicit FTPS, and 22 for SFTP. |
210
+ | `password` | all | Password or `${ENV:NAME}` placeholder. |
211
+ | `privateKeyPath` / `passphrase` | SFTP | SSH private key path and optional passphrase. A leading `~` is expanded. These authenticate the user; they do not verify the server. |
212
+ | `localRoot` | all | Required for upload, deploy, and download. Must resolve to an existing absolute local directory; a leading `~` is supported. Relative and symlink/junction escapes are refused. Relative tool paths resolve inside it, and absolute tool paths must still remain inside it. |
213
+ | `root` | all | Remote root, default `/`. Tool paths are resolved below it. SFTP performs server-side realpath/lstat checks. FTP/FTPS need a server-side chroot for a trustworthy boundary. |
214
+ | `hostKeySha256` | SFTP | Required fingerprint string or non-empty array of pins. Format: `SHA256:<43-character unpadded base64>`. Cannot be combined with `allowUnknownHostKey`. |
215
+ | `allowUnknownHostKey` | SFTP | Emergency compatibility override. `true` accepts an unverified server identity and visibly warns on results. |
216
+ | `readOnly` | all | Blocks upload, deploy, mkdir, rename, and delete. A deploy dry run remains available. |
217
+ | `operationTimeoutMs` | all | Tool deadline including queue and connection time, default 120000 ms. Integer from 100 to 3600000. Native transport timeouts also apply. |
218
+ | `maxTransferBytes` | all | Maximum actual bytes per file, default 268435456 (256 MiB), maximum 1099511627776 (1 TiB). Positive safe integer. |
219
+ | `maxDeployFiles` | all | Maximum selected files per deploy, default 10000, maximum 100000. Positive safe integer; does not bound the full directory scan. |
220
+ | `maxScanEntries` | all | Visited local entries per deploy, including the root, excluded entries and links. Default 100000, maximum 1000000; positive safe integer. |
221
+ | `maxScanDepth` | all | Inclusive directory depth below the root (depth 0). Default 64, maximum 256; positive safe integer. |
222
+ | `maxDeployBytes` | all | Maximum cumulative source bytes per deploy, default 1073741824 (1 GiB), maximum 1099511627776 (1 TiB). Failed attempts retain their reservation. |
223
+ | `implicitTLS` | FTPS | Uses implicit TLS, normally on port 990. |
224
+ | `insecureTLS` | FTPS | Disables certificate verification. Requires `allowInsecure: true`. |
225
+ | `allowInsecure` | FTP/FTPS | Explicitly accepts plaintext FTP or unverified FTPS. It does not make the connection secure. |
226
+ | `allowUnsafeRemoteRoot` | FTP/FTPS | Allows a `root` other than `/` despite the unresolved symlink-escape risk. Use only when the server-side account boundary is understood. |
227
+
228
+ Any string can contain `${ENV:VARIABLE_NAME}`. Missing variables produce a
229
+ named configuration error.
230
+
231
+ ### Verify an SFTP fingerprint out of band
232
+
233
+ Do not trust a fingerprint obtained only through the connection you are about
234
+ to verify.
235
+
236
+ 1. Obtain the SHA-256 host-key fingerprint from the hosting provider's
237
+ authenticated control panel or support channel, or from an administrator
238
+ through a separately authenticated channel.
239
+ 2. If you administer the host, use its trusted console to run a command such as
240
+ `ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub -E sha256`.
241
+ 3. Compare the complete `SHA256:...` value before putting it in
242
+ `hostKeySha256`. `ssh-keyscan` may collect a candidate key, but by itself it
243
+ does not authenticate that key.
244
+
245
+ For rotation, verify the new fingerprint out of band, temporarily configure
246
+ both old and new pins, rotate the server key, confirm connections use the
247
+ expected key, then remove the old pin. Do not use `allowUnknownHostKey` as a
248
+ rotation shortcut.
249
+
250
+ ## Tool reference
251
+
252
+ All remote path arguments are relative to the configured remote `root`. The
253
+ `server` parameter is optional when `defaultServer` is set or only one server
254
+ exists.
255
+
256
+ | Tool | Main parameters | Purpose |
257
+ |---|---|---|
258
+ | `ftp_list_servers` | none | Show server metadata and active safety warnings, never passwords. |
259
+ | `ftp_test` | `server?` | Connect and list the visible root. |
260
+ | `ftp_list` | `server?`, `path?`, `limit?`, `offset?` | List a remote directory. `limit` defaults to 50 (1–200); `offset` defaults to 0. |
261
+ | `ftp_read` | `server?`, `path`, `max_bytes?` | Read a bounded text file; binary data is refused. |
262
+ | `ftp_upload` | `server?`, `local_path`, `remote_path?` | Upload one file from `localRoot`. |
263
+ | `ftp_deploy` | `server?`, `local_dir`, `remote_dir?`, `include?`, `exclude?`, `dry_run?` | Recursively deploy a directory from `localRoot`. |
264
+ | `ftp_download` | `server?`, `remote_path`, `local_path`, `overwrite?` | Download into `localRoot`. |
265
+ | `ftp_mkdir` | `server?`, `path` | Create a remote directory recursively. |
266
+ | `ftp_rename` | `server?`, `from_path`, `to_path` | Rename or move. |
267
+ | `ftp_delete` | `server?`, `path`, `recursive?` | Delete a file or, with explicit recursion, a directory. |
268
+ | `ftp_plan_deploy` | `server?`, `local_dir`, `remote_dir?`, `include?`, `exclude?`, `ttl_seconds?` | Publish an immutable, expiring durable plan. Available only with `stateDir`. |
269
+ | `ftp_apply_deploy` | `plan_id`, `idempotency_key`, `resume?` | Confirm, associate, and explicitly resume a durable apply. |
270
+ | `ftp_deploy_status` | exactly one of `plan_id` / `operation_id`, `offset?`, `limit?`, `if_journal_seq?` | Read a lock-free, paginated durable snapshot without network access or state writes. |
271
+ | `ftp_rollback_deploy` | `operation_id`, `resume?` | Confirm and explicitly resume conservative rollback of durably acknowledged files. |
272
+
273
+ ### Durable workflow guarantees
274
+
275
+ The durable tools require the official MCP `input_required` confirmation flow;
276
+ there is no boolean fallback. Signed request state binds the session, method,
277
+ plan digest, operation, idempotency-key hash, resume choice, journal sequence,
278
+ and expiry. Declined, invalid, expired, or unsupported interaction has no remote
279
+ effect. Association alone is status-only; any nonterminal remote mutation
280
+ requires `resume:true`.
281
+
282
+ The guarantee level is `observable_state_reconciled`: per-file replacement is
283
+ server-dependent, multi-file atomicity and exactly-once execution are false,
284
+ and rollback covers only durably acknowledged files. SFTP supports replacement
285
+ plus new files under existing canonical parents; FTP/FTPS supports replacement
286
+ of existing regular files only. Durable execution never creates parents, purges
287
+ remote extras, automatically rolls back, or rolls back `SATISFIED_UNOWNED`.
288
+
289
+ Cooperating processes sharing one canonical `stateDir` serialize the exact
290
+ server alias before adapter construction. This is not a distributed remote lock
291
+ and does not coordinate different aliases or state directories. Overlapping
292
+ writable aliases, alias renames, mixed-binary upgrades, and a process killed
293
+ while holding a persistent lock require operator care: quiesce upgrades and
294
+ recover stale locks offline. External writers and ABA changes remain outside
295
+ the observable identity guarantee.
296
+
297
+ ### Verified staged promotion
298
+
299
+ Uploads and deploys write to an unpredictable sibling temporary, verify its
300
+ actual byte count and SHA256 against the local source, then promote it with one
301
+ rename. A verification or rename failure never triggers deletion of the final
302
+ target or a direct-overwrite fallback. Downloads verify an exclusive local
303
+ temporary, synchronize and close it, then promote the complete file. The
304
+ default `overwrite:false` uses a hard link to avoid clobbering a file that
305
+ appeared meanwhile; filesystems without hard-link support fail closed.
306
+
307
+ Local and SFTP replacements preserve an existing regular target's permission
308
+ bits (0777); FTP/FTPS cannot portably preserve permissions, so account creation
309
+ defaults, umask and ACL policy need to suit the destination. Rename behavior
310
+ depends on the server and filesystem. Legacy upload/deploy does not promise
311
+ universal atomic replacement, a site transaction, or rollback. Readback adds network traffic.
312
+ See [transfer guarantees, limits and cleanup](./docs/TRANSFERS.md).
313
+
314
+ ### Execution, cancellation, and contention
315
+
316
+ Within one Node process, upload, deploy, mkdir, rename, and delete run in FIFO
317
+ order for the same normalized protocol, hostname, port, and username. Server
318
+ aliases and roots share that lock. Downloads serialize by canonical local
319
+ destination, including across servers. Read-only remote operations can overlap.
320
+
321
+ MCP cancellation and deadlines close active transports and stop subsequent
322
+ deploy files. Errors identify `CANCELLED` or `TIMEOUT`; `TARGET_BUSY` indicates
323
+ waiting for another operation. A timed-out call can return before an underlying
324
+ operation settles, but its lock remains owned until settlement and cleanup.
325
+ No uncertain mutation is retried automatically. Inspect partial remote/local
326
+ state before retrying; legacy mutation calls are not transactional deployment
327
+ and provide no rollback.
328
+
329
+ Internal preparation is single-use and limited to 10 seconds without extending
330
+ the overall operation deadline. Admission remains held until the actual work
331
+ and cleanup settle. A prepared context is released once, including when it
332
+ arrives after cancellation; the handler is not called after preparation is
333
+ cancelled or expires. Preparation callbacks themselves may act. Durable tools
334
+ use the same settlement discipline. See the
335
+ [resource limits](./docs/RESOURCE-BOUNDS.md).
336
+
337
+ Progress notifications are sent only when the caller supplies a progress
338
+ token, with increasing counters and no paths or credential text. Locks do not
339
+ coordinate other Node processes, DNS aliases, other accounts, or external
340
+ clients on the same host.
341
+
342
+ ### Response compatibility, pagination, and annotations
343
+
344
+ `ftp_list` returns one page instead of an unbounded directory listing. Its
345
+ successful response includes `total`, `count`, `offset`, `limit`, `has_more`,
346
+ and `next_offset` pagination fields. For example, a request with
347
+ `{"server":"prod","path":"/assets","limit":2,"offset":2}` may include the
348
+ following intentionally non-exhaustive excerpt. It omits the required
349
+ top-level `server`, `path`, and `security_warning` fields and the required
350
+ per-entry `size_bytes` and `modified_at` fields:
351
+
352
+ ```json
353
+ {
354
+ "structuredContent": {
355
+ "entries": [
356
+ { "name": "app.css", "type": "file" },
357
+ { "name": "app.js", "type": "file" }
358
+ ],
359
+ "total": 6,
360
+ "count": 2,
361
+ "offset": 2,
362
+ "limit": 2,
363
+ "has_more": true,
364
+ "next_offset": 4
365
+ }
366
+ }
367
+ ```
368
+
369
+ The existing human-readable `content` text is retained for compatibility.
370
+ On success, every tool except `ftp_read` also advertises an MCP
371
+ `outputSchema` and returns matching `structuredContent`; `ftp_read` remains a
372
+ bounded text-only tool on success. Each of the nine structured schemas accepts
373
+ either its strict success shape or a strict `{error}` envelope. Tool execution
374
+ errors return `isError: true` with localized text and structured code, request UUID,
375
+ effect observations and safe-retry guidance. Unknown tools remain protocol errors.
376
+ See the [error contract](./docs/ERROR-CONTRACT.md).
377
+
378
+ The process admits at most 64 tool calls, including workers still cleaning up
379
+ after cancellation. Excess calls return `CAPACITY_LIMIT`. Local deployment scans
380
+ are asynchronous and separately bounded; see [resource limits](./docs/RESOURCE-BOUNDS.md)
381
+ for exact counting, `SCAN_LIMIT` and corrected custom exclusion behavior.
382
+
383
+ All tools publish MCP annotations describing read-only, destructive,
384
+ idempotent, and open-world behavior. These annotations are client hints, not a
385
+ security boundary; enforce access with server credentials, `readOnly`,
386
+ `localRoot`, and the protocol controls described above. `ftp_deploy` structured
387
+ results contain a summary and bounded samples, not exhaustive file lists.
388
+
389
+ `ftp_deploy` is not a transaction. If one or more transfers fail, the tool
390
+ returns an MCP error with a partial-deployment summary; files already promoted
391
+ before the failure are not rolled back.
392
+
393
+ Default deploy exclusions include `node_modules`, `.git`, environment files,
394
+ logs, OS metadata, `ftp-servers.json`, and `.ftp-mcp` content at any depth.
395
+ The reserved `.ftp-mcp-*.tmp` basename is always excluded, even if an explicit
396
+ `include` pattern matches it, so deploy cannot select a partial download temporary.
397
+
398
+ ## Client setup
399
+
400
+ `npm run setup` detects supported clients, creates timestamped backups before
401
+ changing existing client configuration, and prints a block for UI-only clients.
402
+ To wire a client manually, replace the path below with the absolute path to
403
+ this checkout:
404
+
405
+ ```json
406
+ {
407
+ "mcpServers": {
408
+ "ftp": {
409
+ "command": "node",
410
+ "args": ["/absolute/path/to/ftp-deploy-mcp/src/index.js"]
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ Common locations include `.mcp.json` for Claude Code,
417
+ `~/.cursor/mcp.json` for Cursor, and
418
+ `~/.codeium/windsurf/mcp_config.json` for Windsurf. Claude Desktop and other
419
+ clients accept the same command/arguments structure through their MCP settings.
420
+
421
+ After the first npm release is verified, this source command can be replaced
422
+ with `npx -y ftp-deploy-mcp`. It is intentionally not presented as a working
423
+ installation method today.
424
+
425
+ ## FileZilla import and diagnostics
426
+
427
+ ```bash
428
+ node src/index.js import-filezilla --file /path/sitemanager.xml --out ./ftp-servers.json
429
+ npm run doctor
430
+ ```
431
+
432
+ Imported passwords may be decoded into plaintext. Keep the output outside
433
+ version control, restrict its permissions, add `localRoot`, and review every
434
+ insecure-transport or FTP/FTPS remote-root warning before connecting.
435
+ `doctor` is read-only and reports configuration and client wiring without
436
+ printing passwords.
437
+
438
+ ## Migrating from v0.1 to v0.2
439
+
440
+ GitHub v0.3.0 is published. This source checkout has version 0.3.1. The npm
441
+ package remains unpublished, and the project still lists Official MCP Registry
442
+ publication as pending. The steps below apply to the source installation and
443
+ do not announce an npm release.
444
+
445
+ 1. Add an absolute `localRoot` to every server used by upload, deploy, or
446
+ download.
447
+ 2. For every SFTP server, add an out-of-band-verified `hostKeySha256`. Use
448
+ `allowUnknownHostKey: true` only as a temporary, explicit risk acceptance;
449
+ do not configure both fields.
450
+ 3. For FTP/FTPS, prefer a dedicated server-side chroot whose visible root is
451
+ `/` and set `root` to `/`. A non-root client path now requires
452
+ `allowUnsafeRemoteRoot: true` and remains unsafe against server-side
453
+ symlinks.
454
+ 4. Treat a failed `ftp_deploy` as a partial deployment: inspect its summary and
455
+ reconcile the remote tree before retrying.
456
+ 5. Re-run `npm run setup` or update the MCP client command to this checkout,
457
+ then run `npm run doctor` and a dry run.
458
+
459
+ Atomic replacement for newly written sensitive configuration is checked by the
460
+ release tests; a version number alone does not establish that guarantee. See
461
+ [docs/RELEASE.md](./docs/RELEASE.md) for the qualification and publication steps.
462
+
463
+ ## Security and limitations
464
+
465
+ - The strongest FTP/FTPS boundary is the server's own account isolation or
466
+ chroot. Client-side normalization rejects obvious traversal, but FTP lacks
467
+ portable `REALPATH`/`LSTAT` primitives and cannot prove that a server-side
468
+ symlink stays inside a configured sub-root.
469
+ - SFTP verifies the host pin and rejects symlink components using
470
+ `realpath`/`lstat`. A server controlled by an attacker can still change
471
+ filesystem state between checks and operations.
472
+ - `readOnly` reduces accidental writes through this MCP server; it is not a
473
+ substitute for read-only credentials enforced by the remote server.
474
+ - FTP, `insecureTLS`, `allowUnknownHostKey`, and
475
+ `allowUnsafeRemoteRoot` are explicit risk acceptances, not security features.
476
+
477
+ Read the full [security model](./docs/SECURITY-MODEL.md) and
478
+ [private disclosure policy](./SECURITY.md).
479
+
480
+ ## Development
481
+
482
+ ```bash
483
+ npm test
484
+ npm run eval:scripted
485
+ node src/index.js --version
486
+ node src/index.js --help
487
+ ```
488
+
489
+ The test suite uses local FTP and SFTP servers and does not require an external
490
+ network. Contributions are welcome; see
491
+ [CONTRIBUTING.md](./CONTRIBUTING.md). Maintainers should use the
492
+ [release guide](./docs/RELEASE.md). A reproducible, externally hosted read-only
493
+ agent evaluation is documented in [evaluations/README.md](./evaluations/README.md).
494
+
495
+ From a source checkout, `npm run eval:scripted` runs 43 cases in both languages
496
+ with a memory adapter and real MCP handlers. See the
497
+ [scripted conformance guide](./docs/SCRIPTED-EVALUATIONS.md) for reports and limits;
498
+ this command does not evaluate a model.
499
+
500
+ ## License
501
+
502
+ MIT — see [LICENSE](./LICENSE).
package/SECURITY.fr.md ADDED
@@ -0,0 +1,99 @@
1
+ # Politique de sécurité
2
+
3
+ [English](./SECURITY.md) | **Français**
4
+
5
+ ## Versions prises en charge
6
+
7
+ Le projet n'a pas encore achevé sa première publication sur npm ou le registre
8
+ MCP. Les correctifs de sécurité visent la branche source actuelle et la dernière
9
+ version 0.x étiquetée. Pour les anciens tags 0.x, une mise à niveau peut être
10
+ demandée plutôt qu'un rétroportage.
11
+
12
+ | Version | Prise en charge |
13
+ |---|---|
14
+ | Sources actuelles / dernier tag 0.x | Prise en charge |
15
+ | Anciens tags 0.x | Selon les possibilités |
16
+
17
+ ## Signaler une vulnérabilité en privé
18
+
19
+ **N'ouvrez pas d'issue, de discussion ou de pull request GitHub publique pour
20
+ une vulnérabilité présumée.**
21
+
22
+ Utilisez le signalement privé de vulnérabilités de GitHub : ouvrez la
23
+ [page Security du dépôt](https://github.com/alebgl77/ftp-deploy-mcp/security),
24
+ choisissez **Report a vulnerability**, puis indiquez :
25
+
26
+ - le commit ou la version et le protocole concernés ;
27
+ - les étapes minimales de reproduction et la configuration serveur requise ;
28
+ - les accès ou divulgations attendus et observés ;
29
+ - l'impact, notamment les fichiers locaux ou distants et les identifiants exposés ;
30
+ - toute correction suggérée ou échéance de divulgation.
31
+
32
+ N'incluez pas d'identifiants actifs ni de clés privées. Utilisez des comptes de
33
+ test jetables et masquez les informations sensibles dans les journaux. Si le
34
+ signalement privé est indisponible, ouvrez une issue publique sans aucun détail
35
+ sur la vulnérabilité et demandez au mainteneur d'établir un canal privé.
36
+
37
+ L'objectif est d'accuser réception d'un rapport complet sous 72 heures, puis
38
+ de confirmer son périmètre, coordonner un correctif et ses tests, et convenir
39
+ d'une date de divulgation. Il s'agit d'un objectif de réponse, sans promesse
40
+ de prime ni de délai de résolution.
41
+
42
+ ## Périmètre
43
+
44
+ - Accès hors de `localRoot` par traversée, lien symbolique, jonction ou
45
+ traitement de la destination d'un téléchargement.
46
+ - Accès SFTP hors de `root`, contournement de la vérification de clé d'hôte ou
47
+ traitement non sûr d'une rotation de clé d'hôte vérifiée.
48
+ - Connexion FTP/FTPS à un confinement côté client dont la racine n'est pas `/`
49
+ sans acceptation explicite via `allowUnsafeRemoteRoot`.
50
+ - FTP en clair ou FTPS non vérifié sans acceptation explicite via `allowInsecure`.
51
+ - Identifiants ou clés exposés dans les résultats d'outils, diagnostics,
52
+ journaux ou erreurs.
53
+ - Contournement de `readOnly` ou des protections d'opérations destructives,
54
+ ou succès annoncé à tort après un déploiement partiel.
55
+ - Corruption ou remplacement non sûr d'une configuration serveur ou client MCP.
56
+ - Archive de publication acceptée malgré une modification des sources livrées,
57
+ du manifeste de dépendances ou du verrouillage source, ou malgré un modificateur de
58
+ dépendances ou un hook d'installation non autorisé.
59
+
60
+ Les problèmes qui reposent sur un serveur FTP malveillant utilisant des liens
61
+ symboliques hors d'une sous-racine configurée côté client sont importants,
62
+ mais **leur prévention n'est pas garantie** : FTP/FTPS exigent une frontière
63
+ de compte/chroot côté serveur. De même, les contrôles SFTP `realpath`/`lstat`
64
+ réduisent les sorties par lien symbolique sans pouvoir supprimer toutes les
65
+ courses sur un serveur malveillant. Ces limites sont décrites dans le
66
+ [modèle de sécurité](./docs/SECURITY-MODEL.fr.md).
67
+
68
+ ## Intégrité des dépendances et de la publication
69
+
70
+ Les six dépendances directes de production utilisent des versions exactes.
71
+ `package-lock.json` est l'unique référence du graphe source, livrée dans
72
+ l'archive d'installation source de 90 fichiers. Utilisez
73
+ `npm ci --omit=dev --ignore-scripts` après extraction et conservez ce fichier.
74
+ Toute modification exige une revue du graphe complet, de ses URL et intégrités,
75
+ puis les contrôles du [guide de publication](./docs/RELEASE.fr.md).
76
+
77
+ Le paquet npm de 89 fichiers ne contient aucun verrouillage et reste non qualifié.
78
+ Une installation réelle a changé dix dépendances de production. Les workflows
79
+ refusent toute dérive du graphe installé avant publication npm ou MCP ; une preuve
80
+ de type source ne peut pas autoriser npm. Un éventuel graphe npm conforme ne vaut
81
+ que pour l'environnement et la date testés, sans garantir les installations futures.
82
+
83
+ Un audit de dépendances réussi vaut pour ce graphe à cette date ; il ne garantit
84
+ pas l'absence d'avis futurs et ne certifie pas un usage en production. Signalez
85
+ en privé les contournements du validateur d'archive selon la procédure ci-dessus.
86
+ Une release GitHub ne prouve pas la disponibilité sur npm ou le registre MCP
87
+ officiel.
88
+
89
+ ## Consignes de recherche
90
+
91
+ - Testez uniquement les systèmes et comptes qui vous appartiennent ou que
92
+ vous êtes autorisé à évaluer.
93
+ - N'accédez pas aux données d'autres utilisateurs, ne dégradez pas le service,
94
+ ne maintenez pas d'accès persistant et n'utilisez pas d'ingénierie sociale.
95
+ - Arrêtez-vous une fois le problème démontré et transmettez les détails en privé.
96
+ - Laissez au projet un délai raisonnable pour corriger le problème avant sa divulgation.
97
+
98
+ Les recherches de bonne foi respectant ces consignes sont bienvenues, mais ce
99
+ document n'autorise pas les tests contre des services FTP/SFTP tiers.