@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.
- package/CHANGELOG.md +73 -0
- package/LICENSE +349 -0
- package/README.md +279 -0
- package/SECURITY.md +39 -0
- package/config/live-test.default.json +1206 -0
- package/config/sites.example.json +53 -0
- package/config/sites.single-site-readonly.example.json +24 -0
- package/dist/application/joomla-service.d.ts +72 -0
- package/dist/application/joomla-service.d.ts.map +1 -0
- package/dist/application/joomla-service.js +484 -0
- package/dist/application/joomla-service.js.map +1 -0
- package/dist/application/joomla-write-service.d.ts +109 -0
- package/dist/application/joomla-write-service.d.ts.map +1 -0
- package/dist/application/joomla-write-service.js +628 -0
- package/dist/application/joomla-write-service.js.map +1 -0
- package/dist/application/site-registry.d.ts +17 -0
- package/dist/application/site-registry.d.ts.map +1 -0
- package/dist/application/site-registry.js +31 -0
- package/dist/application/site-registry.js.map +1 -0
- package/dist/audit/audit-sink.d.ts +24 -0
- package/dist/audit/audit-sink.d.ts.map +1 -0
- package/dist/audit/audit-sink.js +10 -0
- package/dist/audit/audit-sink.js.map +1 -0
- package/dist/bin/joomla-mcp-http.d.ts +3 -0
- package/dist/bin/joomla-mcp-http.d.ts.map +1 -0
- package/dist/bin/joomla-mcp-http.js +65 -0
- package/dist/bin/joomla-mcp-http.js.map +1 -0
- package/dist/bin/joomla-mcp-live-test.d.ts +3 -0
- package/dist/bin/joomla-mcp-live-test.d.ts.map +1 -0
- package/dist/bin/joomla-mcp-live-test.js +10 -0
- package/dist/bin/joomla-mcp-live-test.js.map +1 -0
- package/dist/bin/joomla-mcp.d.ts +3 -0
- package/dist/bin/joomla-mcp.d.ts.map +1 -0
- package/dist/bin/joomla-mcp.js +18 -0
- package/dist/bin/joomla-mcp.js.map +1 -0
- package/dist/catalog/action-catalog.d.ts +35 -0
- package/dist/catalog/action-catalog.d.ts.map +1 -0
- package/dist/catalog/action-catalog.js +525 -0
- package/dist/catalog/action-catalog.js.map +1 -0
- package/dist/catalog/action-gates.d.ts +10 -0
- package/dist/catalog/action-gates.d.ts.map +1 -0
- package/dist/catalog/action-gates.js +18 -0
- package/dist/catalog/action-gates.js.map +1 -0
- package/dist/catalog/cli-command-targets.d.ts +20 -0
- package/dist/catalog/cli-command-targets.d.ts.map +1 -0
- package/dist/catalog/cli-command-targets.js +60 -0
- package/dist/catalog/cli-command-targets.js.map +1 -0
- package/dist/catalog/companion-actions.d.ts +30 -0
- package/dist/catalog/companion-actions.d.ts.map +1 -0
- package/dist/catalog/companion-actions.js +374 -0
- package/dist/catalog/companion-actions.js.map +1 -0
- package/dist/catalog/core.d.ts +17 -0
- package/dist/catalog/core.d.ts.map +1 -0
- package/dist/catalog/core.js +115 -0
- package/dist/catalog/core.js.map +1 -0
- package/dist/catalog/crud-bases.d.ts +8 -0
- package/dist/catalog/crud-bases.d.ts.map +1 -0
- package/dist/catalog/crud-bases.js +203 -0
- package/dist/catalog/crud-bases.js.map +1 -0
- package/dist/catalog/crud-write-fields.d.ts +11 -0
- package/dist/catalog/crud-write-fields.d.ts.map +1 -0
- package/dist/catalog/crud-write-fields.js +110 -0
- package/dist/catalog/crud-write-fields.js.map +1 -0
- package/dist/catalog/index.d.ts +7 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +7 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog/source-metadata.d.ts +8 -0
- package/dist/catalog/source-metadata.d.ts.map +1 -0
- package/dist/catalog/source-metadata.js +73 -0
- package/dist/catalog/source-metadata.js.map +1 -0
- package/dist/catalog/special-reads.d.ts +4 -0
- package/dist/catalog/special-reads.d.ts.map +1 -0
- package/dist/catalog/special-reads.js +243 -0
- package/dist/catalog/special-reads.js.map +1 -0
- package/dist/catalog/special-writes.d.ts +8 -0
- package/dist/catalog/special-writes.d.ts.map +1 -0
- package/dist/catalog/special-writes.js +370 -0
- package/dist/catalog/special-writes.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.d.ts +20 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +156 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/schema.d.ts +171 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +169 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/contracts/action-catalog.d.ts +134 -0
- package/dist/contracts/action-catalog.d.ts.map +1 -0
- package/dist/contracts/action-catalog.js +2 -0
- package/dist/contracts/action-catalog.js.map +1 -0
- package/dist/contracts/bounded-query.d.ts +27 -0
- package/dist/contracts/bounded-query.d.ts.map +1 -0
- package/dist/contracts/bounded-query.js +59 -0
- package/dist/contracts/bounded-query.js.map +1 -0
- package/dist/contracts/route-resolution.d.ts +3 -0
- package/dist/contracts/route-resolution.d.ts.map +1 -0
- package/dist/contracts/route-resolution.js +71 -0
- package/dist/contracts/route-resolution.js.map +1 -0
- package/dist/http/access-limits.d.ts +24 -0
- package/dist/http/access-limits.d.ts.map +1 -0
- package/dist/http/access-limits.js +86 -0
- package/dist/http/access-limits.js.map +1 -0
- package/dist/http/audit.d.ts +19 -0
- package/dist/http/audit.d.ts.map +1 -0
- package/dist/http/audit.js +10 -0
- package/dist/http/audit.js.map +1 -0
- package/dist/http/auth.d.ts +33 -0
- package/dist/http/auth.d.ts.map +1 -0
- package/dist/http/auth.js +123 -0
- package/dist/http/auth.js.map +1 -0
- package/dist/http/index.d.ts +6 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +6 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/remote-http.d.ts +47 -0
- package/dist/http/remote-http.d.ts.map +1 -0
- package/dist/http/remote-http.js +552 -0
- package/dist/http/remote-http.js.map +1 -0
- package/dist/http/request-policy.d.ts +19 -0
- package/dist/http/request-policy.d.ts.map +1 -0
- package/dist/http/request-policy.js +137 -0
- package/dist/http/request-policy.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/api/joomla-api-client.d.ts +26 -0
- package/dist/infrastructure/api/joomla-api-client.d.ts.map +1 -0
- package/dist/infrastructure/api/joomla-api-client.js +139 -0
- package/dist/infrastructure/api/joomla-api-client.js.map +1 -0
- package/dist/infrastructure/cli/joomla-cli-client.d.ts +30 -0
- package/dist/infrastructure/cli/joomla-cli-client.d.ts.map +1 -0
- package/dist/infrastructure/cli/joomla-cli-client.js +163 -0
- package/dist/infrastructure/cli/joomla-cli-client.js.map +1 -0
- package/dist/infrastructure/index.d.ts +3 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +3 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/library.d.ts +33 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +22 -0
- package/dist/library.js.map +1 -0
- package/dist/live-test/catalog.d.ts +4 -0
- package/dist/live-test/catalog.d.ts.map +1 -0
- package/dist/live-test/catalog.js +62 -0
- package/dist/live-test/catalog.js.map +1 -0
- package/dist/live-test/cli.d.ts +2 -0
- package/dist/live-test/cli.d.ts.map +1 -0
- package/dist/live-test/cli.js +305 -0
- package/dist/live-test/cli.js.map +1 -0
- package/dist/live-test/console-report.d.ts +3 -0
- package/dist/live-test/console-report.d.ts.map +1 -0
- package/dist/live-test/console-report.js +75 -0
- package/dist/live-test/console-report.js.map +1 -0
- package/dist/live-test/fixtures.d.ts +22 -0
- package/dist/live-test/fixtures.d.ts.map +1 -0
- package/dist/live-test/fixtures.js +371 -0
- package/dist/live-test/fixtures.js.map +1 -0
- package/dist/live-test/index.d.ts +9 -0
- package/dist/live-test/index.d.ts.map +1 -0
- package/dist/live-test/index.js +8 -0
- package/dist/live-test/index.js.map +1 -0
- package/dist/live-test/known-limitations.d.ts +13 -0
- package/dist/live-test/known-limitations.d.ts.map +1 -0
- package/dist/live-test/known-limitations.js +186 -0
- package/dist/live-test/known-limitations.js.map +1 -0
- package/dist/live-test/progress.d.ts +60 -0
- package/dist/live-test/progress.d.ts.map +1 -0
- package/dist/live-test/progress.js +141 -0
- package/dist/live-test/progress.js.map +1 -0
- package/dist/live-test/reporting.d.ts +7 -0
- package/dist/live-test/reporting.d.ts.map +1 -0
- package/dist/live-test/reporting.js +181 -0
- package/dist/live-test/reporting.js.map +1 -0
- package/dist/live-test/runner.d.ts +19 -0
- package/dist/live-test/runner.d.ts.map +1 -0
- package/dist/live-test/runner.js +2680 -0
- package/dist/live-test/runner.js.map +1 -0
- package/dist/live-test/scenario-config.d.ts +82 -0
- package/dist/live-test/scenario-config.d.ts.map +1 -0
- package/dist/live-test/scenario-config.js +384 -0
- package/dist/live-test/scenario-config.js.map +1 -0
- package/dist/live-test/transports.d.ts +13 -0
- package/dist/live-test/transports.d.ts.map +1 -0
- package/dist/live-test/transports.js +162 -0
- package/dist/live-test/transports.js.map +1 -0
- package/dist/live-test/types.d.ts +140 -0
- package/dist/live-test/types.d.ts.map +1 -0
- package/dist/live-test/types.js +10 -0
- package/dist/live-test/types.js.map +1 -0
- package/dist/mcp/create-server.d.ts +36 -0
- package/dist/mcp/create-server.d.ts.map +1 -0
- package/dist/mcp/create-server.js +472 -0
- package/dist/mcp/create-server.js.map +1 -0
- package/dist/security/confirmation-service.d.ts +51 -0
- package/dist/security/confirmation-service.d.ts.map +1 -0
- package/dist/security/confirmation-service.js +153 -0
- package/dist/security/confirmation-service.js.map +1 -0
- package/dist/security/index.d.ts +4 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +4 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/jwks-jwt-verifier.d.ts +15 -0
- package/dist/security/jwks-jwt-verifier.d.ts.map +1 -0
- package/dist/security/jwks-jwt-verifier.js +196 -0
- package/dist/security/jwks-jwt-verifier.js.map +1 -0
- package/dist/security/permission-grant-service.d.ts +55 -0
- package/dist/security/permission-grant-service.d.ts.map +1 -0
- package/dist/security/permission-grant-service.js +321 -0
- package/dist/security/permission-grant-service.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/docs/API_ACTIONS.md +350 -0
- package/docs/ARCHITECTURE.md +114 -0
- package/docs/CLI.md +99 -0
- package/docs/CLIENTS.md +269 -0
- package/docs/COVERAGE.md +182 -0
- package/docs/DEPLOYMENT.md +272 -0
- package/docs/FIXTURES.md +210 -0
- package/docs/LIBRARY.md +246 -0
- package/docs/LIVE_TESTING.md +409 -0
- package/docs/OPERATIONS.md +138 -0
- package/docs/PHP_COMPANION.md +221 -0
- package/docs/RECONNAISSANCE.md +104 -0
- package/docs/RELEASING.md +233 -0
- package/docs/REMOTE_HTTP.md +126 -0
- package/docs/SECURITY.md +138 -0
- package/docs/SINGLE_SITE.md +223 -0
- package/docs/TESTING.md +160 -0
- package/docs/TROUBLESHOOTING.md +98 -0
- package/docs/USAGE.md +208 -0
- package/examples/embedded-host/README.md +33 -0
- package/examples/embedded-host/http.mjs +68 -0
- package/examples/embedded-host/package.json +13 -0
- package/examples/embedded-host/stdio.mjs +24 -0
- package/package.json +119 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Single-company, single-site deployment
|
|
2
|
+
|
|
3
|
+
This is the supported first production shape: one company, one Joomla site,
|
|
4
|
+
one JoomEngine MCP for Joomla process, and one dedicated Joomla automation
|
|
5
|
+
identity.
|
|
6
|
+
|
|
7
|
+
Start read-only. Add each write or administration toolset after it passes the
|
|
8
|
+
company’s staging, backup, denial, and recovery checks.
|
|
9
|
+
|
|
10
|
+
## 1. Install and validate the server
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
getent group joomla-mcp >/dev/null || sudo groupadd --system joomla-mcp
|
|
14
|
+
id -u joomla-mcp >/dev/null 2>&1 || sudo useradd \
|
|
15
|
+
--system \
|
|
16
|
+
--gid joomla-mcp \
|
|
17
|
+
--home-dir /nonexistent \
|
|
18
|
+
--shell /usr/sbin/nologin \
|
|
19
|
+
joomla-mcp
|
|
20
|
+
sudo install -d -o root -g root -m 0755 /opt/joomla-mcp
|
|
21
|
+
sudo install -d -o root -g joomla-mcp -m 0750 /etc/joomla-mcp
|
|
22
|
+
git clone https://github.com/joomengine/joomla-mcp.git /opt/joomla-mcp
|
|
23
|
+
cd /opt/joomla-mcp
|
|
24
|
+
npm ci
|
|
25
|
+
npm run validate
|
|
26
|
+
npm run build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For a tagged release, the equivalent server artifact is
|
|
30
|
+
`joomengine-mcp-for-joomla-vX.Y.Z.tgz`. The deployment bundle contains the
|
|
31
|
+
Compose, systemd, configuration, operations, and troubleshooting material.
|
|
32
|
+
|
|
33
|
+
## 2. Create a dedicated Joomla API identity
|
|
34
|
+
|
|
35
|
+
In Joomla:
|
|
36
|
+
|
|
37
|
+
1. Enable **API Authentication - Web Services Joomla Token**.
|
|
38
|
+
2. Enable **User - Joomla API Token**.
|
|
39
|
+
3. Create a dedicated automation user and group.
|
|
40
|
+
4. Grant `core.login.api`.
|
|
41
|
+
5. Grant only the component read permissions needed by the enabled read
|
|
42
|
+
toolsets.
|
|
43
|
+
6. Enable only the required Web Services plugins.
|
|
44
|
+
7. Generate the user’s Joomla API token.
|
|
45
|
+
|
|
46
|
+
Do not use a human Super User token.
|
|
47
|
+
|
|
48
|
+
## 3. Install the read-only site configuration
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
sudo cp \
|
|
52
|
+
/opt/joomla-mcp/config/sites.single-site-readonly.example.json \
|
|
53
|
+
/etc/joomla-mcp/sites.json
|
|
54
|
+
sudo chown root:joomla-mcp /etc/joomla-mcp/sites.json
|
|
55
|
+
sudo chmod 0640 /etc/joomla-mcp/sites.json
|
|
56
|
+
sudoedit /etc/joomla-mcp/sites.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Set `api.baseUrl` to the site’s canonical HTTPS origin. Keep the site alias
|
|
60
|
+
stable; AI clients use the alias and never receive the origin or token from a
|
|
61
|
+
tool input.
|
|
62
|
+
|
|
63
|
+
Provision the token through the process environment:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export JOOMLA_COMPANY_TOKEN='the-token-generated-by-joomla'
|
|
67
|
+
export JOOMLA_MCP_CONFIG='/etc/joomla-mcp/sites.json'
|
|
68
|
+
cd /opt/joomla-mcp
|
|
69
|
+
npm start
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Use a service manager or secret store for an unattended deployment. The export
|
|
73
|
+
commands are a foreground validation example, not a production secret-storage
|
|
74
|
+
recommendation.
|
|
75
|
+
|
|
76
|
+
## 4. Connect an AI client
|
|
77
|
+
|
|
78
|
+
Use [AI client connections](CLIENTS.md). The quickest in-house path is local
|
|
79
|
+
stdio:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"joomla": {
|
|
85
|
+
"command": "/usr/bin/node",
|
|
86
|
+
"args": ["/opt/joomla-mcp/dist/bin/joomla-mcp.js"],
|
|
87
|
+
"env": {
|
|
88
|
+
"JOOMLA_MCP_CONFIG": "/etc/joomla-mcp/sites.json"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The client process must inherit `JOOMLA_COMPANY_TOKEN`.
|
|
96
|
+
|
|
97
|
+
Verify:
|
|
98
|
+
|
|
99
|
+
1. `joomla_sites_list`
|
|
100
|
+
2. `joomla_capabilities`
|
|
101
|
+
3. `joomla_actions_search` with `includeWrites: false`
|
|
102
|
+
4. one resource-specific list or `joomla_action_read`
|
|
103
|
+
|
|
104
|
+
## 5. Enable controlled writes
|
|
105
|
+
|
|
106
|
+
Add only the required write toolsets to the site. The available permission
|
|
107
|
+
classes are:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
content.write
|
|
111
|
+
structure.write
|
|
112
|
+
media.write
|
|
113
|
+
users.admin
|
|
114
|
+
extensions.admin
|
|
115
|
+
configuration.write
|
|
116
|
+
maintenance.admin
|
|
117
|
+
core-update
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Add the approval block:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"approval": {
|
|
125
|
+
"secretEnv": "JOOMLA_MCP_APPROVAL_SECRET",
|
|
126
|
+
"ttlMs": 300000,
|
|
127
|
+
"requestTtlMs": 300000,
|
|
128
|
+
"grantStorePath": "/var/lib/joomla-mcp/permission-grants.json",
|
|
129
|
+
"allowIndefinite": false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Create the protected state directory and secret:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
sudo install -d -o joomla-mcp -g joomla-mcp -m 0700 /var/lib/joomla-mcp
|
|
138
|
+
sudo -u joomla-mcp sh -c 'printf "%s\n" "{\"version\":1,\"grants\":[]}" > /var/lib/joomla-mcp/permission-grants.json'
|
|
139
|
+
sudo chmod 0600 /var/lib/joomla-mcp/permission-grants.json
|
|
140
|
+
export JOOMLA_MCP_APPROVAL_SECRET="$(openssl rand -hex 32)"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The file must remain owned by the MCP service account with mode `0600`. The
|
|
144
|
+
systemd unit uses `StateDirectory=joomla-mcp`; the Compose deployment mounts a
|
|
145
|
+
dedicated state volume.
|
|
146
|
+
|
|
147
|
+
Set `allowIndefinite` to `true` only after audit retention, revocation, backup,
|
|
148
|
+
and incident-response procedures have been tested.
|
|
149
|
+
|
|
150
|
+
## 6. Operator permission flow
|
|
151
|
+
|
|
152
|
+
Every write transport and every write/administration toolset uses the same
|
|
153
|
+
flow:
|
|
154
|
+
|
|
155
|
+
1. The AI calls `joomla_action_write_plan` with `dryRun: true`.
|
|
156
|
+
2. The AI calls `joomla_permission_request` with the exact site, toolsets,
|
|
157
|
+
duration, and reason.
|
|
158
|
+
3. The MCP returns a random exact acknowledgement phrase.
|
|
159
|
+
4. The AI shows the complete request and phrase to the operator.
|
|
160
|
+
5. The operator supplies that exact phrase.
|
|
161
|
+
6. The AI submits it to `joomla_permission_approve`.
|
|
162
|
+
7. The AI repeats the write plan with `dryRun: false`.
|
|
163
|
+
8. The MCP binds the active grant to the signed operation plan.
|
|
164
|
+
9. The AI calls `joomla_write_apply`.
|
|
165
|
+
10. Apply rechecks OAuth site/toolset scopes, the stored operation, the grant,
|
|
166
|
+
Joomla-side preconditions where available, Joomla ACL, and the result.
|
|
167
|
+
|
|
168
|
+
| Duration | Behavior | Persistence |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `once` | Authorizes one matching apply attempt | Persisted when a store is configured; removed when consumed |
|
|
171
|
+
| `30-minutes` | Authorizes matching operations for exactly 30 minutes | Persisted when a store is configured |
|
|
172
|
+
| `indefinite` | Authorizes matching operations until explicit revocation | Disabled by default; durable store required |
|
|
173
|
+
|
|
174
|
+
The operator grant never expands server configuration, OAuth scopes, Joomla
|
|
175
|
+
token permissions, or Joomla ACL. All four layers must allow the operation.
|
|
176
|
+
|
|
177
|
+
Use `joomla_permissions_list` to inspect active grants and
|
|
178
|
+
`joomla_permission_revoke` to revoke one immediately. Grant request,
|
|
179
|
+
approval, use, and revocation are emitted as structured audit events. The
|
|
180
|
+
acknowledgement phrase and principal identity are never written to the grant
|
|
181
|
+
store.
|
|
182
|
+
|
|
183
|
+
## 7. Optional local Joomla companion
|
|
184
|
+
|
|
185
|
+
Install the companion only when the MCP process runs on the Joomla host and
|
|
186
|
+
needs fixed Joomla-native operations unavailable through Web Services:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cd /opt/joomla-mcp
|
|
190
|
+
php companion/tests/run.php
|
|
191
|
+
php companion/build.php
|
|
192
|
+
cd /srv/www/joomla
|
|
193
|
+
php cli/joomla.php extension:install \
|
|
194
|
+
--path=/opt/joomla-mcp/companion/dist/pkg_joomlamcp-0.7.0.zip
|
|
195
|
+
php cli/joomla.php joomla:mcp:self-test --format=json --no-interaction --no-ansi
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Select a dedicated MCP actor in the plugin configuration and add the fixed
|
|
199
|
+
`cli` block described in [the companion guide](PHP_COMPANION.md).
|
|
200
|
+
|
|
201
|
+
The companion does not expose arbitrary shell, PHP, SQL, filesystem paths,
|
|
202
|
+
models, methods, URLs, or discovered Joomla commands.
|
|
203
|
+
|
|
204
|
+
## 8. In-house acceptance gate
|
|
205
|
+
|
|
206
|
+
Before production writes:
|
|
207
|
+
|
|
208
|
+
- `npm run validate` passes on the deployed revision;
|
|
209
|
+
- the deployed image or package matches release checksums and provenance;
|
|
210
|
+
- Joomla staging and production versions are recorded;
|
|
211
|
+
- the dedicated actor has no unnecessary ACL privileges;
|
|
212
|
+
- every enabled Web Services plugin is justified;
|
|
213
|
+
- read results contain no tokens or secrets;
|
|
214
|
+
- permission request, approval, use, time-based expiry, and revocation are tested;
|
|
215
|
+
- one denial test is recorded for every enabled write toolset;
|
|
216
|
+
- a current backup is restorable;
|
|
217
|
+
- postconditions are verified for the intended mutation family;
|
|
218
|
+
- audit delivery and retention are monitored;
|
|
219
|
+
- rollback disables the affected toolset without changing source code.
|
|
220
|
+
|
|
221
|
+
The repository’s [coverage truth table](COVERAGE.md) remains authoritative.
|
|
222
|
+
Passing this single-site checklist does not claim universal production
|
|
223
|
+
certification for mutation families that are still marked pending there.
|
package/docs/TESTING.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Testing and release evidence
|
|
2
|
+
|
|
3
|
+
Testing is divided by what it proves. Passing a narrower layer does not confer
|
|
4
|
+
the status of a broader one.
|
|
5
|
+
|
|
6
|
+
| Layer | Command or job | Evidence |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| Type and build | `npm run check`, `npm run build` | TypeScript contracts compile and production output is generated |
|
|
9
|
+
| Offline behavior | `npm test` | Complete route catalogue, field allowlists, special schemas, adapter availability, MCP tools, operator permission grants, write controls, release validation, HTTP security, and process boundaries behave against mocks/fixtures |
|
|
10
|
+
| Generated action reference | `npm run docs:actions:check` | The 236-action user reference exactly matches the executable catalogue |
|
|
11
|
+
| Offline security | `npm run test:security` | Focused authorization, confirmation, and security-boundary checks |
|
|
12
|
+
| Companion boundary | `php companion/tests/run.php` | Framing, registry, ACL preflight, allowlists, confirmation, manifests, and source escape-hatch checks |
|
|
13
|
+
| Companion package | `php companion/build.php` | Installable package ZIP can be assembled |
|
|
14
|
+
| Joomla 6.1 live fixture | `npm run test:fixture:joomengine` | Fresh Joomla 6.1.2/PHP 8.4/MariaDB installs the exact package, validates native CLI contracts, then runs the catalogue-complete live suite through API/companion and stdio/Streamable HTTP with redacted failure evidence |
|
|
15
|
+
| API read contract | `npm run test:contract` | Configured live Joomla answers all 36 CRUD collection reads plus safe configuration |
|
|
16
|
+
| Companion read contract | `npm run test:contract` | Configured local Joomla advertises required actions and executes bounded list/status reads through native services |
|
|
17
|
+
| Container build | CI container job | OCI build definition is buildable |
|
|
18
|
+
| Release supply chain | Tag or manual workflow | Version-validated server package, deployment bundle, companion ZIP, OCI image, SBOM, checksums, and provenance jobs execute |
|
|
19
|
+
|
|
20
|
+
The repository-managed Joomla 6.1 lane now covers deterministic success,
|
|
21
|
+
mutation, verification, deletion, safety-gate, and cleanup behavior. The
|
|
22
|
+
separate Joomla 6.2, PostgreSQL, least-privilege denial, fault-injection,
|
|
23
|
+
concurrency, and recovery matrix below remains required for production
|
|
24
|
+
certification.
|
|
25
|
+
|
|
26
|
+
## Local validation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm ci
|
|
30
|
+
npm run validate
|
|
31
|
+
npm run test:security
|
|
32
|
+
npm run docs:actions:check
|
|
33
|
+
npm audit --omit=dev --audit-level=high
|
|
34
|
+
php companion/tests/run.php
|
|
35
|
+
php companion/build.php
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
With Docker and Compose v2 available, also run the blocking Joomla 6.1 package
|
|
39
|
+
installation smoke gate:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm run test:fixture:joomengine
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The default lane uses JoomEngine's `octoleo/joomengine:6` stable-major label
|
|
46
|
+
(currently JCB 6.1.6, Joomla 6.1.2, and PHP 8.4), pinned to its validated image
|
|
47
|
+
digest, plus an immutable MariaDB 11.4 digest. The lane records the resolved
|
|
48
|
+
registry digests and package SHA-256 in a non-secret evidence file. Every run
|
|
49
|
+
starts with new volumes and always
|
|
50
|
+
removes them because JoomEngine's extension and CLI environment variables are
|
|
51
|
+
first-install bootstrap facilities.
|
|
52
|
+
|
|
53
|
+
The bootstrap hook first runs only the companion-owned `joomla:mcp:describe`,
|
|
54
|
+
`joomla:mcp:self-test`, and `joomla:mcp:cli-inventory` commands through
|
|
55
|
+
`JOOMLA_CLI_COMMANDS`, then validates their feedback. The inventory uses
|
|
56
|
+
Joomla's installed command registry and records command, argument, and option
|
|
57
|
+
metadata without executing discovered commands. Post-start, the fixture runs
|
|
58
|
+
only Joomla's fixed `list` and `help <command>` discovery paths for all 153
|
|
59
|
+
installed commands—38 core, 111 Component Builder, and four companion
|
|
60
|
+
commands—under per-command time and output bounds. It never invokes a discovered
|
|
61
|
+
mutation during command inventory. It then creates an ephemeral API token and
|
|
62
|
+
runs the packaged live command against the disposable site through all four
|
|
63
|
+
MCP/Joomla lane combinations. Structured companion dispatch requests travel
|
|
64
|
+
over stdin and execute as `www-data`. Never place MCP/client/model input in the
|
|
65
|
+
JoomEngine command environment. See [Live Joomla validation](LIVE_TESTING.md).
|
|
66
|
+
|
|
67
|
+
Do not run mutation or maintenance tests against a production Joomla site.
|
|
68
|
+
|
|
69
|
+
## Live API smoke contract
|
|
70
|
+
|
|
71
|
+
Export credentials for one disposable site and run:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
export JOOMLA_CONTRACT_BASE_URL='https://joomla-fixture.example'
|
|
75
|
+
export JOOMLA_CONTRACT_TOKEN='redacted-fixture-token'
|
|
76
|
+
npm run test:contract
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If either value is absent, the suite intentionally skips. The URL is the Joomla
|
|
80
|
+
site origin, not `/api/index.php`; the adapter adds the API path. Use a token for
|
|
81
|
+
a disposable least-privilege fixture actor.
|
|
82
|
+
|
|
83
|
+
To activate the local companion contract on a host or self-hosted runner with
|
|
84
|
+
filesystem access to the disposable Joomla installation:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export JOOMLA_CONTRACT_ROOT='/srv/joomla-fixture'
|
|
88
|
+
export JOOMLA_CONTRACT_PHP_BINARY='/usr/bin/php8.3'
|
|
89
|
+
npm run test:contract
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If either local value is absent, the companion contract skips. The suite checks
|
|
93
|
+
that the installed package advertises every edge-required CRUD/operational
|
|
94
|
+
action and executes the safe list/status set; it does not execute writes.
|
|
95
|
+
|
|
96
|
+
The CI job recognizes:
|
|
97
|
+
|
|
98
|
+
- `JOOMLA_61_CONTRACT_BASE_URL` and `JOOMLA_61_CONTRACT_TOKEN`;
|
|
99
|
+
- `JOOMLA_62_CONTRACT_BASE_URL` and `JOOMLA_62_CONTRACT_TOKEN`;
|
|
100
|
+
- `JOOMLA_70_CONTRACT_BASE_URL` and `JOOMLA_70_CONTRACT_TOKEN`.
|
|
101
|
+
|
|
102
|
+
Joomla 6.1 and 6.2 are blocking targets. Joomla 7 is a permitted-failure canary.
|
|
103
|
+
GitHub-hosted runners must be able to resolve and reach the fixture over HTTPS.
|
|
104
|
+
For a fixture behind a firewall, use a dedicated self-hosted runner on the same
|
|
105
|
+
trusted network; do not expose Joomla administration merely to satisfy CI.
|
|
106
|
+
|
|
107
|
+
The hosted JoomEngine lane removes the external-fixture requirement for the
|
|
108
|
+
Joomla 6.1 package-install and Super User success-path action matrix.
|
|
109
|
+
Joomla 6.2, PostgreSQL, least-privilege denial, fault injection, rollback, and
|
|
110
|
+
recovery still require their dedicated fixtures.
|
|
111
|
+
|
|
112
|
+
## Required per-action live contract
|
|
113
|
+
|
|
114
|
+
Each semantic action must prove:
|
|
115
|
+
|
|
116
|
+
1. its catalogue route or companion action matches the supported Joomla source;
|
|
117
|
+
2. its least-privilege actor succeeds;
|
|
118
|
+
3. an actor missing the declared ACL is denied;
|
|
119
|
+
4. valid minimum and representative inputs succeed;
|
|
120
|
+
5. unknown, missing, oversized, and forbidden fields fail closed;
|
|
121
|
+
6. result normalization and pagination bounds are correct;
|
|
122
|
+
7. writes trigger Joomla's native validation/events and reach the documented
|
|
123
|
+
state;
|
|
124
|
+
8. a verification read confirms the postcondition;
|
|
125
|
+
9. missing, wrong-principal, wrong-site, wrong-toolset, expired, revoked, and
|
|
126
|
+
consumed permission grants fail closed;
|
|
127
|
+
10. duplicate idempotency keys and reused/expired confirmation tokens cannot
|
|
128
|
+
repeat the mutation;
|
|
129
|
+
11. created fixture data is removed through the documented cleanup path.
|
|
130
|
+
|
|
131
|
+
Delete, state, update, extension, database, password, configuration, scheduler,
|
|
132
|
+
and cache actions also require timeout, partial-failure, retry, concurrency,
|
|
133
|
+
rollback, and restore cases appropriate to their native Joomla lifecycle.
|
|
134
|
+
|
|
135
|
+
## Compatibility matrix
|
|
136
|
+
|
|
137
|
+
The production gate requires at least:
|
|
138
|
+
|
|
139
|
+
| Dimension | Required targets |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Joomla | Current supported 6.1 release and current supported 6.2 release |
|
|
142
|
+
| Canary | Current 7.0 development/release target; non-blocking until supported |
|
|
143
|
+
| PHP | Joomla-supported PHP versions, beginning with 8.3 |
|
|
144
|
+
| Database | MySQL/MariaDB and PostgreSQL versions supported by the target Joomla release |
|
|
145
|
+
| Transport | stdio and Streamable HTTP |
|
|
146
|
+
| Joomla path | API-only, companion-only, and dual-path actions |
|
|
147
|
+
| Permission | allowed actor and denied actor |
|
|
148
|
+
| Deployment | package install/upgrade/uninstall; OCI/systemd start/restart/rollback |
|
|
149
|
+
| Failure | downstream timeout, malformed response, process truncation, lost connection, restart, and audit failure |
|
|
150
|
+
| Scale | bounded load, rate/concurrency/session exhaustion, and multi-replica replay/coordination |
|
|
151
|
+
|
|
152
|
+
Store the exact Joomla commit/release, PHP version, database/version, package
|
|
153
|
+
digest, edge commit/image digest, actor ACL, and test result with the release
|
|
154
|
+
evidence. Never store tokens or fixture content containing personal data.
|
|
155
|
+
|
|
156
|
+
## Documentation gate
|
|
157
|
+
|
|
158
|
+
After an action changes, update [coverage](COVERAGE.md), schemas/examples, native
|
|
159
|
+
source references, security/rollback notes, and operator procedures. Mark it
|
|
160
|
+
**live-verified** only when the retained matrix evidence supports that claim.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## JoomEngine fixture fails during bootstrap
|
|
4
|
+
|
|
5
|
+
Run the fixture with a dedicated diagnostics directory:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
php companion/build.php
|
|
9
|
+
JOOMLA_FIXTURE_ARTIFACT_DIR="$PWD/.fixture-artifacts" \
|
|
10
|
+
npm run test:fixture:joomengine
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Inspect `compose-ps.txt`, `compose.log`, `describe.json`, `self-test.json`,
|
|
14
|
+
`cli-list.txt`, `cli-inventory.json`, the bounded `cli-help/` directory,
|
|
15
|
+
`dispatch.json`, and `evidence.json`. The harness always removes its volumes unless
|
|
16
|
+
`JOOMLA_FIXTURE_KEEP=1` is explicitly set for local debugging.
|
|
17
|
+
|
|
18
|
+
A companion installation can succeed while its command remains unavailable if
|
|
19
|
+
an older package installed the console plugin disabled. Install or upgrade to
|
|
20
|
+
0.7.0, then verify `joomla:mcp:describe` as `www-data`. Do not reuse a failed
|
|
21
|
+
JoomEngine volume: its extension and configured CLI phases are first-install
|
|
22
|
+
only.
|
|
23
|
+
|
|
24
|
+
Start with the exact process stderr/audit reason, then verify the narrowest
|
|
25
|
+
boundary. Do not work around a denial by enabling broad toolsets or granting
|
|
26
|
+
Super Users.
|
|
27
|
+
|
|
28
|
+
## Startup and configuration
|
|
29
|
+
|
|
30
|
+
| Symptom | Cause | Corrective action |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `Unable to read configuration` | Wrong `JOOMLA_MCP_CONFIG`, owner, or mode | Use an absolute readable path and verify the service account can traverse parent directories |
|
|
33
|
+
| `Invalid configuration` | Unknown key, invalid HTTPS URL, alias, scope, or bounds | Compare with `config/sites.example.json`; configuration is strict |
|
|
34
|
+
| `Environment variable ... is not set` | A `tokenEnv`, `updateTokenEnv`, or approval secret is absent | Define it in the service secret store and restart; do not put the value in JSON |
|
|
35
|
+
| `write approval secret must contain at least 32 bytes` | Weak approval secret | Generate and install a random secret of at least 32 characters/bytes |
|
|
36
|
+
| Joomla root/PHP/launcher is not a file or directory | Incorrect or inaccessible fixed local path | Correct the server-side path and permissions; tool calls cannot override it |
|
|
37
|
+
| `Remote HTTP is unavailable until the http configuration block is defined` | HTTP entry point started with stdio-only configuration | Add a valid `http` object or run the stdio entry point |
|
|
38
|
+
| Invalid or duplicate HTTP paths | `mcpPath`, `healthPath`, and `readinessPath` collide | Configure three distinct canonical paths; defaults are `/mcp`, `/healthz`, `/readyz` |
|
|
39
|
+
| Invalid shutdown grace | `shutdownGraceMs` is outside 1,000–120,000 ms | Use the default 30,000 ms or a bounded value and set the outer stop timeout higher |
|
|
40
|
+
|
|
41
|
+
## HTTP authentication and policy
|
|
42
|
+
|
|
43
|
+
| Symptom | Cause | Corrective action |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| Host/origin forbidden | Proxy authority does not exactly match policy | Preserve the external Host and add only the canonical expected authority/origin |
|
|
46
|
+
| `No trusted JWKS key matches` | Unknown `kid`, unsupported algorithm, stale/incorrect JWKS | Verify issuer JWKS, key publication, algorithm, and HTTPS reachability; do not disable verification |
|
|
47
|
+
| JWT signature/audience/issuer/time rejection | Wrong token or authorization-server setup | Mint a token for the configured resource audience and issuer with valid times |
|
|
48
|
+
| Principal lacks a site/toolset scope | Token is intentionally narrower than the requested operation | Grant only the exact `joomla:site:<alias>` and `joomla:toolset:<name>` scopes required |
|
|
49
|
+
| Site listing or apply denied | Missing special scope | Add `joomla:sites:list` or `joomla:writes:apply` only for the principal that needs it |
|
|
50
|
+
| Health check fails while process runs | Health request Host differs from `allowedHosts` | Align the health-probe Host and path with the HTTP configuration |
|
|
51
|
+
| `/readyz` returns 503 `not_ready` | The configured JWKS cannot be fetched or validated | Check authorization-server/network/TLS/JWKS health in restricted operator logs; the public response intentionally hides dependency details |
|
|
52
|
+
|
|
53
|
+
## Joomla API
|
|
54
|
+
|
|
55
|
+
| Symptom | Cause | Corrective action |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| HTTP 401 | Token/plugin configuration | Enable both Joomla token plugins, permit the user's group, and rotate/test the token |
|
|
58
|
+
| HTTP 403 | Missing `core.login.api` or component ACL | Add the minimum declared Joomla permission to the dedicated actor and preserve the denied-actor test |
|
|
59
|
+
| HTTP 404 | Required Web Services plugin disabled or unsupported route | Enable the native plugin for that family and confirm the route in the supported Joomla source |
|
|
60
|
+
| Joomla Update token not configured | Action uses Joomla's separate update credential | Define `updateTokenEnv`; do not substitute the normal API token |
|
|
61
|
+
| Malformed JSON or response-size error | Joomla/proxy returned unexpected or excessive content | Inspect redacted downstream response/proxy errors and keep the bound; do not increase it blindly |
|
|
62
|
+
| Redirect rejected | `baseUrl` or proxy redirects API traffic | Configure the canonical HTTPS site origin; redirects are intentionally not followed |
|
|
63
|
+
|
|
64
|
+
## Companion and CLI
|
|
65
|
+
|
|
66
|
+
| Symptom | Cause | Corrective action |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| Commands are missing | Package/plugin not installed or enabled | Install the built package, enable the Console plugin, and run Joomla's command list locally |
|
|
69
|
+
| `ACCESS_DENIED` | Actor unset or lacks native Joomla ACL | Select a dedicated actor and grant only the declared permission |
|
|
70
|
+
| `UNKNOWN_ACTION` / not advertised | Edge and companion versions differ or action is not local | Run `joomla:mcp:describe`, compare action IDs, and upgrade/rollback the pair together |
|
|
71
|
+
| Malformed/unsupported protocol response | Output contamination, version mismatch, or plugin failure | Run the exact `--no-interaction --no-ansi` command manually, capture redacted stderr, and verify package integrity |
|
|
72
|
+
| Timeout/truncated output | Native operation exceeded configured limits | Inspect Joomla/PHP logs and action bounds; fix the native problem before cautiously changing limits |
|
|
73
|
+
| API works but `transport: auto` fails locally | A configured companion is preferred and denies/does not advertise the action | Correct companion/actor parity or explicitly select `api` for an API-backed action |
|
|
74
|
+
|
|
75
|
+
## Writes
|
|
76
|
+
|
|
77
|
+
| Symptom | Cause | Corrective action |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| Controlled writes unavailable | No approval configuration | Add the approval block and strong secret only after write gates pass |
|
|
80
|
+
| No token returned | Request used `dryRun: true` | Review the preview, then issue a separate non-dry plan when approved |
|
|
81
|
+
| Token unknown, expired, or used | One-time/short-lived protection worked | Re-read current Joomla state and create a new plan; never retry an old token |
|
|
82
|
+
| Another write is in progress | Per-site lock is held | Wait for the bounded operation; inspect a persistent condition instead of bypassing the lock |
|
|
83
|
+
| Idempotency key used for another operation | UUID was reused incorrectly | Generate a new UUID for a genuinely different intended mutation |
|
|
84
|
+
| Companion did not prove apply | Native result did not meet the edge postcondition | Treat the outcome as uncertain, inspect Joomla independently, and do not retry until reconciled |
|
|
85
|
+
| Verification mismatch after API write | Joomla state differs from expected postcondition | Stop writes for the family, preserve evidence, and restore/repair through the tested native path |
|
|
86
|
+
| Connections are cut during shutdown | Outer stop timeout expired before application drain | Set Compose `stop_grace_period` or systemd `TimeoutStopSec` above `shutdownGraceMs`; clients must verify interrupted write postconditions |
|
|
87
|
+
|
|
88
|
+
## CI contracts skip
|
|
89
|
+
|
|
90
|
+
`npm run test:contract` skips when either `JOOMLA_CONTRACT_BASE_URL` or
|
|
91
|
+
`JOOMLA_CONTRACT_TOKEN` is empty. Add both target-specific repository secrets as
|
|
92
|
+
described in [Fixtures](FIXTURES.md). A private fixture also needs a dedicated
|
|
93
|
+
self-hosted runner with network reachability.
|
|
94
|
+
|
|
95
|
+
If the issue remains, collect the commit/image and companion digests, Joomla/PHP
|
|
96
|
+
and database versions, redacted configuration shape, exact action ID/transport,
|
|
97
|
+
error/audit reason, and reproduction steps. Use the private process in
|
|
98
|
+
[`SECURITY.md`](../SECURITY.md) if the report may expose a vulnerability.
|