@joomengine/joomla-mcp 0.7.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.
Files changed (243) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +349 -0
  3. package/README.md +279 -0
  4. package/SECURITY.md +39 -0
  5. package/config/live-test.default.json +1206 -0
  6. package/config/sites.example.json +53 -0
  7. package/config/sites.single-site-readonly.example.json +24 -0
  8. package/dist/application/joomla-service.d.ts +72 -0
  9. package/dist/application/joomla-service.d.ts.map +1 -0
  10. package/dist/application/joomla-service.js +484 -0
  11. package/dist/application/joomla-service.js.map +1 -0
  12. package/dist/application/joomla-write-service.d.ts +109 -0
  13. package/dist/application/joomla-write-service.d.ts.map +1 -0
  14. package/dist/application/joomla-write-service.js +628 -0
  15. package/dist/application/joomla-write-service.js.map +1 -0
  16. package/dist/application/site-registry.d.ts +17 -0
  17. package/dist/application/site-registry.d.ts.map +1 -0
  18. package/dist/application/site-registry.js +31 -0
  19. package/dist/application/site-registry.js.map +1 -0
  20. package/dist/audit/audit-sink.d.ts +24 -0
  21. package/dist/audit/audit-sink.d.ts.map +1 -0
  22. package/dist/audit/audit-sink.js +10 -0
  23. package/dist/audit/audit-sink.js.map +1 -0
  24. package/dist/bin/joomla-mcp-http.d.ts +3 -0
  25. package/dist/bin/joomla-mcp-http.d.ts.map +1 -0
  26. package/dist/bin/joomla-mcp-http.js +65 -0
  27. package/dist/bin/joomla-mcp-http.js.map +1 -0
  28. package/dist/bin/joomla-mcp-live-test.d.ts +3 -0
  29. package/dist/bin/joomla-mcp-live-test.d.ts.map +1 -0
  30. package/dist/bin/joomla-mcp-live-test.js +10 -0
  31. package/dist/bin/joomla-mcp-live-test.js.map +1 -0
  32. package/dist/bin/joomla-mcp.d.ts +3 -0
  33. package/dist/bin/joomla-mcp.d.ts.map +1 -0
  34. package/dist/bin/joomla-mcp.js +18 -0
  35. package/dist/bin/joomla-mcp.js.map +1 -0
  36. package/dist/catalog/action-catalog.d.ts +35 -0
  37. package/dist/catalog/action-catalog.d.ts.map +1 -0
  38. package/dist/catalog/action-catalog.js +525 -0
  39. package/dist/catalog/action-catalog.js.map +1 -0
  40. package/dist/catalog/action-gates.d.ts +10 -0
  41. package/dist/catalog/action-gates.d.ts.map +1 -0
  42. package/dist/catalog/action-gates.js +18 -0
  43. package/dist/catalog/action-gates.js.map +1 -0
  44. package/dist/catalog/cli-command-targets.d.ts +20 -0
  45. package/dist/catalog/cli-command-targets.d.ts.map +1 -0
  46. package/dist/catalog/cli-command-targets.js +60 -0
  47. package/dist/catalog/cli-command-targets.js.map +1 -0
  48. package/dist/catalog/companion-actions.d.ts +30 -0
  49. package/dist/catalog/companion-actions.d.ts.map +1 -0
  50. package/dist/catalog/companion-actions.js +374 -0
  51. package/dist/catalog/companion-actions.js.map +1 -0
  52. package/dist/catalog/core.d.ts +17 -0
  53. package/dist/catalog/core.d.ts.map +1 -0
  54. package/dist/catalog/core.js +115 -0
  55. package/dist/catalog/core.js.map +1 -0
  56. package/dist/catalog/crud-bases.d.ts +8 -0
  57. package/dist/catalog/crud-bases.d.ts.map +1 -0
  58. package/dist/catalog/crud-bases.js +203 -0
  59. package/dist/catalog/crud-bases.js.map +1 -0
  60. package/dist/catalog/crud-write-fields.d.ts +11 -0
  61. package/dist/catalog/crud-write-fields.d.ts.map +1 -0
  62. package/dist/catalog/crud-write-fields.js +110 -0
  63. package/dist/catalog/crud-write-fields.js.map +1 -0
  64. package/dist/catalog/index.d.ts +7 -0
  65. package/dist/catalog/index.d.ts.map +1 -0
  66. package/dist/catalog/index.js +7 -0
  67. package/dist/catalog/index.js.map +1 -0
  68. package/dist/catalog/source-metadata.d.ts +8 -0
  69. package/dist/catalog/source-metadata.d.ts.map +1 -0
  70. package/dist/catalog/source-metadata.js +73 -0
  71. package/dist/catalog/source-metadata.js.map +1 -0
  72. package/dist/catalog/special-reads.d.ts +4 -0
  73. package/dist/catalog/special-reads.d.ts.map +1 -0
  74. package/dist/catalog/special-reads.js +243 -0
  75. package/dist/catalog/special-reads.js.map +1 -0
  76. package/dist/catalog/special-writes.d.ts +8 -0
  77. package/dist/catalog/special-writes.d.ts.map +1 -0
  78. package/dist/catalog/special-writes.js +370 -0
  79. package/dist/catalog/special-writes.js.map +1 -0
  80. package/dist/config/index.d.ts +3 -0
  81. package/dist/config/index.d.ts.map +1 -0
  82. package/dist/config/index.js +3 -0
  83. package/dist/config/index.js.map +1 -0
  84. package/dist/config/load.d.ts +20 -0
  85. package/dist/config/load.d.ts.map +1 -0
  86. package/dist/config/load.js +156 -0
  87. package/dist/config/load.js.map +1 -0
  88. package/dist/config/schema.d.ts +171 -0
  89. package/dist/config/schema.d.ts.map +1 -0
  90. package/dist/config/schema.js +169 -0
  91. package/dist/config/schema.js.map +1 -0
  92. package/dist/contracts/action-catalog.d.ts +134 -0
  93. package/dist/contracts/action-catalog.d.ts.map +1 -0
  94. package/dist/contracts/action-catalog.js +2 -0
  95. package/dist/contracts/action-catalog.js.map +1 -0
  96. package/dist/contracts/bounded-query.d.ts +27 -0
  97. package/dist/contracts/bounded-query.d.ts.map +1 -0
  98. package/dist/contracts/bounded-query.js +59 -0
  99. package/dist/contracts/bounded-query.js.map +1 -0
  100. package/dist/contracts/route-resolution.d.ts +3 -0
  101. package/dist/contracts/route-resolution.d.ts.map +1 -0
  102. package/dist/contracts/route-resolution.js +71 -0
  103. package/dist/contracts/route-resolution.js.map +1 -0
  104. package/dist/http/access-limits.d.ts +24 -0
  105. package/dist/http/access-limits.d.ts.map +1 -0
  106. package/dist/http/access-limits.js +86 -0
  107. package/dist/http/access-limits.js.map +1 -0
  108. package/dist/http/audit.d.ts +19 -0
  109. package/dist/http/audit.d.ts.map +1 -0
  110. package/dist/http/audit.js +10 -0
  111. package/dist/http/audit.js.map +1 -0
  112. package/dist/http/auth.d.ts +33 -0
  113. package/dist/http/auth.d.ts.map +1 -0
  114. package/dist/http/auth.js +123 -0
  115. package/dist/http/auth.js.map +1 -0
  116. package/dist/http/index.d.ts +6 -0
  117. package/dist/http/index.d.ts.map +1 -0
  118. package/dist/http/index.js +6 -0
  119. package/dist/http/index.js.map +1 -0
  120. package/dist/http/remote-http.d.ts +47 -0
  121. package/dist/http/remote-http.d.ts.map +1 -0
  122. package/dist/http/remote-http.js +552 -0
  123. package/dist/http/remote-http.js.map +1 -0
  124. package/dist/http/request-policy.d.ts +19 -0
  125. package/dist/http/request-policy.d.ts.map +1 -0
  126. package/dist/http/request-policy.js +137 -0
  127. package/dist/http/request-policy.js.map +1 -0
  128. package/dist/index.d.ts +11 -0
  129. package/dist/index.d.ts.map +1 -0
  130. package/dist/index.js +11 -0
  131. package/dist/index.js.map +1 -0
  132. package/dist/infrastructure/api/joomla-api-client.d.ts +26 -0
  133. package/dist/infrastructure/api/joomla-api-client.d.ts.map +1 -0
  134. package/dist/infrastructure/api/joomla-api-client.js +139 -0
  135. package/dist/infrastructure/api/joomla-api-client.js.map +1 -0
  136. package/dist/infrastructure/cli/joomla-cli-client.d.ts +30 -0
  137. package/dist/infrastructure/cli/joomla-cli-client.d.ts.map +1 -0
  138. package/dist/infrastructure/cli/joomla-cli-client.js +163 -0
  139. package/dist/infrastructure/cli/joomla-cli-client.js.map +1 -0
  140. package/dist/infrastructure/index.d.ts +3 -0
  141. package/dist/infrastructure/index.d.ts.map +1 -0
  142. package/dist/infrastructure/index.js +3 -0
  143. package/dist/infrastructure/index.js.map +1 -0
  144. package/dist/library.d.ts +33 -0
  145. package/dist/library.d.ts.map +1 -0
  146. package/dist/library.js +22 -0
  147. package/dist/library.js.map +1 -0
  148. package/dist/live-test/catalog.d.ts +4 -0
  149. package/dist/live-test/catalog.d.ts.map +1 -0
  150. package/dist/live-test/catalog.js +62 -0
  151. package/dist/live-test/catalog.js.map +1 -0
  152. package/dist/live-test/cli.d.ts +2 -0
  153. package/dist/live-test/cli.d.ts.map +1 -0
  154. package/dist/live-test/cli.js +305 -0
  155. package/dist/live-test/cli.js.map +1 -0
  156. package/dist/live-test/console-report.d.ts +3 -0
  157. package/dist/live-test/console-report.d.ts.map +1 -0
  158. package/dist/live-test/console-report.js +75 -0
  159. package/dist/live-test/console-report.js.map +1 -0
  160. package/dist/live-test/fixtures.d.ts +22 -0
  161. package/dist/live-test/fixtures.d.ts.map +1 -0
  162. package/dist/live-test/fixtures.js +371 -0
  163. package/dist/live-test/fixtures.js.map +1 -0
  164. package/dist/live-test/index.d.ts +9 -0
  165. package/dist/live-test/index.d.ts.map +1 -0
  166. package/dist/live-test/index.js +8 -0
  167. package/dist/live-test/index.js.map +1 -0
  168. package/dist/live-test/known-limitations.d.ts +13 -0
  169. package/dist/live-test/known-limitations.d.ts.map +1 -0
  170. package/dist/live-test/known-limitations.js +186 -0
  171. package/dist/live-test/known-limitations.js.map +1 -0
  172. package/dist/live-test/progress.d.ts +60 -0
  173. package/dist/live-test/progress.d.ts.map +1 -0
  174. package/dist/live-test/progress.js +141 -0
  175. package/dist/live-test/progress.js.map +1 -0
  176. package/dist/live-test/reporting.d.ts +7 -0
  177. package/dist/live-test/reporting.d.ts.map +1 -0
  178. package/dist/live-test/reporting.js +181 -0
  179. package/dist/live-test/reporting.js.map +1 -0
  180. package/dist/live-test/runner.d.ts +19 -0
  181. package/dist/live-test/runner.d.ts.map +1 -0
  182. package/dist/live-test/runner.js +2680 -0
  183. package/dist/live-test/runner.js.map +1 -0
  184. package/dist/live-test/scenario-config.d.ts +82 -0
  185. package/dist/live-test/scenario-config.d.ts.map +1 -0
  186. package/dist/live-test/scenario-config.js +384 -0
  187. package/dist/live-test/scenario-config.js.map +1 -0
  188. package/dist/live-test/transports.d.ts +13 -0
  189. package/dist/live-test/transports.d.ts.map +1 -0
  190. package/dist/live-test/transports.js +162 -0
  191. package/dist/live-test/transports.js.map +1 -0
  192. package/dist/live-test/types.d.ts +140 -0
  193. package/dist/live-test/types.d.ts.map +1 -0
  194. package/dist/live-test/types.js +10 -0
  195. package/dist/live-test/types.js.map +1 -0
  196. package/dist/mcp/create-server.d.ts +36 -0
  197. package/dist/mcp/create-server.d.ts.map +1 -0
  198. package/dist/mcp/create-server.js +472 -0
  199. package/dist/mcp/create-server.js.map +1 -0
  200. package/dist/security/confirmation-service.d.ts +51 -0
  201. package/dist/security/confirmation-service.d.ts.map +1 -0
  202. package/dist/security/confirmation-service.js +153 -0
  203. package/dist/security/confirmation-service.js.map +1 -0
  204. package/dist/security/index.d.ts +4 -0
  205. package/dist/security/index.d.ts.map +1 -0
  206. package/dist/security/index.js +4 -0
  207. package/dist/security/index.js.map +1 -0
  208. package/dist/security/jwks-jwt-verifier.d.ts +15 -0
  209. package/dist/security/jwks-jwt-verifier.d.ts.map +1 -0
  210. package/dist/security/jwks-jwt-verifier.js +196 -0
  211. package/dist/security/jwks-jwt-verifier.js.map +1 -0
  212. package/dist/security/permission-grant-service.d.ts +55 -0
  213. package/dist/security/permission-grant-service.d.ts.map +1 -0
  214. package/dist/security/permission-grant-service.js +321 -0
  215. package/dist/security/permission-grant-service.js.map +1 -0
  216. package/dist/version.d.ts +7 -0
  217. package/dist/version.d.ts.map +1 -0
  218. package/dist/version.js +7 -0
  219. package/dist/version.js.map +1 -0
  220. package/docs/API_ACTIONS.md +350 -0
  221. package/docs/ARCHITECTURE.md +114 -0
  222. package/docs/CLI.md +99 -0
  223. package/docs/CLIENTS.md +269 -0
  224. package/docs/COVERAGE.md +182 -0
  225. package/docs/DEPLOYMENT.md +272 -0
  226. package/docs/FIXTURES.md +210 -0
  227. package/docs/LIBRARY.md +246 -0
  228. package/docs/LIVE_TESTING.md +409 -0
  229. package/docs/OPERATIONS.md +138 -0
  230. package/docs/PHP_COMPANION.md +221 -0
  231. package/docs/RECONNAISSANCE.md +104 -0
  232. package/docs/RELEASING.md +233 -0
  233. package/docs/REMOTE_HTTP.md +126 -0
  234. package/docs/SECURITY.md +138 -0
  235. package/docs/SINGLE_SITE.md +223 -0
  236. package/docs/TESTING.md +160 -0
  237. package/docs/TROUBLESHOOTING.md +98 -0
  238. package/docs/USAGE.md +208 -0
  239. package/examples/embedded-host/README.md +33 -0
  240. package/examples/embedded-host/http.mjs +68 -0
  241. package/examples/embedded-host/package.json +13 -0
  242. package/examples/embedded-host/stdio.mjs +24 -0
  243. package/package.json +119 -0
@@ -0,0 +1,272 @@
1
+ # Deployment, upgrade, and rollback
2
+
3
+ ## Choose the deployment path
4
+
5
+ | Need | Recommended path |
6
+ |---|---|
7
+ | Local developer/desktop MCP client | Source build with stdio |
8
+ | Remote API-only edge | Pinned OCI image with Compose or an orchestrator |
9
+ | Remote edge as a host service | Source/release build with systemd |
10
+ | Joomla-native companion actions | Host deployment with PHP and direct access to the fixed Joomla root |
11
+
12
+ The shipped OCI image contains the TypeScript HTTP edge, not PHP or a Joomla
13
+ installation. It is therefore API-only unless a separately reviewed image and
14
+ mount model is introduced. Do not mount a production Joomla root into the
15
+ standard edge container expecting companion execution.
16
+
17
+ ## Deployment prerequisites
18
+
19
+ - Pin a reviewed commit, release tag, or image digest.
20
+ - Run all checks in [Testing](TESTING.md).
21
+ - Prepare `/etc/joomla-mcp/sites.json` from the example with exact aliases,
22
+ toolsets, API origins, and HTTP authorization settings.
23
+ - Keep `mcpPath`, `healthPath`, and `readinessPath` distinct. The defaults are
24
+ `/mcp`, `/healthz`, and `/readyz`.
25
+ - Set `shutdownGraceMs` to 1,000–120,000 ms; the default is 30,000 ms. The
26
+ container/service stop timeout must be longer than this grace.
27
+ - Put every `tokenEnv`, `updateTokenEnv`, and `approval.secretEnv` value in a
28
+ root/operator-managed secret store or mode `0600` environment file.
29
+ - When `approval.grantStorePath` is configured, make its parent writable only
30
+ by the MCP service account. The store file must be a regular mode `0600`
31
+ file. Indefinite grants are rejected unless the durable path is configured.
32
+ - Configure a dedicated Joomla actor for each enabled path.
33
+ - Keep the HTTP listener private and terminate TLS at a trusted reverse proxy.
34
+ - Take tested Joomla filesystem and database backups before enabling writes or
35
+ upgrading the companion.
36
+
37
+ The uninterrupted single-company procedure is in
38
+ [Single-company, single-site deployment](SINGLE_SITE.md). Client configurations
39
+ are in [AI client connections](CLIENTS.md).
40
+
41
+ ## Release artifacts and manual release
42
+
43
+ The release workflow accepts either a pushed `vX.Y.Z` tag or a manual
44
+ `workflow_dispatch` from `main`. For a manual release, enter SemVer without the
45
+ `v` prefix. The version must already match `package.json` and both Joomla
46
+ companion manifests. The workflow validates, builds, attests, and only then
47
+ creates the tag and immutable GitHub release.
48
+
49
+ Each release contains:
50
+
51
+ - `joomengine-mcp-for-joomla-vX.Y.Z.tgz` — compiled/installable Node server;
52
+ - `joomengine-mcp-for-joomla-deployment-vX.Y.Z.tar.gz` — Compose, systemd,
53
+ configuration, operations, and client runbooks;
54
+ - `pkg_joomlamcp-X.Y.Z.zip` — Joomla companion package;
55
+ - `joomengine-mcp-for-joomla-vX.Y.Z.spdx.json` — source SBOM;
56
+ - `SHA256SUMS` — checksums for every downloadable asset;
57
+ - an attested OCI image at
58
+ `ghcr.io/<repository-owner>/joomla-mcp:vX.Y.Z`.
59
+
60
+ The manual release input does not rewrite versions or source. Prepare and merge
61
+ the version change before dispatching the workflow.
62
+
63
+ ## Stdio installation
64
+
65
+ From a verified checkout:
66
+
67
+ ```bash
68
+ npm ci
69
+ npm run validate
70
+ npm run build
71
+ JOOMLA_MCP_CONFIG=/absolute/path/to/sites.json npm start
72
+ ```
73
+
74
+ Configure the MCP client to launch `dist/bin/joomla-mcp.js` and provide only
75
+ environment variable names/values required for that deployment. The stdio
76
+ process should run as a dedicated account when it can reach a production site.
77
+
78
+ ## OCI and Docker Compose
79
+
80
+ Release images are published to `ghcr.io/joomengine/joomla-mcp` by
81
+ the tag workflow. Verify provenance and pin the selected image by digest, for
82
+ example `ghcr.io/joomengine/joomla-mcp@sha256:<digest>`. Do not use
83
+ `latest` for production.
84
+
85
+ From the repository root:
86
+
87
+ ```bash
88
+ cp deploy/sites.container.example.json deploy/sites.json
89
+ cp deploy/secrets.env.example deploy/secrets.env
90
+ ```
91
+
92
+ Edit both files, then make the non-secret site configuration readable by the
93
+ container's fixed UID but not writable, and keep the Compose-consumed secret
94
+ file private to its host owner:
95
+
96
+ ```bash
97
+ chmod 0444 deploy/sites.json
98
+ chmod 0600 deploy/secrets.env
99
+ ```
100
+
101
+ Validate the deployment artifacts:
102
+
103
+ ```bash
104
+ scripts/deploy/validate.sh
105
+ ```
106
+
107
+ Activate an immutable image and wait for its health probe:
108
+
109
+ ```bash
110
+ scripts/deploy/compose-rollout.sh apply 'ghcr.io/joomengine/joomla-mcp@sha256:<64-lowercase-hex-digest>'
111
+ scripts/deploy/compose-rollout.sh status
112
+ docker compose --project-directory deploy --env-file deploy/.release.env -f deploy/compose.yaml logs --tail=100 joomla-mcp
113
+ ```
114
+
115
+ The rollout script requires Docker Compose v2, rejects mutable tags, serializes
116
+ deployment operations, records the current and previous digest in ignored mode
117
+ `0600` state files, and automatically restores the old image if the new service
118
+ does not become live and JWKS-ready. Use `scripts/deploy/compose-rollout.sh
119
+ rollback` for an operator-requested rollback. The built-in Compose health check
120
+ uses shallow `/healthz`; the rollout script separately requires `200
121
+ {"status":"ready"}` from `/readyz` before reporting activation success.
122
+
123
+ The Compose definition binds the public host port to loopback by default,
124
+ drops capabilities, uses a read-only filesystem and non-root UID, mounts a
125
+ dedicated permission-grant state volume, limits resources, rotates logs, and
126
+ performs a bounded health check. Put a TLS reverse
127
+ proxy in front of `127.0.0.1:3000`; do not change the bind address to a public
128
+ interface without an equivalent network boundary. When `http.requireOrigin` is
129
+ true, export `JOOMLA_MCP_HEALTH_ORIGIN` with one exact allowed origin before
130
+ running the rollout script so the internal health probe passes the same policy.
131
+ If `shutdownGraceMs` is raised above 30 seconds, also raise Compose
132
+ `stop_grace_period` above it; otherwise Docker can terminate the process before
133
+ its application-level drain completes.
134
+
135
+ ## systemd host service
136
+
137
+ Build and validate in a non-privileged staging checkout before copying the
138
+ finished release into `/opt`; do not run package lifecycle scripts as root:
139
+
140
+ ```bash
141
+ npm ci
142
+ npm run validate
143
+ npm run build
144
+ npm prune --omit=dev
145
+ ```
146
+
147
+ Use release directories so the executable can be switched back atomically:
148
+
149
+ Create the unprivileged `joomla-mcp` system account through the operating
150
+ system's account-management policy, then:
151
+
152
+ ```bash
153
+ sudo install -d -o root -g root -m 0755 /opt/joomla-mcp/releases
154
+ sudo install -d -o root -g joomla-mcp -m 0750 /etc/joomla-mcp
155
+ ```
156
+
157
+ Copy that verified built tree under `/opt/joomla-mcp/releases/<version>`, then
158
+ make every release path root-owned and remove group/other write access:
159
+
160
+ ```bash
161
+ sudo chown -R root:root /opt/joomla-mcp/releases/<version>
162
+ sudo chmod -R go-w /opt/joomla-mcp/releases/<version>
163
+ ```
164
+
165
+ The rollout script also rejects broken links, non-root-owned content, and
166
+ symlinks that escape the selected release tree.
167
+
168
+ Use the rollout script to make `/opt/joomla-mcp/current` an atomic symlink to the
169
+ selected release. Install
170
+ `deploy/systemd/joomla-mcp.service` as
171
+ `/etc/systemd/system/joomla-mcp.service`; copy `deploy/runtime.env.example` to
172
+ `/etc/joomla-mcp/runtime.env`, `deploy/secrets.env.example` to
173
+ `/etc/joomla-mcp/secrets.env`, and the reviewed site file to
174
+ `/etc/joomla-mcp/sites.json`.
175
+
176
+ ```bash
177
+ sudo chown root:joomla-mcp /etc/joomla-mcp/sites.json /etc/joomla-mcp/runtime.env /etc/joomla-mcp/secrets.env
178
+ sudo chmod 0640 /etc/joomla-mcp/sites.json /etc/joomla-mcp/runtime.env
179
+ sudo chmod 0600 /etc/joomla-mcp/secrets.env
180
+ sudo systemctl daemon-reload
181
+ sudo scripts/deploy/systemd-rollout.sh activate /opt/joomla-mcp/releases/<version>
182
+ sudo systemctl enable joomla-mcp.service
183
+ sudo systemctl status joomla-mcp.service
184
+ ```
185
+
186
+ The activation script records `/opt/joomla-mcp/previous`, restarts the service,
187
+ and restores the old release automatically when activation fails. Use
188
+ `sudo scripts/deploy/systemd-rollout.sh rollback` to switch current and previous
189
+ releases. The startup readiness command must be present in the selected release
190
+ and its probe `Host` must exactly match an entry in `http.allowedHosts`. When
191
+ `http.requireOrigin` is true, set `JOOMLA_MCP_HEALTH_ORIGIN` in
192
+ `/etc/joomla-mcp/runtime.env` to one exact allowed origin. The shipped systemd
193
+ unit probes `/readyz`, so activation fails closed when the JWKS dependency is
194
+ not ready; `/healthz` remains the separate shallow liveness endpoint. If
195
+ `shutdownGraceMs` is raised above 30 seconds, also raise systemd
196
+ `TimeoutStopSec` above it.
197
+
198
+ The systemd unit uses `StateDirectory=joomla-mcp` with mode `0700`, making
199
+ `/var/lib/joomla-mcp` the supported persistent grant-store directory even
200
+ under `ProtectSystem=strict`.
201
+
202
+ For companion access, the service account also needs execute/read access to the
203
+ fixed PHP binary and Joomla CLI bootstrap plus Unix filesystem ACLs for the
204
+ exact Joomla paths it needs. The shipped unit's `ProtectSystem=strict` makes
205
+ system paths read-only. If local mutation actions are enabled, copy
206
+ `deploy/systemd/joomla-mcp-native.conf.example` to
207
+ `/etc/systemd/system/joomla-mcp.service.d/native.conf` and replace its examples
208
+ with the narrow cache/log/temporary/media/configuration paths required by the
209
+ enabled native actions. Run `systemctl daemon-reload` and repeat live
210
+ denial/write/recovery tests. Do not relax `ProtectSystem`, expose a
211
+ home-directory Joomla root under `ProtectHome=true`, or grant the whole Joomla
212
+ root write access merely to make an action pass.
213
+
214
+ ## Reverse proxy contract
215
+
216
+ The reverse proxy must:
217
+
218
+ - terminate HTTPS with a valid certificate;
219
+ - forward only to the private Node listener;
220
+ - replace untrusted forwarding headers;
221
+ - preserve the exact external authority expected in `allowedHosts`;
222
+ - preserve streaming request/response behavior and use timeouts compatible with
223
+ MCP sessions;
224
+ - apply an outer request/body/concurrency limit no weaker than the edge;
225
+ - expose the configured protected-resource metadata path;
226
+ - probe the configured `readinessPath` before routing MCP traffic;
227
+ - avoid logging bearer tokens or request bodies.
228
+
229
+ Use `/healthz` only as shallow liveness. `/readyz` warms and validates the
230
+ configured JWKS and returns a generic `503` reason `not_ready` on failure.
231
+ Joomla API/companion, database, coordination, and audit readiness still require
232
+ separate non-mutating checks.
233
+
234
+ ## Upgrade procedure
235
+
236
+ 1. Read the release notes and coverage changes; identify configuration, schema,
237
+ companion, and minimum-runtime changes.
238
+ 2. Back up Joomla files and database and prove the restore procedure.
239
+ 3. Retain the current edge image digest/release directory and companion ZIP.
240
+ 4. Validate the new edge and companion artifacts in disposable Joomla 6.1/6.2
241
+ fixtures with the same enabled toolsets and database family.
242
+ 5. Install or pull the new artifacts without replacing the active version.
243
+ 6. Validate configuration with the new code and build/package checks.
244
+ 7. Drain write clients. Let active writes finish; pending plans will be invalid
245
+ after a process restart and must be re-planned.
246
+ 8. Upgrade the Joomla companion through Joomla's native extension installer.
247
+ Run `joomla:mcp:describe` and compare action/permission changes.
248
+ 9. Activate the pinned image digest or release directory with the shipped
249
+ rollout script.
250
+ 10. Verify liveness, JWKS readiness, authorization denials, catalogue, one safe
251
+ API read, one safe companion read when configured, and audit delivery.
252
+ 11. Re-enable write clients only after post-upgrade checks pass.
253
+
254
+ ## Rollback procedure
255
+
256
+ Rollback is an operator-controlled recovery, not an MCP action.
257
+
258
+ 1. Disable write traffic and preserve logs.
259
+ 2. If Joomla data integrity is uncertain, stop and restore the tested filesystem
260
+ and database snapshot before restarting automation.
261
+ 3. Run the shipped Compose or systemd rollback command to activate the retained
262
+ digest/release directory.
263
+ 4. Reinstall the previous companion package through Joomla's native extension
264
+ installer when the package changed. If its upgrade changed persistent data,
265
+ follow that release's database restore instructions.
266
+ 5. Restart the edge; all old pending plans are invalid and must not be replayed.
267
+ 6. Repeat the liveness, JWKS readiness, denial, catalogue, safe-read, and audit
268
+ checks.
269
+ 7. Re-enable reads, then writes, only after Joomla and MCP postconditions pass.
270
+
271
+ Never roll back only application files after a Joomla/database migration unless
272
+ the release notes explicitly establish compatibility.
@@ -0,0 +1,210 @@
1
+ # Disposable Joomla fixture setup
2
+
3
+ The live matrix must use installations owned by the project or explicitly
4
+ authorized for destructive testing. Never point contract tests at a production
5
+ site.
6
+
7
+ ## Repository-managed Joomla 6.1 live fixture
8
+
9
+ The repository includes a blocking, disposable JoomEngine fixture for the first
10
+ live gate:
11
+
12
+ ```bash
13
+ php companion/build.php
14
+ npm run test:fixture:joomengine
15
+ ```
16
+
17
+ It follows JoomEngine's `octoleo/joomengine:6` stable-major tag, currently JCB
18
+ 6.1.6, Joomla 6.1.2, and PHP 8.4, with MariaDB 11.4. CI pins the validated `:6`
19
+ image digest after an intentional image upgrade. The fixture:
20
+
21
+ 1. creates isolated Joomla and database volumes with generated credentials;
22
+ 2. mounts the exact built companion ZIP read-only;
23
+ 3. installs it through JoomEngine's `JOOMLA_EXTENSIONS_PATHS` bootstrap;
24
+ 4. runs companion-owned description, self-test, and CLI-inventory commands through
25
+ `JOOMLA_CLI_COMMANDS` and validates their machine-readable feedback;
26
+ 5. independently describes, self-tests, inventories the installed Joomla CLI,
27
+ captures native `list` output and `help <command>` for every installed command,
28
+ and dispatches the companion as `www-data`;
29
+ 6. confirms the content Web Services route enforces authentication;
30
+ 7. creates a throwaway API token and a host CLI bridge scoped to the fixture;
31
+ 8. runs the packaged full live suite through API and companion CLI over stdio
32
+ and Streamable HTTP;
33
+ 9. uploads redacted Markdown, JSON, JUnit, per-action, Joomla, PHP, MCP, and
34
+ container evidence; and
35
+ 10. always destroys the disposable volumes.
36
+
37
+ JoomEngine's extension and CLI variables execute only during its first
38
+ successful Joomla installation. Never reuse a failed fixture volume: the
39
+ upstream image removes Joomla's installation directory before its extension and
40
+ command phase, so a partial bootstrap is not retryable. The harness therefore
41
+ requires container state, configuration, HTTP health, command logs, JSON
42
+ responses, and runtime versions instead of trusting container startup alone.
43
+
44
+ The JoomEngine entrypoint currently performs bootstrap PHP commands as its
45
+ entrypoint user even though its documentation describes `www-data`. This is
46
+ acceptable only inside the isolated disposable smoke fixture. All independent
47
+ companion checks explicitly use `www-data`, and this lane is not evidence for a
48
+ production operating-system least-privilege boundary.
49
+
50
+ The default keeps the requested `octoleo/joomengine:6` label and pins the
51
+ validated registry digest. Set `JOOMLA_FIXTURE_IMAGE`,
52
+ `JOOMLA_FIXTURE_DATABASE_IMAGE`, and the version-pinned
53
+ `JOOMLA_FIXTURE_MAIL_IMAGE` only when
54
+ deliberately validating an image upgrade. Set
55
+ `JOOMLA_FIXTURE_ARTIFACT_DIR` to retain bounded diagnostics and evidence.
56
+ `JOOMLA_FIXTURE_KEEP=1` is available for local debugging only; never use it in
57
+ CI.
58
+
59
+ The API token is captured in a mode-0600 temporary file, exported only to the
60
+ live-test process, deleted before evidence generation completes, and covered by
61
+ recursive report redaction. MariaDB remains exclusively on the internal fixture
62
+ network. Joomla also joins a dedicated bridge edge because Docker suppresses
63
+ published ports for containers attached only to an internal network; that edge
64
+ publishes only an ephemeral loopback listener and no database port. Full runner
65
+ usage, safety controls, statuses, and failure investigation are documented in
66
+ [Live Joomla validation](LIVE_TESTING.md).
67
+
68
+ ## Fixture set
69
+
70
+ Provision separate, resettable installations for:
71
+
72
+ - current Joomla 6.1 on a supported MySQL/MariaDB database;
73
+ - current Joomla 6.2 on a supported MySQL/MariaDB database;
74
+ - the same supported releases on PostgreSQL;
75
+ - a Joomla 7 canary that may fail without blocking release.
76
+
77
+ Use distinct domains, databases, Joomla secrets, API tokens, companion actors,
78
+ and operating-system accounts. Take a clean filesystem and database snapshot
79
+ after Joomla installation and before installing the companion. The fixture must
80
+ be restorable without relying on MCP.
81
+
82
+ ## Joomla API actor
83
+
84
+ On each fixture, in Joomla Administrator:
85
+
86
+ 1. Create a group named for the fixture, such as **Joomla MCP API Fixture**,
87
+ underneath the least-privileged appropriate parent group.
88
+ 2. Enable **User - Joomla API Token** and permit that group in the plugin's
89
+ allowed-user-group setting.
90
+ 3. Enable **API Authentication - Web Services Joomla Token**.
91
+ 4. Enable only the core Web Services plugins needed by the test run.
92
+ 5. Grant the group **Web Services Login** (`core.login.api`).
93
+ 6. Grant component permissions one family at a time. Maintain two users: an
94
+ allowed actor with the permission under test and a denied actor without it.
95
+ 7. Create both users with non-human fixture addresses and strong random
96
+ passwords; do not grant Super Users unless a test specifically proves a
97
+ privileged operation and its denial counterpart.
98
+ 8. Open each user's **Joomla API Token** tab and copy the generated token into
99
+ the CI or local secret store.
100
+ 9. Verify HTTPS and the API outside MCP:
101
+
102
+ ```bash
103
+ curl --fail-with-body --silent --show-error \
104
+ -H 'Accept: application/vnd.api+json' \
105
+ -H "Authorization: Bearer ${JOOMLA_CONTRACT_TOKEN}" \
106
+ "${JOOMLA_CONTRACT_BASE_URL}/api/index.php/v1/content/articles?page%5Blimit%5D=1"
107
+ ```
108
+
109
+ Do not paste the token into logs or repository configuration.
110
+
111
+ ## Companion actor and package
112
+
113
+ On each fixture:
114
+
115
+ 1. Build or download the companion ZIP whose digest is under test.
116
+ 2. Install it through Joomla's native extension installer.
117
+ 3. Verify **Console - JoomEngine MCP for Joomla Companion** is enabled. Version 0.7.0 and
118
+ later enable it on first installation while preserving state on upgrades.
119
+ 4. Select a dedicated **MCP actor user** with only the permissions for the
120
+ current test group. An unset actor is a required denial case.
121
+ 5. Run the following from the Joomla root as the dedicated deployment account:
122
+
123
+ ```bash
124
+ php cli/joomla.php joomla:mcp:describe --format=json --no-interaction --no-ansi
125
+ ```
126
+
127
+ 6. Confirm that the response reports the expected protocol/package version,
128
+ action IDs, and effective permission results.
129
+ 7. Send a read-only smoke request over stdin:
130
+
131
+ ```bash
132
+ printf '%s' '{"protocol":"joomla-mcp/1","id":"fixture-smoke","action":"system.info","input":{}}' \
133
+ | php cli/joomla.php joomla:mcp:dispatch --input=- --format=json --no-interaction --no-ansi
134
+ ```
135
+
136
+ 8. Record the command exit status and redacted result. Do not run the companion
137
+ process as root or the web-server user unless that account is the explicitly
138
+ isolated fixture deployment account.
139
+
140
+ ## Edge site entries
141
+
142
+ Create separate immutable aliases in a fixture-only `sites.json`. Give each
143
+ alias only the toolsets for the test group. A dual-path entry needs both `api`
144
+ and `cli`; an API-only entry omits `cli`; a companion-only entry omits `api`.
145
+
146
+ ```json
147
+ {
148
+ "defaultSite": "joomla61Fixture",
149
+ "approval": {
150
+ "secretEnv": "JOOMLA_MCP_FIXTURE_APPROVAL_SECRET",
151
+ "ttlMs": 300000
152
+ },
153
+ "sites": {
154
+ "joomla61Fixture": {
155
+ "toolsets": ["discovery", "content.read", "cli.discovery"],
156
+ "api": {
157
+ "baseUrl": "https://joomla61-fixture.example",
158
+ "tokenEnv": "JOOMLA_61_CONTRACT_TOKEN"
159
+ },
160
+ "cli": {
161
+ "root": "/srv/joomla61-fixture",
162
+ "phpBinary": "/usr/bin/php8.3",
163
+ "timeoutMs": 120000,
164
+ "maxOutputBytes": 2097152
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ Keep this file and all referenced secrets outside source control.
172
+
173
+ ## GitHub secret activation
174
+
175
+ Add these Actions secrets to the repository:
176
+
177
+ | Target | Secret names |
178
+ |---|---|
179
+ | Joomla 6.1 | `JOOMLA_61_CONTRACT_BASE_URL`, `JOOMLA_61_CONTRACT_TOKEN` |
180
+ | Joomla 6.2 | `JOOMLA_62_CONTRACT_BASE_URL`, `JOOMLA_62_CONTRACT_TOKEN` |
181
+ | Joomla 7 canary | `JOOMLA_70_CONTRACT_BASE_URL`, `JOOMLA_70_CONTRACT_TOKEN` |
182
+
183
+ Hosted CI now includes the JoomEngine package-install and full Super User
184
+ success-path lane described above. The broader compatibility and denial matrix still requires a runner that
185
+ has the exact package, PHP, filesystem access to the disposable Joomla root,
186
+ and a configured least-privilege actor. Prefer an ephemeral or dedicated
187
+ self-hosted runner; do not grant a general repository runner access to a
188
+ production server.
189
+
190
+ On that runner, set `JOOMLA_CONTRACT_ROOT` to the absolute disposable Joomla
191
+ root and `JOOMLA_CONTRACT_PHP_BINARY` to the absolute PHP executable before
192
+ running `npm run test:contract`. Both paths are validated and never accepted
193
+ from an MCP tool call.
194
+
195
+ ## Seed, test, and reset
196
+
197
+ For each action family:
198
+
199
+ 1. restore the clean snapshot;
200
+ 2. install the exact companion artifact when the local path is tested;
201
+ 3. enable only that family's Web Services plugin, actor ACL, edge toolset, and
202
+ remote scopes;
203
+ 4. create uniquely prefixed fixture records through Joomla-native setup or the
204
+ action under test;
205
+ 5. run allowed, denied, bounds, mutation, verification, and cleanup cases;
206
+ 6. retain redacted evidence and artifact digests;
207
+ 7. restore the filesystem and database snapshot;
208
+ 8. prove that the restored Joomla site starts and passes its own health check.
209
+
210
+ Do not declare a family live-verified if cleanup or snapshot restoration fails.