@noleemits/vision-builder-control-mcp 4.109.3 → 4.111.0

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 +80 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -111,9 +111,14 @@ process.on('SIGINT', () => {
111
111
  // CONFIG
112
112
  // ================================================================
113
113
 
114
- const VERSION = '4.109.3';
114
+ const VERSION = '4.111.0';
115
115
  const MIN_PLUGIN_VERSION = '4.13.0'; // Minimum WP plugin version required by this MCP server
116
116
 
117
+ // v4.110.0: shared styling philosophy appended to every build/style tool so the
118
+ // model is reminded, at the point of use, to use the framework the plugin already
119
+ // ships instead of inventing CSS. The decision is by CATEGORY, not a blanket order.
120
+ const CSS_PHILOSOPHY = ' ── STYLING RULE (we are NOT looking for shortcuts): SPACING/padding → apply the shipped `nvbc-space-*` clamp class (native padding has no clamp; the class IS the framework default). COLOR → bind the saved Elementor GLOBAL (never a hardcoded hex, never a color class). LAYOUT (grid columns, flex direction, gap, background, hover, border) → NATIVE container settings (e.g. set_container_layout) so the client can edit it in the UI. FLUID TYPE size → the shipped `nvbc-font-*` clamp class. IRREDUCIBLE decoration only (pseudo-elements, image crop, keyframes) → register a class via `upsert_class` (LAST resort). NEVER write ad-hoc CSS into Elementor custom_css / Site Settings → Custom CSS. Where EL4 ATOMIC elements are present, prefer atomic elements (shipped classes apply via the class array). Reuse list_classes + get_design_tokens before creating anything new.';
121
+
117
122
  // ================================================================
118
123
  // PARAMETER HELPERS
119
124
  // ================================================================
@@ -2213,7 +2218,7 @@ function getToolDefinitions() {
2213
2218
  },
2214
2219
  {
2215
2220
  name: 'set_container_layout',
2216
- description: 'Set a container\'s layout (flex/grid) from a clean intent — prefer this over raw update_element when you want WYSIWYG-editable native Elementor layout instead of custom_css workarounds. Translates {mode, columns, gap, responsive} into the full Elementor schema (container_type, grid_columns_grid object, gap object shape, _tablet/_mobile variants, etc.). Modes: "grid" (uses Elementor native CSS Grid — best for card layouts), "flex-row" (horizontal flex), "flex-column" (vertical stack). Defaults: gap=24px, responsive=auto (tablet halves columns, mobile = 1 col). Pass responsive: false to skip responsive variants. Only operates on containers (rejected with invalid_target if you target a widget). The resulting layout shows up in Elementor\'s Layout panel as if a human set it, so non-technical editors can modify it through the UI. v4.44.0+. WIDTH SEMANTICS (v4.86.0+): containers default to content_width:"full" — no boxed `.e-con-inner` wrapper, flex-row children lay out side-by-side, and `.your-class > .e-con` CSS hits direct children. Pass content_width:"boxed" for a centered max-width container; combine with boxed_width to set the cap (Elementor\'s default cap is 1140px when unset). Common gotcha: a boxed container with a child carrying _element_custom_width in px greater than the boxed cap will overflow at every viewport — pre-flight with validate_section, which now flags this (child_width_exceeds_parent, flex_row_fixed_widths_overflow). For atomic v4 e-flexbox, width is set via a different settings shape — use add_element preset:"cols-N" for ready-made full-width column rows.',
2221
+ description: 'Set a container\'s layout (flex/grid) from a clean intent — prefer this over raw update_element when you want WYSIWYG-editable native Elementor layout instead of custom_css workarounds. Translates {mode, columns, gap, responsive} into the full Elementor schema (container_type, grid_columns_grid object, gap object shape, _tablet/_mobile variants, etc.). Modes: "grid" (uses Elementor native CSS Grid — best for card layouts), "flex-row" (horizontal flex), "flex-column" (vertical stack). Defaults: gap=24px, responsive=auto (tablet halves columns, mobile = 1 col). Pass responsive: false to skip responsive variants. Only operates on containers (rejected with invalid_target if you target a widget). The resulting layout shows up in Elementor\'s Layout panel as if a human set it, so non-technical editors can modify it through the UI. v4.44.0+. WIDTH SEMANTICS (v4.86.0+): containers default to content_width:"full" — no boxed `.e-con-inner` wrapper, flex-row children lay out side-by-side, and `.your-class > .e-con` CSS hits direct children. Pass content_width:"boxed" for a centered max-width container; combine with boxed_width to set the cap (Elementor\'s default cap is 1140px when unset). Common gotcha: a boxed container with a child carrying _element_custom_width in px greater than the boxed cap will overflow at every viewport — pre-flight with validate_section, which now flags this (child_width_exceeds_parent, flex_row_fixed_widths_overflow). For atomic v4 e-flexbox, width is set via a different settings shape — use add_element preset:"cols-N" for ready-made full-width column rows.' + CSS_PHILOSOPHY,
2217
2222
  inputSchema: {
2218
2223
  type: 'object',
2219
2224
  properties: {
@@ -2259,7 +2264,7 @@ function getToolDefinitions() {
2259
2264
  },
2260
2265
  {
2261
2266
  name: 'update_element',
2262
- description: 'Update any element\'s settings by its Elementor ID or path. Patch widget properties like hover_color, background_color, __globals__ overrides, text, link URLs, etc. Supports dot-notation for nested keys (e.g. "__globals__.hover_color"). Supports element_path as alternative to element_id (e.g. "sectionId/1/0" = section → child 1 → child 0). Use list_elements or export_page first to find the element ID and current settings. IMPORTANT: Prefer settings_json (JSON string) over settings (object) for reliable MCP transport. AUTO-INJECTED KEYS: background_background:"classic" auto-set when you set background_color; typography_typography:"custom" auto-set when you set font properties; flex_grow expands to all 3 required keys; grid column strings auto-wrapped in object format. ICON WIDGET: For view="default" use "icon_size" for dimensions. For view="stacked" or "framed" (circle/square background) use "size" instead — "icon_size" is silently ignored in stacked/framed mode. LOOP-GRID WIDGET: query settings use the prefix "post_query_" (post_query_post_type, post_query_orderby, post_query_order, post_query_posts_per_page) — NOT "posts_post_type". Setting "posts_post_type" is silently accepted but ignored. LOOP-CAROUSEL WIDGET: also uses "post_query_" prefix — NOT the older Elementor "query_" prefix. Both loop-grid and loop-carousel share the same query-control prefix; if you used "query_post_type" the write is silently accepted and ignored. Pull current settings via get_element first to confirm the prefix before patching. RACE CONDITION: when patching multiple elements on the SAME page in parallel, use batch_update_elements instead — parallel update_element calls can clobber each other. ATOMIC SCHEMA VALIDATION (v4.42.5+): writes that violate the Elementor V4 atomic schema are rejected up front (HTTP 400 invalid_atomic_setting) instead of silently corrupting the page. Currently enforced: e-heading.tag ∈ {h1..h6}, e-paragraph.tag ∈ {p, span}. If you need a non-heading visual element styled like an eyebrow, use e-paragraph (tag=p or span) — not e-heading with tag=div. NATIVE GRID/FLEX TIP: for container layout (grid columns, flex direction, gap), prefer set_container_layout — it produces WYSIWYG-editable native settings instead of forcing you to assemble the raw Elementor schema. NOTE: On V4 atomic elements (e-flexbox, e-section, e-div-block, e-grid), visual props (background_color, padding, etc.) are written to settings but V4 renders from the styles array — they will not apply visually. The response will include a warnings[] array when this occurs. Use set_kit_global_css with [data-id="<id>"] as the workaround.',
2267
+ description: 'Update any element\'s settings by its Elementor ID or path. Patch widget properties like hover_color, background_color, __globals__ overrides, text, link URLs, etc. Supports dot-notation for nested keys (e.g. "__globals__.hover_color"). Supports element_path as alternative to element_id (e.g. "sectionId/1/0" = section → child 1 → child 0). Use list_elements or export_page first to find the element ID and current settings. IMPORTANT: Prefer settings_json (JSON string) over settings (object) for reliable MCP transport. AUTO-INJECTED KEYS: background_background:"classic" auto-set when you set background_color; typography_typography:"custom" auto-set when you set font properties; flex_grow expands to all 3 required keys; grid column strings auto-wrapped in object format. ICON WIDGET: For view="default" use "icon_size" for dimensions. For view="stacked" or "framed" (circle/square background) use "size" instead — "icon_size" is silently ignored in stacked/framed mode. LOOP-GRID WIDGET: query settings use the prefix "post_query_" (post_query_post_type, post_query_orderby, post_query_order, post_query_posts_per_page) — NOT "posts_post_type". Setting "posts_post_type" is silently accepted but ignored. LOOP-CAROUSEL WIDGET: also uses "post_query_" prefix — NOT the older Elementor "query_" prefix. Both loop-grid and loop-carousel share the same query-control prefix; if you used "query_post_type" the write is silently accepted and ignored. Pull current settings via get_element first to confirm the prefix before patching. RACE CONDITION: when patching multiple elements on the SAME page in parallel, use batch_update_elements instead — parallel update_element calls can clobber each other. ATOMIC SCHEMA VALIDATION (v4.42.5+): writes that violate the Elementor V4 atomic schema are rejected up front (HTTP 400 invalid_atomic_setting) instead of silently corrupting the page. Currently enforced: e-heading.tag ∈ {h1..h6}, e-paragraph.tag ∈ {p, span}. If you need a non-heading visual element styled like an eyebrow, use e-paragraph (tag=p or span) — not e-heading with tag=div. NATIVE GRID/FLEX TIP: for container layout (grid columns, flex direction, gap), prefer set_container_layout — it produces WYSIWYG-editable native settings instead of forcing you to assemble the raw Elementor schema. NOTE: On V4 atomic elements (e-flexbox, e-section, e-div-block, e-grid), visual props (background_color, padding, etc.) are written to settings but V4 renders from the styles array — they will not apply visually. The response will include a warnings[] array when this occurs. Use set_kit_global_css with [data-id="<id>"] as the workaround.' + CSS_PHILOSOPHY,
2263
2268
  inputSchema: {
2264
2269
  type: 'object',
2265
2270
  properties: {
@@ -2275,7 +2280,8 @@ function getToolDefinitions() {
2275
2280
  type: 'string',
2276
2281
  description: 'Settings as a JSON string (preferred over settings object for reliable MCP transport). Example: \'{"hover_color":"#FFFFFF","__globals__":{"hover_color":""}}\''
2277
2282
  },
2278
- force: { type: 'boolean', description: 'Override edit locks (default: false)' }
2283
+ force: { type: 'boolean', description: 'Override edit locks (default: false)' },
2284
+ confirm: { type: 'boolean', description: 'Required only when setting custom_css on the element (ad-hoc CSS). Without confirm:true that write is REFUSED with guidance — prefer a class via upsert_class. All other settings are unaffected.' }
2279
2285
  },
2280
2286
  required: ['page_id']
2281
2287
  }
@@ -3073,7 +3079,7 @@ function getToolDefinitions() {
3073
3079
  // ── Element Operations (v3.6.0) ──
3074
3080
  {
3075
3081
  name: 'add_element',
3076
- description: 'Add a widget or container into a parent container on a page. Pass the full Elementor element JSON (elType, widgetType, settings, etc.). If no ID is provided, one will be auto-generated. Use position to insert at a specific index. NESTED COLUMN PRESET (v4.86.0): instead of element, pass preset="cols-3" (or cols-2, cols-4, sidebar-left, sidebar-right, split, stack) to drop a gap-safe column row AS A CHILD of parent_id. The scaffold ships content_width:full on the row AND every column, so no boxed `.e-con-inner` wrapper is injected and flex-row children never stack — this is the reusable fix for multi-column rows inside an existing section. Columns are empty; fill them with further add_element calls. GUARDRAIL: classic Elementor section/column elType is rejected (use containers); pass legacy:true to override.',
3082
+ description: 'Add a widget or container into a parent container on a page. Pass the full Elementor element JSON (elType, widgetType, settings, etc.). If no ID is provided, one will be auto-generated. Use position to insert at a specific index. NESTED COLUMN PRESET (v4.86.0): instead of element, pass preset="cols-3" (or cols-2, cols-4, sidebar-left, sidebar-right, split, stack) to drop a gap-safe column row AS A CHILD of parent_id. The scaffold ships content_width:full on the row AND every column, so no boxed `.e-con-inner` wrapper is injected and flex-row children never stack — this is the reusable fix for multi-column rows inside an existing section. Columns are empty; fill them with further add_element calls. GUARDRAIL: classic Elementor section/column elType is rejected (use containers); pass legacy:true to override.' + CSS_PHILOSOPHY,
3077
3083
  inputSchema: {
3078
3084
  type: 'object',
3079
3085
  properties: {
@@ -3409,13 +3415,14 @@ function getToolDefinitions() {
3409
3415
  },
3410
3416
  {
3411
3417
  name: 'set_kit_global_css',
3412
- description: 'Write to the active kit\'s custom_css. Modes: "replace" (default overwrites), "append" (adds to end), "prepend" (adds to start). Output goes through Elementor\'s stylesheet pipeline (no HTML widget needed). Always dry_run=true first.',
3418
+ description: 'ESCAPE HATCH — AVOID. Writes ad-hoc CSS into the active kit\'s custom_css (Site Settings → Custom CSS): invisible to the client, unversioned, non-portable, and the #1 source of class-soup drift. This is NOT where component/utility styling belongs. Before using this, exhaust the styling rule: SPACING → nvbc-space-* class; COLOR → saved global; LAYOUT → native (set_container_layout); reusable decoration → register a class via upsert_class (page-scoped, plugin-owned). Legitimate uses are narrow (e.g. element-targeted [data-id] fix for V4 atomic visual props that the styles array can\'t reach). Modes: "replace" (default), "append", "prepend". Always dry_run=true first.',
3413
3419
  inputSchema: {
3414
3420
  type: 'object',
3415
3421
  properties: {
3416
3422
  css: { type: 'string', description: 'CSS text. Will be wrapped in <style> by Elementor — do not include style tags.' },
3417
3423
  mode: { type: 'string', enum: ['replace', 'append', 'prepend'], description: 'How to combine with existing CSS (default: replace).' },
3418
- dry_run: { type: 'boolean', description: 'Preview without saving (default: true).' }
3424
+ dry_run: { type: 'boolean', description: 'Preview without saving (default: true).' },
3425
+ confirm: { type: 'boolean', description: 'Required to actually write ad-hoc CSS here. Without confirm:true the save is REFUSED with guidance — this is the escape hatch; prefer upsert_class. Only set true for genuinely irreducible CSS with user approval.' }
3419
3426
  },
3420
3427
  required: ['css']
3421
3428
  }
@@ -3438,7 +3445,7 @@ function getToolDefinitions() {
3438
3445
  },
3439
3446
  {
3440
3447
  name: 'patch_kit_global_css',
3441
- description: 'Surgically patch the active kit\'s custom_css with operations (remove_rule, remove_selector_from_rules, find_replace). Avoids the full-payload round-trip of set_kit_global_css. Always dry_run=true first. v4.45.0+.',
3448
+ description: 'Surgically patch the active kit\'s custom_css with operations (remove_rule, remove_selector_from_rules, find_replace). Best use is REMOVING ad-hoc CSS (cleanup), not adding it — adding component/utility styling here is the escape hatch that causes class-soup; prefer upsert_class (page-scoped, plugin-owned) for any new styling. Avoids the full-payload round-trip of set_kit_global_css. Always dry_run=true first. v4.45.0+.',
3442
3449
  inputSchema: {
3443
3450
  type: 'object',
3444
3451
  required: ['operations'],
@@ -3451,6 +3458,10 @@ function getToolDefinitions() {
3451
3458
  dry_run: {
3452
3459
  type: 'boolean',
3453
3460
  description: 'Preview without saving (default: true). Set false to apply.'
3461
+ },
3462
+ confirm: {
3463
+ type: 'boolean',
3464
+ description: 'Required only for a find_replace op that AUTHORS new CSS (non-empty replace). remove_* cleanup ops never need it. Without confirm:true such a write is REFUSED — prefer upsert_class for new styling.'
3454
3465
  }
3455
3466
  }
3456
3467
  }
@@ -3674,9 +3685,24 @@ function getToolDefinitions() {
3674
3685
  required: ['source_template_id', 'title']
3675
3686
  }
3676
3687
  },
3688
+ {
3689
+ name: 'create_template',
3690
+ description: 'Create a BLANK Theme Builder template in one call — then fill it with append_section / add_element. Atomically sets post_type=elementor_library, the elementor_library_type TAXONOMY TERM (required for loop context — setting only the meta silently fails for loop-item), the _elementor_template_type meta, and builder edit-mode. Use this instead of a raw wp/v2/elementor_library POST (which omits the taxonomy term and silently produces a loop template with no post context). For a template BASED ON an existing design, use clone_template instead. v4.111.0.',
3691
+ inputSchema: {
3692
+ type: 'object',
3693
+ properties: {
3694
+ type: { type: 'string', enum: ['loop-item', 'single', 'single-post', 'single-page', 'archive', 'header', 'footer', 'popup', 'section', 'page', 'search-results', 'error-404', 'product', 'product-archive'], description: 'Theme Builder document type. loop-item = the card template a loop-grid repeats; single/archive = full-page templates; etc.' },
3695
+ title: { type: 'string', description: 'Template title (e.g. "Team Member Loop Item")' },
3696
+ slug: { type: 'string', description: 'Optional URL slug. Auto-derived from title if omitted.' },
3697
+ conditions: { type: 'array', items: { type: 'string' }, description: 'Optional display conditions, e.g. ["include/singular/team_member"] or ["include/archive/team_member_archive"]. Omit for loop-item (it is referenced by a loop-grid, not by condition).' },
3698
+ status: { type: 'string', enum: ['publish', 'draft', 'private', 'pending'], description: 'Post status (default: publish)' }
3699
+ },
3700
+ required: ['type', 'title']
3701
+ }
3702
+ },
3677
3703
  {
3678
3704
  name: 'append_section',
3679
- description: 'Append a section to an existing page or template. Pass full section JSON OR use the preset param for instant gap-safe column layouts. PRESET SHORTHAND: pass preset="cols-3" (or cols-2, cols-4, sidebar-left, sidebar-right, split, stack) and the scaffold JSON is generated for you — no manual flex-grow JSON needed. The section param becomes optional when using preset; any settings in section are merged into the preset root (use it to set background_color, css_classes, _title, etc.). engine param selects v3 (classic Container) or v4 (atomic e-flexbox); auto-detected if omitted. WIDTH SEMANTICS: section root containers default to content_width="full" (no boxed `.e-con-inner` wrapper) — flex-row children lay out side-by-side; pass content_width="boxed" + numeric boxed_width for a centered max-width section. When a section has content_width="boxed", any child with _element_custom_width in px greater than boxed_width will overflow horizontally — run validate_section before submitting to catch this (rules child_width_exceeds_parent + flex_row_fixed_widths_overflow, v4.95.0+).',
3705
+ description: 'Append a section to an existing page or template. Pass full section JSON OR use the preset param for instant gap-safe column layouts. PRESET SHORTHAND: pass preset="cols-3" (or cols-2, cols-4, sidebar-left, sidebar-right, split, stack) and the scaffold JSON is generated for you — no manual flex-grow JSON needed. The section param becomes optional when using preset; any settings in section are merged into the preset root (use it to set background_color, css_classes, _title, etc.). engine param selects v3 (classic Container) or v4 (atomic e-flexbox); auto-detected if omitted. WIDTH SEMANTICS: section root containers default to content_width="full" (no boxed `.e-con-inner` wrapper) — flex-row children lay out side-by-side; pass content_width="boxed" + numeric boxed_width for a centered max-width section. When a section has content_width="boxed", any child with _element_custom_width in px greater than boxed_width will overflow horizontally — run validate_section before submitting to catch this (rules child_width_exceeds_parent + flex_row_fixed_widths_overflow, v4.95.0+).' + CSS_PHILOSOPHY,
3680
3706
  inputSchema: {
3681
3707
  type: 'object',
3682
3708
  properties: {
@@ -3989,7 +4015,7 @@ function getToolDefinitions() {
3989
4015
  // ── Class Registry ──
3990
4016
  {
3991
4017
  name: 'list_classes',
3992
- description: 'List registered CSS classes in the NVBC class registry. Returns classes with name, description, category, applies_to, scope, and status. Use to discover available classes before applying them via update_element. By default DRAFT site classes are hidden — pass include_drafts:true to see them. Pass page_id to filter site classes to those that are global OR scoped to that page (built-ins always pass). v4.92.0+ adds scope/status filtering; pre-v4.92 site classes are treated as scope=global + status=published.',
4018
+ description: 'List registered CSS classes in the NVBC class registry — the shipped framework. CHECK THIS FIRST before writing any CSS: it includes the `nvbc-space-*` clamp spacing classes and `nvbc-font-*` clamp type classes (the correct default for spacing/fluid type, since native has no clamp), plus utility primitives. Reusing one of these is the right move, not a shortcut. Returns name, description, category, applies_to, scope, status. Apply via update_element / manage_element_classes. By default DRAFT site classes are hidden — pass include_drafts:true to see them. Pass page_id to filter site classes to those that are global OR scoped to that page (built-ins always pass). v4.92.0+ adds scope/status filtering; pre-v4.92 site classes are treated as scope=global + status=published.',
3993
4019
  inputSchema: {
3994
4020
  type: 'object',
3995
4021
  properties: {
@@ -4040,7 +4066,7 @@ function getToolDefinitions() {
4040
4066
  },
4041
4067
  {
4042
4068
  name: 'upsert_class',
4043
- description: 'Define or update a site CSS class — stores its metadata AND CSS body in the NVBC class registry. NVBC renders the CSS page-scoped (only on pages that use the class); it is NOT written to the Elementor Kit. The class appears in list_classes with source=[site] and in the editor Browse picker. Optional apply_to: attach the class to element IDs on specific pages in the same call. Call again with the same name to update (css/rules are replaced). v4.76.0+. v4.92.0 adds scope (global vs page) and status (published vs draft). v4.97.0 adds specificity (auto|layout|utility) so layout/visual classes win against .elementor .e-con default styles instead of losing on specificity. v4.98.0 adds rules — the recommended way to author classes that need pseudo-elements, hover states, or any multi-rule structure (keeps the plugin the owner of all class CSS instead of forcing the user to drop ad-hoc CSS into Elementor).',
4069
+ description: 'Define or update a site CSS class — THE correct, plugin-owned home for any new CSS (the LAST resort after native settings, saved globals, and existing shipped classes have been ruled out — see the styling rule). Stores its metadata AND CSS body in the NVBC class registry. NVBC renders the CSS page-scoped (only on pages that use the class); it is NOT written to the Elementor Kit custom_css, so it stays versioned, portable, and client-visible. Always prefer this over set_kit_global_css / element custom_css for ad-hoc styling. The class appears in list_classes with source=[site] and in the editor Browse picker. Optional apply_to: attach the class to element IDs on specific pages in the same call. Call again with the same name to update (css/rules are replaced). v4.76.0+. v4.92.0 adds scope (global vs page) and status (published vs draft). v4.97.0 adds specificity (auto|layout|utility) so layout/visual classes win against .elementor .e-con default styles instead of losing on specificity. v4.98.0 adds rules — the recommended way to author classes that need pseudo-elements, hover states, or any multi-rule structure (keeps the plugin the owner of all class CSS instead of forcing the user to drop ad-hoc CSS into Elementor).',
4044
4070
  inputSchema: {
4045
4071
  type: 'object',
4046
4072
  properties: {
@@ -4221,8 +4247,9 @@ async function handleToolCall(name, args) {
4221
4247
 
4222
4248
  case 'capability_check': {
4223
4249
  try {
4224
- const r = await apiCall('/health?include_routes=1');
4250
+ const r = await apiCall('/health?include_routes=1&include_identity=1');
4225
4251
  const routes = r.routes || {};
4252
+ const id = r.identity || null;
4226
4253
  const exposedPaths = new Set(Object.keys(routes));
4227
4254
 
4228
4255
  // Required-route map: which backend route each MCP tool depends on.
@@ -4263,6 +4290,23 @@ async function handleToolCall(name, args) {
4263
4290
  let msg = `=== CAPABILITY CHECK ===\n`;
4264
4291
  msg += `Plugin: v${r.version}\n`;
4265
4292
  msg += `MCP server: v${VERSION}\n`;
4293
+
4294
+ // v4.110.0: identity probe — the fastest way to spot a stale/wrong app
4295
+ // password or a user with no role on this subsite (every write 401s
4296
+ // while routes/version look healthy).
4297
+ if (id) {
4298
+ if (id.user_id > 0) {
4299
+ const roles = (id.roles || []).join(', ') || 'no roles';
4300
+ msg += `Authenticated as: ${id.login} (#${id.user_id}) — ${roles}\n`;
4301
+ const caps = Object.entries(id.caps || {}).map(([c, v]) => `${v ? '✅' : '❌'} ${c}`).join(' ');
4302
+ msg += `Capabilities: ${caps}\n`;
4303
+ if (!id.caps?.edit_posts) {
4304
+ msg += `⚠️ This user CANNOT edit_posts — content writes will 401/403 despite healthy routes. Check the role on THIS (sub)site.\n`;
4305
+ }
4306
+ } else {
4307
+ msg += `⚠️ Authenticated as: NOBODY (user_id 0). The app password is missing/stale/wrong, or the user has no account on this site. Every write will return "Sorry, you are not allowed to do that".\n`;
4308
+ }
4309
+ }
4266
4310
  msg += `Total routes registered: ${Object.keys(routes).length}\n\n`;
4267
4311
 
4268
4312
  if (missing.length === 0) {
@@ -4798,6 +4842,7 @@ async function handleToolCall(name, args) {
4798
4842
  if (args.element_id) body.element_id = args.element_id;
4799
4843
  if (args.element_path) body.element_path = args.element_path;
4800
4844
  if (args.force) body.force = true;
4845
+ if (args.confirm !== undefined) body.confirm = args.confirm;
4801
4846
  if (!body.element_id && !body.element_path) {
4802
4847
  return ok('Failed: Provide element_id or element_path.');
4803
4848
  }
@@ -6581,6 +6626,7 @@ async function handleToolCall(name, args) {
6581
6626
  const body = { css: args.css ?? '' };
6582
6627
  if (args.mode !== undefined) body.mode = args.mode;
6583
6628
  if (args.dry_run !== undefined) body.dry_run = args.dry_run;
6629
+ if (args.confirm !== undefined) body.confirm = args.confirm;
6584
6630
  const r = await apiCall('/kit-global-css', 'POST', body);
6585
6631
  if (r.code || r.error) return ok(`Failed: ${r.message || r.error}`);
6586
6632
  let out = r.dry_run ? `=== SET KIT GLOBAL CSS (DRY RUN) ===\n` : `=== SET KIT GLOBAL CSS ===\n`;
@@ -6593,6 +6639,7 @@ async function handleToolCall(name, args) {
6593
6639
  case 'patch_kit_global_css': {
6594
6640
  const body = { operations: args.operations ?? [] };
6595
6641
  if (args.dry_run !== undefined) body.dry_run = args.dry_run;
6642
+ if (args.confirm !== undefined) body.confirm = args.confirm;
6596
6643
  const r = await apiCall('/kit-global-css/patch', 'POST', body);
6597
6644
  if (r.code || r.error) return ok(`Failed: ${r.message || r.error}`);
6598
6645
  let out = r.dry_run
@@ -7010,6 +7057,27 @@ async function handleToolCall(name, args) {
7010
7057
  return ok(msg);
7011
7058
  }
7012
7059
 
7060
+ case 'create_template': {
7061
+ if (!args.type || !args.title) {
7062
+ return ok('Failed: type and title are required.');
7063
+ }
7064
+ const body = { type: args.type, title: args.title };
7065
+ if (args.slug) body.slug = args.slug;
7066
+ if (Array.isArray(args.conditions)) body.conditions = args.conditions;
7067
+ if (args.status) body.status = args.status;
7068
+ const r = await apiCall('/templates', 'POST', body);
7069
+ if (r.code || r.error) return ok(`Failed: ${r.message || r.error || 'Unknown error'}`);
7070
+ let msg = `Template created!\n`;
7071
+ msg += `ID: ${r.template_id} ("${r.title}")\n`;
7072
+ msg += `Type: ${r.type}\n`;
7073
+ msg += `Status: ${r.status}\n`;
7074
+ msg += `Conditions: ${r.conditions && r.conditions.length ? r.conditions.join(', ') : '(none)'}\n`;
7075
+ if (r.warning) msg += `⚠️ ${r.warning}\n`;
7076
+ msg += `Edit URL: ${r.edit_url}\n`;
7077
+ msg += `Next: add content with append_section / add_element (target_id=${r.template_id}).`;
7078
+ return ok(msg);
7079
+ }
7080
+
7013
7081
  case 'append_section': {
7014
7082
  // Enforce root settings on appended sections
7015
7083
  if (args.section) addBoilerplate(args.section);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noleemits/vision-builder-control-mcp",
3
- "version": "4.109.3",
3
+ "version": "4.111.0",
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",