Skip to content

Commit 1147ea3

Browse files
authored
@W-21048944 Support Plugins and docs update (#253)
1 parent 2862fe5 commit 1147ea3

12 files changed

Lines changed: 158 additions & 68 deletions

File tree

.changeset/mcp-dirname-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@salesforce/b2c-dx-mcp': patch
3+
---
4+
5+
Changed oclif dirname from `b2c-dx-mcp` to `b2c` so the MCP server shares the same plugin directory as the CLI, enabling plugin discovery and unified plugin management.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@salesforce/b2c-dx-mcp': patch
3+
'@salesforce/b2c-dx-docs': patch
4+
---
5+
6+
Improved MCP documentation: added `@latest` to all examples to prevent Windows caching issues, standardized server name to `b2c-dx-mcp`, updated GitHub Copilot examples to use correct `servers` format with `type: stdio`, clarified MRT configuration options (`mrtProject`, `mrtEnvironment`, `mrtApiKey` in dw.json vs `api_key` in ~/.mobify), changed "Claude Desktop" to "Claude Code" throughout, simplified authentication sections, and improved flag documentation consistency across tool pages.

docs/mcp/configuration.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ The B2C DX MCP Server uses the same configuration system as the B2C CLI. For MCP
1010

1111
Credentials are resolved in the following priority order (same as the CLI):
1212

13-
1. **Flags** (highest priority)
14-
2. **Environment variables**
15-
3. **Config files** (lowest priority)
13+
1. **Flags** (highest priority) - e.g., `--server`, `--api-key`, `--project`
14+
2. **Environment variables** - Set in MCP client's `env` object
15+
3. **Config files** (lowest priority) - `dw.json` (project-level) and `~/.mobify` (user-level for MRT API key)
16+
17+
**Note:** For MRT API key specifically, `dw.json` (`mrtApiKey` field) takes precedence over `~/.mobify` when both are present.
1618

1719
## Credential Sources
1820

@@ -38,23 +40,23 @@ Create a [`dw.json`](../guide/configuration#configuration-file) file in your pro
3840
}
3941
```
4042

41-
The server automatically loads this file when using project-level installation (recommended). With user-level Cursor configuration, ensure `--project-directory` points to your project.
43+
The server automatically loads this file when using project-level configuration (recommended). With user-level Cursor configuration, ensure `--project-directory "${workspaceFolder}"` is included in the args array. Claude Code and GitHub Copilot automatically detect the project location.
4244

4345
**Required fields per toolset:**
4446

4547
| Toolset | Required Fields |
4648
|---------|----------------|
4749
| **SCAPI** | `short-code`, `tenant-id`, `client-id`, `client-secret` |
4850
| **CARTRIDGES** | `hostname`, `username`, `password` (or OAuth: `hostname`, `client-id`, `client-secret`) |
49-
| **MRT** | `project`, MRT API key (from `~/.mobify` or `--api-key`) |
51+
| **MRT** | `mrtProject` (from `dw.json` `mrtProject` field or `--project` flag), MRT API key (from `dw.json` `mrtApiKey`, `~/.mobify` `api_key`, or `--api-key` flag) |
5052
| **PWAV3** | None (project directory auto-detected with project-level installation) |
5153
| **STOREFRONTNEXT** | None (project directory auto-detected with project-level installation) |
5254

5355
**Note:** Some tools require specific scopes. See [Configuring Scopes](../guide/authentication#configuring-scopes) in the Authentication Setup guide and individual tool pages for scope requirements.
5456

5557
#### MRT Credentials (`~/.mobify`)
5658

57-
MRT API keys are loaded from [`~/.mobify`](../guide/configuration#mrt-api-key) using the same format and resolution order as the CLI.
59+
MRT tools require an API key for authentication. MRT API keys are stored in a separate [`~/.mobify`](../guide/configuration#mrt-api-key) file in your home directory.
5860

5961
Create the `~/.mobify` file manually:
6062

@@ -64,18 +66,26 @@ Create the `~/.mobify` file manually:
6466
}
6567
```
6668

67-
For complete setup instructions, see the [Authentication Guide](../guide/authentication#managed-runtime-api-key).
69+
**File locations:**
70+
- Default: `~/.mobify`
71+
- With `--cloud-origin`: `~/.mobify--{hostname}` (e.g., `~/.mobify--custom.example.com` for `--cloud-origin https://custom.example.com`)
72+
73+
**Note:** The `dw.json` file can include `mrtProject`, `mrtEnvironment`, and `mrtApiKey` for project-level MRT configuration. Alternatively, the API key can be stored in `~/.mobify` (user-level, shared across projects). If both are present, `dw.json` takes precedence. Environment variables and flags can override these values (see [Configuration Priority](#configuration-priority)).
74+
75+
For complete setup instructions, including how to get your API key, see the [Authentication Guide](../guide/authentication#managed-runtime-api-key).
6876

6977
### Option 2: Environment Variables
7078

7179
Set environment variables in the `env` object of your MCP client configuration. The MCP server supports the same environment variables as the CLI. See the [CLI Configuration guide](../guide/configuration#environment-variables) for the complete list of supported variables.
7280

81+
> **Note:** Examples below use `mcpServers` (Cursor format). For GitHub Copilot/VS Code, use `servers` instead and add `"type": "stdio"` (see [Installation](./installation#github-copilot)).
82+
7383
```json
7484
{
7585
"mcpServers": {
76-
"b2c-dx": {
86+
"b2c-dx-mcp": {
7787
"command": "npx",
78-
"args": ["-y", "@salesforce/b2c-dx-mcp", "--allow-non-ga-tools"],
88+
"args": ["-y", "@salesforce/b2c-dx-mcp@latest", "--allow-non-ga-tools"],
7989
"env": {
8090
"SFCC_SERVER": "xxx.demandware.net",
8191
"SFCC_CLIENT_ID": "...",
@@ -96,11 +106,11 @@ Pass credentials directly as command-line flags:
96106
```json
97107
{
98108
"mcpServers": {
99-
"b2c-dx": {
109+
"b2c-dx-mcp": {
100110
"command": "npx",
101111
"args": [
102112
"-y",
103-
"@salesforce/b2c-dx-mcp",
113+
"@salesforce/b2c-dx-mcp@latest",
104114
"--server",
105115
"xxx.demandware.net",
106116
"--username",
@@ -135,11 +145,11 @@ Override auto-discovery by specifying toolsets explicitly:
135145
```json
136146
{
137147
"mcpServers": {
138-
"b2c-dx": {
148+
"b2c-dx-mcp": {
139149
"command": "npx",
140150
"args": [
141151
"-y",
142-
"@salesforce/b2c-dx-mcp",
152+
"@salesforce/b2c-dx-mcp@latest",
143153
"--toolsets",
144154
"CARTRIDGES,MRT",
145155
"--allow-non-ga-tools"

docs/mcp/index.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ The MCP server automatically detects your project type and enables relevant tool
2828

2929
```bash [Project Scope (Recommended)]
3030
cd /path/to/your/project
31-
claude mcp add --transport stdio --scope project b2c-dx -- npx -y @salesforce/b2c-dx-mcp --allow-non-ga-tools
31+
claude mcp add --transport stdio --scope project b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest --allow-non-ga-tools
3232
```
3333

3434
```bash [User Scope]
35-
claude mcp add --transport stdio --scope user b2c-dx -- npx -y @salesforce/b2c-dx-mcp --allow-non-ga-tools
35+
claude mcp add --transport stdio --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest --allow-non-ga-tools
3636
```
3737

3838
:::
3939

40-
**Cursor:** [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3AiLCItLXByb2plY3QtZGlyZWN0b3J5IiwiJHt3b3Jrc3BhY2VGb2xkZXJ9IiwiLS1hbGxvdy1ub24tZ2EtdG9vbHMiXX0=)
40+
**Cursor:** [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3BAbGF0ZXN0IiwiLS1wcm9qZWN0LWRpcmVjdG9yeSIsIiR7d29ya3NwYWNlRm9sZGVyfSIsIi0tYWxsb3ctbm9uLWdhLXRvb2xzIl19)
4141

4242
See the [Installation Guide](./installation) for detailed setup instructions for Claude Code, Cursor, GitHub Copilot, and other MCP clients.
4343

@@ -130,6 +130,12 @@ AI assistants automatically decide which MCP tools to use based on your prompts.
130130

131131
See the [Toolsets & Tools Reference](./toolsets) for more prompting examples for each toolset.
132132

133+
## Plugins
134+
135+
The MCP server uses the B2C CLI under the hood, so CLI plugins automatically extend MCP functionality. Plugins can add new commands, provide custom configuration sources, integrate with external systems, and more.
136+
137+
See the [CLI Plugin documentation](../guide/extending) for details on creating plugins and [Third-Party Plugins](../guide/third-party-plugins) for available community plugins.
138+
133139
## Next Steps
134140

135141
- [Installation Guide](./installation) - Set up Claude Code, Cursor, GitHub Copilot, or other MCP clients

docs/mcp/installation.md

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ Claude Code supports MCP servers via CLI installation:
5353

5454
```bash [Project Scope (Recommended)]
5555
cd /path/to/your/project
56-
claude mcp add --transport stdio --scope project b2c-dx -- npx -y @salesforce/b2c-dx-mcp --allow-non-ga-tools
56+
claude mcp add --transport stdio --scope project b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest --allow-non-ga-tools
5757
```
5858

5959
```bash [User Scope]
60-
claude mcp add --transport stdio --scope user b2c-dx -- npx -y @salesforce/b2c-dx-mcp --allow-non-ga-tools
60+
claude mcp add --transport stdio --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest --allow-non-ga-tools
6161
```
6262

6363
:::
@@ -78,9 +78,9 @@ Project-level configuration automatically detects your project location and can
7878
```json
7979
{
8080
"mcpServers": {
81-
"b2c-dx": {
81+
"b2c-dx-mcp": {
8282
"command": "npx",
83-
"args": ["-y", "@salesforce/b2c-dx-mcp", "--allow-non-ga-tools"]
83+
"args": ["-y", "@salesforce/b2c-dx-mcp@latest", "--allow-non-ga-tools"]
8484
}
8585
}
8686
}
@@ -94,27 +94,47 @@ With project-level configuration, the server automatically detects your project
9494

9595
Alternatively, use the "Add to Cursor" link to add to user-level configuration:
9696

97-
[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3AiLCItLXByb2plY3QtZGlyZWN0b3J5IiwiJHt3b3Jrc3BhY2VGb2xkZXJ9IiwiLS1hbGxvdy1ub24tZ2EtdG9vbHMiXX0=)
97+
[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3BAbGF0ZXN0IiwiLS1wcm9qZWN0LWRpcmVjdG9yeSIsIiR7d29ya3NwYWNlRm9sZGVyfSIsIi0tYWxsb3ctbm9uLWdhLXRvb2xzIl19)
9898

99-
**Note:** The install link adds to user-level configuration (`~/.cursor/mcp.json`) with `--project-directory "${workspaceFolder}"`. The `${workspaceFolder}` variable automatically expands to your current workspace, so no manual updates are needed when switching projects.
99+
**Manual Configuration (Windows or if link doesn't work):**
100+
101+
1. Open or create `~/.cursor/mcp.json` (on Windows: `C:\Users\<your-username>\.cursor\mcp.json`)
102+
2. Add the following configuration:
103+
104+
```json
105+
{
106+
"mcpServers": {
107+
"b2c-dx-mcp": {
108+
"command": "npx",
109+
"args": ["-y", "@salesforce/b2c-dx-mcp@latest", "--project-directory", "${workspaceFolder}", "--allow-non-ga-tools"]
110+
}
111+
}
112+
}
113+
```
114+
115+
> **Note:** Cursor uses `"mcpServers"` as the top-level key. For GitHub Copilot/VS Code, use `"servers"` instead (see [GitHub Copilot](#github-copilot) section). The `${workspaceFolder}` variable automatically expands to your current workspace, so no manual updates are needed when switching projects.
100116
101117
## GitHub Copilot
102118

103119
GitHub Copilot supports MCP servers via configuration in your workspace. See the [GitHub Copilot MCP documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers#_configure-the-mcpjson-file) for setup instructions.
104120

105-
Copilot supports project-level configuration. Create the MCP config file in your workspace:
121+
Copilot supports project-level configuration. Create the MCP config file in your workspace (`.vscode/mcp.json`):
106122

107123
```json
108124
{
109-
"mcpServers": {
110-
"b2c-dx": {
125+
"servers": {
126+
"b2c-dx-mcp": {
127+
"type": "stdio",
111128
"command": "npx",
112-
"args": ["-y", "@salesforce/b2c-dx-mcp", "--allow-non-ga-tools"]
129+
"args": ["-y", "@salesforce/b2c-dx-mcp@latest", "--allow-non-ga-tools"]
113130
}
114-
}
131+
},
132+
"inputs": []
115133
}
116134
```
117135

136+
> **Note:** GitHub Copilot/VS Code uses `"servers"` (not `"mcpServers"`) and requires `"type": "stdio"` for stdio-based servers. The `"inputs"` array is optional but included for consistency with VS Code's format.
137+
118138
With project-level configuration, the server automatically detects your project location.
119139

120140
## Troubleshooting
@@ -124,6 +144,31 @@ With project-level configuration, the server automatically detects your project
124144
- Verify Node.js version: `node --version` (must be 22.0.0+)
125145
- Check that `npx` is available and working
126146

147+
### "Could not determine executable to run" Error (Windows)
148+
149+
This error occurs when npx uses a cached broken version (`0.0.1`) instead of the latest version. npx's cache-first behavior can reuse an older cached version even when newer versions are available.
150+
151+
**Solution:**
152+
153+
1. **Update your MCP configuration** to use `@latest`:
154+
```json
155+
{
156+
"mcpServers": {
157+
"b2c-dx-mcp": {
158+
"command": "npx",
159+
"args": ["-y", "@salesforce/b2c-dx-mcp@latest", "--allow-non-ga-tools"]
160+
}
161+
}
162+
}
163+
```
164+
165+
2. **Clear the npx cache** if the issue persists:
166+
```bash
167+
npm cache clean --force
168+
```
169+
170+
**Prevention:** Always use `@latest` in your MCP configuration to ensure npx fetches the latest version from the registry instead of using cached versions.
171+
127172
### Tools Not Available
128173

129174
- Ensure `--allow-non-ga-tools` flag is included (required for preview tools)

docs/mcp/tools/cartridge-deploy.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ This tool is useful for deploying custom code cartridges for SFRA or other B2C C
2020

2121
## Authentication
2222

23-
Supports two authentication methods:
23+
Requires WebDAV access credentials. Supports two authentication methods:
2424

25-
- **Basic Authentication (WebDAV)** - Uses `username` and `password` from `dw.json` or environment variables
26-
- **OAuth** - Uses `client-id` and `client-secret` from `dw.json` or environment variables
25+
**Required:**
26+
- **Basic Auth (recommended)** - `hostname`, `username`, and `password` (WebDAV access key). Provides better performance for WebDAV operations.
27+
- **OAuth** - `hostname`, `client-id`, and `client-secret`. Requires WebDAV Client Permissions configured.
2728

28-
See [Configuration](../configuration) for complete credential setup details.
29+
**Configuration priority:** Flags → Environment variables → `dw.json` config file
2930

30-
**Configuration Priority:**
31-
1. Flags (`--server`, `--username`, `--password`, `--client-id`, `--client-secret`)
32-
2. Environment variables (`SFCC_SERVER`, `SFCC_USERNAME`, `SFCC_PASSWORD`, `SFCC_CLIENT_ID`, `SFCC_CLIENT_SECRET`)
33-
3. `dw.json` config file (auto-discovered or via `--config` flag)
31+
See [Configuration](../configuration) for complete credential setup details including flags and environment variables. See [Authentication Setup](../../guide/authentication#webdav-access) for WebDAV access key and OAuth configuration instructions.
3432

3533
## Parameters
3634

docs/mcp/tools/mrt-bundle-push.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ This tool is shared across the MRT, PWAV3, and STOREFRONTNEXT toolsets.
2121

2222
## Authentication
2323

24-
Requires Managed Runtime (MRT) credentials. See [MRT Credentials](../configuration#mrt-credentials-mobify) for complete details.
25-
26-
**Configuration priority:**
27-
1. Flags (`--api-key`, `--project`, `--environment`, `--cloud-origin`)
28-
2. Environment variables (`MRT_API_KEY`, `MRT_PROJECT`, `MRT_ENVIRONMENT`, `MRT_CLOUD_ORIGIN`)
29-
3. `~/.mobify` config file (or `~/.mobify--[hostname]` if `--cloud-origin` is set)
24+
Requires Managed Runtime (MRT) credentials.
3025

3126
**Required:**
32-
- `project` (via `--project` flag or `MRT_PROJECT` environment variable)
33-
- `api-key` (via `--api-key` flag, `MRT_API_KEY` environment variable, or `~/.mobify` config file)
27+
- `project` - MRT project slug
28+
- `api-key` - MRT API key
29+
30+
**Required when `deploy: true`:**
31+
- `environment` - Target environment (e.g., staging, production)
3432

3533
**Optional:**
36-
- `environment` (required only when `deploy: true`; via `--environment` flag or `MRT_ENVIRONMENT` environment variable)
37-
- `cloud-origin` (for environment-specific `~/.mobify` files; via `--cloud-origin` flag or `MRT_CLOUD_ORIGIN` environment variable)
34+
- `cloud-origin` - Overrides MRT API endpoint and uses `~/.mobify--{hostname}` instead of `~/.mobify`
35+
36+
**Configuration priority:** Flags → Environment variables → `~/.mobify` config file
37+
38+
See [MRT Credentials](../configuration#mrt-credentials-mobify) for complete setup instructions including flags, environment variables, and the `~/.mobify` file format. See [Authentication Setup](../../guide/authentication#managed-runtime-api-key) for how to get your API key.
3839

3940
## Parameters
4041

packages/b2c-dx-mcp/CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ For local development or testing, use the development build directly:
3333
```json
3434
{
3535
"mcpServers": {
36-
"b2c-dx": {
36+
"b2c-dx-mcp": {
3737
"command": "node",
3838
"args": ["/path/to/packages/b2c-dx-mcp/bin/dev.js", "--project-directory", "${workspaceFolder}", "--allow-non-ga-tools"]
3939
}
@@ -113,7 +113,7 @@ When updating MCP documentation, you may need to create or update the "Add to Cu
113113

114114
The deep link follows this format:
115115
```
116-
cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx&config=<base64-encoded-config>
116+
cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx-mcp&config=<base64-encoded-config>
117117
```
118118

119119
### Generating the Base64 Config
@@ -124,27 +124,27 @@ cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx&config=<base64-encode
124124
```json
125125
{
126126
"command": "npx",
127-
"args": ["-y", "@salesforce/b2c-dx-mcp", "--project-directory", "${workspaceFolder}", "--allow-non-ga-tools"]
127+
"args": ["-y", "@salesforce/b2c-dx-mcp@latest", "--project-directory", "${workspaceFolder}", "--allow-non-ga-tools"]
128128
}
129129
```
130130

131131
The `${workspaceFolder}` variable automatically expands to the current workspace directory in Cursor.
132132

133133
2. **Encode to Base64** using Node.js:
134134
```bash
135-
node -e "console.log(Buffer.from(JSON.stringify({command: 'npx', args: ['-y', '@salesforce/b2c-dx-mcp', '--project-directory', '\${workspaceFolder}', '--allow-non-ga-tools']})).toString('base64'))"
135+
node -e "console.log(Buffer.from(JSON.stringify({command: 'npx', args: ['-y', '@salesforce/b2c-dx-mcp@latest', '--project-directory', '\${workspaceFolder}', '--allow-non-ga-tools']})).toString('base64'))"
136136
```
137137

138138
3. **Construct the full link**:
139139
```
140-
cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx&config=<base64-string>
140+
cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx-mcp&config=<base64-string>
141141
```
142142

143143
### Example
144144

145145
**User-level link (used in documentation):**
146146
```markdown
147-
[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3AiLCItLXByb2plY3QtZGlyZWN0b3J5IiwiJHt3b3Jrc3BhY2VGb2xkZXJ9IiwiLS1hbGxvdy1ub24tZ2EtdG9vbHMiXX0=)
147+
[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3AiLCItLXByb2plY3QtZGlyZWN0b3J5IiwiJHt3b3Jrc3BhY2VGb2xkZXJ9IiwiLS1hbGxvdy1ub24tZ2EtdG9vbHMiXX0=)
148148
```
149149

150150
### Where to Update

0 commit comments

Comments
 (0)