formwork-elementor-mcp

abd-haseeb-02/formwork-elementor-mcp Checked 1 day ago

Build WordPress Elementor sites by talking to Claude.

Think of it as what the Webflow MCP does for Webflow, but for WordPress and Elementor. Elementor has no public builder API. A whole page lives in one protected post-meta field (_elementor_data) as undocumented JSON, and its CSS is compiled into per-page files that must be regenerated after every write. Formwork is the bridge that makes that safe to drive from a conversation. The WooCommerce suite (pro-test) needs WooCommerce, which the dev stack does not install; it reports its three product-template checks as skipped there.

Summary extracted from the README.

Formwork — Elementor MCP for Claude

Build and edit WordPress Elementor sites by talking to Claude. Describe a page and get a real Elementor page you can keep editing in the visual builder — layouts, styling, responsive design, a global design system, theme-builder headers and footers, WooCommerce product templates, forms, and SEO.

Think of it as what the Webflow MCP does for Webflow, but for WordPress and Elementor.

Download the plugin → · Install in 5 minutes

Elementor has no public builder API. A whole page lives in one protected post-meta field (_elementor_data) as undocumented JSON, and its CSS is compiled into per-page files that must be regenerated after every write. Formwork is the bridge that makes that safe to drive from a conversation.

Status: V3, V4 atomic, Pro, SEO, content, library, and Pro-flow tracks all working end-to-end. 18 tools / 117 actions; 157 checks passing across six suites in the production request context, against WordPress 7.1 + Elementor 4.2.4 + Elementor Pro 4.2.3 + Yoast 28.4.

The WooCommerce suite (pro-test) needs WooCommerce, which the dev stack does not install; it reports its three product-template checks as skipped there.


What it can do today

Tool What it does
guide Call once per session. Site snapshot, tool map, and the working method.
site Versions, health check, breakpoints, experiments, site identity, installed addons.
widgets Live schema introspection — every widget on the site with its real control names. On the dev stack that is 149: 59 from Elementor, 82 from Elementor Pro, and 8 V4 atomic elements. Third-party addons work automatically. element_schema covers container flex and grid layout.
pages Create, list, duplicate, delete documents; page templates and settings.
structure Compact page outline and element search. Read this before editing.
elements Add, update, move, duplicate, remove. Responsive values, global-token links, dynamic tags, and batch edits.
page_data Whole-tree get/set with validation and dry-run.
design_system V3: global colors, fonts, theme styles. V4: design variables, and global CSS classes with per-breakpoint overrides.
media Upload from URL or base64, manage alt text.
seo SEO title, meta description, canonical, robots, and Open Graph / Twitter cards. Adapts to Yoast, Rank Math, or SEOPress; emits the tags itself when no SEO plugin is installed. Audits pages for missing or weak metadata.
content Posts, pages, custom post types, categories, tags, excerpts, and featured images. This is what Loop Grids and archive templates display.
menus Navigation menus with nesting, and assignment to theme locations. Feeds Elementor's Nav Menu widget.
patterns Ready-made sections - heroes, feature grids, contact cards, CTAs - already built and visually checked, with named slots for the copy and colours that change.
templates Elementor's own template library: save a section for reuse, insert it anywhere, and import/export its native JSON so template kits from anywhere can be used.
theme_builder Headers, footers, single/archive/404/search and WooCommerce product templates, with display conditions. Requires Elementor Pro — verified against Pro 4.2.3 with a live product template.
forms Build Pro forms from a list of field descriptions, wire what happens after submit (email, redirect, webhook), and read submissions. Requires Elementor Pro.
popups Popups with triggers (load, scroll, exit intent, click, inactivity), display conditions, and frequency. Requires an activated Pro licence — see below.
publish Publish, regenerate CSS, verify a page actually rendered, snapshot and restore.

Architecture

Three transports, so a change in any upstream dependency cannot leave you stranded:

  1. Own REST namespace (/wp-json/formwork/v1/) — always on, no dependencies. This is what the bridge uses.
  2. WordPress Abilities API (WP 6.9+) — registers automatically when core supports it.
  3. Official MCP Adapter — wired up defensively; used when the plugin is installed with its Composer dependencies.

Every write goes through Elementor's own Document::save(), never raw update_post_meta. That single choice buys validation, revisions, sanitisation, and CSS regeneration for free — and avoids the silent backslash-stripping that corrupts hand-written meta.

Claude  ──stdio──▶  bridge/formwork-mcp.mjs  ──HTTPS──▶  Formwork plugin  ──▶  Elementor PHP APIs

Install

1. Get the plugin

Download dist/formwork.zip from this repository.

2. Install it on your WordPress site

In wp-admin: Plugins → Add New → Upload Plugin → Choose File → Install Now → Activate.

Requirements: WordPress 6.4+, PHP 8.1+, and Elementor. Elementor free is enough for pages, styling, responsive design, the design system, SEO, and the pattern library. Pro adds the theme builder, forms, and dynamic content.

3. Create an application password

In wp-admin go to Users → Profile, scroll to Application Passwords, enter a name such as Claude, and click Add New Application Password. Copy the password it shows you — WordPress will not show it again.

4. Connect Claude

The bridge needs Node 18+ and nothing else: no npm install, no build step.

There is also a skill in skill/SKILL.md that teaches Claude the working method below. Copy it to ~/.claude/skills/elementor-builder/SKILL.md to have it loaded automatically; it ships inside the plugin zip as well. Clone this repository (or copy bridge/formwork-mcp.mjs anywhere), then run:

claude mcp add formwork --env FORMWORK_SITE_URL=https://yoursite.com --env FORMWORK_USER=your-wp-username --env FORMWORK_APP_PASSWORD=xxxx-xxxx-xxxx-xxxx -- node /path/to/formwork/bridge/formwork-mcp.mjs

Replace the site URL, your WordPress username, and the application password from step 3.

5. Try it

Start a new Claude Code session and say:

call the formwork guide tool

Claude reads the site — Elementor version, whether Pro is active, which widgets exist — and reports back. From there you can just describe what you want:

Build a contact page with a hero, a form, and our address Set our brand colours to #5736FF and near-black Make the hero heading smaller on mobile Which pages are missing a meta description?

Start read-only on a site that matters

Add --env FORMWORK_READ_ONLY=1 to the connect command and Claude can read everything and change nothing. Drop the flag once you trust it. Server-side, update_option('formwork_read_only', true) enforces the same for every client.


Development

The repository includes a Docker stack that provisions WordPress, Elementor, and the plugin from scratch.

cd docker && docker compose up -d
docker compose exec -T wpcli bash /scripts/provision.sh

Site: http://localhost:8080 · Admin: formwork / formwork

Elementor Pro is not included — it is commercial software. To develop against Pro features, drop your own elementor-pro.zip into docker/scripts/vendor/ and install it:

docker compose exec -T wpcli wp --path=/var/www/html plugin install /scripts/vendor/elementor-pro.zip --activate

Rebuild the distributable zip after changing the plugin:

./build.sh

Do not run wp plugin install --force against the dev stack. plugin/ is bind-mounted into the container, and a forced install deletes the mounted source.

The working method

What the guide tool tells Claude, and why pages come out right:

  1. Orient — site.info, site.health.
  2. Discover — widgets.schema before styling anything unfamiliar. Guessing setting names is the main reason generated Elementor pages come out unstyled.
  3. Design system first — design_system.set_colors / set_fonts, so pages reference tokens instead of hardcoded hex.
  4. Build — pages.create, then elements.add section by section.
  5. Style — elements.update, set_responsive for per-device values, link_global to bind to tokens.
  6. Verify — publish.verify fetches the real page and reports whether it rendered. Then look at it.
  7. Ship — publish.publish.

Why the screenshot step is not optional

The demo page passed publish.verify as healthy while its call-to-action button was invisible — white text on a near-white background, because the accent global had been set to a pale tint and Elementor buttons default to accent. Verification proves a page rendered; only looking at it proves the page is good.


Landmines already handled

You never have to think about these — the plugin does:

  • Protected meta — _elementor_data is unreachable via core REST; all access goes through our abilities.
  • Element ids — generated server-side, 7 hex chars, collisions rejected before save.
  • Value shapes — pass 24, "24px", "3.5rem", or "96px 24px"; converted to Elementor's slider and dimension objects.
  • Enum keys that look dimensional — content_width is "boxed", not a size. Values are only converted when they actually look convertible.
  • Group-control toggles — writing typography_font_size auto-sets typography_typography: "custom", without which the style silently does nothing.
  • Two-axis gaps — flex_gap is a gaps control, not a slider. Pass 24 for an even gap or {"column":28,"row":16} for independent axes; the right shape is written either way.
  • Hidden layout controls — container flex and grid settings live in group controls that Elementor never flattens outside the editor. widgets.element_schema reads them off the group classes directly.
  • Responsive suffixes — set_responsive expands {desktop, tablet, mobile} into the right _tablet / _mobile keys.
  • Global links — the __globals__ map and its globals/colors?id=… syntax.
  • Stale CSS — regenerated on every save; publish.regenerate_css to repair.
  • Batch safety — a failing operation aborts the whole batch and saves nothing.
  • Setting names are checked — a key the widget does not declare is refused with the closest real names, rather than stored and rendered as nothing. Same for select values, dynamic-tag names, and V4 style properties.
  • Group controls are enabled from Elementor's own conditions — writing a font size sets the typography toggle; writing a corner radius does not switch a border on, and an overlay colour does not overwrite the element's background.
  • Saves are reconciled — the response counts what Elementor kept, not what was sent, so a dropped widget is reported instead of being counted as added.
  • Permissions match WordPress — publishing needs publish_posts, deleting needs delete_post, theme-wide templates need edit_theme_options, and form submissions need manage_options.
  • Restore points live with the page — kept in post meta, so they are removed when the page is, and a restore brings back page settings and the page template, not just the layout.
  • Imports run through Elementor's own importer — remote images are pulled into the media library instead of hotlinked, and attachment ids from the source site are not trusted.
  • Word counts work in any script — Cyrillic, Arabic and CJK pages are measured properly rather than reported as empty.
  • Theme-builder conditions — Pro's save_conditions() registers a template into the location map and expects parsed condition objects. Writing the meta alone stores a condition that never activates, so the template silently never displays. Formwork writes through the real API and clears both caches.
  • Pro field widgets — woocommerce-product-title and friends extend the Heading widget and ship with placeholder text. The editor binds them when you drag them in; over the API you must bind them with elements.set_dynamic or the page renders "Add Your Heading Text Here".
  • WooCommerce "Coming soon" mode — on by default for new stores, and it serves a launch placeholder to logged-out visitors, which makes a working product template look broken. site.health now flags it.
  • SEO plugin key differences — Yoast, Rank Math, and SEOPress store the same concepts under different keys and encode robots flags three different ways. Formwork speaks one vocabulary and translates.
  • Yoast rejects integer image ids — it registers a string sanitizer on its image-id meta, so writing 77 silently stores an empty value while "77" persists. Image ids are written as strings, and the URL field alongside them, because the plugins build tags from the URL.
  • SEO plugin caches — Yoast precomputes an indexable record at post creation and renders from that, not from post meta, so metadata written to a fresh page serves stale tags. seo.set now invalidates it (Yoast and Rank Math).
  • Elementor Pro form field height is preset-only — input_size offers xs/sm/md/lg/xl with no padding control, so an exact pixel height needs a little custom CSS. Colours, radii, borders, and typography all work through real controls.
  • Elementor pages have empty post_content — word counts and description fallbacks taken from it read as zero. The SEO tool extracts visible text from the element tree instead, including atomic widgets' nested text.

Context matters more than anything else here

Elementor registers a different control stack under WP-CLI than in a web request. Measured on the same install:

Web request (REST) WP-CLI
Form controls 569 365
field_* style controls 15 0
field_border_radius dimensions absent
Container controls 454 306
flex_align_items choose absent

Formwork reads real control types to decide how to shape a value, so this is not academic: under WP-CLI it silently falls back to key-name heuristics, and half of Elementor's styling is unreachable. It also explains why compiled CSS sometimes failed to appear.

Formwork itself always runs in a web request, so production is the good column. The trap is testing: a suite run through wp eval-file exercises the fallback path, not the real one. The dev stack therefore ships a REST test runner, and the smoke suite asserts the full stack is visible and reports which context it is in.

Testing

Unit tests for the pure classes need nothing but PHP:

composer install && vendor/bin/phpunit

The integration suites need the stack. Run them the way production runs, through a real web request:

curl -s -u "USER:APP_PASSWORD" http://localhost:8080/wp-json/formwork-dev/v1/run/smoke

Valid suites: smoke, v4-test, pro-test, seo-test, content-test, library-test, proflow-test. The runner lives in docker/mu-plugins/ and is mounted only in the dev stack; it is not part of the shipped plugin.

WP-CLI still works and is useful for quick checks, but it skips the control-introspection assertions and tells you so:

docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/smoke.php
docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/v4-test.php
docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/pro-test.php
docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/seo-test.php
docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/content-test.php
docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/library-test.php
docker compose exec -T wpcli wp --path=/var/www/html eval-file /scripts/proflow-test.php

build-demo.php is a demo builder rather than a suite: it produces a three-section landing page to look at.

smoke.php covers value normalization, page creation, element add/edit, validation, render verification, and snapshots. v4-test.php covers atomic elements, design variables, and global classes. pro-test.php builds a WooCommerce single-product template and asserts it actually takes over a live product URL. seo-test.php writes metadata through Yoast and confirms the tags reach the rendered page. content-test.php builds a small blog - posts, a category, a featured image, a nested menu - and asserts a Pro archive template lists all of it on a live category URL. library-test.php builds a page entirely from patterns, then saves, exports, re-imports, and re-inserts a section. proflow-test.php builds a Pro form declaratively and asserts popups refuse cleanly when the licence gate is closed. All suites are idempotent and can be re-run. build-demo.php builds a three-section landing page with a design system.


Known limitations

  • The pattern library is small — four sections (hero, three-up features, contact cards, CTA banner). It is a starting set, not a catalogue; add a JSON file to plugin/patterns/ or capture one with patterns.save.
  • Popups need an activated Pro licence, not just Pro installed. Elementor registers the popup document type only once the licence is active. Without it, creating a popup appears to succeed and Elementor then relabels the document as something else. popups detects this and refuses with an explanation rather than leaving a broken template behind.
  • Elementor Pro form field height is preset-only — input_size offers xs/sm/md/lg/xl with no padding control, so an exact pixel height needs a little custom CSS. Everything else (colours, radii, borders, typography) goes through real controls.
  • Pro is required for dynamic content, with no free fallback. On a free install the dynamic-tags manager registers zero tags, and e-form / e-collection-loop are Pro promotion stubs (their PHP classes are named *_Promotion). Product and archive templates are Pro-only.
  • No live editor sync — writes are server-side. Refresh an open Elementor tab to see changes.

Roadmap

Known gaps, roughly in order of how often they come up:

  • The pattern library is small. Four sections. Add JSON to plugin/patterns/, or capture one with patterns.save.
  • No visual check. publish.verify proves a page rendered; it cannot see that a button is invisible. elements.get with include: ["css","html"] is the nearest thing.
  • Coverage is thin above the pure classes. Tree, Values and Atomic have unit tests; everything else is covered only by the integration suites, which need a running WordPress.
  • WooCommerce is not in the dev stack, so the product-template track is only exercised by hand.

License

GPL-2.0-or-later, matching WordPress.