@diviops/mcp-server 1.5.39 → 1.5.41
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 +68 -11
- package/dist/authoring-shape-integration.d.ts +16 -0
- package/dist/authoring-shape-integration.js +19 -0
- package/dist/cross-env-source-hints.d.ts +7 -0
- package/dist/cross-env-source-hints.js +22 -0
- package/dist/health-tools.d.ts +1 -1
- package/dist/health-tools.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -44
- package/dist/startup-capture.d.ts +33 -0
- package/dist/startup-capture.js +69 -0
- package/dist/wp-client.d.ts +1 -0
- package/dist/wp-client.js +1 -1
- package/package.json +20 -5
package/README.md
CHANGED
|
@@ -19,9 +19,28 @@ DiviOps fits multiple WordPress workflows where AI-driven authoring + management
|
|
|
19
19
|
- **WordPress site auditing** — preset audits, design-token usage scans, orphan detection (presets, variables, dangling references); broader site surveys via wp-cli (`wp option list`, `wp post list --format=json`, `wp post term list <id> <taxonomy> --format=json`, `wp user list`).
|
|
20
20
|
- **Hybrid sites (Divi + custom PHP)** — Divi authors the marketing pages; custom PHP templates handle dynamic ones (CPT listings, single-post views, member portals); design tokens harmonized across both surfaces via CSS custom properties driven from the Divi variable system.
|
|
21
21
|
|
|
22
|
+
## Authoring policy
|
|
23
|
+
|
|
24
|
+
Use native Divi modules first. Intentional custom HTML is supported when native
|
|
25
|
+
Divi cannot meet the agreed requirement; HTML shape is not a semantic refusal gate.
|
|
26
|
+
Permissions, schemas, sanitization, bounded parsing, dry-run, required backups and
|
|
27
|
+
readback still apply. Ordinary server startup and the seven full-content writes
|
|
28
|
+
do not require a browser, trust registration or receipt. Visual QA is separate.
|
|
29
|
+
|
|
30
|
+
With an unreleased browser-gate plugin snapshot, its refusals remain authoritative:
|
|
31
|
+
the migrated server removes private browser handoff data and does not retry or
|
|
32
|
+
bypass the refusal. An unreleased browser-gate server snapshot tolerates the
|
|
33
|
+
retired registration route on the migrated plugin, but retains its own
|
|
34
|
+
startup-attestation overhead. Existing capability checks and
|
|
35
|
+
authentication errors are unchanged. Published server 1.5.40 and Free 1.5.13
|
|
36
|
+
predate that experiment and did not require browser attestation or receipts.
|
|
37
|
+
Source behavior is not a claim that current npm, WordPress.org or manually
|
|
38
|
+
installed packages include the migration.
|
|
39
|
+
|
|
22
40
|
## Quick start
|
|
23
41
|
|
|
24
|
-
|
|
42
|
+
The first three steps prove connectivity. Native Divi authoring additionally
|
|
43
|
+
requires the client-side skill and first-run verification in steps 4 and 5.
|
|
25
44
|
|
|
26
45
|
### 1. Install the WordPress plugin
|
|
27
46
|
|
|
@@ -38,6 +57,19 @@ In **WP Admin → Users → Your Profile → Application Passwords**:
|
|
|
38
57
|
|
|
39
58
|
### 3. Register the MCP server
|
|
40
59
|
|
|
60
|
+
The successor server line requires Node.js 22 or newer. Upgrade Node before
|
|
61
|
+
selecting `@diviops/mcp-server@1.5.40` or a later release. Operators who must
|
|
62
|
+
remain on Node 18 can pin the previously shipped compatible server explicitly:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx -y --package=@diviops/mcp-server@1.5.39 diviops-mcp
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That pin affects only the MCP server. Free and Pro WordPress plugin versions
|
|
69
|
+
use independent version series and remain compatible through the advertised
|
|
70
|
+
per-capability handshake. Direct npm/stdio and MCP v1 remain supported on the
|
|
71
|
+
Node 22 successor; MCP v2 fixtures and the launcher sidecar are not published.
|
|
72
|
+
|
|
41
73
|
Claude Code:
|
|
42
74
|
|
|
43
75
|
```bash
|
|
@@ -61,7 +93,9 @@ WP_USER = "your-wp-username"
|
|
|
61
93
|
WP_APP_PASSWORD = "xxxxXXXXxxxxXXXXxxxxXXXX"
|
|
62
94
|
```
|
|
63
95
|
|
|
64
|
-
Then ask your AI client: **"List the pages on my site."** It calls
|
|
96
|
+
Then ask your AI client: **"List the pages on my site."** It calls
|
|
97
|
+
`diviops_page_list` and renders the result. This proves the plugin and MCP transport;
|
|
98
|
+
it does not prove that the client has loaded Divi authoring knowledge.
|
|
65
99
|
|
|
66
100
|
For Claude Desktop JSON, use `"command": "npx"` with args `["-y", "--package", "@diviops/mcp-server", "diviops-mcp"]`. The package also ships `diviops-preset`, so the explicit package/bin form is required; shorthand package invocation cannot reliably infer which bin to run.
|
|
67
101
|
|
|
@@ -74,6 +108,24 @@ change direct npm/stdio support.
|
|
|
74
108
|
|
|
75
109
|
For a deeper walkthrough (containerized environments, WP-CLI configuration, troubleshooting installation), see [setup-guide.md](../docs/setup-guide.md).
|
|
76
110
|
|
|
111
|
+
### 4. Load the `divi-5-builder` skill
|
|
112
|
+
|
|
113
|
+
Install it for Claude Code by running
|
|
114
|
+
`claude plugin marketplace add oaris-dev/diviops` and then
|
|
115
|
+
`claude plugin install divi-5-builder@diviops`, or copy the distribution's
|
|
116
|
+
`skills/*` into the supported skill directory for Codex/manual setups. WordPress
|
|
117
|
+
and npm updates do not update manual skill copies. Avoid simultaneous
|
|
118
|
+
plugin-managed and stale manual copies, then restart the client and confirm
|
|
119
|
+
`divi-5-builder` is visible.
|
|
120
|
+
|
|
121
|
+
### 5. Prove native module authoring
|
|
122
|
+
|
|
123
|
+
Run the disposable, fail-closed
|
|
124
|
+
[native Divi verification](../docs/setup-guide.md#first-run-native-divi-verification).
|
|
125
|
+
Stop if the skill or required tools are unavailable. Do not accept page-sized HTML,
|
|
126
|
+
Code modules, iframe layouts, or structural HTML in text/container fields as a
|
|
127
|
+
fallback for editable native Divi modules.
|
|
128
|
+
|
|
77
129
|
## Example workflow
|
|
78
130
|
|
|
79
131
|
> **You:** Create a hero section on a new page called "Spring Launch" with a heading, subheading, and a CTA button. Use my brand colors.
|
|
@@ -82,9 +134,10 @@ Claude orchestrates a few tool calls in sequence:
|
|
|
82
134
|
|
|
83
135
|
1. `diviops_global_color_list` — discovers your brand palette.
|
|
84
136
|
2. `diviops_template_list` / `diviops_template_get` — pulls a verified hero template that matches the request.
|
|
85
|
-
3. `
|
|
86
|
-
4. `
|
|
87
|
-
5. `
|
|
137
|
+
3. `diviops_validate_blocks` with inline `content` — confirms the constructed hero markup is well-formed before any write.
|
|
138
|
+
4. `diviops_page_create` — creates `Spring Launch` as a draft using those exact validated bytes.
|
|
139
|
+
5. `diviops_validate_blocks` with the saved `page_id` — verifies persisted readback.
|
|
140
|
+
6. `diviops_render_preview` — returns the rendered HTML so you can verify before publishing. Accepts inline `content` or a `page_id` to preview an existing page.
|
|
88
141
|
|
|
89
142
|
The skill enforces the Divi block format, the design system, and the response contract throughout — you stay at the prompt level.
|
|
90
143
|
|
|
@@ -106,7 +159,9 @@ The server exposes **94 always-on tools** across the categories below. Each cate
|
|
|
106
159
|
| WP-CLI passthrough | Escape hatch for site ops | `meta_wp_cli` |
|
|
107
160
|
| Cache + meta | Connection probe, identity, icons, cache flush | `meta_*` |
|
|
108
161
|
|
|
109
|
-
Use `diviops_meta_info` as the S0 preflight before dogfooding or product work. It returns `server_version`, a numeric `tool_count`, a `tools` catalog summary (`registered_total`, always-on count, Pro possible/registered counts by target), `plugins` version records for `diviops-agent`, `diviops-agent-pro`, FluentCart, and FluentCart Pro when available, plus the existing handshake and slice state.
|
|
162
|
+
Use `diviops_meta_info` as the S0 preflight before dogfooding or product work. It returns `server_version`, a numeric `tool_count`, a `tools` catalog summary (`registered_total`, always-on count, Pro possible/registered counts by target), `plugins` version records for `diviops-agent`, `diviops-agent-pro`, FluentCart, and FluentCart Pro when available, plus the existing handshake and slice state. In regular npm/stdio sessions, successfully observed plugin, module, capability, and registered-tool fields are the immutable handshake snapshot that built the session catalog. The additive `startup_capture` record supplies its non-secret timestamp, exact covered evidence, independent-component compatibility rule, and deterministic reconnect guidance. A failed handshake instead reports `startup_unavailable`, a bounded `startup_handshake_failed` reason class, and no covered target evidence. After a supported plugin, theme, or target change, reconnect or restart MCP before treating `meta_info`, the registered tools, or capability gates as current. Live read tools such as `diviops_fc_status` remain separate current observations; they do not rewrite startup registry truth.
|
|
163
|
+
|
|
164
|
+
Launcher health mode keeps its stricter existing contract: `diviops_meta_ping` and `diviops_meta_info` re-observe model-visible target evidence on every call. The regular stdio `startup_capture` record does not alter launcher behavior, direct npm/stdio compatibility, or tool registration after initialization.
|
|
110
165
|
|
|
111
166
|
Additional **conditionally-registered Pro tools** appear only on sites that have the Pro plugin (`diviops-agent-pro`) active alongside the target coverage plugin:
|
|
112
167
|
|
|
@@ -226,10 +281,12 @@ plus checksum, not an arbitrary filesystem path.
|
|
|
226
281
|
To collect the target JSON from the target WordPress site, call the Free/core
|
|
227
282
|
read-only MCP tool `diviops_cross_env_target_context_get` against the target
|
|
228
283
|
server and save the returned `data` object as `target.json`. Optional
|
|
229
|
-
`source_asset_hints` and `source_attachment_ids` let the
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
284
|
+
`source_asset_hints`, `source_upload_paths`, and `source_attachment_ids` let the
|
|
285
|
+
target site search for media-library candidates. `source_upload_paths` preserves
|
|
286
|
+
exact path provenance, including for root-level filenames; basename-only hints
|
|
287
|
+
remain ambiguous when multiple target paths share a filename. No media is
|
|
288
|
+
uploaded and no global colors or layouts are created. The export includes a
|
|
289
|
+
SHA-256 checksum of the current target layout
|
|
233
290
|
`post_content` as `destination_checksum` so preflight can bind the reviewed plan
|
|
234
291
|
to the target state without exposing the raw target content. It also includes
|
|
235
292
|
`global_color_value_evidence`, a deterministic SHA-256 digest map for resolved
|
|
@@ -380,7 +437,7 @@ Common quick fixes — full reference in [troubleshooting.md](../docs/troublesho
|
|
|
380
437
|
|
|
381
438
|
## Requirements
|
|
382
439
|
|
|
383
|
-
- Node.js >=
|
|
440
|
+
- Node.js >= 22.0.0
|
|
384
441
|
- PHP >= 7.4
|
|
385
442
|
- WordPress >= 6.5
|
|
386
443
|
- Divi 5 theme active
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DiviopsResponse } from "./envelope.js";
|
|
2
|
+
type Client = {
|
|
3
|
+
requestEnveloped(endpoint: string, options: {
|
|
4
|
+
method: string;
|
|
5
|
+
body: Record<string, unknown>;
|
|
6
|
+
}): Promise<DiviopsResponse<unknown>>;
|
|
7
|
+
};
|
|
8
|
+
export type AuthoringWriteSpec = {
|
|
9
|
+
endpoint: string;
|
|
10
|
+
method: string;
|
|
11
|
+
body: Record<string, unknown>;
|
|
12
|
+
operation: string;
|
|
13
|
+
dryRun: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function requestAuthoringWrite(client: Client, spec: AuthoringWriteSpec): Promise<DiviopsResponse<unknown>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { normalizeBody } from "./wp-client.js";
|
|
2
|
+
export async function requestAuthoringWrite(client, spec) {
|
|
3
|
+
const result = await client.requestEnveloped(spec.endpoint, {
|
|
4
|
+
method: spec.method,
|
|
5
|
+
body: normalizeBody(spec.body),
|
|
6
|
+
});
|
|
7
|
+
if (result.ok || result.error.code !== "authoring_shape.render_required")
|
|
8
|
+
return result;
|
|
9
|
+
// Older plugins still own their refusal. Never expose their private candidate
|
|
10
|
+
// handoff, manufacture a receipt, or replay a write to bypass that policy.
|
|
11
|
+
return {
|
|
12
|
+
ok: false,
|
|
13
|
+
error: {
|
|
14
|
+
code: result.error.code,
|
|
15
|
+
message: result.error.message,
|
|
16
|
+
...(result.error.hint ? { hint: result.error.hint } : {}),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SourceLayoutPayload } from "./cross-env-preflight/header-preflight.js";
|
|
2
|
+
export interface CrossEnvSourceHints {
|
|
3
|
+
source_asset_hints?: string[];
|
|
4
|
+
source_upload_paths?: string[];
|
|
5
|
+
source_attachment_ids?: number[];
|
|
6
|
+
}
|
|
7
|
+
export declare function sourceHintsFromPayload(source: SourceLayoutPayload): CrossEnvSourceHints;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function sourceHintsFromPayload(source) {
|
|
2
|
+
const hints = new Set();
|
|
3
|
+
const uploadPaths = new Set();
|
|
4
|
+
const ids = new Set();
|
|
5
|
+
for (const attachment of source.attachments ?? []) {
|
|
6
|
+
if (typeof attachment.id === "number" && Number.isInteger(attachment.id) && attachment.id > 0) {
|
|
7
|
+
ids.add(attachment.id);
|
|
8
|
+
}
|
|
9
|
+
for (const value of [attachment.path, attachment.url, attachment.filename]) {
|
|
10
|
+
if (typeof value === "string" && value.trim())
|
|
11
|
+
hints.add(value.trim());
|
|
12
|
+
}
|
|
13
|
+
if (typeof attachment.path === "string" && attachment.path.trim()) {
|
|
14
|
+
uploadPaths.add(attachment.path.trim());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
...(hints.size > 0 ? { source_asset_hints: [...hints].sort((a, b) => a.localeCompare(b)) } : {}),
|
|
19
|
+
...(uploadPaths.size > 0 ? { source_upload_paths: [...uploadPaths].sort((a, b) => a.localeCompare(b)) } : {}),
|
|
20
|
+
...(ids.size > 0 ? { source_attachment_ids: [...ids].sort((a, b) => a - b) } : {}),
|
|
21
|
+
};
|
|
22
|
+
}
|
package/dist/health-tools.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const META_PING_CONFIG: {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
export declare const META_INFO_CONFIG: {
|
|
16
|
-
readonly description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.";
|
|
16
|
+
readonly description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. In regular stdio mode, a successful plugin, module, capability, and registered-tool observation is the immutable startup snapshot; failed startup observation is explicitly unavailable and claims no target coverage. Reconnect or restart MCP after supported target changes. Launcher health mode continues to observe target evidence per call. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.";
|
|
17
17
|
readonly annotations: {
|
|
18
18
|
readonly readOnlyHint: true;
|
|
19
19
|
readonly idempotentHint: true;
|
package/dist/health-tools.js
CHANGED
|
@@ -9,7 +9,7 @@ export const META_PING_CONFIG = {
|
|
|
9
9
|
_meta: { idempotent: "true" },
|
|
10
10
|
};
|
|
11
11
|
export const META_INFO_CONFIG = {
|
|
12
|
-
description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
|
|
12
|
+
description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. In regular stdio mode, a successful plugin, module, capability, and registered-tool observation is the immutable startup snapshot; failed startup observation is explicitly unavailable and claims no target coverage. Reconnect or restart MCP after supported target changes. Launcher health mode continues to observe target evidence per call. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
|
|
13
13
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
14
14
|
_meta: { idempotent: "true" },
|
|
15
15
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -33,4 +33,4 @@ export type HandshakeState = {
|
|
|
33
33
|
* fixture deliberately share this seam so the v2 proof materializes the real
|
|
34
34
|
* Free/Pro-gated catalog instead of maintaining a second set of definitions.
|
|
35
35
|
*/
|
|
36
|
-
export declare function finalizeProductionRegistryForHandshake(state: HandshakeState): CanonicalToolRegistry;
|
|
36
|
+
export declare function finalizeProductionRegistryForHandshake(state: HandshakeState, observedAt?: string | Date | null): CanonicalToolRegistry;
|
package/dist/index.js
CHANGED
|
@@ -12,17 +12,20 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
12
12
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
import { WPClient } from "./wp-client.js";
|
|
15
|
+
import { requestAuthoringWrite } from "./authoring-shape-integration.js";
|
|
15
16
|
import { capabilityUpgradeHint, MissingCapabilityError, observedVersion, proToolGatesSatisfied, } from "./compatibility.js";
|
|
16
17
|
import { missingCapabilityEnvelope, } from "./capability-envelope.js";
|
|
17
18
|
import { ErrorCodes, envelopeMap, recordIdempotent, serializeEnvelope, withCode, wrapResponse, } from "./envelope.js";
|
|
18
19
|
import { preflightCrossEnvHeaderSync, } from "./cross-env-preflight/header-preflight.js";
|
|
19
20
|
import { preflightCrossEnvThemeBuilderLayoutSync, } from "./cross-env-preflight/layout-preflight.js";
|
|
20
21
|
import { crossEnvEvidenceLayoutKinds } from "./cross-env-preflight/layout-capability.js";
|
|
22
|
+
import { sourceHintsFromPayload } from "./cross-env-source-hints.js";
|
|
21
23
|
import { createSourcePayloadRef, loadSourcePayloadRef, } from "./cross-env-preflight/source-payload-ref.js";
|
|
22
24
|
import { optimizeSchema } from "./schema-optimizer.js";
|
|
23
25
|
import { schemaModuleRoute } from "./schema-route.js";
|
|
24
26
|
import { createWpCli } from "./wp-cli.js";
|
|
25
27
|
import { META_INFO_CONFIG, META_PING_CONFIG, requestAbortSignal, } from "./health-tools.js";
|
|
28
|
+
import { createStartupCaptureEvidence, } from "./startup-capture.js";
|
|
26
29
|
import { CanonicalToolRegistry } from "./canonical-tool-registry.js";
|
|
27
30
|
import { isolationFailure, scanValueForForeignVarRefs, writerIsolationErrorResult, } from "./validate-attrs.js";
|
|
28
31
|
import { readFileSync, readdirSync, realpathSync } from "fs";
|
|
@@ -51,6 +54,7 @@ const wp = new WPClient({
|
|
|
51
54
|
username: WP_USER,
|
|
52
55
|
applicationPassword: WP_APP_PASSWORD,
|
|
53
56
|
});
|
|
57
|
+
const authoringWrite = (endpoint, method, body, operation, dryRun) => requestAuthoringWrite(wp, { endpoint, method, body, operation, dryRun });
|
|
54
58
|
// WP-CLI (optional — Local by Flywheel via WP_PATH, or custom wrapper via WP_CLI_CMD)
|
|
55
59
|
const WP_PATH = process.env.WP_PATH ?? "";
|
|
56
60
|
const WP_CLI_CMD = process.env.WP_CLI_CMD?.trim() ?? "";
|
|
@@ -92,6 +96,7 @@ const SERVER_VERSION = (() => {
|
|
|
92
96
|
// ── MCP Server ───────────────────────────────────────────────────────
|
|
93
97
|
const registry = new CanonicalToolRegistry();
|
|
94
98
|
let handshakeState = { kind: "pending" };
|
|
99
|
+
let startupCaptureEvidence = createStartupCaptureEvidence(handshakeState, null);
|
|
95
100
|
const toolCatalog = [];
|
|
96
101
|
function recordToolCatalog(entry) {
|
|
97
102
|
const existing = toolCatalog.find((item) => item.name === entry.name && item.kind === entry.kind);
|
|
@@ -245,6 +250,7 @@ function buildMetaInfo() {
|
|
|
245
250
|
capabilities,
|
|
246
251
|
tool_count: tools.registered_total,
|
|
247
252
|
tools,
|
|
253
|
+
startup_capture: startupCaptureEvidence,
|
|
248
254
|
plugins: buildPluginVersionSummary(),
|
|
249
255
|
handshake: handshakeState.kind === "ok"
|
|
250
256
|
? {
|
|
@@ -1252,10 +1258,7 @@ registerPluginTool("diviops_page_update_content", {
|
|
|
1252
1258
|
body.dry_run = true;
|
|
1253
1259
|
if (backup)
|
|
1254
1260
|
body.backup = true;
|
|
1255
|
-
const result = await
|
|
1256
|
-
method: "POST",
|
|
1257
|
-
body,
|
|
1258
|
-
});
|
|
1261
|
+
const result = await authoringWrite(`/page/update-content/${page_id}`, "POST", body, "page_update_content", dry_run === true);
|
|
1259
1262
|
return {
|
|
1260
1263
|
content: [
|
|
1261
1264
|
{ type: "text", text: serializeEnvelope(result, "diviops_page_update_content") },
|
|
@@ -1865,10 +1868,7 @@ registerPluginTool("diviops_page_create", {
|
|
|
1865
1868
|
const body = { title, content: content ?? "", status: status ?? "draft" };
|
|
1866
1869
|
if (dry_run)
|
|
1867
1870
|
body.dry_run = true;
|
|
1868
|
-
const result = await
|
|
1869
|
-
method: "POST",
|
|
1870
|
-
body,
|
|
1871
|
-
});
|
|
1871
|
+
const result = await authoringWrite("/page/create", "POST", body, "page_create", dry_run === true);
|
|
1872
1872
|
return {
|
|
1873
1873
|
content: [
|
|
1874
1874
|
{ type: "text", text: serializeEnvelope(result, "diviops_page_create") },
|
|
@@ -2452,10 +2452,7 @@ registerPluginTool("diviops_library_save", {
|
|
|
2452
2452
|
const body = { title, content, layout_type, scope };
|
|
2453
2453
|
if (dry_run)
|
|
2454
2454
|
body.dry_run = true;
|
|
2455
|
-
const result = await
|
|
2456
|
-
method: "POST",
|
|
2457
|
-
body,
|
|
2458
|
-
});
|
|
2455
|
+
const result = await authoringWrite("/library/save", "POST", body, "library_save", dry_run === true);
|
|
2459
2456
|
return {
|
|
2460
2457
|
content: [
|
|
2461
2458
|
{ type: "text", text: serializeEnvelope(result, "diviops_library_save") },
|
|
@@ -2530,6 +2527,10 @@ function registerCrossEnvEvidenceTools() {
|
|
|
2530
2527
|
.array(z.string())
|
|
2531
2528
|
.optional()
|
|
2532
2529
|
.describe("Optional source upload paths, asset URLs, or basenames used to search target media candidates. Query strings, fragments, and credentials are stripped from output."),
|
|
2530
|
+
source_upload_paths: z
|
|
2531
|
+
.array(z.string())
|
|
2532
|
+
.optional()
|
|
2533
|
+
.describe("Optional source-export attachment paths with exact-path provenance, including root-level filenames."),
|
|
2533
2534
|
source_attachment_ids: z
|
|
2534
2535
|
.array(z.number())
|
|
2535
2536
|
.optional()
|
|
@@ -2542,7 +2543,7 @@ function registerCrossEnvEvidenceTools() {
|
|
|
2542
2543
|
},
|
|
2543
2544
|
annotations: { idempotentHint: true },
|
|
2544
2545
|
_meta: { idempotent: "true" },
|
|
2545
|
-
}, async ({ destination_id, destination_kind, source_asset_hints, source_attachment_ids, }) => {
|
|
2546
|
+
}, async ({ destination_id, destination_kind, source_asset_hints, source_upload_paths, source_attachment_ids, }) => {
|
|
2546
2547
|
const body = {
|
|
2547
2548
|
destination_id,
|
|
2548
2549
|
destination_kind: destination_kind ?? "tb_header_layout",
|
|
@@ -2550,6 +2551,9 @@ function registerCrossEnvEvidenceTools() {
|
|
|
2550
2551
|
if (source_asset_hints && source_asset_hints.length > 0) {
|
|
2551
2552
|
body.source_asset_hints = source_asset_hints;
|
|
2552
2553
|
}
|
|
2554
|
+
if (source_upload_paths && source_upload_paths.length > 0) {
|
|
2555
|
+
body.source_upload_paths = source_upload_paths;
|
|
2556
|
+
}
|
|
2553
2557
|
if (source_attachment_ids && source_attachment_ids.length > 0) {
|
|
2554
2558
|
body.source_attachment_ids = source_attachment_ids;
|
|
2555
2559
|
}
|
|
@@ -2644,10 +2648,7 @@ registerPluginTool("diviops_tb_layout_update", {
|
|
|
2644
2648
|
body.dry_run = true;
|
|
2645
2649
|
if (backup)
|
|
2646
2650
|
body.backup = true;
|
|
2647
|
-
const result = await
|
|
2648
|
-
method: "PUT",
|
|
2649
|
-
body,
|
|
2650
|
-
});
|
|
2651
|
+
const result = await authoringWrite(`/theme-builder/layout/update/${layout_id}`, "PUT", body, "tb_layout_update", dry_run === true);
|
|
2651
2652
|
return {
|
|
2652
2653
|
content: [
|
|
2653
2654
|
{ type: "text", text: serializeEnvelope(result, "diviops_tb_layout_update") },
|
|
@@ -2736,10 +2737,7 @@ registerPluginTool("diviops_tb_template_create", {
|
|
|
2736
2737
|
const body = { title, condition, header_content, footer_content };
|
|
2737
2738
|
if (dry_run)
|
|
2738
2739
|
body.dry_run = true;
|
|
2739
|
-
const result = await
|
|
2740
|
-
method: "POST",
|
|
2741
|
-
body,
|
|
2742
|
-
});
|
|
2740
|
+
const result = await authoringWrite("/theme-builder/template/create", "POST", body, "tb_template_create", dry_run === true);
|
|
2743
2741
|
return {
|
|
2744
2742
|
content: [
|
|
2745
2743
|
{ type: "text", text: serializeEnvelope(result, "diviops_tb_template_create") },
|
|
@@ -2826,7 +2824,7 @@ registerPluginTool("diviops_canvas_create", {
|
|
|
2826
2824
|
body.z_index = z_index;
|
|
2827
2825
|
if (dry_run)
|
|
2828
2826
|
body.dry_run = true;
|
|
2829
|
-
const result = await
|
|
2827
|
+
const result = await authoringWrite("/canvas/create", "POST", body, "canvas_create", dry_run === true);
|
|
2830
2828
|
return {
|
|
2831
2829
|
content: [
|
|
2832
2830
|
{ type: "text", text: serializeEnvelope(result, "diviops_canvas_create") },
|
|
@@ -2971,10 +2969,7 @@ registerPluginTool("diviops_canvas_update", {
|
|
|
2971
2969
|
body.z_index = z_index;
|
|
2972
2970
|
if (dry_run)
|
|
2973
2971
|
body.dry_run = true;
|
|
2974
|
-
const result = await
|
|
2975
|
-
method: "POST",
|
|
2976
|
-
body,
|
|
2977
|
-
});
|
|
2972
|
+
const result = await authoringWrite(`/canvas/update/${canvas_post_id}`, "POST", body, "canvas_update", dry_run === true);
|
|
2978
2973
|
return {
|
|
2979
2974
|
content: [
|
|
2980
2975
|
{ type: "text", text: serializeEnvelope(result, "diviops_canvas_update") },
|
|
@@ -4133,23 +4128,6 @@ const CrossEnvSourcePayloadRefSchema = z
|
|
|
4133
4128
|
function normalizeReviewedFingerprint(value) {
|
|
4134
4129
|
return value.trim().replace(/^sha256:/i, "").toLowerCase();
|
|
4135
4130
|
}
|
|
4136
|
-
function sourceHintsFromPayload(source) {
|
|
4137
|
-
const hints = new Set();
|
|
4138
|
-
const ids = new Set();
|
|
4139
|
-
for (const attachment of source.attachments ?? []) {
|
|
4140
|
-
if (typeof attachment.id === "number" && Number.isInteger(attachment.id) && attachment.id > 0) {
|
|
4141
|
-
ids.add(attachment.id);
|
|
4142
|
-
}
|
|
4143
|
-
for (const value of [attachment.path, attachment.url, attachment.filename]) {
|
|
4144
|
-
if (typeof value === "string" && value.trim())
|
|
4145
|
-
hints.add(value.trim());
|
|
4146
|
-
}
|
|
4147
|
-
}
|
|
4148
|
-
return {
|
|
4149
|
-
...(hints.size > 0 ? { source_asset_hints: [...hints].sort((a, b) => a.localeCompare(b)) } : {}),
|
|
4150
|
-
...(ids.size > 0 ? { source_attachment_ids: [...ids].sort((a, b) => a - b) } : {}),
|
|
4151
|
-
};
|
|
4152
|
-
}
|
|
4153
4131
|
const ManagedRecoveryPolicySchema = z
|
|
4154
4132
|
.object({
|
|
4155
4133
|
version: z.literal(1),
|
|
@@ -5561,11 +5539,12 @@ let productionRegistryFinalized = false;
|
|
|
5561
5539
|
* fixture deliberately share this seam so the v2 proof materializes the real
|
|
5562
5540
|
* Free/Pro-gated catalog instead of maintaining a second set of definitions.
|
|
5563
5541
|
*/
|
|
5564
|
-
export function finalizeProductionRegistryForHandshake(state) {
|
|
5542
|
+
export function finalizeProductionRegistryForHandshake(state, observedAt = new Date()) {
|
|
5565
5543
|
if (productionRegistryFinalized) {
|
|
5566
5544
|
throw new Error("Production MCP registry has already been finalized");
|
|
5567
5545
|
}
|
|
5568
5546
|
handshakeState = state;
|
|
5547
|
+
startupCaptureEvidence = createStartupCaptureEvidence(state, observedAt);
|
|
5569
5548
|
registerCrossEnvEvidenceTools();
|
|
5570
5549
|
registerProTools();
|
|
5571
5550
|
productionRegistryFinalized = true;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const STARTUP_CAPTURE_RECONNECT_GUIDANCE = "Plugin, theme, or target changes require reconnecting or restarting the MCP session before diviops_meta_info, the registered tool catalog, and capability gates can be treated as current.";
|
|
2
|
+
export declare const STARTUP_CAPTURE_MIXED_VERSION_GUIDANCE = "DiviOps MCP server and WordPress component versions are independent. Compatibility is determined by the per-capability startup handshake, not by matching version numbers.";
|
|
3
|
+
export declare const STARTUP_CAPTURE_LIVE_READ_GUIDANCE = "Live read tools such as diviops_fc_status are separate current target observations and do not refresh this startup snapshot or the registered tool catalog.";
|
|
4
|
+
export declare function createStartupCaptureEvidence(observation: {
|
|
5
|
+
kind: "ok" | "failed" | "pending";
|
|
6
|
+
}, observedAt?: string | Date | null): {
|
|
7
|
+
mode: "startup_captured" | "startup_unavailable";
|
|
8
|
+
captured_at: string | null;
|
|
9
|
+
attempted_at: string | null;
|
|
10
|
+
timestamp_status: "recorded" | "unavailable_legacy" | "observation_failed";
|
|
11
|
+
observation: {
|
|
12
|
+
state: "ok" | "failed" | "pending";
|
|
13
|
+
reason_class: "startup_handshake_failed" | "startup_handshake_pending" | null;
|
|
14
|
+
};
|
|
15
|
+
immutable_for_session: boolean;
|
|
16
|
+
covers: ("capabilities" | "plugin_versions" | "module_activation" | "registered_tool_catalog")[];
|
|
17
|
+
freshness: {
|
|
18
|
+
status: "startup_snapshot" | "unavailable";
|
|
19
|
+
invalidated_by: ("plugin_change" | "theme_change" | "target_change")[];
|
|
20
|
+
action: "reconnect_or_restart_mcp";
|
|
21
|
+
guidance: string;
|
|
22
|
+
};
|
|
23
|
+
compatibility: {
|
|
24
|
+
component_versions: "independent";
|
|
25
|
+
authority: "per_capability_startup_handshake";
|
|
26
|
+
guidance: string;
|
|
27
|
+
};
|
|
28
|
+
live_observations: {
|
|
29
|
+
separate: boolean;
|
|
30
|
+
guidance: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type StartupCaptureEvidence = ReturnType<typeof createStartupCaptureEvidence>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const STARTUP_CAPTURE_RECONNECT_GUIDANCE = "Plugin, theme, or target changes require reconnecting or restarting the MCP session before diviops_meta_info, the registered tool catalog, and capability gates can be treated as current.";
|
|
2
|
+
export const STARTUP_CAPTURE_MIXED_VERSION_GUIDANCE = "DiviOps MCP server and WordPress component versions are independent. Compatibility is determined by the per-capability startup handshake, not by matching version numbers.";
|
|
3
|
+
export const STARTUP_CAPTURE_LIVE_READ_GUIDANCE = "Live read tools such as diviops_fc_status are separate current target observations and do not refresh this startup snapshot or the registered tool catalog.";
|
|
4
|
+
const STARTUP_CAPTURE_COVERS = [
|
|
5
|
+
"plugin_versions",
|
|
6
|
+
"module_activation",
|
|
7
|
+
"capabilities",
|
|
8
|
+
"registered_tool_catalog",
|
|
9
|
+
];
|
|
10
|
+
const STARTUP_CAPTURE_INVALIDATED_BY = [
|
|
11
|
+
"plugin_change",
|
|
12
|
+
"theme_change",
|
|
13
|
+
"target_change",
|
|
14
|
+
];
|
|
15
|
+
function captureTimestamp(value) {
|
|
16
|
+
if (value instanceof Date) {
|
|
17
|
+
return Number.isNaN(value.getTime()) ? null : value.toISOString();
|
|
18
|
+
}
|
|
19
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
20
|
+
return null;
|
|
21
|
+
const parsed = new Date(value);
|
|
22
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
23
|
+
}
|
|
24
|
+
export function createStartupCaptureEvidence(observation, observedAt) {
|
|
25
|
+
const observationState = observation.kind;
|
|
26
|
+
const timestamp = captureTimestamp(observedAt);
|
|
27
|
+
const captured = observationState === "ok";
|
|
28
|
+
return {
|
|
29
|
+
mode: captured
|
|
30
|
+
? "startup_captured"
|
|
31
|
+
: "startup_unavailable",
|
|
32
|
+
captured_at: captured ? timestamp : null,
|
|
33
|
+
attempted_at: captured ? null : timestamp,
|
|
34
|
+
timestamp_status: captured
|
|
35
|
+
? timestamp
|
|
36
|
+
? "recorded"
|
|
37
|
+
: "unavailable_legacy"
|
|
38
|
+
: timestamp
|
|
39
|
+
? "observation_failed"
|
|
40
|
+
: "unavailable_legacy",
|
|
41
|
+
observation: {
|
|
42
|
+
state: observationState,
|
|
43
|
+
reason_class: observationState === "failed"
|
|
44
|
+
? "startup_handshake_failed"
|
|
45
|
+
: observationState === "pending"
|
|
46
|
+
? "startup_handshake_pending"
|
|
47
|
+
: null,
|
|
48
|
+
},
|
|
49
|
+
immutable_for_session: true,
|
|
50
|
+
covers: captured ? [...STARTUP_CAPTURE_COVERS] : [],
|
|
51
|
+
freshness: {
|
|
52
|
+
status: captured
|
|
53
|
+
? "startup_snapshot"
|
|
54
|
+
: "unavailable",
|
|
55
|
+
invalidated_by: [...STARTUP_CAPTURE_INVALIDATED_BY],
|
|
56
|
+
action: "reconnect_or_restart_mcp",
|
|
57
|
+
guidance: STARTUP_CAPTURE_RECONNECT_GUIDANCE,
|
|
58
|
+
},
|
|
59
|
+
compatibility: {
|
|
60
|
+
component_versions: "independent",
|
|
61
|
+
authority: "per_capability_startup_handshake",
|
|
62
|
+
guidance: STARTUP_CAPTURE_MIXED_VERSION_GUIDANCE,
|
|
63
|
+
},
|
|
64
|
+
live_observations: {
|
|
65
|
+
separate: true,
|
|
66
|
+
guidance: STARTUP_CAPTURE_LIVE_READ_GUIDANCE,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
package/dist/wp-client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { type HandshakeResult } from './compatibility.js';
|
|
8
8
|
import { type DiviopsResponse } from './envelope.js';
|
|
9
|
+
export declare function normalizeBody(value: unknown, withinBlockTree?: boolean): unknown;
|
|
9
10
|
export interface WPClientConfig {
|
|
10
11
|
siteUrl: string;
|
|
11
12
|
username: string;
|
package/dist/wp-client.js
CHANGED
|
@@ -99,7 +99,7 @@ const NON_BLOCK_STORAGE_PREFIXES = [
|
|
|
99
99
|
function endpointSkipsNormalization(endpoint) {
|
|
100
100
|
return NON_BLOCK_STORAGE_PREFIXES.some((prefix) => endpoint.startsWith(prefix));
|
|
101
101
|
}
|
|
102
|
-
function normalizeBody(value, withinBlockTree = false) {
|
|
102
|
+
export function normalizeBody(value, withinBlockTree = false) {
|
|
103
103
|
if (typeof value === 'string') {
|
|
104
104
|
return withinBlockTree ? normalizeQuoteEscapes(value) : value;
|
|
105
105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diviops/mcp-server",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.41",
|
|
4
4
|
"description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
"!dist/launcher-bootstrap.d.ts",
|
|
17
17
|
"!dist/launcher-sidecar.js",
|
|
18
18
|
"!dist/launcher-sidecar.d.ts",
|
|
19
|
+
"!dist/authoring-browser-contract.js",
|
|
20
|
+
"!dist/authoring-browser-contract.d.ts",
|
|
21
|
+
"!dist/authoring-browser-coordinator.js",
|
|
22
|
+
"!dist/authoring-browser-coordinator.d.ts",
|
|
23
|
+
"!dist/authoring-browser-runtime.js",
|
|
24
|
+
"!dist/authoring-browser-runtime.d.ts",
|
|
25
|
+
"!dist/authoring-browser-worker.js",
|
|
26
|
+
"!dist/authoring-browser-worker.d.ts",
|
|
19
27
|
"templates",
|
|
20
28
|
"data/verified-attrs.json",
|
|
21
29
|
"data/verified-attrs-backlog.json",
|
|
@@ -25,9 +33,10 @@
|
|
|
25
33
|
"build": "tsc",
|
|
26
34
|
"start": "node dist/index.js",
|
|
27
35
|
"dev": "tsc --watch",
|
|
28
|
-
"test": "npm run build && node --test dist/__tests__/*.test.js dist/preset-cli/__tests__/*.test.js dist/cross-env-preflight/__tests__/*.test.js && node scripts/check-release-boundary.mjs",
|
|
36
|
+
"test": "npm run build && node --test dist/__tests__/*.test.js dist/preset-cli/__tests__/*.test.js dist/cross-env-preflight/__tests__/*.test.js scripts/authoring-release-boundary.test.mjs && node scripts/check-release-boundary.mjs",
|
|
29
37
|
"prepublishOnly": "npm run build",
|
|
30
|
-
"regen:skill": "node scripts/regen-module-formats.mjs"
|
|
38
|
+
"regen:skill": "node scripts/regen-module-formats.mjs",
|
|
39
|
+
"check:authoring-shape-budget": "node scripts/check-page-sized-html-fallback-production-budget.mjs"
|
|
31
40
|
},
|
|
32
41
|
"keywords": [
|
|
33
42
|
"mcp",
|
|
@@ -48,10 +57,15 @@
|
|
|
48
57
|
},
|
|
49
58
|
"homepage": "https://github.com/oaris-dev/diviops/tree/main/diviops-server#readme",
|
|
50
59
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
60
|
+
"node": ">=22.0.0"
|
|
52
61
|
},
|
|
53
62
|
"dependencies": {
|
|
54
|
-
"@
|
|
63
|
+
"@hono/node-server": "2.1.0",
|
|
64
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
65
|
+
"body-parser": "2.3.0",
|
|
66
|
+
"fast-uri": "3.1.5",
|
|
67
|
+
"hono": "4.13.1",
|
|
68
|
+
"ip-address": "10.5.0",
|
|
55
69
|
"zod": "^4.3.6"
|
|
56
70
|
},
|
|
57
71
|
"devDependencies": {
|
|
@@ -59,6 +73,7 @@
|
|
|
59
73
|
"@modelcontextprotocol/core": "2.0.0",
|
|
60
74
|
"@modelcontextprotocol/server": "2.0.0",
|
|
61
75
|
"@types/node": "^22.0.0",
|
|
76
|
+
"playwright-core": "1.62.1",
|
|
62
77
|
"typescript": "^5.7.0"
|
|
63
78
|
}
|
|
64
79
|
}
|