@diviops/mcp-server 0.2.20 → 0.2.21
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/README.md +39 -24
- package/dist/wp-cli.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,31 +32,33 @@ Go to **WP Admin -> Users -> Your Profile -> Application Passwords**:
|
|
|
32
32
|
### 3. Configure Claude Code
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
claude mcp add diviops-mcp
|
|
36
|
-
WP_URL=http://your-site.local \
|
|
37
|
-
WP_USER=your-wp-username \
|
|
38
|
-
WP_APP_PASSWORD=xxxxXXXXxxxxXXXXxxxxXXXX \
|
|
39
|
-
npx @diviops/mcp-server
|
|
35
|
+
claude mcp add diviops-mcp \
|
|
36
|
+
--env WP_URL=http://your-site.local \
|
|
37
|
+
--env WP_USER=your-wp-username \
|
|
38
|
+
--env WP_APP_PASSWORD=xxxxXXXXxxxxXXXXxxxxXXXX \
|
|
39
|
+
-- npx @diviops/mcp-server
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
> **Use `--env` flags, not the `env` command.** Claude Code's native `--env KEY=VALUE` flags survive copy-paste; the older `-- env KEY=VALUE` form (piping through unix `env`) breaks silently when any value contains a space. Quote any value with spaces (e.g. `--env "WP_PATH=/Users/you/Local Sites/site/app/public"`) — no backslash escaping needed inside quotes.
|
|
43
|
+
|
|
42
44
|
**With WP-CLI** (optional — enables `diviops_wp_cli` tool):
|
|
43
45
|
```bash
|
|
44
|
-
claude mcp add diviops-mcp
|
|
45
|
-
WP_URL=http://your-site.local \
|
|
46
|
-
WP_USER=your-wp-username \
|
|
47
|
-
WP_APP_PASSWORD=xxxxXXXXxxxxXXXXxxxxXXXX \
|
|
48
|
-
WP_PATH
|
|
49
|
-
npx @diviops/mcp-server
|
|
46
|
+
claude mcp add diviops-mcp \
|
|
47
|
+
--env WP_URL=http://your-site.local \
|
|
48
|
+
--env WP_USER=your-wp-username \
|
|
49
|
+
--env WP_APP_PASSWORD=xxxxXXXXxxxxXXXXxxxxXXXX \
|
|
50
|
+
--env "WP_PATH=/path/to/wordpress" \
|
|
51
|
+
-- npx @diviops/mcp-server
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
**With Docker-based WP-CLI** (optional — uses a custom command prefix):
|
|
53
55
|
```bash
|
|
54
|
-
claude mcp add diviops-mcp
|
|
55
|
-
WP_URL=https://site-name.ddev.site \
|
|
56
|
-
WP_USER=your-wp-username \
|
|
57
|
-
WP_APP_PASSWORD=xxxxXXXXxxxxXXXXxxxxXXXX \
|
|
58
|
-
WP_CLI_CMD=
|
|
59
|
-
npx @diviops/mcp-server
|
|
56
|
+
claude mcp add diviops-mcp \
|
|
57
|
+
--env WP_URL=https://site-name.ddev.site \
|
|
58
|
+
--env WP_USER=your-wp-username \
|
|
59
|
+
--env WP_APP_PASSWORD=xxxxXXXXxxxxXXXXxxxxXXXX \
|
|
60
|
+
--env "WP_CLI_CMD=ddev wp" \
|
|
61
|
+
-- npx @diviops/mcp-server
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
### Environment Variables
|
|
@@ -186,6 +188,7 @@ These commands carry higher risk and require explicit opt-in via the `DIVIOPS_WP
|
|
|
186
188
|
| Command | Risk | Why opt-in |
|
|
187
189
|
|---------|------|------------|
|
|
188
190
|
| `option update` | High | Can change site URL, admin email, or security settings |
|
|
191
|
+
| `option delete` | High | Permanently removes a WP option (no undo) |
|
|
189
192
|
| `post delete` | Medium | Permanently removes content |
|
|
190
193
|
| `post meta delete` | Medium | Removes metadata |
|
|
191
194
|
| `term delete` | Medium | Permanently removes taxonomy terms |
|
|
@@ -198,17 +201,29 @@ These commands carry higher risk and require explicit opt-in via the `DIVIOPS_WP
|
|
|
198
201
|
To enable extended commands, add `DIVIOPS_WP_CLI_ALLOW` to your MCP registration:
|
|
199
202
|
|
|
200
203
|
```bash
|
|
201
|
-
claude mcp add diviops-mcp
|
|
202
|
-
WP_URL=http://your-site.local \
|
|
203
|
-
WP_USER=admin \
|
|
204
|
-
WP_APP_PASSWORD=xxxx \
|
|
205
|
-
WP_PATH
|
|
206
|
-
DIVIOPS_WP_CLI_ALLOW=
|
|
207
|
-
npx @diviops/mcp-server
|
|
204
|
+
claude mcp add diviops-mcp \
|
|
205
|
+
--env WP_URL=http://your-site.local \
|
|
206
|
+
--env WP_USER=admin \
|
|
207
|
+
--env WP_APP_PASSWORD=xxxx \
|
|
208
|
+
--env "WP_PATH=/path/to/wordpress" \
|
|
209
|
+
--env "DIVIOPS_WP_CLI_ALLOW=option update,post delete,search-replace" \
|
|
210
|
+
-- npx @diviops/mcp-server
|
|
208
211
|
```
|
|
209
212
|
|
|
210
213
|
Only list the specific commands you need. Unknown entries are ignored with a warning.
|
|
211
214
|
|
|
215
|
+
#### Wildcard / "god-mode" (local dev only)
|
|
216
|
+
|
|
217
|
+
For trusted local-dev environments where you don't want to re-list every extended command per site, the values `*` and `all` grant the full extended set:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
--env "DIVIOPS_WP_CLI_ALLOW=*"
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The sentinel grants exactly the extended set above — it does NOT unlock anything beyond it (notably: `db query` stays out by design). The server emits a startup warning to stderr whenever the wildcard is active, so the broad grant is never silent. Auto-adopts new extended commands on future versions.
|
|
224
|
+
|
|
225
|
+
> **Don't use this in shared or production environments.** Pin the specific commands you need with the comma-separated form instead.
|
|
226
|
+
|
|
212
227
|
> **Note on `acf import`**: included in the default allowlist because it's an idempotent dev-time schema operation (re-creates field groups from JSON). Bulk content imports use `wp import` instead, which is opt-in.
|
|
213
228
|
|
|
214
229
|
### Filesystem flag validation
|
package/dist/wp-cli.js
CHANGED
|
@@ -90,6 +90,7 @@ const DEFAULT_COMMANDS = [
|
|
|
90
90
|
*/
|
|
91
91
|
const EXTENDED_COMMANDS = [
|
|
92
92
|
'option update', // Can change site URL, admin email, active plugins
|
|
93
|
+
'option delete', // Destructive — permanently removes a WP option
|
|
93
94
|
'post delete', // Destructive — permanently removes content
|
|
94
95
|
'post meta delete', // Destructive — removes metadata
|
|
95
96
|
'term delete', // Destructive — removes taxonomy terms
|
|
@@ -104,6 +105,14 @@ function buildAllowlist() {
|
|
|
104
105
|
const extra = process.env.DIVIOPS_WP_CLI_ALLOW?.trim();
|
|
105
106
|
if (!extra)
|
|
106
107
|
return DEFAULT_COMMANDS;
|
|
108
|
+
// Wildcard sentinel — convenience for trusted local-dev environments. Grants
|
|
109
|
+
// every entry in EXTENDED_COMMANDS but does NOT unlock anything beyond it
|
|
110
|
+
// (notably: `db query` stays out — see #361 Chunk B). Always emits a startup
|
|
111
|
+
// warning so the broad grant is never silent.
|
|
112
|
+
if (extra === '*' || extra === 'all') {
|
|
113
|
+
console.warn(`[diviops] DIVIOPS_WP_CLI_ALLOW="${extra}" — granting ALL ${EXTENDED_COMMANDS.length} extended commands. Intended for trusted local-dev only.`);
|
|
114
|
+
return [...DEFAULT_COMMANDS, ...EXTENDED_COMMANDS];
|
|
115
|
+
}
|
|
107
116
|
const requested = extra.split(',').map((s) => s.trim()).filter(Boolean);
|
|
108
117
|
const granted = new Set(DEFAULT_COMMANDS);
|
|
109
118
|
for (const cmd of requested) {
|