Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
6e11ede
initial version for pwa-storefront-mcp server
wei-liu-sf Jun 17, 2025
f251d9b
clean up
wei-liu-sf Jun 17, 2025
c59dd1c
more mcp clean up
wei-liu-sf Jun 17, 2025
3288e57
more mcp clean up
wei-liu-sf Jun 17, 2025
1e5fd22
more MCP clean up
wei-liu-sf Jun 17, 2025
91cdbb5
remove the old fashioned MCP server.
wei-liu-sf Jun 17, 2025
636bf1a
adjust babel/runtime version to be consistent
wei-liu-sf Jun 17, 2025
686386d
Merge branch 'develop' into feature/pwa-developer-agent-only
wei-liu-sf Jun 17, 2025
ec79e73
normalize the path
wei-liu-sf Jun 17, 2025
8c2e84b
Merge branch 'feature/pwa-developer-agent-only' of https://github.com…
wei-liu-sf Jun 17, 2025
81cdeaa
Merge branch 'develop' of https://github.com/SalesforceCommerceCloud/…
wei-liu-sf Jun 18, 2025
8ba630c
make the project more aligned with pwa project
wei-liu-sf Jun 18, 2025
247d54a
remove the build.watch
wei-liu-sf Jun 19, 2025
8f58fb5
Merge branch 'develop' of https://github.com/SalesforceCommerceCloud/…
wei-liu-sf Jun 19, 2025
e771f81
Merge branch 'develop' of https://github.com/SalesforceCommerceCloud/…
wei-liu-sf Jun 19, 2025
c7b109e
Merge branch 'feature/pwa-developer-agent-only' into feature/pwa-deve…
bendvc Jun 19, 2025
5ed279a
Update package name and set it to be private
bendvc Jun 19, 2025
bb81302
Fix lint integration and run linter
bendvc Jun 19, 2025
6ec3791
@W-18782447: [PWA Kit Dev Agent] Check in the MCP Server for others …
wei-liu-sf Jun 19, 2025
e51d2fe
@W-18737409 add development guidelines tool
yhsieh1 Jun 19, 2025
e568af0
Merge branch 'feature/pwa-developer-agent-only' of https://github.com…
yhsieh1 Jun 19, 2025
67fd9a5
add storefront development guideline tool
yhsieh1 Jun 19, 2025
199baf6
remove hard coded project structure
yhsieh1 Jun 19, 2025
c66ac96
fix unit test
yhsieh1 Jun 19, 2025
b3533f6
@W-18737409 Add Storefront Development Guidelines MCP Tool
yhsieh1 Jun 20, 2025
96e665a
@W-18737409 updte guidelines
yhsieh1 Jun 20, 2025
9c40f9d
fix unit test
yhsieh1 Jun 21, 2025
ed5543c
@W-18737409 update file names
yhsieh1 Jun 23, 2025
8c52951
fix lint and test
yhsieh1 Jun 23, 2025
a66c88e
rename file
yhsieh1 Jun 23, 2025
a8d0201
@W-18737409 Update Guidelines Tool
yhsieh1 Jun 23, 2025
d43b1e1
update readme with tools supported
wei-liu-sf Jun 23, 2025
cf9998b
add Cursor config
wei-liu-sf Jun 24, 2025
5412aba
update README.md
wei-liu-sf Jun 24, 2025
6742671
update README.md
wei-liu-sf Jun 24, 2025
8dacd1b
more updates
wei-liu-sf Jun 24, 2025
cc17d06
more updates
wei-liu-sf Jun 24, 2025
30e115f
@W-18780788 README.md documentation update on github
wei-liu-sf Jun 25, 2025
ecd838c
add tool for site perf and accessibility test
wei-liu-sf Jun 25, 2025
bc27992
clean up
wei-liu-sf Jun 25, 2025
49ad284
skip changelog
yhsieh1 Jun 25, 2025
d008115
Adding the files for create Component Tool
snilakandan13 Jun 25, 2025
f4f8e83
Cleaned up tool
snilakandan13 Jun 25, 2025
e2e0037
Cursor rules for accessibility
wei-liu-sf Jun 26, 2025
c5b913b
@W-18895432 cleanup
yhsieh1 Jun 26, 2025
94a685d
skip changelog
yhsieh1 Jun 26, 2025
9816396
Committing for Tool Updates
snilakandan13 Jun 26, 2025
0914785
Initial Commit
bendvc Jun 26, 2025
6b5d174
Create CHANGELOG.md
bendvc Jun 26, 2025
dbe1d29
Make code look more like existing guideline tools
bendvc Jun 26, 2025
3408b5e
Tool updates
snilakandan13 Jun 26, 2025
ab59654
revert image html tag in readme
yhsieh1 Jun 26, 2025
8d68b79
revert image html tag in readme
yhsieh1 Jun 26, 2025
b1cb41a
Committing the tool
snilakandan13 Jun 26, 2025
f7d16fd
Fix variable name
bendvc Jun 26, 2025
cf1e354
Naming convention of directory
snilakandan13 Jun 26, 2025
082f17e
Fix lint errors
bendvc Jun 27, 2025
d8ac80a
revert data json files
yhsieh1 Jun 27, 2025
a0891a4
@W-18895432 Cleanup feature branch
yhsieh1 Jun 27, 2025
5261c55
Merge latest
bendvc Jun 27, 2025
0a3e25b
@W-18737373 - Committing for createComponentTool and HookRecommenderTool
snilakandan13 Jun 27, 2025
28d92ef
Merge pull request #2651 from SalesforceCommerceCloud/t/commerce/W-18…
snilakandan13 Jun 27, 2025
b11a6c9
Merge branch 'develop' into bendvc/update-pwa-developer-agent-only
bendvc Jun 27, 2025
1e392e7
Merge pull request #2686 from SalesforceCommerceCloud/bendvc/update-p…
bendvc Jun 27, 2025
08d60e6
Merge branch 'feature/pwa-developer-agent-only' into bendvc/W-1881237…
bendvc Jun 27, 2025
1c0e4b8
merge with feature branch
wei-liu-sf Jun 30, 2025
087152f
W-18887897 - Create a site test tool for performance and accessibilit…
wei-liu-sf Jun 30, 2025
da65feb
W-18887897 - Create a site test tool for performance and accessibilit…
wei-liu-sf Jun 30, 2025
a9bdd78
W-18887897 - Create a site test tool for performance and accessibilit…
wei-liu-sf Jun 30, 2025
5ef4bfd
W-18887897 - Create a site test tool for performance and accessibilit…
wei-liu-sf Jun 30, 2025
6a498f2
W-18887897 - Create a site test tool for performance and accessibilit…
wei-liu-sf Jun 30, 2025
19d14fb
Merge pull request #2645 from SalesforceCommerceCloud/feature/pwa-dev…
wei-liu-sf Jun 30, 2025
14829e1
@W-18737391 fix unit test
yhsieh1 Jun 30, 2025
768c2a1
skip changelog
yhsieh1 Jun 30, 2025
66dac96
@W-18737391 unit test fix
yhsieh1 Jun 30, 2025
bbe7fbc
Get program information from tty
bendvc Jun 30, 2025
d90959c
Merge branch 'feature/pwa-developer-agent-only' into bendvc/W-1881237…
bendvc Jun 30, 2025
df73299
Re-create lock file
bendvc Jun 30, 2025
c89dec5
Merge pull request #2663 from SalesforceCommerceCloud/bendvc/W-188123…
bendvc Jun 30, 2025
3b45e3b
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
e06198b
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
e75678a
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
3617027
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
27ace00
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
a0df7b8
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
d2e56ff
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
c66054c
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
1160b59
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
5b67664
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
2316a4f
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
72abf33
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
912361f
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
f31011f
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
725916b
Update packages/pwa-storefront-mcp/docs/cursor-integration-guide.md
wei-liu-sf Jun 30, 2025
53281c6
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
2ed05f0
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
604fe11
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
25c06c0
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
a593a5c
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
6a056ae
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
cc041f1
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
7a62482
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
af29853
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
10e5dc1
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
60f347b
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
52aecd5
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
efd2bf7
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
2c15fad
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
0e86a63
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
44b409d
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
87e0f83
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
eeb6c77
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
d3ac757
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
7a7d7f1
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
0d12db9
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
8bb66a3
Update packages/pwa-storefront-mcp/README.md
wei-liu-sf Jun 30, 2025
aa032c1
Initial Commit
bendvc Jun 30, 2025
5de9967
Remove console log
bendvc Jun 30, 2025
6a7096b
Remove addd jest.config.js, update ignore patterns
bendvc Jun 30, 2025
9804f33
Fix for windows
bendvc Jun 30, 2025
09db6aa
Fix create-app script exiting before flushing
bendvc Jul 1, 2025
76deb5e
Update CHANGELOG.md
bendvc Jul 1, 2025
067680c
Remove commented out import
bendvc Jul 1, 2025
fb01733
PR feedback
bendvc Jul 2, 2025
91cb2fd
Merge pull request #2699 from SalesforceCommerceCloud/bendvc/clean-up…
bendvc Jul 2, 2025
2f11d35
Adding changes for cleanup
snilakandan13 Jul 2, 2025
cc12949
Linting errors
snilakandan13 Jul 2, 2025
fedc7bc
Fixing tests
snilakandan13 Jul 3, 2025
050e8f8
Linter errors
snilakandan13 Jul 3, 2025
d3ddbdb
Fixing test
snilakandan13 Jul 3, 2025
7bcbb4e
Merge pull request #2720 from SalesforceCommerceCloud/t/commerce/W-18…
snilakandan13 Jul 3, 2025
f3eaee9
change log and tool name update
wei-liu-sf Jul 7, 2025
89fbb7c
@W-18891405 rename tool, update readme and change log
yhsieh1 Jul 7, 2025
bd799e3
update chagnelog
yhsieh1 Jul 7, 2025
44c5923
@W-18891405/initial merge
yhsieh1 Jul 7, 2025
c1540ca
Merge pull request #2736 from SalesforceCommerceCloud/feature/pwa-dev…
wei-liu-sf Jul 7, 2025
ca16326
Merge branch 'develop' of https://github.com/SalesforceCommerceCloud/…
yhsieh1 Jul 7, 2025
4d151db
handle cursor rules
wei-liu-sf Jul 7, 2025
92e04dc
remove console.log
wei-liu-sf Jul 7, 2025
0a09a62
update CHANGELOG.md
wei-liu-sf Jul 7, 2025
1edbee6
@W-18979555 - Handle Cursor rules
wei-liu-sf Jul 7, 2025
7299b79
Merge branch 'develop' into feature/pwa-developer-agent-only
yhsieh1 Jul 7, 2025
6a585b3
update the right CHANGELOG.md
wei-liu-sf Jul 7, 2025
cbddfac
update the right CHANGELOG.md
wei-liu-sf Jul 7, 2025
636cccf
@W-18979555 - update the right CHANGELOG.md
wei-liu-sf Jul 7, 2025
17ac131
Updating Readme files
snilakandan13 Jul 7, 2025
9a0fb76
Merge pull request #2745 from SalesforceCommerceCloud/t/commerce/W-18…
snilakandan13 Jul 7, 2025
6e0a3d8
Updated MCP.json
snilakandan13 Jul 7, 2025
1f3f892
move cursor rules to assets
wei-liu-sf Jul 7, 2025
7fb681b
Added mcp config
snilakandan13 Jul 7, 2025
bad0508
@W-18979555: Merge pull request #2747 from SalesforceCommerceCloud/fe…
wei-liu-sf Jul 7, 2025
75448b0
Merge pull request #2746 from SalesforceCommerceCloud/t/commerce/W-18…
snilakandan13 Jul 7, 2025
b5e4555
@W-18979555 fix build failure
yhsieh1 Jul 7, 2025
b6c9497
skip changelog
yhsieh1 Jul 7, 2025
eccf182
read version from package.json
yhsieh1 Jul 7, 2025
7d5810b
update readme
yhsieh1 Jul 7, 2025
b8aa103
update lint format
yhsieh1 Jul 7, 2025
1acb049
@W-18979555 Fix cursor rules copy build failure
yhsieh1 Jul 7, 2025
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
120 changes: 120 additions & 0 deletions packages/pwa-storefront-mcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# PWA Storefront MCP Server

An Model Context Protocol (MCP) server that helps PWA Storefront developers with development.

## What is MCP?

The Model Context Protocol (MCP) is an open protocol that enables secure connections between host applications (like Claude Desktop or other AI assistants) and external data sources and tools.

## Features

This MCP server provides:
- `create_new_component`: Help developers to create a new PWA Storefront component

## Setup

1. Install dependencies:
```bash
npm install
```

## Testing the MCP Server

### Method 1: Run the automated test script
```bash
npm test
```

This will:
- Start the MCP server
- Connect to it as a client
- List available tools
- Call the `create_new_component` tool
- Display the results

### Method 2: Manual testing with MCP clients

#### Using Claude Desktop
1. Add this server to your Claude Desktop configuration:
```json
{
"mcpServers": {
"pwa-storefront-server": {
"command": "node",
"args": ["server.js"],
"cwd": "{{$parent_dir_to_mcp}}/pwa-storefront-mcp"
}
}
}
```

#### Using other MCP clients
The server runs on stdio, so you can test it with any MCP-compatible client.

### Method 3: Direct stdio testing

You can also test directly by running the server and sending JSON-RPC messages:

```bash
# Start the server
node server.js

# Then send JSON-RPC requests to stdin:
{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}
{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "create_new_component", "arguments": {}}}
```

## Files

- `server.js` - Main MCP server implementation
- `test-mcp.js` - Automated test script
- `mcp.json` - MCP configuration file for clients
- `package.json` - Node.js dependencies and scripts

## Development

To run the server in development mode:
```bash
npm start
```

The server will output debug information to stderr and handle MCP protocol messages via stdio.

# Project Structure

```
/ (root)
- package.json
- package-lock.json
- README.md
- mcp.json
- claude_desktop_config.json
/src
/components
- index.js
- PrimaryButton.jsx
... (other components)
/server
- server.js
- server-old-fashioned.js
/utils
- AddComponentTool.js
/scripts
- create-button.js
- demo.js
/tests
- 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.
8 changes: 8 additions & 0 deletions packages/pwa-storefront-mcp/claude_desktop_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"pwa-storefront-mcp": {
"command": "node",
"args": ["/Users/wei.liu/dev/git-repos/pwa-kit/packages/pwa-storefront-mcp/src/server/server.js"]
}
}
}
175 changes: 175 additions & 0 deletions packages/pwa-storefront-mcp/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
#!/usr/bin/env node

import { spawn } from 'child_process';

// Example React code to analyze and modify
const exampleCode = `import React from 'react';
import './App.css';

function App() {
return (
<div className="App">
<header className="App-header">
<h1>My PWA Storefront</h1>
</header>
</div>
);
}

export default App;`;

async function demonstrateMCPTools() {
console.log('🚀 Demonstrating MCP Server Tools...\n');

// Start the MCP server process
const serverProcess = spawn('node', ['src/server/server.js'], {
stdio: ['pipe', 'pipe', 'pipe']
});

let responseData = '';

serverProcess.stdout.on('data', (data) => {
responseData += data.toString();
});

serverProcess.stderr.on('data', (data) => {
console.log('Server:', data.toString().trim());
});

try {
// Initialize connection
const initRequest = {
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'demo-client', version: '1.0.0' }
}
};
serverProcess.stdin.write(JSON.stringify(initRequest) + '\n');
await wait(500);

// Test 1: Analyze code structure
console.log('📋 1. Analyzing code structure...');
const analyzeRequest = {
jsonrpc: '2.0',
id: 2,
method: 'tools/call',
params: {
name: 'analyze_code_structure',
arguments: { code: exampleCode }
}
};
serverProcess.stdin.write(JSON.stringify(analyzeRequest) + '\n');
await wait(1000);

// Test 2: Insert a Product Card component
console.log('\n🛍️ 2. Inserting a ProductCard component...');
const insertRequest = {
jsonrpc: '2.0',
id: 3,
method: 'tools/call',
params: {
name: 'insert_react_component',
arguments: {
code: exampleCode,
componentType: 'product',
options: {
name: 'ProductCard',
styling: 'tailwind',
showPrice: true,
showRating: true
}
}
}
};
serverProcess.stdin.write(JSON.stringify(insertRequest) + '\n');
await wait(1000);

// Test 3: Create a new Button component file
console.log('\n🔘 3. Creating a new Button component file...');
const createRequest = {
jsonrpc: '2.0',
id: 4,
method: 'tools/call',
params: {
name: 'create_component_file',
arguments: {
componentName: 'PrimaryButton',
componentType: 'button',
options: {
variant: 'primary',
size: 'medium',
styling: 'tailwind'
}
}
}
};
serverProcess.stdin.write(JSON.stringify(createRequest) + '\n');
await wait(1000);

// Parse and display results
console.log('\n📨 Results:');
parseAndDisplayResults(responseData);

} catch (error) {
console.error('❌ Error:', error);
} finally {
serverProcess.kill();
}
}

function parseAndDisplayResults(responseData) {
if (!responseData.trim()) {
console.log('No responses received');
return;
}

const responses = responseData.trim().split('\n').filter(line => line.trim());

responses.forEach((response, index) => {
try {
const parsed = JSON.parse(response);
if (parsed.id === 1) {
console.log('✅ Server initialized');
} else if (parsed.id === 2 && parsed.result) {
const data = JSON.parse(parsed.result.content[0].text);
console.log('\n📊 Code Analysis:');
console.log(`- Components found: ${data.summary.totalComponents}`);
console.log(`- Imports found: ${data.summary.totalImports}`);
console.log(`- Has React: ${data.summary.hasReact}`);
console.log(`- Has Tailwind: ${data.summary.hasTailwind}`);
console.log(`- Insertion points: ${data.summary.insertionPoints}`);
} else if (parsed.id === 3 && parsed.result) {
const data = JSON.parse(parsed.result.content[0].text);
if (data.success) {
console.log('\n✅ Component inserted successfully!');
console.log('Modified code preview:');
console.log('```javascript');
console.log(data.modifiedCode.substring(0, 500) + '...');
console.log('```');
}
} else if (parsed.id === 4 && parsed.result) {
const data = JSON.parse(parsed.result.content[0].text);
if (data.success) {
console.log('\n✅ New component file created!');
console.log(`Component: ${data.componentName}`);
console.log('Generated code preview:');
console.log('```javascript');
console.log(data.code.substring(0, 300) + '...');
console.log('```');
}
}
} catch (e) {
console.log(`Response ${index + 1}:`, response);
}
});
}

function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

demonstrateMCPTools().catch(console.error);
Loading
Loading