@noleemits/vision-builder-control-mcp 4.5.6 → 4.5.7

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.
Files changed (2) hide show
  1. package/index.js +62 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -94,7 +94,8 @@ process.on('SIGINT', () => {
94
94
  // CONFIG
95
95
  // ================================================================
96
96
 
97
- const VERSION = '4.5.6';
97
+ const VERSION = '4.5.7';
98
+ const MIN_PLUGIN_VERSION = '4.5.7'; // Minimum WP plugin version required by this MCP server
98
99
 
99
100
  // ================================================================
100
101
  // PARAMETER HELPERS
@@ -1727,6 +1728,18 @@ function getToolDefinitions() {
1727
1728
  }
1728
1729
  }
1729
1730
  },
1731
+ {
1732
+ name: 'fix_trailing_slashes',
1733
+ description: 'Add missing trailing slashes to internal URLs across ALL post types (pages, posts, CPTs). Scans both Elementor widget data and Gutenberg/classic post_content. Skips anchors (#), query strings (?), external URLs, and file extensions (.pdf etc). ALWAYS run with dry_run=true first to preview changes.',
1734
+ inputSchema: {
1735
+ type: 'object',
1736
+ properties: {
1737
+ post_id: { type: 'number', description: 'Fix only this specific post ID. Omit to scan all posts.' },
1738
+ post_type: { type: 'string', description: 'Filter by post type (e.g. "page", "post", "treatment"). Omit for all public post types.' },
1739
+ dry_run: { type: 'boolean', description: 'Preview changes without saving. Default: true (safe). Set false to apply.' }
1740
+ }
1741
+ }
1742
+ },
1730
1743
  {
1731
1744
  name: 'fix_links',
1732
1745
  description: 'Auto-fix link targets across all Elementor pages. Internal links → same tab, external → new tab. Supports dry_run mode. Use include_templates to also fix library templates.',
@@ -2428,13 +2441,31 @@ async function handleToolCall(name, args) {
2428
2441
  case 'health_check': {
2429
2442
  try {
2430
2443
  const r = await apiCall('/health');
2444
+
2445
+ // Compare plugin version against minimum required
2446
+ const versionOk = (pluginVer, minVer) => {
2447
+ const p = pluginVer.split('.').map(Number);
2448
+ const m = minVer.split('.').map(Number);
2449
+ for (let i = 0; i < 3; i++) {
2450
+ if ((p[i] || 0) > (m[i] || 0)) return true;
2451
+ if ((p[i] || 0) < (m[i] || 0)) return false;
2452
+ }
2453
+ return true; // equal is fine
2454
+ };
2455
+
2456
+ const compatible = versionOk(r.version, MIN_PLUGIN_VERSION);
2457
+ const compatLine = compatible
2458
+ ? `Compatibility: OK`
2459
+ : `⚠️ Compatibility: Plugin v${r.version} is below required v${MIN_PLUGIN_VERSION}.\n Some tools may fail. Please update the WordPress plugin.`;
2460
+
2431
2461
  return ok(
2432
2462
  `Vision Builder Control: ACTIVE\n` +
2433
2463
  `Plugin: v${r.version}\n` +
2434
2464
  `Elementor: ${r.elementor ? 'Active' : 'NOT ACTIVE'}\n` +
2435
2465
  `Components: ${r.components}\n` +
2436
2466
  `Shortcodes: ${r.shortcodes ? 'Enabled' : 'Disabled'}\n` +
2437
- `MCP Server: v${VERSION} (${httpMode ? 'HTTP/SSE' : 'stdio'})`
2467
+ `MCP Server: v${VERSION} (${httpMode ? 'HTTP/SSE' : 'stdio'})\n` +
2468
+ compatLine
2438
2469
  );
2439
2470
  } catch (e) {
2440
2471
  return ok(`Vision Builder Control: NOT RESPONDING\nError: ${e.message}\n\nMake sure:\n1. Noleemits Vision Builder Control plugin is activated\n2. Elementor is installed and activated\n3. WP_URL, WP_USER, WP_APP_PASSWORD are correct`);
@@ -2803,6 +2834,35 @@ async function handleToolCall(name, args) {
2803
2834
  return ok(msg);
2804
2835
  }
2805
2836
 
2837
+ case 'fix_trailing_slashes': {
2838
+ const body = { dry_run: args.dry_run !== false };
2839
+ if (args.post_id) body.post_id = args.post_id;
2840
+ if (args.post_type) body.post_type = args.post_type;
2841
+ const r = await apiCall('/fix-trailing-slashes', 'POST', body);
2842
+ if (r.code || r.error) return ok(`Failed: ${r.message || r.error || 'Unknown error'}`);
2843
+
2844
+ const mode = r.dry_run ? 'DRY RUN — no changes saved' : 'APPLIED';
2845
+ let msg = `=== TRAILING SLASH FIX (${mode}) ===\nPosts scanned: ${r.posts_scanned}\nPosts with changes: ${r.posts_fixed}\nTotal URLs to fix: ${r.total_changes}\n`;
2846
+
2847
+ if (r.total_changes === 0) {
2848
+ msg += '\nAll internal URLs already have trailing slashes.';
2849
+ } else {
2850
+ r.results.forEach(p => {
2851
+ msg += `\n--- ${p.title} [${p.post_type}] (ID: ${p.post_id}) — ${p.count} change(s) ---\n`;
2852
+ p.changes.forEach(c => {
2853
+ const loc = c.source === 'elementor'
2854
+ ? `[${c.widget}] ${c.field}`
2855
+ : c.source === 'elementor_html'
2856
+ ? `[${c.widget}] HTML`
2857
+ : '[post_content]';
2858
+ msg += ` ${loc}: ${c.old} → ${c.new}\n`;
2859
+ });
2860
+ });
2861
+ if (r.dry_run) msg += '\n(Dry run — run again with dry_run=false to apply changes.)';
2862
+ }
2863
+ return ok(msg);
2864
+ }
2865
+
2806
2866
  case 'fix_links': {
2807
2867
  const body = {};
2808
2868
  if (args.page_id) body.page_id = args.page_id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noleemits/vision-builder-control-mcp",
3
- "version": "4.5.6",
3
+ "version": "4.5.7",
4
4
  "description": "Vision Builder Control MCP server - design token-driven page builder tools for WordPress/Elementor websites",
5
5
  "type": "module",
6
6
  "main": "index.js",