@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,246 @@
1
+ # Library integration
2
+
3
+ `@joomengine/joomla-mcp` is both the complete self-hosted server and an
4
+ embeddable Node.js library. The command-line binaries, container, systemd
5
+ deployment, and host applications all use the same runtime and action
6
+ registration code.
7
+
8
+ ## Install
9
+
10
+ Pin a compatible version in the consuming application:
11
+
12
+ ```bash
13
+ npm install @joomengine/joomla-mcp@^0.7.0
14
+ ```
15
+
16
+ For exact, reproducible deployments:
17
+
18
+ ```json
19
+ {
20
+ "dependencies": {
21
+ "@joomengine/joomla-mcp": "0.7.0"
22
+ }
23
+ }
24
+ ```
25
+
26
+ The package is ESM-only and requires Node.js 22.12 or newer. Commit the
27
+ consumer's lockfile. Do not import `dist/*` files directly; the public package
28
+ exports define the compatibility boundary.
29
+
30
+ Every versioned GitHub release also includes the exact installable npm
31
+ tarball. A consumer that cannot reach the npm registry can pin that immutable
32
+ release asset:
33
+
34
+ ```json
35
+ {
36
+ "dependencies": {
37
+ "@joomengine/joomla-mcp": "https://github.com/joomengine/joomla-mcp/releases/download/v0.7.0/joomengine-mcp-for-joomla-v0.7.0.tgz"
38
+ }
39
+ }
40
+ ```
41
+
42
+ Verify release assets with the attached `SHA256SUMS` and provenance
43
+ attestations.
44
+
45
+ ## Public entry points
46
+
47
+ | Import | Contract |
48
+ |---|---|
49
+ | `@joomengine/joomla-mcp` | Application factory, runtime/server factories, configuration resolution, services, audit types, JWKS verifier, and package identity |
50
+ | `@joomengine/joomla-mcp/config` | Configuration schemas, types, file loader, and secret-resolver API |
51
+ | `@joomengine/joomla-mcp/catalog` | Complete source-backed Joomla action catalogue and resolution helpers |
52
+ | `@joomengine/joomla-mcp/adapters` | Joomla API and companion CLI transport contracts and default implementations |
53
+ | `@joomengine/joomla-mcp/http` | Authenticated Streamable HTTP gateway, authorization, limits, audit, and request-policy contracts |
54
+ | `@joomengine/joomla-mcp/live-test` | Catalogue-complete live-test runner, scenario/fixture metadata, evidence writers, and public result types |
55
+ | `@joomengine/joomla-mcp/security` | Confirmation, operator grant, fingerprinting, and JWKS verification primitives |
56
+ | `@joomengine/joomla-mcp/package.json` | Package metadata for tooling that explicitly needs it |
57
+
58
+ JavaScript and TypeScript consumers use the same ESM exports. Declaration
59
+ files and source maps are included in the package.
60
+
61
+ The packaged `joomla-mcp-live-test` binary uses the live-test subpath. Hosts
62
+ may call `runLiveTest()` programmatically with the same explicit safety
63
+ options and consume `LiveTestSummary`; see [live validation](LIVE_TESTING.md).
64
+
65
+ ## Create an application
66
+
67
+ Importing the library has no operational side effects. It does not read a
68
+ configuration file, inspect environment variables, bind a port, connect a
69
+ transport, or register process signal handlers.
70
+
71
+ ```js
72
+ import {
73
+ createJoomlaMcp,
74
+ loadConfiguration,
75
+ } from '@joomengine/joomla-mcp';
76
+
77
+ const configuration = await loadConfiguration('/etc/joomla-mcp/sites.json');
78
+ const application = createJoomlaMcp({ configuration });
79
+ ```
80
+
81
+ The application owns one shared `JoomlaMcpRuntime`. Each call to
82
+ `application.createServer()` returns a fresh MCP protocol server backed by
83
+ that runtime. This is essential for authenticated HTTP sessions: protocol
84
+ connections are isolated while permission grants, write plans, idempotency,
85
+ locks, and audit dependencies remain coherent inside the application.
86
+
87
+ ## Resolve secrets through the host
88
+
89
+ Configuration documents contain secret references, never secret values.
90
+ `loadConfiguration` uses `process.env` by default. A host can resolve those
91
+ references through its own vault, database, or secret manager:
92
+
93
+ ```js
94
+ import {
95
+ loadConfiguration,
96
+ } from '@joomengine/joomla-mcp';
97
+
98
+ const configuration = await loadConfiguration('/etc/joomla-mcp/sites.json', {
99
+ resolveSecret: async ({ name, purpose, site }) => {
100
+ return secretManager.read({
101
+ key: name,
102
+ purpose,
103
+ tenant: site,
104
+ });
105
+ },
106
+ });
107
+ ```
108
+
109
+ When configuration is already available as an object, avoid temporary files:
110
+
111
+ ```js
112
+ import { resolveConfiguration } from '@joomengine/joomla-mcp/config';
113
+
114
+ const configuration = await resolveConfiguration(rawConfiguration, {
115
+ source: 'tenant configuration',
116
+ resolveSecret: ({ name }) => secretManager.read({ key: name }),
117
+ });
118
+ ```
119
+
120
+ `RawConfigurationSchema` remains the authority for the object shape and
121
+ applies the same strict defaults and validation as file loading. CLI paths are
122
+ canonicalized and checked before use.
123
+
124
+ ## Connect stdio
125
+
126
+ The host owns the transport and lifecycle:
127
+
128
+ ```js
129
+ import { createJoomlaMcp } from '@joomengine/joomla-mcp';
130
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
131
+
132
+ const application = createJoomlaMcp({
133
+ configuration,
134
+ server: {
135
+ name: 'company-joomla-mcp',
136
+ localPrincipal: 'automation:joomla',
137
+ },
138
+ });
139
+ const server = application.createServer();
140
+
141
+ await server.connect(new StdioServerTransport());
142
+ ```
143
+
144
+ `localPrincipal` binds operator grants and write confirmations to the
145
+ embedding identity when the transport does not provide MCP `AuthInfo`. Use a
146
+ stable identity that cannot be selected by an untrusted caller. Remote HTTP
147
+ principals always come from the verified JWT.
148
+
149
+ ## Create authenticated HTTP
150
+
151
+ `application.createHttpServer()` inserts the application server factory into
152
+ the complete HTTP gateway. The host supplies identity verification,
153
+ authorization, request boundaries, the listener, and shutdown policy:
154
+
155
+ ```js
156
+ const verifier = new JwksJwtVerifier({ jwksUrl: http.jwksUrl });
157
+ const controller = application.createHttpServer({
158
+ jwtVerifier: verifier,
159
+ authorization: {
160
+ issuer: http.issuer,
161
+ audience: http.audience,
162
+ requiredScopes: http.requiredScopes,
163
+ },
164
+ requestPolicy: {
165
+ allowedHosts: http.allowedHosts,
166
+ allowedOrigins: http.allowedOrigins,
167
+ requireOrigin: http.requireOrigin,
168
+ },
169
+ limits: http.limits,
170
+ readinessCheck: () => verifier.warm(),
171
+ });
172
+
173
+ controller.server.listen(http.port, http.listenHost);
174
+ // During host shutdown:
175
+ await controller.close();
176
+ ```
177
+
178
+ See the complete executable
179
+ [HTTP example](../examples/embedded-host/http.mjs) and
180
+ [remote HTTP contract](REMOTE_HTTP.md).
181
+
182
+ ## Inject host adapters
183
+
184
+ The runtime accepts stable host-facing ports:
185
+
186
+ ```js
187
+ const application = createJoomlaMcp({
188
+ configuration,
189
+ runtimeOptions: {
190
+ audit: auditSink,
191
+ api: joomlaApiTransport,
192
+ cli: joomlaCliTransport,
193
+ },
194
+ });
195
+ ```
196
+
197
+ - `AuditSink` receives bounded, secret-free Joomla action and permission
198
+ events.
199
+ - `JoomlaApiTransport` performs the fixed, already-resolved Joomla API
200
+ requests.
201
+ - `JoomlaCliTransport` performs the fixed companion operations.
202
+ - A fully assembled `JoomlaMcpRuntime` may be supplied when a host needs
203
+ complete service construction control.
204
+
205
+ An adapter does not expand the action surface. Origins, credentials, methods,
206
+ paths, commands, and schemas still come from immutable configuration and the
207
+ public catalogue. Do not turn an adapter into generic URL, shell, SQL,
208
+ filesystem, PHP, or Joomla-model passthrough.
209
+
210
+ ## Isolation and scaling
211
+
212
+ Create a separate application runtime for every trust boundary. A hosted
213
+ service should normally create one runtime per tenant or per isolated site
214
+ group and must never share downstream credentials, permission grants, write
215
+ plans, or audit identity across tenants.
216
+
217
+ The default confirmation, idempotency, lock, and session coordination is
218
+ process-local. The indefinite-grant store is integrity protected but
219
+ file-backed. A write-enabled deployment must therefore route one trust
220
+ boundary to one active writer process. Read-only replicas may scale
221
+ independently. Multi-writer deployment remains blocked unless the host
222
+ provides an architecture with equivalent shared coordination and proves it
223
+ against the write and recovery contract.
224
+
225
+ ## Compatibility policy
226
+
227
+ - Public root and documented subpath exports follow Semantic Versioning.
228
+ - Additive tools, catalogue entries, optional fields, and exports are minor
229
+ releases.
230
+ - Removing or changing a documented export, required field, tool contract, or
231
+ behavior requires a major release.
232
+ - Security corrections may tighten invalid or unsafe input acceptance in a
233
+ patch release.
234
+ - Repository source paths and undocumented `dist` paths are not public APIs.
235
+ - The npm package, companion ZIP, OCI image, deployment bundle, SBOM, and
236
+ documentation use one synchronized version.
237
+
238
+ Before upgrading, read the GitHub release notes, update the pinned dependency,
239
+ run the consuming application's tests, and exercise the supported Joomla
240
+ contract matrix.
241
+
242
+ ## Licensing
243
+
244
+ The library is `GPL-2.0-or-later`. A consuming application must comply with
245
+ the license when it conveys a combined or derivative work. Consult qualified
246
+ legal counsel for the distribution model in question.
@@ -0,0 +1,409 @@
1
+ # Live Joomla validation
2
+
3
+ `joomla-mcp-live-test` exercises the published MCP package against a Joomla
4
+ site. It uses the same catalogue, permission requests, reviewed plans,
5
+ one-time confirmation tokens, API adapter, companion adapter, stdio server,
6
+ and Streamable HTTP gateway as a real host application. It does not call
7
+ Joomla routes directly.
8
+
9
+ The full runner is intentionally destructive. Use a disposable demo site or a
10
+ site whose owner has explicitly authorized the selected mutations. Never run
11
+ `crud` or `full` against production.
12
+
13
+ ## What the profiles prove
14
+
15
+ | Profile | Joomla activity | Intended use |
16
+ |---|---|---|
17
+ | `read` | Catalogue discovery and every selected executable read | Existing non-production site; no write grant |
18
+ | `crud` | Execute every configured resource lifecycle, including several named creates/updates, relationship resolution, collection visibility, item read-back, and optional deletion | Demo or disposable site |
19
+ | `full` | `crud` plus media, configuration, plugin, privacy, language-override, history, cache, scheduler, session, extension, state, and other fixed administrative actions | Explicitly disposable site only |
20
+
21
+ Every run can select:
22
+
23
+ - Joomla path: Web Services API, companion CLI, or both;
24
+ - MCP transport: stdio, authenticated Streamable HTTP, or both;
25
+ - all domains or a comma-separated family subset;
26
+ - continue-and-report or fail-fast behavior;
27
+ - strict removal or retention of every generated record.
28
+
29
+ ## Declarative scenario file
30
+
31
+ The packaged default is `config/live-test.default.json`. It is a versioned,
32
+ strict JSON contract and is included in the npm package. Override it without
33
+ changing code:
34
+
35
+ ```bash
36
+ npm run test:live -- \
37
+ --scenario /absolute/path/to/my-live-scenario.json \
38
+ --config /absolute/path/to/sites.json \
39
+ --non-interactive
40
+ ```
41
+
42
+ `--test-config` is an exact alias for `--scenario`. The scenario controls the
43
+ profile, Joomla and MCP lanes, mutation/disposable acknowledgement, cleanup
44
+ policy, selected CRUD families, special actions, fixture values, updates, and
45
+ relationships. Command-line selection and safety flags override the scenario.
46
+
47
+ Joomla private-message list and item models expose a message only to its
48
+ authenticated recipient. When `messages.messages` is configured, set
49
+ `target.actorUsernames.api` and/or `target.actorUsernames.cli` to the
50
+ human-readable username authenticated on each selected path. The runner
51
+ resolves that username through `users.users.list`; no actor ID is stored in
52
+ the scenario.
53
+
54
+ Omitting a resource family from `resources` skips all CRUD actions for that
55
+ family. Omitting `specialActions` skips non-CRUD actions. The packaged default
56
+ explicitly contains all 36 CRUD families and all special actions. Its visible
57
+ site graph contains three content categories, five articles, four user groups,
58
+ five users, two banner clients, three banner categories, five banners, two site
59
+ menus, five article menu items, and five custom HTML modules.
60
+
61
+ Relationships are named and never use database IDs. A single reference uses:
62
+
63
+ ```json
64
+ { "$ref": "content.categories.news" }
65
+ ```
66
+
67
+ Several references use:
68
+
69
+ ```json
70
+ {
71
+ "$refs": [
72
+ "users.groups.authors",
73
+ "users.groups.reviewers"
74
+ ]
75
+ }
76
+ ```
77
+
78
+ Menu links can interpolate a verified record field:
79
+
80
+ ```json
81
+ {
82
+ "$template": "index.php?option=com_content&view=article&id={{content.articles.welcome.id}}"
83
+ }
84
+ ```
85
+
86
+ Ordinary string values can use `{{seed}}`, `{{lane}}`, or `{{token}}`.
87
+ `{{token}}` is a stable 12-character value derived from the scenario name,
88
+ run seed, and MCP/Joomla lane. The packaged scenario uses it in aliases,
89
+ usernames, addresses, menu types, and other unique fields so retained runs and
90
+ parallel lanes cannot silently reuse one another's records.
91
+
92
+ The runner validates every reference and dependency cycle before it attempts
93
+ the dependent write. Numeric category, client, or user-group associations in a
94
+ scenario fail validation.
95
+
96
+ The scenario cleanup setting accepts only `always` or `never`. Override it
97
+ with `--cleanup always` or `--cleanup never`; bare `--cleanup` remains a
98
+ compatibility alias for `always`. `never` is literal: the runner creates no
99
+ deletion candidates, issues no delete calls, performs no trash transition, and
100
+ retains every record it created so it can be inspected in Joomla.
101
+
102
+ The scenario inventory is generated from the authoritative API and companion
103
+ catalogues. Unit validation fails when an action is added without a live
104
+ scenario or when one of the 36 CRUD bases lacks deterministic fixture data.
105
+ The five Joomla routes that are deliberately fail-closed remain visible as
106
+ `SOURCE_ONLY_GATED`.
107
+
108
+ ## Configure a target
109
+
110
+ Use the normal Joomla MCP site configuration. A dual-path run requires both
111
+ `api` and `cli`, all selected toolsets, and an approval secret:
112
+
113
+ ```json
114
+ {
115
+ "defaultSite": "demo",
116
+ "approval": {
117
+ "secretEnv": "JOOMLA_MCP_LIVE_APPROVAL_SECRET",
118
+ "ttlMs": 300000,
119
+ "requestTtlMs": 300000
120
+ },
121
+ "sites": {
122
+ "demo": {
123
+ "toolsets": [
124
+ "discovery",
125
+ "content.read",
126
+ "content.write",
127
+ "structure.read",
128
+ "structure.write",
129
+ "media.read",
130
+ "media.write",
131
+ "users.read",
132
+ "users.admin",
133
+ "extensions.read",
134
+ "extensions.admin",
135
+ "configuration.read",
136
+ "configuration.write",
137
+ "maintenance.read",
138
+ "maintenance.admin",
139
+ "core-update",
140
+ "cli.discovery"
141
+ ],
142
+ "api": {
143
+ "baseUrl": "https://demo.example",
144
+ "tokenEnv": "JOOMLA_MCP_LIVE_API_TOKEN",
145
+ "updateTokenEnv": "JOOMLA_MCP_LIVE_UPDATE_TOKEN"
146
+ },
147
+ "cli": {
148
+ "root": "/srv/www/demo",
149
+ "phpBinary": "/usr/bin/php8.3",
150
+ "timeoutMs": 120000,
151
+ "maxOutputBytes": 2097152
152
+ }
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ Export the referenced secrets from a secret manager. The API token must belong
159
+ to an actor with the Joomla ACL required by the selected actions. A Joomla
160
+ Update lane also needs the separately scoped `updateTokenEnv`; when it is not
161
+ configured, update actions are reported as `BLOCKED_BY_PREREQUISITE`.
162
+
163
+ HTTP Joomla origins must use HTTPS. `allowInsecureLoopback: true` permits HTTP
164
+ only for `localhost`, `127.0.0.1`, or `::1`; it exists solely for disposable
165
+ local fixtures and cannot enable cleartext access to a remote host.
166
+
167
+ ## Interactive demo run
168
+
169
+ Build the package, then start the menu:
170
+
171
+ ```bash
172
+ npm run build
173
+ npx joomla-mcp-live-test
174
+ ```
175
+
176
+ The menu asks for the site, profile, Joomla path, MCP transport, families,
177
+ retention, and run seed. Before any mutation it prints the exact target and
178
+ requires:
179
+
180
+ ```text
181
+ MUTATE <target-hostname> <run-seed>
182
+ ```
183
+
184
+ The default scenario is sufficient for unattended execution, so interaction is
185
+ optional. Interactive mode remains available as a safety-oriented compatibility
186
+ front end.
187
+
188
+ ## Unattended run
189
+
190
+ A read-only run requires no mutation flag:
191
+
192
+ ```bash
193
+ npm run test:live -- \
194
+ --scenario ./config/live-test.default.json \
195
+ --config /etc/joomla-mcp/demo-sites.json \
196
+ --site demo \
197
+ --profile read \
198
+ --joomla-path all \
199
+ --mcp-transport all \
200
+ --non-interactive \
201
+ --output ./artifacts/live-read
202
+ ```
203
+
204
+ An unattended full run requires both explicit mutation confirmation and an
205
+ explicitly disposable target:
206
+
207
+ ```bash
208
+ npm run test:live -- \
209
+ --config /etc/joomla-mcp/demo-sites.json \
210
+ --site demo \
211
+ --profile full \
212
+ --joomla-path all \
213
+ --mcp-transport all \
214
+ --families all \
215
+ --seed release-candidate-1 \
216
+ --output ./artifacts/live-full \
217
+ --repository-commit "$(git rev-parse HEAD)" \
218
+ --non-interactive \
219
+ --confirm-mutations \
220
+ --disposable \
221
+ --cleanup always
222
+ ```
223
+
224
+ `--fail-fast` stops at the first unexpected failure. The default continues all
225
+ independent scenarios and links dependent failures to their root cause. A
226
+ complete, all-family, disposable `full` run exits nonzero for any `FAIL`,
227
+ `CLEANUP_FAILED`, or `BLOCKED_BY_PREREQUISITE`; it cannot certify an
228
+ unexercised operation. Narrow read, CRUD, or family-selected diagnostic runs
229
+ may still report prerequisite blocks without failing. Before exiting, the
230
+ command prints every direct failure to standard output with its action, phase,
231
+ MCP/Joomla lane, failure code, reason, expected/actual values when available,
232
+ and exact reproduction command.
233
+
234
+ ## Operation flow
235
+
236
+ For each selected lane, the runner:
237
+
238
+ 1. initializes the actual MCP client and server transport;
239
+ 2. lists sites, capabilities, and the complete enabled action catalogue;
240
+ 3. requests and approves a time-bounded grant for the selected write toolsets;
241
+ 4. submits every write as a dry run;
242
+ 5. creates a fresh executable plan and consumes its signed one-time token;
243
+ 6. treats the mutation response only as a candidate identifier;
244
+ 7. independently reads the candidate item and compares persisted non-secret
245
+ fields, publication state, and resolved relationships;
246
+ 8. pages the matching MCP list action until the exact created resource is
247
+ found, proving collection/administrator-list visibility;
248
+ 9. repeats list/get verification after every configured update and through the
249
+ other Joomla path when it is available;
250
+ 10. removes every run-owned record in reverse dependency order only when the
251
+ effective cleanup policy is `always`.
252
+
253
+ An article create therefore cannot pass merely because Joomla returned an ID.
254
+ It must appear in `content.articles.list`, be readable by
255
+ `content.articles.get`, retain its configured category and publication state,
256
+ and—on dual-path fixtures—be visible through both API and the Joomla-native
257
+ companion model. Menu items must target the verified article IDs, and custom
258
+ modules must retain their configured HTML, positions, publication state, and
259
+ created menu-item assignments.
260
+
261
+ ## Real-time standard output
262
+
263
+ The CLI writes one complete progress line immediately before and after each
264
+ transport, lane, scenario phase, verification, cleanup operation, and report
265
+ write. A heartbeat is written every 30 seconds by default while an individual
266
+ MCP operation is still running. Set
267
+ `JOOMLA_MCP_LIVE_HEARTBEAT_MS` between 5000 and 300000 milliseconds to change
268
+ that interval.
269
+
270
+ Typical output:
271
+
272
+ ```text
273
+ [live-test 2026-07-25T10:00:00.000Z] START 0042-http-api-content.articles.create-create-welcome http/api content.articles.create phase=create-welcome
274
+ [live-test 2026-07-25T10:00:01.240Z] PASS ... duration=1.2s
275
+ ```
276
+
277
+ Requests, responses, passwords, authorization values, approval
278
+ acknowledgements, confirmation tokens, and cookies are never printed. The
279
+ disposable fixture retains this redacted stream in `live-test/console.log`
280
+ while continuing to upload all existing JSON, Markdown, JUnit, action, Joomla,
281
+ and container evidence.
282
+
283
+ The authoritative JoomEngine fixture additionally provisions visible,
284
+ deterministic prerequisites before starting the MCP client: one media file, one
285
+ confirmed privacy export request, one consent record, site and administrator
286
+ language overrides, a separate Joomla Update token, and a locally served
287
+ checksum-verified update package. Joomla 6.1.2 cannot create module instances
288
+ through its API; after that exact pinned defect is recorded, the fixture creates
289
+ the same `mod_custom` instances through the companion CLI and then exercises
290
+ the API get, update, read-back, delete, and deletion verification operations.
291
+
292
+ Generated titles, aliases, users, addresses, paths, and constants contain the
293
+ run seed and lane. Existing records may be read as prerequisites, but they are
294
+ never chosen as generic CRUD mutation targets. Reversible administrative state
295
+ is restored by its scenario. Irreversible/high-risk scenarios do not dispatch
296
+ unless the target is declared disposable. Some full-profile actions, including
297
+ privacy requests, have no public deletion route; they remain listed under
298
+ `retainedRecords` even with `--cleanup`, which is why the full profile requires
299
+ a disposable site or external snapshot restoration.
300
+
301
+ ## Evidence
302
+
303
+ The output directory contains:
304
+
305
+ | Artifact | Purpose |
306
+ |---|---|
307
+ | `summary.md` | Human result, failure table, blocked/root-cause table, retained records, and debugging procedure |
308
+ | `summary.json` | Complete machine-readable run, selection, versions, commit, seed, configuration fingerprint, fixture identities, transport diagnostics, and attempts |
309
+ | `junit.xml` | CI test cases with failures and skipped/gated classifications |
310
+ | `actions/*.json` | One bounded, redacted request/result record per attempt, including phase, lane, source, expectation, actual result, stack, dependencies, root cause, and reproduction command |
311
+ | `compose.log`, `compose-ps.txt`, `joomla-logs/` | Disposable-fixture runtime evidence captured before teardown |
312
+
313
+ Tokens, passwords, approval acknowledgements, signed confirmation tokens,
314
+ authorization headers, cookies, and secret-named values are recursively
315
+ redacted. Large strings and arrays are bounded.
316
+
317
+ Statuses have precise meanings:
318
+
319
+ | Status | Meaning | CI result |
320
+ |---|---|---|
321
+ | `PASS` | Dispatch and postcondition succeeded | pass |
322
+ | `FAIL` | Unexpected transport, Joomla, validation, or postcondition failure | fail |
323
+ | `EXPECTED_DENIAL` | Safety policy intentionally prevented dispatch | pass, reported |
324
+ | `KNOWN_UPSTREAM_LIMITATION` | The exact pinned fixture, action, phase, and error matched a reviewed Joomla defect after dispatch | pass, reported with source reference |
325
+ | `SOURCE_ONLY_GATED` | Known source route is deliberately non-executable | pass, reported |
326
+ | `BLOCKED_BY_PREREQUISITE` | Named prerequisite was absent or failed | fail for complete disposable certification; reported-only for narrower diagnostic runs |
327
+ | `CLEANUP_FAILED` | Generated data/state could not be removed/restored | fail |
328
+
329
+ ## Debug a failure
330
+
331
+ 1. Open `summary.md` and find the failed attempt ID.
332
+ 2. Open the matching file under `actions/`.
333
+ 3. Check `phase`, `mcpTransport`, `joomlaPath`, `failureCode`, `reason`,
334
+ `expected`, and `actual`.
335
+ 4. Follow `rootCauseId` before investigating dependent failures.
336
+ 5. Use the recorded reproduction command to isolate the family and lane.
337
+ 6. For `joomla_http_*`, inspect the redacted Joomla body and Joomla logs.
338
+ 7. For `companion_error`, inspect bounded stderr, the companion response, PHP
339
+ logs, and `joomla:mcp:describe`.
340
+ 8. For `postcondition_failed`, compare the applied mutation with the
341
+ verification read; confirm Joomla events/plugins did not transform the
342
+ submitted value.
343
+ 9. Treat every `CLEANUP_FAILED` as operationally significant. Review
344
+ `retainedRecords` and remove only records carrying the exact run label.
345
+
346
+ `KNOWN_UPSTREAM_LIMITATION` is deliberately narrower than a skip. The request
347
+ was dispatched and its failure evidence was captured. The classification is
348
+ accepted only for the exact pinned fixture identity plus an exact
349
+ action/phase/error signature documented in the report. The same action on a
350
+ different Joomla image, or a changed error on the pinned image, is `FAIL`.
351
+
352
+ For a mutation whose Joomla response reports failure after changing state, the
353
+ status also requires a successful independent read-back of the exact submitted
354
+ identifier or fields. If that verification is absent or differs, the attempt is
355
+ `FAIL`.
356
+
357
+ The pinned Joomla 6.1.2 fixture currently documents these reviewed behaviors:
358
+
359
+ | API behavior | Why the report can classify it | Joomla source |
360
+ |---|---|---|
361
+ | Contact item GET returns 500 immediately after a successful delete | Exact contact action, `verify-deleted` phase, image digest, and 500 body must match; an independent collection read must also prove the contact is absent from the active collection | [Contact API controller](https://github.com/joomla/joomla-cms/blob/6.1.2/api/components/com_contact/src/Controller/ContactController.php) |
362
+ | Private-message or newsfeed item GET returns 500 after deletion | The exact item action, `verify-deleted` phase, image digest, and 500 body must match; an independent collection read must prove that exact identifier is absent or trashed | [Message model](https://github.com/joomla/joomla-cms/blob/6.1.2/administrator/components/com_messages/src/Model/MessageModel.php), [newsfeed API controller](https://github.com/joomla/joomla-cms/blob/6.1.2/api/components/com_newsfeeds/src/Controller/FeedsController.php) |
363
+ | Site or administrator module POST reports missing `params` | The generic save runs before the modules controller seeds its edit-model client state; the companion lane remains executable | [Modules API controller](https://github.com/joomla/joomla-cms/blob/6.1.2/api/components/com_modules/src/Controller/ModulesController.php) |
364
+ | Private-message POST returns 404 after storing the message | A list read must find the exact submitted subject before the attempt is accepted and cleanup continues | [Generic API add flow](https://github.com/joomla/joomla-cms/blob/6.1.2/libraries/src/MVC/Controller/ApiController.php#L369-L379) |
365
+ | Private-message PATCH returns 200 but creates a replacement instead of updating the requested ID | The original must remain unchanged and the collection must contain a different ID with the exact submitted fields. With cleanup enabled, the runner deletes the replacement and proves it absent; `cleanup: never` retains and reports it without issuing a delete. | [Message form without `message_id`](https://github.com/joomla/joomla-cms/blob/6.1.2/administrator/components/com_messages/forms/message.xml) |
366
+ | Content-language PATCH reports an empty check-in failure after storing the fields | An item read must match every submitted field before update or cleanup continues | [Generic API post-save check](https://github.com/joomla/joomla-cms/blob/6.1.2/libraries/src/MVC/Controller/ApiController.php#L523-L535) |
367
+ | Override item GET, site create, delete, or cache refresh fails in the reviewed signature | Joomla filters the string item ID as an integer, coerces the named site client as administrator, or delegates the file-backed operation through an incompatible generic path | [Overrides controller](https://github.com/joomla/joomla-cms/blob/6.1.2/api/components/com_languages/src/Controller/OverridesController.php), [override model](https://github.com/joomla/joomla-cms/blob/6.1.2/administrator/components/com_languages/src/Model/OverrideModel.php) |
368
+ | `scheduler:state` says an unlocked task is checked out | The exact companion command, write phase, fixture image, exit code, and bounded output must match; `scheduler:run` remains independently executable | [`scheduler:state` command](https://github.com/joomla/joomla-cms/blob/6.1.2/libraries/src/Console/TasksStateCommand.php#L126-L132), [generic checkout comparison](https://github.com/joomla/joomla-cms/blob/6.1.2/libraries/src/MVC/Model/BaseDatabaseModel.php#L294-L304) |
369
+
370
+ Private-message create fixtures deliberately omit `state`. Joomla's recipient
371
+ `MessageModel::getItem()` marks an existing message read as part of the item
372
+ read, so cross-path verification can validly observe the state transition
373
+ from unread (`0`) to read (`1`). Subject, recipient, priority, body, exact ID,
374
+ and collection visibility remain strict postconditions.
375
+
376
+ This table describes fixture evidence, not a blanket Joomla-version waiver.
377
+ Every rule is encoded and unit-tested as an exact match.
378
+
379
+ Common failure codes:
380
+
381
+ | Code | First check |
382
+ |---|---|
383
+ | `joomla_http_401` / `403` | Token, `core.login.api`, component ACL, Web Services plugin |
384
+ | `joomla_http_404` | Joomla version/plugin route and generated identifier |
385
+ | `joomla_http_422` | Per-resource dummy payload and Joomla form validation |
386
+ | `mcp_tool_error` | Per-action MCP content plus server transport diagnostics |
387
+ | `companion_error` | Installed companion version, actor ACL, PHP stderr |
388
+ | `timeout` | Joomla/PHP/container logs and configured API/CLI bounds |
389
+ | `postcondition_failed` | Mutation response versus follow-up read |
390
+ | `prerequisite_unavailable` | `dependencyIds` and `rootCauseId` |
391
+
392
+ ## Disposable CI fixture
393
+
394
+ The `joomla-61-fixture` job builds and installs the companion, creates a
395
+ throwaway Super User API token inside the isolated fixture, publishes Joomla
396
+ only on a random loopback port, configures an internal Mailpit SMTP sink for
397
+ contact-form delivery, and creates a local CLI bridge that executes as
398
+ `www-data` inside the container. It then runs the same packaged command with:
399
+
400
+ - `full`;
401
+ - API and companion CLI;
402
+ - stdio and Streamable HTTP;
403
+ - explicit non-interactive mutation and disposable flags;
404
+ - cleanup verification before volume destruction;
405
+ - all action families.
406
+
407
+ The token and approval secret exist only for the process lifetime and are
408
+ removed before evidence upload. The job uploads reports and logs even when the
409
+ suite fails, then always destroys both Joomla and database volumes.