Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default {
testEnvironment: 'node',
testMatch: [
'**/__tests__/**/*.js',
'**/?(*.)+(spec|test).js'
],
collectCoverageFrom: [
'src/**/*.js',
'!src/**/*.test.js',
'!src/**/*.spec.js'
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
testTimeout: 10000,
extensionsToTreatAsEsm: ['.js']
}
33 changes: 14 additions & 19 deletions packages/pwa-storefront-mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ The Model Context Protocol (MCP) is an open protocol that enables secure connect
## Features

This MCP server provides:

- `development_guidelines`: Help developers to understand and follow PWA Storefront developer guidelines and best practices
- `create_new_component`: Help developers to create a new PWA Storefront component. It will guide developers through a few simple questions and then generate code for the component based on the commerce data model used, layouts, etc.
- `submit_pwa_kit_project_answers`: Help developers to generate a new PWA Storefront project

## Setup

1. Install dependencies:
Install dependencies:

```bash
npm install
```

## Run the MCP Server

### Method 1: Run MCP Server From Cursor

Open Cursor Application

Go to Cursor Menu on top menu bar, then *Settings* > *Cursor Settings...*
Expand All @@ -36,7 +39,8 @@ Select Tools & Integrations > MCP Tools > New MCP Server
<img src="./docs/images/cursor-mcp-tools.png" alt="Cursor MCP Tools Screenshot" width="50%" />

You will be led to mcp.json file. Add this to your mcp.json:
``` json

```json
{
"mcpServers": {

Expand All @@ -50,6 +54,7 @@ You will be led to mcp.json file. Add this to your mcp.json:
```

Cursor will:

- Start the MCP server
- Connect to it as a client
- List available tools
Expand All @@ -59,12 +64,14 @@ You can go back to MCP Tools choose to enable/disable any MCP Server or tools.
### Method 2: Run MCP Server from Claude

#### Using Claude Desktop

1. Go to Claude menu on top menu bar then "Developer" > "Edit Config"
This will lead you to "claude_desktop_config.json" file.

<img src="./docs/images/claude-config.png" alt="Claude MCP Config Screenshot" width="50%" />

2. Add this server to your claude_desktop_config.json:

```json
{
"mcpServers": {
Expand All @@ -78,6 +85,7 @@ This will lead you to "claude_desktop_config.json" file.
```

Claude will:

- Start the MCP server
- Connect to it as a client
- List available tools
Expand Down Expand Up @@ -129,36 +137,23 @@ The server will output debug information to stderr and handle MCP protocol messa
- mcp.json
- claude_desktop_config.json
/src
/components
- index.js
- PrimaryButton.jsx
... (other components)
/server
- server.js
/utils
- AddComponentTool.js
- pwa-developer-guideline-tool.js
/scripts
- create-button.js
- demo.js
- utils.js
/tests
/images
- test-mcp.js
/docs
/images
- claude-config.png
- claude-list-tools.png
- cursor-list-tools.png
- cursor-settings.pnb
- test-mcp.js
/docs
- cursor-integration-guide.md
/node_modules
/.cursor
```

- All React components are in `src/components/`.
- Server code is in `src/server/`.
- Utilities/tools are in `src/utils/`.
- Scripts are in `src/scripts/`.
- Tests are in `src/tests/`.
- Documentation is in `docs/`.

Update your import paths accordingly.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = require('@salesforce/pwa-kit-dev/configs/babel/babel-config')
const parentConfig = require('@salesforce/pwa-kit-dev/configs/babel/babel-config').default

module.exports = {
...parentConfig,
sourceType: 'module'
}
183 changes: 0 additions & 183 deletions packages/pwa-storefront-mcp/demo.js

This file was deleted.

24 changes: 24 additions & 0 deletions packages/pwa-storefront-mcp/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2025, Salesforce, Inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
const parentConfig = require('@salesforce/pwa-kit-dev/configs/jest/jest.config.js')

module.exports = {
...parentConfig,
testEnvironment: 'node',
testMatch: [
'**/__tests__/**/*.js',
'**/?(*.)+(spec|test).js'
],
collectCoverageFrom: [
'src/**/*.js',
'!src/**/*.test.js',
'!src/**/*.spec.js'
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
testTimeout: 10000
}
32 changes: 0 additions & 32 deletions packages/pwa-storefront-mcp/jest.config.js

This file was deleted.

8 changes: 4 additions & 4 deletions packages/pwa-storefront-mcp/mcp.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"mcpServers": {
"pwa-storefront-mcp-server": {
"command": "node",
"args": ["src/server/server.js"],
"cwd": "."
"pwa-storefront-mcp": {
"command": "node {{parent-dir-to-mcp}}/pwa-storefront-mcp/src/server/server.js",
"transport": "stdio",
"args": []
}
}
}
Loading
Loading