mcp-magento-cms
v1.0.4
Published
Cursor MCP: Magento CMS pages/blocks with Page Builder Row→Text (zero npm deps)
Downloads
787
Readme
Magento CMS MCP (Cursor)
Create/update Magento CMS Pages / Blocks with Page Builder Row → Text from Cursor chat.
- AI: Cursor plans the content
- This server: Magento REST via an Integration Access Token
- Install:
npx(no local clone, notools/folder, no.envfile required)
Requires Node.js 18+ and Cursor.
Package: npmjs.com/package/mcp-magento-cms
Tools
| Tool | Purpose |
|------|---------|
| magento_health | Test base URL + token |
| get_cms_page | Load by page_id |
| create_cms_page | Create from title + content |
| update_cms_page | Update by page_id |
| get_cms_block / create_cms_block / update_cms_block | Blocks |
| list_section_types | Supported layouts (MVP: simple_text) |
Setup (any machine)
You do not need to clone this repo or create a .env file. Cursor runs the package with npx and reads credentials from mcp.json.
1. Magento Integration Access Token
No clone or tools/ folder is needed. Create the token in Magento Admin:
- System → Extensions → Integrations → Add New Integration
- Name it (e.g.
MCP CMS) and set your admin password when prompted - Open the API tab → set Resource Access to Custom
- Under Content → Elements, select:
| Select | Notes | |--------|--------| | Pages | Required (parent) | | → Save Page | Create / update pages | | → Edit Page Design | Page Builder / design fields | | → Delete Page | Optional (MCP does not delete today) | | Blocks | Required (create / update blocks) |
Leave everything else unchecked (Staging, Widgets, Media Gallery, Amasty, Blog, Design Themes, etc.).
- Save → Activate → copy the Access Token into
mcp.json(step 3)
Magento 2.4.4+ blocks integration tokens as Bearer by default. Enable once (either way):
Admin UI: Stores → Configuration → Services → OAuth → Consumer Settings → set Allow OAuth Access Tokens to be used as standalone Bearer tokens to Yes → Save Config.
CLI:
bin/magento config:set oauth/consumer/enable_integration_as_bearer 1
bin/magento cache:flush config(With ddev: prefix CLI with ddev exec.)
2. Magento base URL
Use your storefront base URL without a trailing slash, for example:
- Production:
https://www.example.com - Local ddev:
https://your-project.ddev.site(ddev describeshows the URL)
3. Add the MCP in Cursor
Cursor → Settings → MCP → Edit Config, or create .cursor/mcp.json in your project:
{
"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 / self-signed HTTPS — Node often rejects the local TLS cert and MCP calls fail with fetch failed. Add:
"NODE_TLS_REJECT_UNAUTHORIZED": "0"Example for a ddev store:
{
"mcpServers": {
"magento-cms": {
"command": "npx",
"args": ["-y", "mcp-magento-cms"],
"env": {
"MAGENTO_BASE_URL": "https://your-project.ddev.site",
"MAGENTO_ACCESS_TOKEN": "YOUR_INTEGRATION_ACCESS_TOKEN",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
}
}
}
}Use this only for local/dev. Prefer a trusted public HTTPS cert in production (omit this variable).
Optional alternative (if mkcert CA is installed): set NODE_EXTRA_CA_CERTS to your mkcert root CA path instead (e.g. $HOME/.local/share/mkcert/rootCA.pem).
Optional env vars:
| Variable | Default | Purpose |
|----------|---------|---------|
| MAGENTO_STORE_CODE | (empty) | REST store code |
| MAGENTO_ADMIN_PATH | admin | Admin path used in edit links |
| NODE_TLS_REJECT_UNAUTHORIZED | (unset) | Set "0" for local ddev / self-signed SSL |
4. Restart MCP
In Cursor MCP settings, refresh/restart the magento-cms server until it shows connected.
5. Verify
In Cursor chat:
Use magento_health to verify Magento.Then try:
Create a CMS page titled "MCP Demo" with this content:
First paragraph.
Second paragraph.Update CMS page_id 8 with content: Updated body for page 8.Security
- Put tokens only in
mcp.json/ Cursor env (do not commit them) - Give the Magento integration CMS-only permissions
Requirements
- Node.js 18+ on the machine running Cursor
- Magento 2 with REST and an Integration token
- Network access from that machine to
MAGENTO_BASE_URL
For package maintainers
Clone this repo to develop or republish. Bump version in package.json, then:
npm publish --access public