@diviops/mcp-server 1.5.37 → 1.5.39

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 CHANGED
@@ -65,6 +65,13 @@ Then ask your AI client: **"List the pages on my site."** It calls `diviops_page
65
65
 
66
66
  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
67
 
68
+ The public npm package exposes exactly three supported CLIs:
69
+ `diviops-mcp`, `diviops-preset`, and `diviops-cross-env-preflight`. The
70
+ launcher-managed MCP sidecar is a separate future artifact identity; it is not
71
+ a public npm bin or part of the npm tarball. Repository launcher development
72
+ builds and supplies that private entrypoint explicitly. This boundary does not
73
+ change direct npm/stdio support.
74
+
68
75
  For a deeper walkthrough (containerized environments, WP-CLI configuration, troubleshooting installation), see [setup-guide.md](../docs/setup-guide.md).
69
76
 
70
77
  ## Example workflow
@@ -83,7 +90,7 @@ The skill enforces the Divi block format, the design system, and the response co
83
90
 
84
91
  ## Tools at a glance
85
92
 
86
- The server exposes **91 always-on tools** across the categories below. Each category links to representative tools; the full table lives in [server-reference.md](../docs/server-reference.md).
93
+ The server exposes **94 always-on tools** across the categories below. Each category links to representative tools; the full table lives in [server-reference.md](../docs/server-reference.md).
87
94
 
88
95
  | Category | Use case | Tool prefixes |
89
96
  |----------|----------|---------------|
@@ -91,6 +98,7 @@ The server exposes **91 always-on tools** across the categories below. Each cate
91
98
  | Design system | Manage colors, fonts, variables, presets | `variable_*`, `global_color_*`, `global_font_*`, `preset_*` |
92
99
  | Library + templates | Reusable layouts + Theme Builder | `library_*`, `template_*`, `tb_*` |
93
100
  | WordPress menus | Author reusable nav menus and theme-location assignments | `menu_*` |
101
+ | Semantic SEO metadata | Inspect provider support and author two explicit TSF text fields with checksum/readback guards | `seo_*` |
94
102
  | Schema introspection | Module attribute discovery | `schema_*` |
95
103
  | Canvas / off-canvas | Popups, modals, menus | `canvas_*` |
96
104
  | SCF integration | Secure Custom Fields sync | `scf_*` |
@@ -274,13 +282,13 @@ Tools return a standardized envelope. The shape lets clients branch on `ok` and
274
282
  | `validation_failed` | 400 | `validate_blocks`-detected shape error |
275
283
  | `conflict` | 409 | Uniqueness collision |
276
284
  | `forbidden` | 403 | Row-level WordPress auth signal |
277
- | `capability_missing` | 412 | Plugin version below required for this tool |
285
+ | `capability_missing` | 412 | Connected plugin does not advertise the capability required by this tool; component versions are independent |
278
286
  | `wp_error` | 500 | Underlying WordPress error |
279
287
  | `divi_error` | 500 | Divi-specific error (block parser, validator, etc.) |
280
288
 
281
289
  ### Namespace-specific codes
282
290
 
283
- Namespaces extend the vocabulary using the `<namespace>.<reason>` convention — e.g. `meta_wp_cli.command_failed`, `scf.not_configured`, `preset.bucket_mismatch`, `variable.customizer_default_immutable`. Namespace-prefixed codes carry structured `error.data` documenting the failure (exit codes, conflicting fields, reference counts, etc.). Per-tool descriptions name the codes each tool emits and the `error.data` shape that accompanies them.
291
+ Namespaces extend the vocabulary using the `<namespace>.<reason>` convention — e.g. `meta_wp_cli.command_failed`, `scf.not_configured`, `preset.bucket_mismatch`, `variable.customizer_default_immutable`, `seo.provider_absent`, and `seo.metadata_drift`. Namespace-prefixed codes carry structured `error.data` documenting the failure (exit codes, conflicting fields, reference counts, checksums, rollback evidence, etc.). Per-tool descriptions name the codes each tool emits and the `error.data` shape that accompanies them.
284
292
 
285
293
  ### Per-tool `error.data` extensions
286
294
 
@@ -319,6 +327,13 @@ permission, refuses content or supported Divi post-meta drift before mutation,
319
327
  uses the same full-content integrity/readback guard, and has no force override
320
328
  or second pre-restore snapshot in this MVP.
321
329
 
330
+ `diviops_seo_metadata_update` is a separate explicit-metadata-only path. It
331
+ accepts no raw provider keys, requires the checksum from
332
+ `diviops_seo_metadata_get`, validates plain text before TSF sanitization,
333
+ verifies exact stored readback, and performs request-local restoration on a
334
+ mismatch. It does not create a persistent rollback snapshot; effective
335
+ provider output is verified through a follow-up get request.
336
+
322
337
  ### `_meta.idempotent` markers
323
338
 
324
339
  Every tool's `_meta.idempotent` field documents how it behaves under repeat calls with identical inputs. Some tools are silent-success idempotent (e.g. `page_trash` on an already-trashed post returns `ok: true` with `data.already_trashed = true`); others are side-effect-equivalent (re-running produces the same final state via different intermediate effects). See [idempotency-audit.md](../docs/idempotency-audit.md) for the per-tool record.
@@ -350,7 +365,7 @@ Common quick fixes — full reference in [troubleshooting.md](../docs/troublesho
350
365
  - **"Missing required environment variable(s)"** — ensure `WP_URL`, `WP_USER`, `WP_APP_PASSWORD` are all set on `claude mcp add`.
351
366
  - **`npx` fails with "could not determine executable to run"** — use `npx -y --package @diviops/mcp-server diviops-mcp`; this explicitly selects the MCP server bin.
352
367
  - **"Connection failed"** — verify the plugin is active by visiting `{WP_URL}/wp-json/diviops/v1/schema/settings`; test the credentials with `curl -u "user:pass" …`.
353
- - **"This tool requires plugin capability"** — the plugin doesn't advertise the capability this tool needs. Update the plugin to the latest release.
368
+ - **"This tool requires plugin capability"** — the connected plugin does not advertise the capability this tool needs. Server and plugin versions are independent; install a compatible plugin from the same DiviOps suite release or a newer supported component, then reconnect or restart the MCP session to refresh the handshake.
354
369
  - **Preset edits not visible on the frontend** — Divi serves frontend CSS from `wp-content/et-cache/{post_id}/`, which `wp cache flush` doesn't touch. Use `diviops_meta_flush_cache` after preset writes; `post_id` mode also sweeps that exact directory and reports `post_dir_sweep` evidence.
355
370
 
356
371
  ## Learn more
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Transport-neutral ownership of DiviOps MCP registrations.
3
+ *
4
+ * The shipped server still materializes this registry into the v1 SDK. The
5
+ * non-publishing v2 compatibility spike materializes the same definitions
6
+ * into the split v2 server package. Keeping the registry ignorant of either
7
+ * SDK is the guard against a second tool catalog or a wire-shape translator.
8
+ */
9
+ export type ToolRegistrar = {
10
+ registerTool(name: string, config: any, handler: any): unknown;
11
+ };
12
+ export type ResourceRegistrar = {
13
+ registerResource(name: string, uri: string, config: any, handler: any): unknown;
14
+ };
15
+ export type RegistryTarget = ToolRegistrar & ResourceRegistrar;
16
+ export declare class CanonicalToolRegistry implements RegistryTarget {
17
+ #private;
18
+ registerTool(name: string, config: any, handler: any): void;
19
+ registerResource(name: string, uri: string, config: any, handler: any): void;
20
+ install(target: RegistryTarget): void;
21
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Transport-neutral ownership of DiviOps MCP registrations.
3
+ *
4
+ * The shipped server still materializes this registry into the v1 SDK. The
5
+ * non-publishing v2 compatibility spike materializes the same definitions
6
+ * into the split v2 server package. Keeping the registry ignorant of either
7
+ * SDK is the guard against a second tool catalog or a wire-shape translator.
8
+ */
9
+ export class CanonicalToolRegistry {
10
+ #tools = new Map();
11
+ #resources = new Map();
12
+ registerTool(name, config, handler) {
13
+ if (this.#tools.has(name)) {
14
+ throw new Error(`Duplicate canonical MCP tool registration: ${name}`);
15
+ }
16
+ this.#tools.set(name, { name, config, handler });
17
+ }
18
+ registerResource(name, uri, config, handler) {
19
+ if (this.#resources.has(name)) {
20
+ throw new Error(`Duplicate canonical MCP resource registration: ${name}`);
21
+ }
22
+ this.#resources.set(name, { name, uri, config, handler });
23
+ }
24
+ install(target) {
25
+ for (const registration of this.#tools.values()) {
26
+ target.registerTool(registration.name, registration.config, registration.handler);
27
+ }
28
+ for (const registration of this.#resources.values()) {
29
+ target.registerResource(registration.name, registration.uri, registration.config, registration.handler);
30
+ }
31
+ }
32
+ }
33
+ /* eslint-enable @typescript-eslint/no-explicit-any */
@@ -5,8 +5,13 @@ export type MissingCapabilityMcpResult = {
5
5
  text: string;
6
6
  }>;
7
7
  };
8
+ export type MissingCapabilityEnvelopeOptions = {
9
+ hint?: string;
10
+ serverVersion?: string | null;
11
+ releaseEvidence?: unknown;
12
+ };
8
13
  /**
9
14
  * Convert a server-side capability gate failure into the canonical DiviOps
10
15
  * response envelope carried in MCP text content.
11
16
  */
12
- export declare function missingCapabilityEnvelope(error: MissingCapabilityError, toolName: string, hint?: string): MissingCapabilityMcpResult;
17
+ export declare function missingCapabilityEnvelope(error: MissingCapabilityError, toolName: string, options?: MissingCapabilityEnvelopeOptions): MissingCapabilityMcpResult;
@@ -1,21 +1,32 @@
1
+ import { capabilityUpgradeHint, observedVersion, } from "./compatibility.js";
1
2
  import { ErrorCodes, serializeEnvelope, } from "./envelope.js";
2
- const DEFAULT_HINT = "Update the diviops-agent WP plugin to the version shipped with this MCP server release.";
3
3
  /**
4
4
  * Convert a server-side capability gate failure into the canonical DiviOps
5
5
  * response envelope carried in MCP text content.
6
6
  */
7
- export function missingCapabilityEnvelope(error, toolName, hint = DEFAULT_HINT) {
7
+ export function missingCapabilityEnvelope(error, toolName, options = {}) {
8
+ const pluginVersion = observedVersion(error.pluginVersion);
9
+ const serverVersion = observedVersion(options.serverVersion);
10
+ const diagnosticData = {
11
+ capability: error.capability,
12
+ plugin_component: error.pluginComponent === "pro" ? "diviops-agent-pro" : "diviops-agent",
13
+ tool: toolName,
14
+ };
15
+ if (pluginVersion)
16
+ diagnosticData.plugin_version = pluginVersion;
17
+ if (serverVersion)
18
+ diagnosticData.server_version = serverVersion;
19
+ if (options.releaseEvidence !== undefined) {
20
+ diagnosticData.release_evidence = options.releaseEvidence;
21
+ }
8
22
  const failure = {
9
23
  ok: false,
10
24
  error: {
11
25
  code: ErrorCodes.CAPABILITY_MISSING,
12
26
  message: error.message,
13
- hint,
14
- data: {
15
- capability: error.capability,
16
- plugin_version: error.pluginVersion,
17
- tool: toolName,
18
- },
27
+ hint: options.hint ??
28
+ capabilityUpgradeHint(error.capability, error.pluginComponent),
29
+ data: diagnosticData,
19
30
  },
20
31
  };
21
32
  return {
@@ -6,12 +6,11 @@
6
6
  * `/handshake`. See `wp-client.ts` (handshake parse) and `index.ts`
7
7
  * (`requireCapability` gate at each plugin-touching tool entry).
8
8
  *
9
- * Implicit floor: pre-1.2.0 plugins emit `capabilities` as a string[] of
10
- * coarse namespace tags, not the per-tool map this server expects.
11
- * `wp-client.ts` normalizes that legacy shape to an empty map, which makes
12
- * every gated tool fail fast with the upgrade hint. So while there is no
13
- * declared `MIN_PLUGIN_VERSION` constant, the capability-map shape change
14
- * effectively sets a 1.2.0 floor for any tool that calls `requireCapability`.
9
+ * Legacy plugins may emit `capabilities` as a string[] of coarse namespace
10
+ * tags, not the per-tool map this server expects. `wp-client.ts` normalizes
11
+ * that legacy shape to an empty map, which makes every gated tool fail fast
12
+ * with capability-based upgrade guidance. No numeric plugin-version floor is
13
+ * inferred from that legacy response.
15
14
  *
16
15
  * `compareVersions` is kept exported because handshake helper code and
17
16
  * future per-tool soft-deprecation messages may want it.
@@ -64,7 +63,7 @@ export interface HandshakePluginInfo {
64
63
  */
65
64
  export interface HandshakeResult {
66
65
  compatible: boolean;
67
- plugin_version: string;
66
+ plugin_version?: string | null;
68
67
  min_server: string;
69
68
  divi: {
70
69
  active: boolean;
@@ -81,6 +80,13 @@ export interface HandshakeResult {
81
80
  active_modules?: Record<string, boolean>;
82
81
  /** Advisory installed-plugin versions for S0 preflight reports. */
83
82
  plugins?: Record<string, HandshakePluginInfo>;
83
+ /** Permission-gated non-secret identity of the authenticated App Password owner. */
84
+ authenticated_user?: {
85
+ id: number;
86
+ login: string;
87
+ };
88
+ /** Observed WordPress site URL; normalized and pinned by launcher mode. */
89
+ site_url?: string;
84
90
  }
85
91
  export declare function proToolGatesSatisfied(state: {
86
92
  proActive: boolean;
@@ -99,6 +105,10 @@ export declare function proToolGatesSatisfied(state: {
99
105
  */
100
106
  export declare class MissingCapabilityError extends Error {
101
107
  readonly capability: string;
102
- readonly pluginVersion: string;
103
- constructor(capability: string, pluginVersion: string);
108
+ readonly pluginVersion?: string | null | undefined;
109
+ readonly pluginComponent: "free" | "pro";
110
+ constructor(capability: string, pluginVersion?: string | null | undefined, pluginComponent?: "free" | "pro");
104
111
  }
112
+ export declare function observedVersion(version?: string | null): string | null;
113
+ export declare function capabilityMissingMessage(capability: string, pluginVersion?: string | null, pluginComponent?: "free" | "pro"): string;
114
+ export declare function capabilityUpgradeHint(capability: string, pluginComponent?: "free" | "pro", alternative?: string): string;
@@ -6,12 +6,11 @@
6
6
  * `/handshake`. See `wp-client.ts` (handshake parse) and `index.ts`
7
7
  * (`requireCapability` gate at each plugin-touching tool entry).
8
8
  *
9
- * Implicit floor: pre-1.2.0 plugins emit `capabilities` as a string[] of
10
- * coarse namespace tags, not the per-tool map this server expects.
11
- * `wp-client.ts` normalizes that legacy shape to an empty map, which makes
12
- * every gated tool fail fast with the upgrade hint. So while there is no
13
- * declared `MIN_PLUGIN_VERSION` constant, the capability-map shape change
14
- * effectively sets a 1.2.0 floor for any tool that calls `requireCapability`.
9
+ * Legacy plugins may emit `capabilities` as a string[] of coarse namespace
10
+ * tags, not the per-tool map this server expects. `wp-client.ts` normalizes
11
+ * that legacy shape to an empty map, which makes every gated tool fail fast
12
+ * with capability-based upgrade guidance. No numeric plugin-version floor is
13
+ * inferred from that legacy response.
15
14
  *
16
15
  * `compareVersions` is kept exported because handshake helper code and
17
16
  * future per-tool soft-deprecation messages may want it.
@@ -100,11 +99,41 @@ export function proToolGatesSatisfied(state, gates) {
100
99
  export class MissingCapabilityError extends Error {
101
100
  capability;
102
101
  pluginVersion;
103
- constructor(capability, pluginVersion) {
104
- super(`Tool requires plugin capability "${capability}", which is not present in the active diviops-agent plugin (version ${pluginVersion}). ` +
105
- 'Upgrade the diviops-agent plugin to the version shipped alongside this MCP server release.');
102
+ pluginComponent;
103
+ constructor(capability, pluginVersion, pluginComponent = "free") {
104
+ super(capabilityMissingMessage(capability, pluginVersion, pluginComponent));
106
105
  this.capability = capability;
107
106
  this.pluginVersion = pluginVersion;
107
+ this.pluginComponent = pluginComponent;
108
108
  this.name = 'MissingCapabilityError';
109
109
  }
110
110
  }
111
+ export function observedVersion(version) {
112
+ if (typeof version !== "string")
113
+ return null;
114
+ const normalized = version.trim();
115
+ return normalized && normalized.toLowerCase() !== "unknown"
116
+ ? normalized
117
+ : null;
118
+ }
119
+ export function capabilityMissingMessage(capability, pluginVersion, pluginComponent = "free") {
120
+ const component = pluginComponent === "pro"
121
+ ? "Pro WordPress plugin"
122
+ : "Free WordPress plugin";
123
+ const version = observedVersion(pluginVersion);
124
+ const versionEvidence = version ? ` (observed version ${version})` : "";
125
+ return (`The connected ${component}${versionEvidence} does not advertise ` +
126
+ `the "${capability}" capability required by this operation. ` +
127
+ "MCP server and WordPress plugin versions are independent.");
128
+ }
129
+ export function capabilityUpgradeHint(capability, pluginComponent = "free", alternative) {
130
+ const component = pluginComponent === "pro"
131
+ ? "Pro WordPress plugin"
132
+ : "Free WordPress plugin";
133
+ const fallback = alternative ? ` ${alternative}` : "";
134
+ return ("MCP server and WordPress plugin versions are independent. " +
135
+ `Install a compatible ${component} from the same DiviOps suite release ` +
136
+ `or a newer supported component that advertises "${capability}", then ` +
137
+ "reconnect or restart the MCP session to refresh the capability handshake." +
138
+ fallback);
139
+ }
@@ -61,7 +61,7 @@ export declare const ErrorCodes: {
61
61
  readonly WP_ERROR: "wp_error";
62
62
  /** Divi-specific error (block parser, validator, etc.). HTTP 500. */
63
63
  readonly DIVI_ERROR: "divi_error";
64
- /** Plugin version below required for this tool (#486 handshake miss). HTTP 412. */
64
+ /** Connected plugin does not advertise the required capability. HTTP 412. */
65
65
  readonly CAPABILITY_MISSING: "capability_missing";
66
66
  /** validate_blocks-detected shape error in submitted markup. HTTP 400. */
67
67
  readonly VALIDATION_FAILED: "validation_failed";
package/dist/envelope.js CHANGED
@@ -29,7 +29,7 @@ export const ErrorCodes = {
29
29
  WP_ERROR: "wp_error",
30
30
  /** Divi-specific error (block parser, validator, etc.). HTTP 500. */
31
31
  DIVI_ERROR: "divi_error",
32
- /** Plugin version below required for this tool (#486 handshake miss). HTTP 412. */
32
+ /** Connected plugin does not advertise the required capability. HTTP 412. */
33
33
  CAPABILITY_MISSING: "capability_missing",
34
34
  /** validate_blocks-detected shape error in submitted markup. HTTP 400. */
35
35
  VALIDATION_FAILED: "validation_failed",
@@ -0,0 +1,53 @@
1
+ import type { ToolRegistrar } from "./canonical-tool-registry.js";
2
+ import type { WPClient } from "./wp-client.js";
3
+ import type { TargetEvidence } from "./target-evidence.js";
4
+ export declare const LAUNCHER_HEALTH_TOOL_NAMES: readonly ["diviops_meta_ping", "diviops_meta_info"];
5
+ export declare const META_PING_CONFIG: {
6
+ readonly description: "Test the connection to the WordPress site and verify the Divi MCP plugin is active. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { connected: true, message: \"Connected to Divi <version>\" } and connection failure surfaces as { ok: false, error: { code: 'wp_error', message } } with the underlying transport message preserved.";
7
+ readonly annotations: {
8
+ readonly readOnlyHint: true;
9
+ readonly idempotentHint: true;
10
+ };
11
+ readonly _meta: {
12
+ readonly idempotent: "true";
13
+ };
14
+ };
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? } }.";
17
+ readonly annotations: {
18
+ readonly readOnlyHint: true;
19
+ readonly idempotentHint: true;
20
+ };
21
+ readonly _meta: {
22
+ readonly idempotent: "true";
23
+ };
24
+ };
25
+ export declare function modelVisibleHealthResult(response: unknown, target: TargetEvidence, toolName: string): {
26
+ content: {
27
+ type: "text";
28
+ text: string;
29
+ }[];
30
+ structuredContent: {
31
+ result: unknown;
32
+ diviops_target: TargetEvidence;
33
+ };
34
+ _meta: {
35
+ diviops_target: TargetEvidence;
36
+ };
37
+ };
38
+ type ToolCancellationContext = {
39
+ signal?: AbortSignal;
40
+ mcpReq?: {
41
+ signal?: AbortSignal;
42
+ };
43
+ };
44
+ export declare function requestAbortSignal(args: unknown, context?: ToolCancellationContext): AbortSignal | undefined;
45
+ export declare function registerLauncherHealthTools(options: {
46
+ server: ToolRegistrar;
47
+ wp: {
48
+ testConnection(signal?: AbortSignal): ReturnType<WPClient["testConnection"]>;
49
+ };
50
+ observe: (signal?: AbortSignal) => Promise<TargetEvidence>;
51
+ serverVersion: string;
52
+ }): void;
53
+ export {};
@@ -0,0 +1,83 @@
1
+ import { ErrorCodes, recordIdempotent, serializeEnvelope, withCode, wrapResponse, } from "./envelope.js";
2
+ export const LAUNCHER_HEALTH_TOOL_NAMES = [
3
+ "diviops_meta_ping",
4
+ "diviops_meta_info",
5
+ ];
6
+ export const META_PING_CONFIG = {
7
+ description: "Test the connection to the WordPress site and verify the Divi MCP plugin is active. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { connected: true, message: \"Connected to Divi <version>\" } and connection failure surfaces as { ok: false, error: { code: 'wp_error', message } } with the underlying transport message preserved.",
8
+ annotations: { readOnlyHint: true, idempotentHint: true },
9
+ _meta: { idempotent: "true" },
10
+ };
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? } }.",
13
+ annotations: { readOnlyHint: true, idempotentHint: true },
14
+ _meta: { idempotent: "true" },
15
+ };
16
+ export function modelVisibleHealthResult(response, target, toolName) {
17
+ const visible = {
18
+ ...response,
19
+ diviops_target: target,
20
+ };
21
+ return {
22
+ content: [
23
+ {
24
+ type: "text",
25
+ text: serializeEnvelope(visible, toolName),
26
+ },
27
+ ],
28
+ structuredContent: {
29
+ result: response,
30
+ diviops_target: target,
31
+ },
32
+ _meta: { diviops_target: target },
33
+ };
34
+ }
35
+ export function requestAbortSignal(args, context) {
36
+ const fallback = args;
37
+ return (context?.mcpReq?.signal ??
38
+ context?.signal ??
39
+ fallback?.mcpReq?.signal ??
40
+ fallback?.signal);
41
+ }
42
+ export function registerLauncherHealthTools(options) {
43
+ const { server, wp, observe, serverVersion } = options;
44
+ recordIdempotent("diviops_meta_ping", META_PING_CONFIG._meta);
45
+ recordIdempotent("diviops_meta_info", META_INFO_CONFIG._meta);
46
+ server.registerTool("diviops_meta_ping", META_PING_CONFIG, async (_args, context) => {
47
+ const signal = requestAbortSignal(_args, context);
48
+ const target = await observe(signal);
49
+ const response = await wrapResponse(async () => {
50
+ const ping = await wp.testConnection(signal);
51
+ if (!ping.ok)
52
+ withCode(ErrorCodes.WP_ERROR, ping.message);
53
+ return { connected: true, message: ping.message };
54
+ });
55
+ return modelVisibleHealthResult(response, target, "diviops_meta_ping");
56
+ });
57
+ server.registerTool("diviops_meta_info", META_INFO_CONFIG, async (_args, context) => {
58
+ const target = await observe(requestAbortSignal(_args, context));
59
+ const response = await wrapResponse(async () => ({
60
+ brand: "DiviOps",
61
+ server: "diviops-mcp",
62
+ server_version: serverVersion,
63
+ version: serverVersion,
64
+ license: "MIT",
65
+ launcher_mode: true,
66
+ tool_count: LAUNCHER_HEALTH_TOOL_NAMES.length,
67
+ tools: {
68
+ registered_total: LAUNCHER_HEALTH_TOOL_NAMES.length,
69
+ registered_tool_names: [...LAUNCHER_HEALTH_TOOL_NAMES],
70
+ },
71
+ plugins: {
72
+ diviops_agent: { active: true, version: target.plugin_version },
73
+ },
74
+ handshake: {
75
+ state: "ok",
76
+ plugin_version: target.plugin_version,
77
+ capability_count: Object.values(target.capabilities).filter(Boolean).length,
78
+ },
79
+ wp_cli: false,
80
+ }));
81
+ return modelVisibleHealthResult(response, target, "diviops_meta_info");
82
+ });
83
+ }
package/dist/index.d.ts CHANGED
@@ -8,4 +8,29 @@
8
8
  * Auth: WordPress Application Passwords (Basic Auth).
9
9
  * Config: Environment variables WP_URL, WP_USER, WP_APP_PASSWORD.
10
10
  */
11
- export {};
11
+ import { type HandshakePluginInfo } from "./compatibility.js";
12
+ import { CanonicalToolRegistry } from "./canonical-tool-registry.js";
13
+ export type HandshakeState = {
14
+ kind: "ok";
15
+ capabilities: Record<string, boolean>;
16
+ pluginVersion: string | null;
17
+ proVersion?: string;
18
+ proActive: boolean;
19
+ availableTargets: Record<string, {
20
+ present: boolean;
21
+ version?: string | null;
22
+ }>;
23
+ activeModules: Record<string, boolean>;
24
+ plugins: Record<string, HandshakePluginInfo>;
25
+ } | {
26
+ kind: "failed";
27
+ } | {
28
+ kind: "pending";
29
+ };
30
+ /**
31
+ * Complete the canonical registry after the connected site's handshake has
32
+ * settled. Production startup and the credential-free dual-era compatibility
33
+ * fixture deliberately share this seam so the v2 proof materializes the real
34
+ * Free/Pro-gated catalog instead of maintaining a second set of definitions.
35
+ */
36
+ export declare function finalizeProductionRegistryForHandshake(state: HandshakeState): CanonicalToolRegistry;