@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,233 @@
1
+ # Versioning and releases
2
+
3
+ One release version identifies every deliverable produced from one immutable
4
+ source commit:
5
+
6
+ | Deliverable | Coordinate |
7
+ |---|---|
8
+ | Node.js library and CLI | `@joomengine/joomla-mcp@<version>` |
9
+ | Installable npm tarball | `joomengine-mcp-for-joomla-v<version>.tgz` |
10
+ | Joomla companion | `pkg_joomlamcp-<version>.zip` |
11
+ | OCI image | `ghcr.io/joomengine/joomla-mcp:v<version>` |
12
+ | Self-hosted deployment bundle | `joomengine-mcp-for-joomla-deployment-v<version>.tar.gz` |
13
+ | Source SBOM | `joomengine-mcp-for-joomla-v<version>.spdx.json` |
14
+ | Machine-readable release contract | `release-manifest.json` |
15
+ | Integrity manifest | `SHA256SUMS` |
16
+
17
+ `package.json` is the release-version authority. The lockfile, TypeScript
18
+ package identity, Joomla manifests, companion-reported version, build filename,
19
+ tests, fixture, examples, changelog, and versioned documentation are verified
20
+ mirrors. `npm run version:check` fails on drift.
21
+
22
+ ## Maintainer release
23
+
24
+ Open **Actions → Release → Run workflow** on `main`.
25
+
26
+ For the normal path, leave **strategy** as `auto` and run the workflow:
27
+
28
+ - if the repository version has no completed release, `auto` proposes that
29
+ current version;
30
+ - if the current stable version is already released, `auto` proposes its next
31
+ patch;
32
+ - if the current version is a published prerelease, `auto` proposes its next
33
+ prerelease.
34
+
35
+ For an initialized but unpublished repository, the first `auto` run therefore
36
+ proposes the exact value already present in `package.json` instead of skipping
37
+ ahead to a patch version.
38
+
39
+ GitHub cannot put a dynamically calculated value in the workflow-dispatch
40
+ form. The read-only **Plan and authorize** job supplies the dynamic suggestion:
41
+ it writes the repository version, exact proposed version, tag, npm channel,
42
+ release state, and source commit to the run summary. No mutation occurs until
43
+ an authorized reviewer approves the protected `release` environment.
44
+
45
+ The form deliberately has no independent prerelease checkbox. Prerelease state
46
+ is derived from SemVer:
47
+
48
+ - `1.2.3` → normal GitHub release and npm `latest`;
49
+ - `1.3.0-rc.1` → GitHub prerelease and npm `next`.
50
+
51
+ Use **plan only** to calculate and review the same plan without changing Git,
52
+ npm, GHCR, or GitHub Releases.
53
+
54
+ ## Strategies
55
+
56
+ | Strategy | Result |
57
+ |---|---|
58
+ | `auto` | Current unpublished version; otherwise next patch/prerelease |
59
+ | `current` | Release or reconcile the exact version already in `package.json` |
60
+ | `patch` | Increment `x.y.z` to `x.y.(z+1)` |
61
+ | `minor` | Increment `x.y.z` to `x.(y+1).0` |
62
+ | `major` | Increment `x.y.z` to `(x+1).0.0` |
63
+ | `prerelease` | Start the next minor prerelease or increment the current prerelease |
64
+ | `promote` | Remove the prerelease suffix from the current version |
65
+ | `exact` | Use the supplied `exact_version` after monotonic SemVer validation |
66
+
67
+ `exact_version` is rejected for every strategy except `exact`. Release
68
+ versions use SemVer without build metadata, and numeric identifiers may not
69
+ exceed JavaScript's safe-integer limit. A release can never move behind either
70
+ the repository version or an immutable version tag.
71
+
72
+ ## Release state machine
73
+
74
+ The one-click path uses two globally serialized workflows. `release.yml`
75
+ plans and anchors the source. It then dispatches `publish-release.yml` with
76
+ the new tag as that workflow's Git ref. This separation is important:
77
+ GitHub OIDC, npm provenance, and artifact attestations therefore name the
78
+ actual release commit rather than the pre-bump dispatch commit.
79
+
80
+ The workflows run these phases:
81
+
82
+ 1. **Plan** — require both the dispatching and triggering actors to have
83
+ `maintain` or `admin`, inspect tags/releases, calculate the suggestion, and
84
+ report the exact proposed release without mutating anything.
85
+ 2. **Approve source** — pause before mutation at the protected `release`
86
+ environment, then generate authoritative release notes.
87
+ 3. **Version** — preflight every version target, update all targets in memory,
88
+ prepend the generated changelog entry, run the complete Node and PHP
89
+ validation, then create a release commit when required.
90
+ 4. **Anchor** — push a bumped main commit and annotated tag together with
91
+ `git push --atomic`. If `main` advanced, neither ref is pushed. An
92
+ unpublished current version only needs the tag.
93
+ 5. **Dispatch tag publication** — start `publish-release.yml` on the immutable
94
+ tag. The publication workflow independently verifies the source run,
95
+ maintainer, tag, commit, and synchronized version.
96
+ 6. **Build** — check out the tag commit explicitly and build the
97
+ npm/deployment packages, Joomla companion, and SPDX SBOM with provenance
98
+ rooted in that exact commit.
99
+ 7. **Stage** — enforce the exact asset allowlist, generate
100
+ `release-manifest.json` and `SHA256SUMS`, and upload the exact set to a
101
+ durable draft GitHub release.
102
+ 8. **Approve publication** — require the protected `release` environment
103
+ again immediately before any registry publication.
104
+ 9. **Seal** — publish or verify a commit-addressed OCI image, bind the
105
+ versioned OCI tag to that registry digest, and seal both the OCI digest and
106
+ expected npm SHA-512 integrity into the final release manifest and
107
+ checksums.
108
+ 10. **Publish** — upload and byte-verify the final draft assets, publish npm
109
+ directly to SemVer-derived `latest` or `next`, verify the registry
110
+ integrity/channel, and make the GitHub release public last.
111
+
112
+ Git, npm, GHCR, and GitHub Releases cannot participate in one cross-service
113
+ transaction. The draft-first, integrity-checked, resumable workflow provides
114
+ transaction-like safety without pretending that a distributed atomic commit is
115
+ possible.
116
+
117
+ ## One-time repository setup
118
+
119
+ ### Protected environment
120
+
121
+ Create an environment named `release` and configure:
122
+
123
+ - required reviewers from the release-maintainer or system-administrator team;
124
+ - prevent self-review when at least two maintainers are available;
125
+ - deployment refs restricted to branch `main` and tags matching `v*`;
126
+ - `NPM_TOKEN` only for the first npm bootstrap release, if required;
127
+ - optional `RELEASE_APP_ID` and `RELEASE_APP_PRIVATE_KEY` for the dedicated
128
+ release GitHub App.
129
+
130
+ The actor permission check is defense in depth. Environment reviewers are the
131
+ human authorization boundary. A normal release asks for approval twice: first
132
+ for the version commit/tag and later for external registry publication. The
133
+ build and draft-staging work between those gates does not require another
134
+ approval.
135
+
136
+ ### Branch and tag rules
137
+
138
+ Normal development should continue through pull requests. To support the
139
+ intentional no-PR release bump:
140
+
141
+ 1. Create a narrowly scoped GitHub App installed only on this repository.
142
+ 2. Grant it repository contents write permission.
143
+ 3. Make that App the only bypass actor for the `main` release commit and `v*`
144
+ tag-creation rules.
145
+ 4. Keep force-push, tag update, and tag deletion disabled.
146
+ 5. Store its App ID and private key in the protected `release` environment.
147
+
148
+ When the App secrets are absent, the workflow falls back to `GITHUB_TOKEN`.
149
+ That is sufficient only when the repository rules permit Actions to create the
150
+ release commit and tag. A protected branch rejection is a configuration
151
+ failure; do not weaken the rules for all maintainers to work around it.
152
+
153
+ Enable immutable GitHub releases for the repository after confirming that the
154
+ draft reconciliation path works.
155
+
156
+ ### npm bootstrap and trusted publishing
157
+
158
+ The package is public as `@joomengine/joomla-mcp`.
159
+
160
+ For the first publication:
161
+
162
+ 1. Ensure the `joomengine` npm organization exists and the operator may publish
163
+ public scoped packages.
164
+ 2. Put a short-lived granular bootstrap token in the protected environment as
165
+ `NPM_TOKEN`.
166
+ 3. Run the release. It publishes directly to `latest` or `next`, as derived
167
+ from SemVer, verifies the exact integrity and channel, then makes the
168
+ already-sealed GitHub release public.
169
+ 4. Configure npm trusted publishing for organization `joomengine`, repository
170
+ `joomla-mcp`, workflow `publish-release.yml`, environment `release`.
171
+ 5. Remove `NPM_TOKEN`. Later releases use GitHub OIDC with npm provenance.
172
+
173
+ Keeping the bootstrap token permanently defeats the purpose of trusted
174
+ publishing. A token is needed again only for exceptional repair of a legacy
175
+ partial release whose immutable npm version exists but whose dist-tag is
176
+ wrong; trusted publishing intentionally cannot edit dist-tags.
177
+
178
+ ## Local version verification
179
+
180
+ Check the current tree without modifying it:
181
+
182
+ ```bash
183
+ npm run version:check
184
+ ```
185
+
186
+ Preview the default plan locally:
187
+
188
+ ```bash
189
+ RELEASE_CURRENT_STATE=unreleased npm run version:plan
190
+ ```
191
+
192
+ The workflow owns normal version updates. For exceptional local preparation,
193
+ generate reviewed release notes and run:
194
+
195
+ ```bash
196
+ npm run version:sync -- <version> --notes-file /path/to/release-notes.md
197
+ npm run validate
198
+ php companion/tests/run.php
199
+ php companion/build.php
200
+ ```
201
+
202
+ The synchronizer preflights every target before its first write, rejects
203
+ backward versions, preserves historical changelog entries, and is idempotent
204
+ when the requested version is already current.
205
+
206
+ ## Recovery
207
+
208
+ Dispatch a new run with `auto` or `current` while the current version is
209
+ partial. Do not use GitHub's **Re-run jobs** button: every dispatch persists a
210
+ fresh release intent and artifact namespace. The workflow resumes from the
211
+ immutable source/tag and reconciles each boundary:
212
+
213
+ - a tag must resolve to the same release commit;
214
+ - external npm or OCI state without that source tag is rejected as
215
+ unverifiable rather than retroactively anchored;
216
+ - a draft may be updated only for that tag and exact asset allowlist;
217
+ - an existing npm version must have the same SHA-512 integrity;
218
+ - an existing OCI version tag must have the same manifest digest;
219
+ - a public GitHub release must contain the exact byte-for-byte asset set;
220
+ - public-release recovery reuses those immutable assets and skips rebuilding
221
+ timestamp-sensitive artifacts such as the SBOM;
222
+ - the npm channel must point at the exact version before GitHub publication.
223
+
224
+ Any identity, integrity, digest, prerelease-state, or asset-contract mismatch
225
+ fails closed with the conflicting coordinate. Never delete and recreate a
226
+ published npm version, overwrite an OCI version tag, move a release tag, or
227
+ replace public release assets. Correct the source and publish a new version.
228
+
229
+ The machine-readable `release-manifest.json` is the downstream authority for
230
+ the version, commit, npm coordinate, OCI coordinate, Joomla compatibility, and
231
+ per-artifact SHA-256 hashes. Consumers such as the SaaS layer should pin an
232
+ exact released version and promote upgrades only after their own compatibility
233
+ canary succeeds.
@@ -0,0 +1,126 @@
1
+ # Remote Streamable HTTP
2
+
3
+ The HTTP entry point exposes MCP Streamable HTTP at the configured `mcpPath`.
4
+ The stdio entry point remains a separate process and does not require this
5
+ authorization configuration.
6
+
7
+ ## Required configuration
8
+
9
+ Copy the `http` object from `config/sites.example.json` and set:
10
+
11
+ - `listenHost` and `port` to a private listener;
12
+ - `mcpPath`, `healthPath`, and `readinessPath` to three distinct paths;
13
+ - `shutdownGraceMs` to the maximum graceful connection-drain interval (default
14
+ 30,000 ms; accepted range 1,000–120,000 ms);
15
+ - `allowedHosts` to the exact external authority, including a non-default port;
16
+ - `allowedOrigins` to approved browser origins, if any;
17
+ - `issuer`, `audience`, and `jwksUrl` to the external authorization server;
18
+ - `resourceMetadataUrl` to this service's HTTPS protected-resource metadata URL;
19
+ - `requiredScopes` to the global MCP access scope;
20
+ - `limits` according to measured workload and available memory.
21
+
22
+ All issuer, audience, JWKS, metadata, and browser-origin URLs must use HTTPS.
23
+ The gateway validates access tokens but does not issue them and does not use a
24
+ Joomla API token as an inbound MCP credential.
25
+
26
+ An accepted token needs all applicable scopes:
27
+
28
+ | Operation | Required scope |
29
+ |---|---|
30
+ | Enter the service | Every value in `http.requiredScopes` |
31
+ | List site aliases | `joomla:sites:list` |
32
+ | Access one site | `joomla:site:<alias>` or `joomla:sites:*` |
33
+ | Use one toolset | `joomla:toolset:<toolset>` or `joomla:toolsets:*` |
34
+ | Request, approve, or revoke a permission | `joomla:permissions:grant` |
35
+ | List active permissions | `joomla:permissions:read` |
36
+ | Apply a planned write | `joomla:writes:apply` |
37
+
38
+ Use narrow site and toolset scopes for people and clients. Wildcard scopes are
39
+ appropriate only for separately controlled operator identities.
40
+
41
+ ## Security contract
42
+
43
+ - `Host` is required and must match an exact configured value, including the port when one is present. Wildcards are not supported.
44
+ - An `Origin`, when supplied, must be a canonical exact match. Set `requireOrigin: true` for browser-only deployments; non-browser MCP clients commonly omit it.
45
+ - Every `/mcp` request requires one structurally valid Bearer JWT. The injected `JwtCryptographicVerifier` is the cryptographic trust boundary: it must verify the signature and trusted key and reject unsupported algorithms before returning claims.
46
+ - The gateway then independently enforces the configured issuer, audience, expiry, not-before time, and every required scope. It never treats decoded, unverified claims as authenticated.
47
+ - When `resourceMetadataUrl` is configured, its exact path serves unauthenticated RFC 9728 metadata and authentication challenges reference that URL. The advertised resource, authorization server and scopes come from the same authorization policy used for validation.
48
+ - Stateful MCP sessions use a cryptographically random SDK v1 session ID, a fresh `McpServer` instance and transport per session, principal binding, idle expiry, absolute lifetime, and a bounded session table.
49
+ - SSE resumability can be enabled with an isolated `eventStoreFactory`; without one, replay after a disconnected stream is intentionally unavailable.
50
+ - Body size and read time, header size, global/per-principal concurrency, per-principal token-bucket rate, and session count are bounded.
51
+ - Audit events contain request IDs, principals, session IDs, outcomes and stable reason codes. They never contain the bearer token or request body.
52
+ - `/healthz` is intentionally shallow and unauthenticated. It still passes Host/Origin checks and reports no configuration, downstream state, or secrets.
53
+ - `/readyz` is unauthenticated but passes the same Host/Origin policy. `GET` or
54
+ `HEAD` warms and validates the configured HTTPS JWKS dependency. Success is
55
+ `200 {"status":"ready"}`. Failure is a generic `503` with reason
56
+ `not_ready`; no JWKS URL, response, key, or internal error is disclosed.
57
+ - Tool calls additionally require `joomla:site:<alias>` plus `joomla:toolset:<toolset>` (or `joomla:sites:*` plus `joomla:toolsets:*`). Site discovery, permission management, permission listing, and write apply require `joomla:sites:list`, `joomla:permissions:grant`, `joomla:permissions:read`, and `joomla:writes:apply` as applicable. A permission request and write plan are bound to the issuer/subject/client. Approval and apply recheck their site and toolset scopes before activating or consuming state.
58
+
59
+ Terminate TLS at a trusted reverse proxy, clear inbound forwarding headers, preserve the original allowed `Host`, and do not expose the Node listener directly to an untrusted network. Distributed replicas need a shared session/rate strategy or session affinity; the included stores are process-local.
60
+
61
+ ## Integration
62
+
63
+ The shipped entry point wires the gateway to the Joomla server factory and the fixed HTTPS JWKS verifier. The equivalent programmatic integration is:
64
+
65
+ ```ts
66
+ import { createRemoteHttpServer } from '../http/index.js';
67
+ import { createServer } from '../mcp/create-server.js';
68
+ import { JwksJwtVerifier } from '../security/jwks-jwt-verifier.js';
69
+
70
+ const productionVerifier = new JwksJwtVerifier({
71
+ jwksUrl: 'https://identity.example.org/.well-known/jwks.json',
72
+ });
73
+
74
+ const remote = createRemoteHttpServer({
75
+ createMcpServer: () => createServer(configuration),
76
+ jwtVerifier: productionVerifier,
77
+ authorization: {
78
+ issuer: 'https://identity.example.org',
79
+ audience: 'https://joomla-mcp.example.org',
80
+ requiredScopes: ['mcp:access'],
81
+ },
82
+ requestPolicy: {
83
+ allowedHosts: ['joomla-mcp.example.org'],
84
+ allowedOrigins: ['https://approved-client.example.org'],
85
+ },
86
+ resourceMetadataUrl: 'https://joomla-mcp.example.org/.well-known/oauth-protected-resource',
87
+ readinessPath: '/readyz',
88
+ readinessCheck: () => productionVerifier.warm(),
89
+ shutdownGraceMs: 30_000,
90
+ audit: productionAuditSink,
91
+ });
92
+
93
+ remote.server.listen(3000, '127.0.0.1');
94
+ ```
95
+
96
+ The gateway validates access tokens but does not mint them. Configure the external authorization server for the resource audience and Joomla site/toolset scopes. Put session affinity or shared session/event infrastructure in front of multiple replicas before horizontal scaling.
97
+
98
+ ## Operations
99
+
100
+ Use `/healthz` for liveness and `/readyz` for the configured JWKS readiness
101
+ dependency. Joomla API/companion, database, coordination, and audit readiness
102
+ still require separate non-mutating checks. Monitor readiness failures, reject
103
+ reason codes, audit-sink health, active connections, session capacity, and
104
+ event-loop latency. Rotate JWT signing keys through the verifier's trusted JWKS
105
+ cache and fail closed when a key cannot be validated.
106
+
107
+ Before exposing the endpoint:
108
+
109
+ 1. validate configuration and run the offline security suite;
110
+ 2. bind Node to loopback or a private service network;
111
+ 3. terminate TLS at a maintained reverse proxy;
112
+ 4. replace forwarded headers rather than trusting arbitrary inbound values;
113
+ 5. preserve the exact external `Host` expected by `allowedHosts`;
114
+ 6. test a valid token, wrong audience, wrong issuer, expired token, missing site
115
+ scope, missing toolset scope, forbidden host, and forbidden origin;
116
+ 7. verify that request IDs and denial reasons reach the audit destination without
117
+ tokens or request bodies.
118
+
119
+ On shutdown, admission stops before drain begins. Idle connections close
120
+ immediately; active connections may finish for at most `shutdownGraceMs`, after
121
+ which the server force-closes them. Size the service manager/container stop
122
+ timeout above that value. Restart drains in-memory sessions and invalidates
123
+ pending write plans. Clients must reconnect, verify any interrupted operation,
124
+ and re-plan. Do not enable write traffic on multiple replicas until shared
125
+ confirmation/idempotency/lock state and the chosen session strategy have passed
126
+ failure and replay tests.
@@ -0,0 +1,138 @@
1
+ # Security model
2
+
3
+ This document defines the runtime security contract. Report suspected
4
+ vulnerabilities through the private process in [`SECURITY.md`](../SECURITY.md).
5
+
6
+ ## Defaults
7
+
8
+ - Read-only toolsets by default; write and administration toolsets require explicit configuration.
9
+ - Fixed site aliases and adapter locations.
10
+ - Dedicated Joomla API identities.
11
+ - HTTPS only, redirects rejected.
12
+ - No generic HTTP, shell, CLI, PHP, SQL, or filesystem tool.
13
+ - Bounded API responses, pagination, CLI output, and execution time.
14
+ - Secrets referenced by environment variable and omitted from discovery/audit results.
15
+ - Native Joomla ACL and model checks remain authoritative; edge authorization is an additional boundary, not a replacement.
16
+
17
+ ## Threats and controls
18
+
19
+ | Threat | Required control |
20
+ |---|---|
21
+ | Prompt injection in Joomla content | Treat all returned content as untrusted data; never derive policy from it |
22
+ | Confused deputy | Map authenticated MCP identity to site/toolsets; use dedicated downstream Joomla identities |
23
+ | Command injection | Fixed executable/root, argument arrays, no shell, typed action schemas |
24
+ | SSRF | Server-configured origins only; reject redirects; bridge actions cannot accept arbitrary URLs |
25
+ | Path traversal/symlinks | Canonicalize configured roots at startup; clients never supply paths |
26
+ | Secret exfiltration | Environment/secret references, strict configuration allowlist, redacted metadata-only logs |
27
+ | Destructive action | Disabled by default; plan/apply approval; site lock; postcondition verification |
28
+ | Extension/core-update RCE | Separate privileged toolset and identity; package origin/hash policy; signed approval |
29
+ | Cross-site leakage | Immutable request site context; tenant/subject/site/action keyed state |
30
+ | Session/token replay | HTTPS, short-lived audience-bound MCP tokens, expiry and rotation |
31
+ | DNS rebinding/CORS | Exact Origin/Host validation on the Streamable HTTP transport |
32
+ | Denial of service | Rate limits, size/page ceilings, subprocess concurrency limits, timeouts |
33
+ | Log leakage | Never log raw authorization, secrets, passwords, or unrestricted payloads |
34
+ | Supply-chain compromise | Lockfile, audit, SBOM, signed artifacts and provenance |
35
+ | Joomla actor escalation | Dedicated actors, effective companion ACL preflight, explicit Web Services plugin and component permissions |
36
+ | Unsafe native lifecycle | Source-backed semantic action, preview/confirmation, postcondition, action-specific rollback and live recovery tests |
37
+
38
+ ## Joomla-specific warnings
39
+
40
+ - Joomla CLI operates outside the normal Web Services token/ACL boundary.
41
+ - `--no-interaction` can skip delete confirmation and is never user approval.
42
+ - `config:get` can reveal database and mail credentials and is not exposed.
43
+ - Password-bearing CLI options are unsafe because process arguments are visible.
44
+ - Extension installation executes PHP and URL installation is also an SSRF surface.
45
+ - Database import drops tables before recreating them.
46
+ - Joomla Update uses a separate update token and configuration.
47
+
48
+ The service must run as a dedicated per-site deployment account, never root. Filesystem permissions should cover only the Joomla paths required by enabled actions.
49
+
50
+ The companion is an adapter around Joomla's dependency-injection container,
51
+ ACL, services, models, tables, forms, and events. It must not duplicate Joomla
52
+ domain logic or invoke a caller-selected model or method. A stock Joomla CLI
53
+ capability becomes remotely usable only after a fixed structured action defines
54
+ its input, permission, bounds, postcondition, and recovery behavior.
55
+
56
+ The local Joomla CLI is a trusted administrative boundary. The companion trusts
57
+ the edge-internal `_edgeConfirmed` stdin marker; it cannot validate the edge's
58
+ HMAC confirmation token. Restrict login, process execution, sudo, and filesystem
59
+ access to the deployment account. Production MCP mutations must enter through
60
+ edge plan/apply; companion stdin is not a separately authenticated remote API.
61
+
62
+ ## Least-privilege deployment
63
+
64
+ 1. Create a non-human Joomla API user for each site or trust zone.
65
+ 2. Put it in a dedicated group that is permitted by the Joomla API Token plugin.
66
+ 3. Grant `core.login.api` and only the component actions required by configured
67
+ read toolsets.
68
+ 4. Create a separate companion actor when local actions need different
69
+ permissions; leaving the actor unset must fail closed.
70
+ 5. Use a separate downstream identity and deployment for privileged toolsets
71
+ where practical.
72
+ 6. Give remote MCP principals exact site and toolset scopes. Avoid wildcard
73
+ scopes for interactive clients.
74
+ 7. Run Node and PHP as an unprivileged operating-system user with access only to
75
+ the configured Joomla root and required runtime files.
76
+ 8. Keep `configuration.php`, secret environment files, tokens, package sources,
77
+ backups, and audit stores unreadable by unrelated accounts.
78
+
79
+ The site configuration toolsets are an upper bound, inbound OAuth scopes are a
80
+ per-principal bound, and Joomla ACL is the downstream bound. All must allow an
81
+ operation.
82
+
83
+ ## Controlled writes
84
+
85
+ - A non-dry write plan requires an active operator grant bound to the authenticated principal, site, and exact write/administration toolset.
86
+ - A grant request returns a random exact acknowledgement phrase. The MCP client must show the complete request to the operator and may approve it only after the operator supplies that phrase.
87
+ - Grant duration is exactly one operation, 30 minutes, or indefinite until revoked. Indefinite grants are disabled by default and require a mode `0600` integrity-protected persistent store.
88
+ - Grant request, approval, use, and revocation emit audit events without the acknowledgement phrase or raw principal.
89
+ - A plan validates a fixed action schema and stores the exact operation server-side.
90
+ - The returned HMAC-signed token contains only identifiers, expiry, operation fingerprint, and a one-way principal fingerprint; it is short-lived and one-time.
91
+ - A remote plan is bound to the authenticated issuer, subject, and client. Apply rechecks the planned site and toolset scopes before the token is consumed.
92
+ - Apply executes the stored operation, not caller-supplied replacement fields.
93
+ - Idempotency keys, optional ETags, site locks, audit events, and verification reads reduce duplicate and concurrent mutations.
94
+ - Current locks and idempotency state are process-local. Multi-replica deployments must provide shared coordination before enabling writes.
95
+ - Restarting a single process invalidates pending plans; clients must re-plan rather than replay a previous token. Active grants survive only when `grantStorePath` is configured.
96
+
97
+ ## Remote authorization
98
+
99
+ The HTTP edge cryptographically verifies JWTs against the configured HTTPS JWKS, then independently validates issuer, resource audience, expiry, not-before, and scopes. A token needs the global configured scope plus a site scope and toolset scope for each operation. Downstream Joomla tokens are never accepted from or passed through the inbound MCP token.
100
+
101
+ ## Toolset activation
102
+
103
+ Start with `discovery` and the necessary `*.read` toolsets. Enable one write or
104
+ administration toolset only after:
105
+
106
+ - its action IDs and native Joomla path are reviewed;
107
+ - the actor's allow and deny cases pass on disposable supported fixtures;
108
+ - accepted and rejected schemas are proven;
109
+ - success postconditions and cleanup are verified;
110
+ - timeout, duplicate, concurrent, partial-failure, and rollback cases pass;
111
+ - audit output is complete and secret-free.
112
+
113
+ `users.admin`, `extensions.admin`, `configuration.write`,
114
+ `maintenance.admin`, and `core-update` require separate operational approval.
115
+ Database import/export, extension installation/removal, password operations,
116
+ core update execution, and similar recovery-sensitive actions remain disabled
117
+ until explicitly marked live-verified in the coverage matrix.
118
+
119
+ ## Logging and incident response
120
+
121
+ Audit events belong on a restricted append-only destination outside returned MCP
122
+ content. Monitor authentication denials, site/toolset authorization denials,
123
+ rate and session exhaustion, companion capability changes, write plans and
124
+ applies, downstream Joomla failures, verification mismatches, and audit-sink
125
+ failures.
126
+
127
+ If compromise is suspected:
128
+
129
+ 1. stop remote traffic or disable the affected toolsets;
130
+ 2. revoke inbound OAuth tokens and rotate authorization-server signing keys as
131
+ required;
132
+ 3. revoke and regenerate affected Joomla API and update tokens;
133
+ 4. revoke active grants, preserve the old grant store for evidence, replace it with an empty mode `0600` store, and rotate the approval secret, which invalidates pending write plans and old grant signatures;
134
+ 5. preserve redacted edge, reverse-proxy, operating-system, and Joomla logs;
135
+ 6. compare companion package and OCI image digests with release attestations;
136
+ 7. restore Joomla through its tested site/database backup process if mutation
137
+ integrity is uncertain;
138
+ 8. complete a root-cause review before re-enabling writes.