@respira/wordpress-mcp-server 7.2.4 → 7.2.6

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/dist/server.d.ts CHANGED
@@ -138,6 +138,19 @@ export declare class RespiraWordPressServer {
138
138
  /** Cached site context for tool filtering (refreshed on site switch). */
139
139
  private cachedFilterContext;
140
140
  private static readonly FILTER_CACHE_TTL;
141
+ /**
142
+ * Capability negotiation (7.2.6): tools whose plugin REST route only exists
143
+ * from a given plugin version. On older plugins these 404 with
144
+ * respira_rest_no_route — the biggest non-element failure class in the
145
+ * MCP-quality telemetry (656 errors across 97 tools), pure version skew since
146
+ * only ~half the connected sites run a current plugin. We stop advertising
147
+ * these tools when the connected plugin predates the route, so the agent is
148
+ * never offered something that will 404. @since values are verified against
149
+ * the plugin source (the first release tag that contains each route).
150
+ */
151
+ private static readonly TOOL_MIN_PLUGIN_VERSION;
152
+ /** True when version `a` is strictly older than `b` (both "x.y.z"). */
153
+ private static versionLt;
141
154
  private filterToolsByContext;
142
155
  private isWooCommerceAddonAvailable;
143
156
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAkQzE,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAgC;IACnD,OAAO,CAAC,KAAK,CAA2C;IACxD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,YAAY,CAA4B;IAChD,8EAA8E;IAC9E,OAAO,CAAC,YAAY,CAA4B;IAChD,8EAA8E;IAC9E,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;IAEhE;;;OAGG;IACH,OA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QAAQ,CAAC,gBAAgB,CAAU;IAElD;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAQ7C;IAEF,uEAAuE;IACvE,OAAO,CAAC,MAAM,CAAC,SAAS;YAWV,oBAAoB;YAwEpB,2BAA2B;IAazC;;;;OAIG;YACW,cAAc;IAY5B,OAAO,CAAC,mBAAmB;IAwT3B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAe3C;IAEF;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;YAmCpB,cAAc;IAqG5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,eAAe;YAuCT,gBAAgB;IA22B9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwUzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA6UxB,GAAG;CAyCV"}
package/dist/server.js CHANGED
@@ -2178,6 +2178,10 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
2178
2178
  description: 'When editing an original, choose ask, live, or duplicate. Defaults to ask when direct editing is enabled.',
2179
2179
  enum: ['ask', 'live', 'duplicate'],
2180
2180
  },
2181
+ confirm_live_edit: {
2182
+ type: 'boolean',
2183
+ description: 'Set true together with edit_target:"live" to acknowledge a direct write to the published original. Exposed at the top level so autonomous flows can complete the confirmation_required handshake without polluting the updates object.',
2184
+ },
2181
2185
  },
2182
2186
  required: ['builder', 'page_id', 'module_identifier', 'updates'],
2183
2187
  },
@@ -2338,6 +2342,10 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
2338
2342
  description: 'When editing an original, choose ask, live, or duplicate. Defaults to ask when direct editing is enabled.',
2339
2343
  enum: ['ask', 'live', 'duplicate'],
2340
2344
  },
2345
+ confirm_live_edit: {
2346
+ type: 'boolean',
2347
+ description: 'Set true together with edit_target:"live" to acknowledge a direct write to the published original. Exposed at the top level so autonomous flows can complete the confirmation_required handshake without polluting the operations.',
2348
+ },
2341
2349
  },
2342
2350
  required: ['builder', 'post_id', 'operations'],
2343
2351
  },
@@ -4245,6 +4253,37 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
4245
4253
  /** Cached site context for tool filtering (refreshed on site switch). */
4246
4254
  cachedFilterContext = null;
4247
4255
  static FILTER_CACHE_TTL = 60_000; // 1 minute
4256
+ /**
4257
+ * Capability negotiation (7.2.6): tools whose plugin REST route only exists
4258
+ * from a given plugin version. On older plugins these 404 with
4259
+ * respira_rest_no_route — the biggest non-element failure class in the
4260
+ * MCP-quality telemetry (656 errors across 97 tools), pure version skew since
4261
+ * only ~half the connected sites run a current plugin. We stop advertising
4262
+ * these tools when the connected plugin predates the route, so the agent is
4263
+ * never offered something that will 404. @since values are verified against
4264
+ * the plugin source (the first release tag that contains each route).
4265
+ */
4266
+ static TOOL_MIN_PLUGIN_VERSION = {
4267
+ wordpress_run_pagespeed_audit: '7.1.0', // /pagespeed/audit — first in v7.1.0
4268
+ wordpress_analyze_pagespeed: '7.1.0', // /analyze/pagespeed — first in v7.1.0
4269
+ wordpress_abilities_gap_report: '7.1.0', // /abilities/gap-report — first in v7.1.0
4270
+ wordpress_invoke_ability: '7.1.0', // /abilities/invoke — first in v7.1.0
4271
+ wordpress_read_theme_file: '7.0.42', // /theme-files/* — @since 7.0.42
4272
+ wordpress_write_theme_file: '7.0.42',
4273
+ wordpress_append_theme_file: '7.0.42',
4274
+ };
4275
+ /** True when version `a` is strictly older than `b` (both "x.y.z"). */
4276
+ static versionLt(a, b) {
4277
+ const pa = a.split('.').map((n) => parseInt(n, 10) || 0);
4278
+ const pb = b.split('.').map((n) => parseInt(n, 10) || 0);
4279
+ for (let i = 0; i < 3; i++) {
4280
+ const x = pa[i] || 0;
4281
+ const y = pb[i] || 0;
4282
+ if (x !== y)
4283
+ return x < y;
4284
+ }
4285
+ return false;
4286
+ }
4248
4287
  async filterToolsByContext(tools) {
4249
4288
  if (!this.currentSite) {
4250
4289
  return tools; // No site connected — show everything.
@@ -4263,6 +4302,16 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
4263
4302
  return tools; // Can't fetch context — show everything.
4264
4303
  }
4265
4304
  }
4305
+ // Capability negotiation: make sure the plugin version is known (cheap and
4306
+ // memoized in the client) so the per-tool gate below can hide routes the
4307
+ // connected plugin is too old to have. Never blocks the filter on failure.
4308
+ try {
4309
+ await this.currentSite.checkCompatibility();
4310
+ }
4311
+ catch {
4312
+ /* non-fatal — fall through with whatever version we have (possibly null) */
4313
+ }
4314
+ const pluginVersion = this.currentSite.pluginVersion ?? null;
4266
4315
  const detectedBuilder = (context?.page_builder?.name || '').toLowerCase();
4267
4316
  const hasWooCommerce = Boolean(context?.woocommerce?.active || context?.addons?.woocommerce?.installed);
4268
4317
  return tools.filter((tool) => {
@@ -4287,6 +4336,14 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
4287
4336
  if (name.startsWith('woocommerce_')) {
4288
4337
  return hasWooCommerce;
4289
4338
  }
4339
+ // Capability negotiation: hide tools whose plugin route only exists from a
4340
+ // newer plugin version than the connected site runs (avoids rest_no_route
4341
+ // 404s on version-skewed sites). Conservative: only when the plugin version
4342
+ // is KNOWN and below the tool's verified minimum.
4343
+ const minPv = RespiraWordPressServer.TOOL_MIN_PLUGIN_VERSION[name];
4344
+ if (minPv && pluginVersion && RespiraWordPressServer.versionLt(pluginVersion, minPv)) {
4345
+ return false;
4346
+ }
4290
4347
  // Everything else: always show.
4291
4348
  return true;
4292
4349
  });
@@ -5033,7 +5090,7 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
5033
5090
  return await client.makeResponsive(args.page_id, args.dry_run || false);
5034
5091
  case 'wordpress_update_module':
5035
5092
  return hoistDroppedStylingWarnings({
5036
- ...(await client.updateModule(args.builder, args.page_id, args.module_identifier, args.updates, args.edit_target)),
5093
+ ...(await client.updateModule(args.builder, args.page_id, args.module_identifier, args.updates, args.edit_target, args.confirm_live_edit)),
5037
5094
  respira_approvals_url: client.getApprovalsUrl(),
5038
5095
  });
5039
5096
  case 'wordpress_validate_security':
@@ -5336,7 +5393,7 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
5336
5393
  case 'wordpress_end_session':
5337
5394
  return await client.callRestV2('POST', '/snapshots/session/end', {});
5338
5395
  case 'wordpress_apply_builder_patch':
5339
- return await client.applyBuilderPatch(args.builder, args.post_id, args.operations, args.include, args.edit_target);
5396
+ return await client.applyBuilderPatch(args.builder, args.post_id, args.operations, args.include, args.edit_target, args.confirm_live_edit);
5340
5397
  case 'woocommerce_list_products':
5341
5398
  return await client.woocommerceListProducts(args);
5342
5399
  case 'woocommerce_get_product':