Skip to content

Commit 029c1fa

Browse files
authored
Merge branch 'main' into add-mrt-utilities
2 parents c96f1ec + f00470b commit 029c1fa

File tree

171 files changed

+23744
-538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+23744
-538
lines changed

.changeset/docs-mcp-preview-update.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/unregister-placeholder-tools.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/3pl-guard.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,14 @@ jobs:
123123
per_page: 100,
124124
});
125125
126+
// Exclude package.json under test/fixtures/ (e.g. e2e workspace-detection fixtures)
127+
const isUnderTestFixtures = (filename) =>
128+
filename.includes('/test/') && filename.includes('/fixtures/');
126129
const changedPackageJsonFiles = files
127130
.map((file) => file.filename)
128-
.filter((filename) => filename.endsWith('package.json'));
131+
.filter((filename) =>
132+
filename.endsWith('package.json') && !isUnderTestFixtures(filename),
133+
);
129134
130135
const findings = [];
131136
@@ -200,4 +205,4 @@ jobs:
200205
await addLabel(reviewLabel);
201206
core.setFailed(
202207
`Net-new third-party dependencies found: ${allNetNewDeps.join(', ')}. Add \`${approvalLabel}\` after review.`,
203-
);
208+
);

.github/workflows/e2e-tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,39 @@ jobs:
166166
if (context.eventName === 'schedule') {
167167
github.rest.issues.create(issue);
168168
}
169+
170+
mcp-e2e-tests:
171+
name: MCP E2E
172+
runs-on: ubuntu-latest
173+
timeout-minutes: 15
174+
steps:
175+
- uses: actions/checkout@v4
176+
- uses: actions/setup-node@v4
177+
with:
178+
node-version: '22.x'
179+
- name: Setup pnpm
180+
uses: pnpm/action-setup@v4
181+
with:
182+
version: 10.17.1
183+
- name: Get pnpm store directory
184+
id: pnpm-store
185+
shell: bash
186+
run: |
187+
echo "store_path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
188+
- name: Setup pnpm cache
189+
uses: actions/cache@v4
190+
with:
191+
path: ${{ steps.pnpm-store.outputs.store_path }}
192+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
193+
restore-keys: |
194+
${{ runner.os }}-pnpm-store-
195+
- name: Install dependencies
196+
run: pnpm install --frozen-lockfile
197+
- name: Build packages
198+
run: pnpm -r run build
199+
- name: Run MCP E2E tests
200+
working-directory: packages/b2c-dx-mcp
201+
env:
202+
SFCC_DISABLE_TELEMETRY: 'true'
203+
NODE_ENV: test
204+
run: pnpm run test:e2e:ci

docs/.vitepress/config.mts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ const guideSidebar = [
5151
{text: 'Storefront Next', link: '/guide/storefront-next'},
5252
],
5353
},
54+
{
55+
text: 'MCP Server',
56+
items: [
57+
{text: 'Overview', link: '/mcp/'},
58+
{text: 'Installation', link: '/mcp/installation'},
59+
{text: 'Configuration', link: '/mcp/configuration'},
60+
{text: 'Toolsets & Tools', link: '/mcp/toolsets'},
61+
{text: 'Figma Tools Setup', link: '/mcp/figma-tools-setup'},
62+
],
63+
},
5464
{
5565
text: 'Extending',
5666
items: [
@@ -83,6 +93,23 @@ const guideSidebar = [
8393
{text: 'Logging', link: '/cli/logging'},
8494
],
8595
},
96+
{
97+
text: 'Tools Reference',
98+
items: [
99+
{text: 'cartridge_deploy', link: '/mcp/tools/cartridge-deploy'},
100+
{text: 'mrt_bundle_push', link: '/mcp/tools/mrt-bundle-push'},
101+
{text: 'pwakit_development_guidelines', link: '/mcp/tools/pwakit-development-guidelines'},
102+
{text: 'scapi_schemas_list', link: '/mcp/tools/scapi-schemas-list'},
103+
{text: 'scapi_custom_api_scaffold', link: '/mcp/tools/scapi-custom-api-scaffold'},
104+
{text: 'scapi_custom_apis_status', link: '/mcp/tools/scapi-custom-apis-status'},
105+
{text: 'storefront_next_development_guidelines', link: '/mcp/tools/storefront-next-development-guidelines'},
106+
{text: 'storefront_next_figma_to_component_workflow', link: '/mcp/tools/storefront-next-figma-to-component-workflow'},
107+
{text: 'storefront_next_generate_component', link: '/mcp/tools/storefront-next-generate-component'},
108+
{text: 'storefront_next_map_tokens_to_theme', link: '/mcp/tools/storefront-next-map-tokens-to-theme'},
109+
{text: 'storefront_next_page_designer_decorator', link: '/mcp/tools/storefront-next-page-designer-decorator'},
110+
{text: 'storefront_next_site_theming', link: '/mcp/tools/storefront-next-site-theming'},
111+
],
112+
},
86113
];
87114

88115
// Script to force hard navigation for version switching links
@@ -133,6 +160,7 @@ export default defineConfig({
133160
{text: 'Guide', link: '/guide/'},
134161
{text: 'CLI Reference', link: '/cli/'},
135162
{text: 'API Reference', link: '/api/'},
163+
{text: 'MCP Server', link: '/mcp/'},
136164
{
137165
text: isDevBuild ? 'Dev' : 'Latest',
138166
items: getVersionItems(),
@@ -147,6 +175,7 @@ export default defineConfig({
147175
sidebar: {
148176
'/guide/': guideSidebar,
149177
'/cli/': guideSidebar,
178+
'/mcp/': guideSidebar,
150179
'/api/': [
151180
{
152181
text: 'API Reference',

docs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @salesforce/b2c-dx-docs
22

3+
## 0.2.1
4+
5+
### Patch Changes
6+
7+
- [#202](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/202) [`917c230`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/917c230d033b7b12bd0262d221173618f71cd0a7) - MCP docs: preview release wording, sidebar nav, remove placeholder tool references (Thanks [@yhsieh1](https://github.com/yhsieh1)!)
8+
9+
- [#217](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/217) [`eee5dbc`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/eee5dbc126db7a635389889204a504e25ea132fb) - Add MCP tool reference documentation for pwakit_development_guidelines and storefront_next_development_guidelines; MCP Server sidebar, Tools Reference, and nav updates in config (Thanks [@yhsieh1](https://github.com/yhsieh1)!)
10+
311
## 0.2.0
412

513
### Minor Changes

docs/mcp/figma-tools-setup.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
description: Prerequisites and setup for Figma-to-component tools (workflow orchestrator, generate component, map tokens).
3+
---
4+
5+
# Figma-to-Component Tools Setup
6+
7+
Prerequisites and setup for using the Figma workflow tools: `storefront_next_figma_to_component_workflow`, `storefront_next_generate_component`, and `storefront_next_map_tokens_to_theme`.
8+
9+
## Overview
10+
11+
The Figma-to-component workflow uses **two MCP servers** that must both be enabled in your MCP client:
12+
13+
1. **b2c-dx-mcp** - Workflow orchestration, component analysis (REUSE/EXTEND/CREATE), and token mapping
14+
2. **Figma MCP** (external) - Fetches design context, screenshots, and metadata from Figma files
15+
16+
For full end-to-end conversion from Figma design to Storefront Next component, both servers must be configured and enabled.
17+
18+
## B2C DX MCP Configuration
19+
20+
Ensure the b2c-dx-mcp server is configured with:
21+
22+
- **`--project-directory`** - Must point to your Storefront Next project root. Required for:
23+
- `storefront_next_map_tokens_to_theme` - Theme file discovery (`app.css`)
24+
- `storefront_next_generate_component` - Workspace context
25+
- **`--allow-non-ga-tools`** - Figma tools are preview; this flag is required to enable them
26+
- **Storefront Next project** - Must have `app.css` or `src/app.css` for token mapping (or pass `themeFilePath` explicitly)
27+
28+
See [Installation](./installation) for MCP client setup (Cursor, Claude Desktop, etc.).
29+
30+
## Figma MCP Setup
31+
32+
The workflow calls Figma MCP tools to fetch design data. These come from a **separate Figma MCP server** that you must enable in your MCP client.
33+
34+
**Figma MCP tools used by the workflow:**
35+
36+
| Tool | Purpose |
37+
|------|---------|
38+
| `get_design_context` | Generates UI code from the design and returns asset URLs |
39+
| `get_screenshot` | Provides a visual reference image of the design |
40+
| `get_metadata` | Retrieves node hierarchy, layer types, names, positions, and sizes |
41+
42+
See the [Figma MCP Server Documentation](https://developers.figma.com/docs/figma-mcp-server) for official setup and tool details.
43+
44+
Figma provides two connection options. Check the [Figma MCP catalog](https://www.figma.com/mcp-catalog/) to see which your client supports, then follow the matching installation:
45+
46+
### Desktop MCP (Local)
47+
48+
Runs through the Figma desktop app on your machine. No API token required; uses your Figma app session.
49+
50+
- Requires the Figma desktop application to be installed and running
51+
- See [Figma MCP - Local Server Installation](https://developers.figma.com/docs/figma-mcp-server/local-server-installation/)
52+
53+
### Remote MCP (Hosted)
54+
55+
Connects directly to Figma's hosted endpoint. Does not require the desktop app but **requires a Figma Personal Access Token**.
56+
57+
- See [Figma MCP - Remote Server Installation](https://developers.figma.com/docs/figma-mcp-server/remote-server-installation/)
58+
59+
#### Creating a Figma Personal Access Token
60+
61+
1. Log in to [Figma](https://www.figma.com)
62+
2. Click your profile icon (top-left) → **Settings**
63+
3. Go to **Settings → Security → Personal Access Tokens**
64+
4. Click **Generate New Token** and give it a name (e.g., "MCP")
65+
5. Select **read-only** access for all scopes
66+
6. Click **Generate token** and **copy the token immediately** — Figma shows it only once
67+
68+
#### Storing the Token
69+
70+
Store the token in an environment variable (e.g., `FIGMA_API_KEY` or `FIGMA_ACCESS_TOKEN`). Do not hardcode it in configuration files or commit it to version control.
71+
72+
**Cursor** (`.cursor/mcp.json`):
73+
74+
```json
75+
{
76+
"mcpServers": {
77+
"figma": {
78+
"command": "...",
79+
"env": {
80+
"FIGMA_API_KEY": "your-token-here"
81+
}
82+
}
83+
}
84+
}
85+
```
86+
87+
Refer to your Figma MCP provider's documentation for the exact environment variable name and configuration.
88+
89+
## Figma Design File
90+
91+
### File Access
92+
93+
You must have **view access** (or higher) to the Figma file. The file cannot be restricted in a way that blocks API access.
94+
95+
### URL with node-id
96+
97+
The workflow requires a Figma URL that includes the `node-id` query parameter. This identifies the specific frame or component to convert.
98+
99+
**How to get a URL with node-id:**
100+
101+
1. Open the Figma file
102+
2. Select the frame or component you want to convert
103+
3. Right-click → **Copy link to selection** (or use the share menu)
104+
4. The copied URL will include `?node-id=1-2` (or similar)
105+
106+
**Supported URL formats:**
107+
108+
- `https://figma.com/design/:fileKey/:fileName?node-id=1-2`
109+
- `https://www.figma.com/design/:fileKey/:fileName?node-id=1-2`
110+
- `https://figma.com/file/:fileKey/:fileName?node-id=1-2`
111+
112+
### No Special Figma Configuration
113+
114+
The basic workflow does not require:
115+
116+
- Figma Dev Mode
117+
- Code Connect
118+
- Plugins
119+
- Special file structure
120+
121+
## Verification
122+
123+
To confirm both servers are working:
124+
125+
1. **b2c-dx-mcp** - List tools in your MCP client; you should see `storefront_next_figma_to_component_workflow`, `storefront_next_generate_component`, and `storefront_next_map_tokens_to_theme`
126+
2. **Figma MCP** - List tools; you should see `mcp__figma__get_design_context`, `mcp__figma__get_screenshot`, and `mcp__figma__get_metadata` (or similar names per your Figma MCP provider)
127+
128+
If the Figma MCP server is not enabled, the workflow tool will still return instructions and parsed parameters, but the AI assistant will not be able to fetch design data. Inform the user that the Figma MCP server must be enabled for full conversion.
129+
130+
## Related Documentation
131+
132+
- [storefront_next_figma_to_component_workflow](./tools/storefront-next-figma-to-component-workflow) - Workflow orchestrator (call first)
133+
- [storefront_next_generate_component](./tools/storefront-next-generate-component) - REUSE/EXTEND/CREATE recommendation
134+
- [storefront_next_map_tokens_to_theme](./tools/storefront-next-map-tokens-to-theme) - Token mapping
135+
- [STOREFRONTNEXT Toolset](./toolsets#storefrontnext) - Overview of Storefront Next tools
136+
- [Figma MCP Server Documentation](https://developers.figma.com/docs/figma-mcp-server) - Official Figma MCP setup

docs/mcp/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ AI assistants automatically decide which MCP tools to use based on your prompts.
120120
**Storefront Next Development:**
121121
- ✅ "I'm new to Storefront Next. Use the MCP tool to show me the critical rules I need to know."
122122
- ✅ "I need to build a product detail page. Use the MCP tool to show me best practices for data fetching and component patterns."
123+
- ✅ "I want to apply my brand colors to my Storefront Next site. Use the MCP tool to help me."
123124

124125
**SCAPI Discovery:**
125126
- ✅ "Use the MCP tool to list all available SCAPI schemas."
@@ -131,6 +132,11 @@ AI assistants automatically decide which MCP tools to use based on your prompts.
131132
**MRT Bundle Operations:**
132133
- ✅ "Use the MCP tool to build and push my Storefront Next bundle to staging."
133134

135+
**Figma-to-Component:**
136+
- ✅ "Use the MCP tool to convert this Figma design to a Storefront Next component: [Figma URL with node-id]"
137+
- ✅ "Use the MCP tool to create this homepage from the Figma design: [Figma URL with node-id]. Create new components or update existing components using the MCP tool if necessary, then update the home page. The expected result should be that the homepage matches as closely as possible to the provided Figma design."
138+
- ✅ "Use the MCP tool to map Figma design tokens to my theme."
139+
134140
See the [Toolsets & Tools Reference](./toolsets) for more prompting examples for each toolset.
135141

136142
## Telemetry

docs/mcp/installation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ This guide covers installing and configuring the B2C DX MCP Server for various M
1212
- A B2C Commerce project (for project-specific toolsets)
1313
- MCP client (Cursor, Claude Desktop, or compatible client)
1414

15+
**Figma-to-component tools:** If you use the Figma workflow tools (`storefront_next_figma_to_component_workflow`, `storefront_next_generate_component`, `storefront_next_map_tokens_to_theme`), you also need an external Figma MCP server enabled. See [Figma-to-Component Tools Setup](./figma-tools-setup) for prerequisites and configuration.
16+
1517
## Install via npm (Recommended)
1618

1719
```json

0 commit comments

Comments
 (0)