mcp-magento-cms 1.0.0 → 1.0.2
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.
- package/README.md +67 -88
- package/package.json +8 -1
- package/src/index.js +0 -0
- package/.env.example +0 -11
- package/cursor-mcp.example.json +0 -15
- package/samples/figma-category.json +0 -966
- package/samples/figma-slider.json +0 -900
- package/samples/page-7.json +0 -17
- package/samples/page-8.json +0 -15
- package/scripts/create-demo-page.js +0 -237
- package/scripts/create-integration.php +0 -80
- package/scripts/create-melissa-home.js +0 -287
- package/scripts/health-check.js +0 -18
- package/scripts/smoke-e2e.js +0 -42
- package/scripts/test-compose.js +0 -18
package/README.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
# Magento CMS MCP (Cursor)
|
|
1
|
+
# Magento CMS MCP (Cursor)
|
|
2
2
|
|
|
3
|
-
Create/update Magento **CMS Pages / Blocks** with Page Builder **Row → Text
|
|
3
|
+
Create/update Magento **CMS Pages / Blocks** with Page Builder **Row → Text** from Cursor chat.
|
|
4
4
|
|
|
5
|
-
- **AI:**
|
|
6
|
-
- **This server:** Magento REST
|
|
5
|
+
- **AI:** Cursor plans the content
|
|
6
|
+
- **This server:** Magento REST via an Integration Access Token
|
|
7
|
+
- **Install:** `npx` (no local clone, no `tools/` folder, no `.env` file required)
|
|
7
8
|
|
|
8
|
-
Requires **Node 18+**
|
|
9
|
+
Requires **Node.js 18+** and [Cursor](https://cursor.com).
|
|
10
|
+
|
|
11
|
+
Package: [npmjs.com/package/mcp-magento-cms](https://www.npmjs.com/package/mcp-magento-cms)
|
|
9
12
|
|
|
10
13
|
## Tools
|
|
11
14
|
|
|
@@ -14,113 +17,90 @@ Requires **Node 18+** only (`fetch` built-in). No `npm install` required.
|
|
|
14
17
|
| `magento_health` | Test base URL + token |
|
|
15
18
|
| `get_cms_page` | Load by `page_id` |
|
|
16
19
|
| `create_cms_page` | Create from title + content |
|
|
17
|
-
| `update_cms_page` | Update by `page_id`
|
|
20
|
+
| `update_cms_page` | Update by `page_id` |
|
|
18
21
|
| `get_cms_block` / `create_cms_block` / `update_cms_block` | Blocks |
|
|
19
|
-
| `list_section_types` | Supported layouts (MVP: simple_text) |
|
|
20
|
-
|
|
21
|
-
## Setup
|
|
22
|
-
|
|
23
|
-
### 1. Magento Integration token
|
|
22
|
+
| `list_section_types` | Supported layouts (MVP: `simple_text`) |
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
## Setup (any machine)
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
ddev exec php tools/mcp-magento-cms/scripts/create-integration.php
|
|
29
|
-
# prints ACCESS_TOKEN=... (idempotent; reuses the "MCP CMS Studio" integration)
|
|
30
|
-
```
|
|
26
|
+
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`.
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
API tab: allow **CMS Pages/Blocks** and **Content → Design (save_design)** → Save → Activate → copy Access Token.
|
|
34
|
-
|
|
35
|
-
Magento 2.4.4+ blocks integration tokens as bearer by default. Enable once:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
ddev exec bin/magento config:set oauth/consumer/enable_integration_as_bearer 1
|
|
39
|
-
ddev exec bin/magento cache:flush config
|
|
40
|
-
```
|
|
28
|
+
### 1. Magento Integration Access Token
|
|
41
29
|
|
|
42
|
-
|
|
30
|
+
In Magento Admin:
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
1. **System → Extensions → Integrations → Add New Integration**
|
|
33
|
+
2. Name it (e.g. `MCP CMS`)
|
|
34
|
+
3. **API** tab: allow **CMS → Pages**, **CMS → Blocks**, and **Content → Design** (`save_design`) as needed
|
|
35
|
+
4. **Save → Activate** → copy the **Access Token**
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
Magento **2.4.4+** blocks integration tokens as Bearer by default. Enable once on the Magento server:
|
|
50
38
|
|
|
51
39
|
```bash
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# set:
|
|
55
|
-
# MAGENTO_BASE_URL=https://YOUR-PROJECT.ddev.site
|
|
56
|
-
# MAGENTO_ACCESS_TOKEN=your_access_token
|
|
40
|
+
bin/magento config:set oauth/consumer/enable_integration_as_bearer 1
|
|
41
|
+
bin/magento cache:flush config
|
|
57
42
|
```
|
|
58
43
|
|
|
59
|
-
|
|
44
|
+
(With ddev: prefix with `ddev exec`.)
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
# ddev uses a mkcert TLS cert that Node does not trust by default:
|
|
63
|
-
export NODE_EXTRA_CA_CERTS="$HOME/.local/share/mkcert/rootCA.pem"
|
|
46
|
+
### 2. Magento base URL
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
node scripts/health-check.js
|
|
48
|
+
Use your storefront base URL **without** a trailing slash, for example:
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# local compose smoke test (no Magento):
|
|
72
|
-
node scripts/test-compose.js
|
|
73
|
-
```
|
|
50
|
+
- Production: `https://www.example.com`
|
|
51
|
+
- Local ddev: `https://your-project.ddev.site` (`ddev describe` shows the URL)
|
|
74
52
|
|
|
75
|
-
###
|
|
53
|
+
### 3. Add the MCP in Cursor
|
|
76
54
|
|
|
77
|
-
**Cursor → Settings → MCP**, or
|
|
78
|
-
|
|
79
|
-
Use **absolute** path to `index.js`:
|
|
55
|
+
**Cursor → Settings → MCP → Edit Config**, or create `.cursor/mcp.json` in your project:
|
|
80
56
|
|
|
81
57
|
```json
|
|
82
58
|
{
|
|
83
59
|
"mcpServers": {
|
|
84
60
|
"magento-cms": {
|
|
85
|
-
"command": "
|
|
86
|
-
"args": [
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["-y", "mcp-magento-cms"],
|
|
63
|
+
"env": {
|
|
64
|
+
"MAGENTO_BASE_URL": "https://www.example.com",
|
|
65
|
+
"MAGENTO_ACCESS_TOKEN": "YOUR_INTEGRATION_ACCESS_TOKEN"
|
|
66
|
+
}
|
|
89
67
|
}
|
|
90
68
|
}
|
|
91
69
|
}
|
|
92
70
|
```
|
|
93
71
|
|
|
94
|
-
|
|
72
|
+
**Local ddev / mkcert only** — Node may not trust the local TLS cert. Add:
|
|
95
73
|
|
|
96
74
|
```json
|
|
97
|
-
|
|
98
|
-
"mcpServers": {
|
|
99
|
-
"magento-cms": {
|
|
100
|
-
"command": "node",
|
|
101
|
-
"args": [
|
|
102
|
-
"/ABSOLUTE/PATH/tools/mcp-magento-cms/src/index.js"
|
|
103
|
-
],
|
|
104
|
-
"env": {
|
|
105
|
-
"MAGENTO_BASE_URL": "https://mage248p3.ddev.site",
|
|
106
|
-
"MAGENTO_ACCESS_TOKEN": "YOUR_TOKEN"
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
75
|
+
"NODE_EXTRA_CA_CERTS": "/absolute/path/to/mkcert/rootCA.pem"
|
|
111
76
|
```
|
|
112
77
|
|
|
113
|
-
|
|
78
|
+
Typical Linux path: `$HOME/.local/share/mkcert/rootCA.pem`
|
|
79
|
+
|
|
80
|
+
Optional env vars:
|
|
81
|
+
|
|
82
|
+
| Variable | Default | Purpose |
|
|
83
|
+
|----------|---------|---------|
|
|
84
|
+
| `MAGENTO_STORE_CODE` | (empty) | REST store code |
|
|
85
|
+
| `MAGENTO_ADMIN_PATH` | `admin` | Admin path used in edit links |
|
|
114
86
|
|
|
115
|
-
|
|
87
|
+
### 4. Restart MCP
|
|
88
|
+
|
|
89
|
+
In Cursor MCP settings, refresh/restart the `magento-cms` server until it shows connected.
|
|
90
|
+
|
|
91
|
+
### 5. Verify
|
|
92
|
+
|
|
93
|
+
In Cursor chat:
|
|
116
94
|
|
|
117
95
|
```text
|
|
118
96
|
Use magento_health to verify Magento.
|
|
119
97
|
```
|
|
120
98
|
|
|
99
|
+
Then try:
|
|
100
|
+
|
|
121
101
|
```text
|
|
122
102
|
Create a CMS page titled "MCP Demo" with this content:
|
|
123
|
-
First paragraph
|
|
103
|
+
First paragraph.
|
|
124
104
|
Second paragraph.
|
|
125
105
|
```
|
|
126
106
|
|
|
@@ -130,20 +110,19 @@ Update CMS page_id 8 with content: Updated body for page 8.
|
|
|
130
110
|
|
|
131
111
|
## Security
|
|
132
112
|
|
|
133
|
-
-
|
|
134
|
-
-
|
|
113
|
+
- Put tokens only in `mcp.json` / Cursor env (do not commit them)
|
|
114
|
+
- Give the Magento integration **CMS-only** permissions
|
|
135
115
|
|
|
136
|
-
##
|
|
116
|
+
## Requirements
|
|
137
117
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
samples/ Exported reference pages (Page Builder HTML)
|
|
118
|
+
- Node.js **18+** on the machine running Cursor
|
|
119
|
+
- Magento 2 with REST and an Integration token
|
|
120
|
+
- Network access from that machine to `MAGENTO_BASE_URL`
|
|
121
|
+
|
|
122
|
+
## For package maintainers
|
|
123
|
+
|
|
124
|
+
Clone this repo to develop or republish. Bump `version` in `package.json`, then:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm publish --access public
|
|
149
128
|
```
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-magento-cms",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Cursor MCP: Magento CMS pages/blocks with Page Builder Row→Text (zero npm deps)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-magento-cms": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
7
14
|
"scripts": {
|
|
8
15
|
"start": "node src/index.js",
|
|
9
16
|
"health": "node scripts/health-check.js",
|
package/src/index.js
CHANGED
|
File without changes
|
package/.env.example
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Magento (ddev or remote) — no trailing slash
|
|
2
|
-
MAGENTO_BASE_URL=https://mage248p3.ddev.site
|
|
3
|
-
|
|
4
|
-
# Integration Access Token from Admin → System → Integrations
|
|
5
|
-
MAGENTO_ACCESS_TOKEN=
|
|
6
|
-
|
|
7
|
-
# Optional store code for REST (default: all / empty uses /rest/V1)
|
|
8
|
-
# MAGENTO_STORE_CODE=default
|
|
9
|
-
|
|
10
|
-
# Optional admin path prefix for edit links (default: admin)
|
|
11
|
-
# MAGENTO_ADMIN_PATH=admin
|
package/cursor-mcp.example.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mcpServers": {
|
|
3
|
-
"magento-cms": {
|
|
4
|
-
"command": "node",
|
|
5
|
-
"args": [
|
|
6
|
-
"/home/ajaykumar.prajapati@brainvire.com/htdocs/mage248p3/tools/mcp-magento-cms/src/index.js"
|
|
7
|
-
],
|
|
8
|
-
"env": {
|
|
9
|
-
"MAGENTO_BASE_URL": "https://mage248p3.ddev.site",
|
|
10
|
-
"MAGENTO_ACCESS_TOKEN": "REPLACE_WITH_INTEGRATION_ACCESS_TOKEN",
|
|
11
|
-
"NODE_EXTRA_CA_CERTS": "/home/ajaykumar.prajapati@brainvire.com/.local/share/mkcert/rootCA.pem"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|