npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-magento-cms

v1.4.0

Published

Cursor MCP: Magento CMS pages/blocks + custom-entity Page Builder fields (case study/product/category) + compose/validate/repair (zero npm deps)

Downloads

288

Readme

Magento CMS MCP (Cursor)

Create/update Magento CMS Pages / Blocks with Page Builder from Cursor chat — including validate/repair for stage-safe HTML and raw Page Builder HTML saves for complex layouts.

  • AI: Cursor plans content and diagnostics
  • This server: Magento REST via Integration Access Token
  • Local: run from this repo path in mcp.json (point MAGENTO_BASE_URL at the target store)
  • Published: npx -y mcp-magento-cms (npm)

Requires Node.js 18+ and Cursor.

CMS workflow (mandatory for agents & teams)

Use this MCP as the only way to create or update Magento CMS pages/blocks.

| Do | Do not | |----|--------| | pagebuilder_rules → compose_pagebuilder / create_cms_page / set_pagebuilder_html | Project PHP tools/compose-*.php / deploy-*.php | | validate_pagebuilder / repair_pagebuilder before save | Direct DB edits to cms_page / cms_block content | | Improve this package when something is missing or wrong | Bypass MCP with one-off scripts |

Preferred path: sections[] → compose_pagebuilder (or create_cms_page with sections) → validate → save. Use set_pagebuilder_html only for intentional raw master HTML. After save, verify on the storefront.

Reload/restart the MCP server in Cursor after changing this package so teammates pick up new rules and tools.

REST field note (Magento 2.4.8): cmsPage create/update use active (not is_active) and reject store_id / unknown fields. The client maps is_active → active so tool args stay familiar.

Store views: Magento REST cannot set cms_page_store / cms_block_store. On create, this MCP assigns All Store Views (store_id = 0) by default via Magento PHP (scripts/assign-stores.php + ddev exec when .ddev exists). Pass store_ids: [1, 2] (etc.) only when the user asks for specific store view(s). Requires MAGENTO_ROOT (or infer from MAGENTO_CMS_PROJECT_RULES → project root).

Page layout: On create, default page_layout is cms-full-width (admin label: Page — Full Width). Pass page_layout only when the user asks for a different layout (e.g. 1column).

Shared rules (all projects — read first)

Returned by pagebuilder_rules for every store. This package stays free of store-specific hex / class catalogs; those go in optional project rules.

Page Builder (stage-safe)

  1. Rows: use Full Width or Contained. Never Full Bleed unless the user explicitly asks.
  2. When edge-to-edge hero is intentional: allow_full_bleed=true on validate/set/repair.
  3. full-width rows MUST include .row-full-width-inner[data-element=inner].
  4. contained rows MUST include [data-element=inner].
  5. Converting full-bleed → full-width without adding the inner wrapper breaks admin Page Builder.
  6. Every [data-pb-style=ID] in <style> must match an element — orphans crash the stage.
  7. Every column needs width:% in the style block.
  8. Avoid raw <svg> inside Text — use Image (or theme CSS) for icons.
  9. Hero CTAs: Banner Show Button=Always + Link URL.
  10. Links: prefer {{store url=path}} with an unquoted path (avoid &quot; in href).
  11. Prefer native content types; CMS body = page content only (layout owns chrome).

CMS media + theme conventions (all projects)

  1. One flat media folder per CMS page under pub/media/wysiwyg/ — no cards/, icons/, products/, related/ subfolders.
  2. Folder name = CMS page URL key (identifier), e.g. wysiwyg/markets/market-industrial/hero.jpg.
  3. After renaming media folders, update all {{media url=…}} in cms_page / cms_block, then flush cache.
  4. Sibling pages share one Magento_Cms LESS partial + shared classes — do not copy near-identical LESS into theme _sources.less per page.
  5. Page-only LESS → theme Magento_Cms/web/css/source/ + _module.less import.
  6. Brand primary/secondary once in _theme.less (@theme__color__primary / @theme__color__secondary); use vars, not hex, in page LESS.
  7. No module-level re-aliases of theme vars; no redundant font-family when body already uses the theme base font.
  8. Scope page CSS with layout body class and/or content markers (:has(.…)).

Use tools pagebuilder_rules, validate_pagebuilder, and repair_pagebuilder.

Per-store project rules (optional)

Keep the published MCP general. Put store-specific values (brand hex, Vendor/theme, URL keys, class prefixes) in the Magento project, not in this package.

Recommended (project-wise Cursor config):

  1. Commit .cursor/magento-cms-project-rules.json in the Magento repo.
  2. Add project MCP config at .cursor/mcp.json (Customize → MCPs → workspace) with MAGENTO_ROOT only — rules auto-load from ${MAGENTO_ROOT}/.cursor/magento-cms-project-rules.json.
{
  "mcpServers": {
    "magento-cms": {
      "command": "npx",
      "args": ["-y", "mcp-magento-cms"],
      "env": {
        "MAGENTO_BASE_URL": "https://your-store.example/",
        "MAGENTO_ACCESS_TOKEN": "${env:MAGENTO_ACCESS_TOKEN}",
        "MAGENTO_ROOT": "${workspaceFolder}"
      }
    }
  }
}

Optional override: MAGENTO_CMS_PROJECT_RULES=/path/to/file.json if the rules file is not under .cursor/.

pagebuilder_rules appends project rules after shared rules. JSON shape:

{
  "rules": ["store-only convention"],
  "detail": { "brand_tokens": "optional longer notes" }
}

Markdown/text files are also supported (one rule per non-empty, non-# line). Projects with no rules file still get all shared conventions.

Compose with sections[]

Prefer structured trees over project-specific PHP. Theme CSS class names go in css_classes (project owns naming).

// Tool: compose_pagebuilder  OR  create_cms_page({ title, sections })
{
  "sections": [
    {
      "type": "row",
      "appearance": "full-bleed",
      "children": [{
        "type": "banner",
        "background_image": "{{media url=wysiwyg/hero.jpg}}",
        "content_html": "<h1>Title</h1>",
        "show_button": "always",
        "button_text": "Contact",
        "link_url": "#contact"
      }]
    },
    {
      "type": "row",
      "appearance": "contained",
      "children": [
        { "type": "heading", "text": "Section", "heading_type": "h2" },
        { "type": "text", "html": "<p>Body</p>" },
        {
          "type": "columns",
          "columns": [
            { "children": [
              { "type": "image", "src": "{{media url=wysiwyg/a.jpg}}", "alt": "A" },
              { "type": "text", "html": "<p>Card</p>" }
            ]}
          ]
        },
        { "type": "buttons", "items": [{ "text": "Shop", "url": "{{store url=shop}}" }] },
        { "type": "divider" },
        { "type": "products", "skus": ["SKU1", "SKU2"] },
        { "type": "block", "identifier": "my-cms-block" }
      ]
    }
  ]
}

Native types: row, columns / column-group / column, text, heading, image, buttons, banner, html, divider, video, map, tabs, slider, products, block.

Call list_section_types for the full parameter catalog. For intentional edge-to-edge heroes use appearance: "full-bleed" and allow_full_bleed: true on save.

Tools

| Tool | Purpose | |------|---------| | magento_health | Test base URL + token | | pagebuilder_rules | Return Full Width / inner / orphan-style rules | | list_section_types | Native element catalog + composition patterns | | compose_pagebuilder | Build master-format HTML from sections[] (all PB types); optional save | | search_cms | Find pages/blocks by identifier | | get_cms_page / get_cms_block | Load entity (include_content, validate) | | validate_pagebuilder | Stage-safety checks (html / page_id / block_id) | | repair_pagebuilder | Fix orphans, full-bleed, inners, widths, SVG (apply=true to save) | | set_pagebuilder_html | Save raw PB HTML without wiping to simple_text | | create_cms_page / update_cms_page | Simple Row→Text composer | | create_cms_block / update_cms_block | Simple Row→Text composer | | set_entity_pagebuilder_html | Save PB HTML into non-CMS fields (case study, product/category attributes, flat text columns). Requires MAGENTO_ROOT. |

Important: update_cms_page / update_cms_block with content rebuild as simple_text only. For complex pages use set_pagebuilder_html or repair_pagebuilder with apply=true.

Custom entity Page Builder fields (case studies, PDP, categories, …)

When Page Builder lives on a custom module column (or catalog attribute) instead of cms_page / cms_block:

// Tool: set_entity_pagebuilder_html
{
  entity: "casestudy",       // or "product" + sku, or "category"
  entity_id: 17,
  field: "challenges",       // admin PB field / DB column
  sections: [ /* same tree as compose_pagebuilder */ ],
  // html: "<div data-content-type=...>"  // alternative to sections
}

Presets: casestudy → brainvire_case_studies; product / category → Magento repositories. Or pass table + entity_id + field for other flat modules. Still call pagebuilder_rules / validate first — this tool compose+repairs+validates before writing.

Local Cursor config (this machine)

{
  "mcpServers": {
    "magento-cms": {
      "command": "node",
      "args": [
        "/home/[email protected]/htdocs/mcp-magento-cms/src/index.js"
      ],
      "env": {
        "MAGENTO_BASE_URL": "https://your-store.ddev.site",
        "MAGENTO_ACCESS_TOKEN": "YOUR_TOKEN",
        "NODE_TLS_REJECT_UNAUTHORIZED": "0"
      }
    }
  }
}

After changing this package, reload MCP in Cursor (Settings → MCP → refresh / restart).

Setup (published npx)

1. Magento Integration Access Token

  1. System → Extensions → Integrations → Add New Integration
  2. API → Custom → Content → Pages (Save/Edit Design) + Blocks
  3. Activate → copy Access Token

Enable Bearer tokens (2.4.4+):

bin/magento config:set oauth/consumer/enable_integration_as_bearer 1
bin/magento cache:flush config

2. mcp.json with npx

{
  "mcpServers": {
    "magento-cms": {
      "command": "npx",
      "args": ["-y", "mcp-magento-cms"],
      "env": {
        "MAGENTO_BASE_URL": "https://www.example.com",
        "MAGENTO_ACCESS_TOKEN": "YOUR_INTEGRATION_ACCESS_TOKEN"
      }
    }
  }
}

Local ddev TLS: add "NODE_TLS_REJECT_UNAUTHORIZED": "0".

Scripts

npm run test:compose
npm run test:validate
npm run health

Version

1.2.0 — compose all native Page Builder content types via sections[] + validate/repair/raw HTML.