@salesforce/pwa-kit-mcp 0.1.0-preview.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.
- package/CHANGELOG.md +5 -0
- package/README.md +165 -0
- package/dist/CHANGELOG.md +5 -0
- package/dist/data/CategoryDocument.json +239 -0
- package/dist/data/DocumentList.json +920 -0
- package/dist/data/ProductDocument.json +1458 -0
- package/dist/package.json +67 -0
- package/dist/server/server.js +210 -0
- package/dist/utils/create-new-component-tool.js +340 -0
- package/dist/utils/index.js +27 -0
- package/dist/utils/pwa-create-app-guideline-tool.js +99 -0
- package/dist/utils/pwa-developer-guideline-tool.js +131 -0
- package/dist/utils/run-site-test-accessibility.js +33 -0
- package/dist/utils/run-site-test-performance.js +107 -0
- package/dist/utils/run-site-test-tool.js +47 -0
- package/dist/utils/utils.js +115 -0
- package/package.json +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
## v1.0.0-dev.0 (Jun 26, 2025)
|
|
2
|
+
- Add `create_app_guidelines` MCP tool [#2663](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2663)
|
|
3
|
+
- Add `create_new_sample_component` MCP tool. [#2651](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2651)
|
|
4
|
+
- Add `create_app_guidelines` MCP tool. [#2599](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2599)
|
|
5
|
+
- Add `run_site_test` MCP tool [#2645](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2645):
|
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# PWA Storefront MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that provides AI coding assistance for developing PWA-kit-based storefront apps in an IDE.
|
|
4
|
+
|
|
5
|
+
Install and run this MCP server as a local MCP server or run locally via `npx` (when it's available on `npm` in feature).
|
|
6
|
+
|
|
7
|
+
## What is MCP?
|
|
8
|
+
|
|
9
|
+
The Model Context Protocol (MCP) is an open protocol that enables secure connections between host applications, such as Claude Desktop or other AI assistants, and external data sources and tools.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
The PWA Storefront MCP Server provides these features.
|
|
14
|
+
|
|
15
|
+
- `development_guidelines`: Helps developers understand and follow PWA Storefront developer guidelines and best practices.
|
|
16
|
+
- `create_new_sample_component`: Helps developers create a new sample PWA Storefront component. This feature guides developers through a few simple questions and then generates code for the component based on the commerce data model used, layouts, etc.
|
|
17
|
+
- `create_app_guidelines`: Helps developers generate a new PWA Storefront project.
|
|
18
|
+
- `run_site_test`: Run site performance or accessibility test for a given site URL (e.g. [https://pwa-kit.mobify-storefront.com](https://pwa-kit.mobify-storefront.com))
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
Install dependencies and build under `pwa-kit` root directory:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd {{pwa-kit root directory}}
|
|
26
|
+
npm ci
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Run the MCP Server
|
|
30
|
+
|
|
31
|
+
### Method 1: Run MCP Server from Cursor
|
|
32
|
+
|
|
33
|
+
1. Open the Cursor application.
|
|
34
|
+
|
|
35
|
+
2. In the Cursor Menu on the top menu bar, click **Settings** > **Cursor Settings...**.
|
|
36
|
+
|
|
37
|
+
<img src="./docs/images/cursor-settings.png" alt="Cursor Settings Screenshot" width="50%" />
|
|
38
|
+
|
|
39
|
+
3. Click **Tools & Integrations** > **MCP Tools** > **New MCP Server**.
|
|
40
|
+
|
|
41
|
+
<img src="./docs/images/cursor-mcp-tools.png" alt="Cursor MCP Tools Screenshot" width="50%" />
|
|
42
|
+
|
|
43
|
+
The `mcp.json` file opens. Add this definition to your `mcp.json` file and replace {{parent-dir-to-mcp}} and {{path-to-app-directory}} placeholders with correct values.
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
|
|
49
|
+
"pwa-kit-mcp": {
|
|
50
|
+
"command": "node {{parent-dir-to-mcp}}/pwa-kit-mcp/dist/server/server.js",
|
|
51
|
+
"transport": "stdio",
|
|
52
|
+
"args": [],
|
|
53
|
+
"env": {
|
|
54
|
+
"PWA_STOREFRONT_APP_PATH": "{{path-to-app-directory}}"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
After you modify the `mcp.json` file, cursor will do these actions.
|
|
62
|
+
|
|
63
|
+
- Start the MCP server.
|
|
64
|
+
- Connect to the MCP server as a client.
|
|
65
|
+
- List available tools.
|
|
66
|
+
|
|
67
|
+
You can go back to MCP Tools and choose to enable/disable any MCP Server or tools.
|
|
68
|
+
|
|
69
|
+
### Method 2: Run MCP Server from Claude
|
|
70
|
+
|
|
71
|
+
#### Using Claude Desktop
|
|
72
|
+
|
|
73
|
+
1. In the Claude app menu, on the top menu bar, click **Developer** > **Edit Config**.
|
|
74
|
+
The `claude_desktop_config.json` file opens.
|
|
75
|
+
|
|
76
|
+
<img src="./docs/images/claude-config.png" alt="Claude MCP Config Screenshot" width="50%" />
|
|
77
|
+
|
|
78
|
+
2. Add this server definition to your `claude_desktop_config.json` and replace {{path-to-node}}, {{parent-dir-to-mcp}} and {{path-to-app-directory}} placeholders with correct values.
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"pwa-kit-mcp": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "@salesforce/pwa-kit-mcp-server@0.1.0-preview.0"],
|
|
86
|
+
"env": {
|
|
87
|
+
"PWA_STOREFRONT_APP_PATH": "{{path-to-app-directory}}"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
After you modify the `claude_desktop_config.json` file, Claude will do these actions.
|
|
95
|
+
|
|
96
|
+
- Start the MCP server.
|
|
97
|
+
- Connect to the MCP server as a client.
|
|
98
|
+
- List available tools.
|
|
99
|
+
|
|
100
|
+
<img src="./docs/images/claude-list-tools.png" alt="Claude MCP Tools Screenshot" width="40%" />
|
|
101
|
+
|
|
102
|
+
You can also enable/disable any available tools from here.
|
|
103
|
+
|
|
104
|
+
#### Using other MCP clients
|
|
105
|
+
The server runs on stdio, so you can test it with any MCP-compatible client.
|
|
106
|
+
|
|
107
|
+
### Method 3: Manually start MCP Server
|
|
108
|
+
|
|
109
|
+
You can also manually start the server from command line and sending JSON-RPC messages:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd {{dir-to-mcp}}
|
|
113
|
+
# Start the server
|
|
114
|
+
npm run start
|
|
115
|
+
|
|
116
|
+
# Then send JSON-RPC requests to stdin:
|
|
117
|
+
{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}
|
|
118
|
+
{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "create_new_component", "arguments": {}}}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Files
|
|
122
|
+
|
|
123
|
+
- `server.js` - Main MCP server implementation
|
|
124
|
+
- `mcp.json` - MCP configuration file for clients
|
|
125
|
+
- `package.json` - Node.js dependencies and scripts
|
|
126
|
+
|
|
127
|
+
## Development
|
|
128
|
+
|
|
129
|
+
To run the server in development mode:
|
|
130
|
+
```bash
|
|
131
|
+
npm start
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The server outputs debug information to stderr and handle MCP protocol messages via stdio.
|
|
135
|
+
|
|
136
|
+
# Project Structure
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
/ (root)
|
|
140
|
+
- package.json
|
|
141
|
+
- package-lock.json
|
|
142
|
+
- README.md
|
|
143
|
+
- mcp.json
|
|
144
|
+
- claude_desktop_config.json
|
|
145
|
+
/src
|
|
146
|
+
/server
|
|
147
|
+
- server.js
|
|
148
|
+
/utils
|
|
149
|
+
- pwa-developer-guideline-tool.js
|
|
150
|
+
- utils.js
|
|
151
|
+
/tests
|
|
152
|
+
- test-mcp.js
|
|
153
|
+
/docs
|
|
154
|
+
/images
|
|
155
|
+
- claude-config.png
|
|
156
|
+
- claude-list-tools.png
|
|
157
|
+
- cursor-list-tools.png
|
|
158
|
+
- cursor-settings.pnb
|
|
159
|
+
- cursor-integration-guide.md
|
|
160
|
+
/node_modules
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- Server code is in `src/server/`.
|
|
164
|
+
- Utilities/tools are in `src/utils/`.
|
|
165
|
+
- Documentation is in `docs/`.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
## v1.0.0-dev.0 (Jun 26, 2025)
|
|
2
|
+
- Add `create_app_guidelines` MCP tool [#2663](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2663)
|
|
3
|
+
- Add `create_new_sample_component` MCP tool. [#2651](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2651)
|
|
4
|
+
- Add `create_app_guidelines` MCP tool. [#2599](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2599)
|
|
5
|
+
- Add `run_site_test` MCP tool [#2645](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2645):
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Document representing a category.",
|
|
3
|
+
"properties": {
|
|
4
|
+
"c_alternativeUrl": {
|
|
5
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/markup_text",
|
|
6
|
+
"description": "Renders an alternative URL in main navigation. Uses Commerce Cloud content url notation. For example: $url('Account-Show')$ or normal URL http://xchange.demandware.com",
|
|
7
|
+
"x-label": {
|
|
8
|
+
"default": "Alternative URL"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"c_catBannerID": {
|
|
12
|
+
"description": "Used to define the content asset used to populate a grid page banner for a category. This value is applied to all sub-category navigation (cascading) if no specific catBannerID has been defined for a sub-category.",
|
|
13
|
+
"x-label": {
|
|
14
|
+
"default": "Category Banner ID"
|
|
15
|
+
},
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"c_customCSSFile": {
|
|
19
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/media_file",
|
|
20
|
+
"description": "Use this attribute to apply custom styles for this category.",
|
|
21
|
+
"x-label": {
|
|
22
|
+
"default": "Custom CSS File"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"c_enableCompare": {
|
|
26
|
+
"description": "Used to define if/when the Compare feature is to be visualized in the storefront based on navigation. If enableCompare = FALSE, no Compare checkboxes will be displayed in the grid view. If enableCompare = TRUE, the category (and its children) will support the Compare feature.",
|
|
27
|
+
"x-label": {
|
|
28
|
+
"default": "Enable Compare"
|
|
29
|
+
},
|
|
30
|
+
"type": "boolean"
|
|
31
|
+
},
|
|
32
|
+
"c_headerMenuBanner": {
|
|
33
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/markup_text",
|
|
34
|
+
"x-label": {
|
|
35
|
+
"default": "Header Menu Banner"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"c_headerMenuOrientation": {
|
|
39
|
+
"description": "Which way to orient the menu and optional header menu HTML. Vertical will list all in one line. Horizontal will list in columns.",
|
|
40
|
+
"enum": [
|
|
41
|
+
"Horizontal",
|
|
42
|
+
"Vertical"
|
|
43
|
+
],
|
|
44
|
+
"x-enum-labels": [
|
|
45
|
+
{
|
|
46
|
+
"default": "Horizontal"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"default": "Vertical"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"x-label": {
|
|
53
|
+
"default": "Header Menu Orientation"
|
|
54
|
+
},
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"c_showInMenu": {
|
|
58
|
+
"description": "Used to indicate that a category (such as Mens -> Footwear -> Boots) will display in the roll-over navigation. A sub-category only shows if also the parent category is marked as showInMenu. Up to three category levels are shown in roll-over navigation.",
|
|
59
|
+
"x-label": {
|
|
60
|
+
"default": "Show in Menu Navigation"
|
|
61
|
+
},
|
|
62
|
+
"type": "boolean"
|
|
63
|
+
},
|
|
64
|
+
"c_sizeChartID": {
|
|
65
|
+
"description": "Used to define the content asset ID of the Size Chart that is appropriate for products whose PRIMARY category is the associated category (and its children). Whenever a product detail page (or quick view) is rendered, the Size Chart link is populated based on the value of this attribute for the products primary categorization. If not defined, NO size chart link is displayed.",
|
|
66
|
+
"x-label": {
|
|
67
|
+
"default": "Size Chart"
|
|
68
|
+
},
|
|
69
|
+
"type": "string"
|
|
70
|
+
},
|
|
71
|
+
"c_slotBannerHtml": {
|
|
72
|
+
"additionalProperties": {
|
|
73
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/markup_text"
|
|
74
|
+
},
|
|
75
|
+
"format": "localized",
|
|
76
|
+
"x-label": {
|
|
77
|
+
"default": "Slot Banner HTML"
|
|
78
|
+
},
|
|
79
|
+
"type": "object"
|
|
80
|
+
},
|
|
81
|
+
"c_slotBannerImage": {
|
|
82
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/media_file",
|
|
83
|
+
"description": "Image used on either the top or bottom slot on the category landing pages.",
|
|
84
|
+
"x-label": {
|
|
85
|
+
"default": "Category Landing Slot Image"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"catalog_id": {
|
|
89
|
+
"description": "The id of the catalog that contains it.",
|
|
90
|
+
"x-label": {
|
|
91
|
+
"default": "ID"
|
|
92
|
+
},
|
|
93
|
+
"type": "string"
|
|
94
|
+
},
|
|
95
|
+
"categories": {
|
|
96
|
+
"description": "The array of sub categories for the category.",
|
|
97
|
+
"items": {
|
|
98
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/category"
|
|
99
|
+
},
|
|
100
|
+
"type": "array"
|
|
101
|
+
},
|
|
102
|
+
"creation_date": {
|
|
103
|
+
"description": "Returns the value of attribute 'creationDate'.",
|
|
104
|
+
"format": "date-time",
|
|
105
|
+
"x-label": {
|
|
106
|
+
"default": "Creation Date"
|
|
107
|
+
},
|
|
108
|
+
"readOnly": true,
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"description": {
|
|
112
|
+
"additionalProperties": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"description": "The localized description of the category.",
|
|
116
|
+
"format": "localized",
|
|
117
|
+
"x-label": {
|
|
118
|
+
"default": "Description"
|
|
119
|
+
},
|
|
120
|
+
"type": "object"
|
|
121
|
+
},
|
|
122
|
+
"id": {
|
|
123
|
+
"description": "The id of the category.",
|
|
124
|
+
"x-label": {
|
|
125
|
+
"default": "ID"
|
|
126
|
+
},
|
|
127
|
+
"maxLength": 256,
|
|
128
|
+
"minLength": 1,
|
|
129
|
+
"type": "string"
|
|
130
|
+
},
|
|
131
|
+
"image": {
|
|
132
|
+
"description": "The name of the category image. The URL to the image is computed.",
|
|
133
|
+
"x-label": {
|
|
134
|
+
"default": "Standard Image"
|
|
135
|
+
},
|
|
136
|
+
"maxLength": 256,
|
|
137
|
+
"minLength": 1,
|
|
138
|
+
"type": "string"
|
|
139
|
+
},
|
|
140
|
+
"last_modified": {
|
|
141
|
+
"description": "Returns the value of attribute 'lastModified'.",
|
|
142
|
+
"format": "date-time",
|
|
143
|
+
"x-label": {
|
|
144
|
+
"default": "Last Modified"
|
|
145
|
+
},
|
|
146
|
+
"readOnly": true,
|
|
147
|
+
"type": "string"
|
|
148
|
+
},
|
|
149
|
+
"link": {
|
|
150
|
+
"description": "The URL to get the category. This is a computed attribute and cannot be modified.",
|
|
151
|
+
"type": "string"
|
|
152
|
+
},
|
|
153
|
+
"name": {
|
|
154
|
+
"additionalProperties": {
|
|
155
|
+
"type": "string"
|
|
156
|
+
},
|
|
157
|
+
"description": "The localized name of the category.",
|
|
158
|
+
"format": "localized",
|
|
159
|
+
"x-label": {
|
|
160
|
+
"default": "Name"
|
|
161
|
+
},
|
|
162
|
+
"type": "object"
|
|
163
|
+
},
|
|
164
|
+
"online": {
|
|
165
|
+
"description": "The online status of the category determines if it is visible in the storefront. Defaults to false if not specified on create.",
|
|
166
|
+
"x-label": {
|
|
167
|
+
"default": "Online"
|
|
168
|
+
},
|
|
169
|
+
"type": "boolean"
|
|
170
|
+
},
|
|
171
|
+
"page_description": {
|
|
172
|
+
"additionalProperties": {
|
|
173
|
+
"type": "string"
|
|
174
|
+
},
|
|
175
|
+
"description": "The localized page description of the category.",
|
|
176
|
+
"format": "localized",
|
|
177
|
+
"x-label": {
|
|
178
|
+
"default": "Page Description"
|
|
179
|
+
},
|
|
180
|
+
"type": "object"
|
|
181
|
+
},
|
|
182
|
+
"page_keywords": {
|
|
183
|
+
"additionalProperties": {
|
|
184
|
+
"type": "string"
|
|
185
|
+
},
|
|
186
|
+
"description": "The localized page keywords for the category.",
|
|
187
|
+
"format": "localized",
|
|
188
|
+
"x-label": {
|
|
189
|
+
"default": "Page Keywords"
|
|
190
|
+
},
|
|
191
|
+
"type": "object"
|
|
192
|
+
},
|
|
193
|
+
"page_title": {
|
|
194
|
+
"additionalProperties": {
|
|
195
|
+
"type": "string"
|
|
196
|
+
},
|
|
197
|
+
"description": "The localized page title of the category.",
|
|
198
|
+
"format": "localized",
|
|
199
|
+
"x-label": {
|
|
200
|
+
"default": "Page Title"
|
|
201
|
+
},
|
|
202
|
+
"type": "object"
|
|
203
|
+
},
|
|
204
|
+
"parent_category_id": {
|
|
205
|
+
"description": "The id of the parent category. Defaults to root if not specified on create.",
|
|
206
|
+
"maxLength": 256,
|
|
207
|
+
"minLength": 1,
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"paths": {
|
|
211
|
+
"description": "The paths that contains catalog and category information requested by non-standard expand request",
|
|
212
|
+
"items": {
|
|
213
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/path_record"
|
|
214
|
+
},
|
|
215
|
+
"type": "array"
|
|
216
|
+
},
|
|
217
|
+
"position": {
|
|
218
|
+
"description": "The position of the category determines the display order in the storefront.",
|
|
219
|
+
"format": "double",
|
|
220
|
+
"type": "number"
|
|
221
|
+
},
|
|
222
|
+
"sorting_rules": {
|
|
223
|
+
"description": "The sorting rules that are attached to the category requested by non-standard expand request",
|
|
224
|
+
"items": {
|
|
225
|
+
"$ref": "https://zzrf-001.dx.commercecloud.salesforce.com/s/-/dw/meta/rest/data/v23_1/documents/sorting_rule"
|
|
226
|
+
},
|
|
227
|
+
"type": "array"
|
|
228
|
+
},
|
|
229
|
+
"thumbnail": {
|
|
230
|
+
"description": "The name of the category thumbnail. The URL to the thumbnail is computed.",
|
|
231
|
+
"x-label": {
|
|
232
|
+
"default": "Thumbnail Image"
|
|
233
|
+
},
|
|
234
|
+
"maxLength": 256,
|
|
235
|
+
"minLength": 1,
|
|
236
|
+
"type": "string"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|