You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarified MCP documentation for quick install and configuration, including project-root setup steps, environment variable guidance, and MRT/theming tool setup details to reduce onboarding confusion.
3. Add this entry under `servers` (merge with existing config, do not replace the full file):
50
64
51
-
**Cursor:**[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=b2c-dx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzYWxlc2ZvcmNlL2IyYy1keC1tY3BAbGF0ZXN0IiwiLS1wcm9qZWN0LWRpcmVjdG9yeSIsIiR7d29ya3NwYWNlRm9sZGVyfSIsIi0tYWxsb3ctbm9uLWdhLXRvb2xzIl19)
See the [MCP Server Installation Guide](/mcp/installation) for detailed setup instructions for Claude Code, Cursor, GitHub Copilot, and other MCP clients.
73
+
See the [MCP Server Installation Guide](/mcp/installation) for full setup steps and troubleshooting.
@@ -4,29 +4,15 @@ description: Configure the B2C DX MCP Server with credentials, flags, environmen
4
4
5
5
# Configuration
6
6
7
-
The B2C DX MCP Server uses the same configuration system as the B2C CLI. For MCP, environment variables are set in your MCP client's JSON config (`env` object), not as system environment variables. See the [CLI Configuration guide](../guide/configuration) and [Authentication Setup guide](../guide/authentication) for credential formats and setup details.
7
+
The B2C DX MCP Server uses the same configuration system as the B2C CLI.
8
8
9
-
## Configuration Priority
10
-
11
-
Credentials are resolved in the following priority order (same as the CLI):
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.
18
-
19
-
## Credential Sources
9
+
See the [CLI Configuration guide](../guide/configuration) and [Authentication Setup guide](../guide/authentication) for credential formats and setup details.
20
10
21
-
### Option 1: Config Files (Recommended)
11
+
##Credentials
22
12
23
-
Config files are the recommended approach for managing credentials. They keep credentials out of your MCP client configuration and are automatically loaded from your project.
13
+
### `dw.json` (Recommended) {#dw-json}
24
14
25
-
#### B2C Credentials (`dw.json`)
26
-
27
-
Create a [`dw.json`](../guide/configuration#configuration-file) file in your project root. The MCP server uses the same format as the CLI. See the [CLI Configuration guide](../guide/configuration#configuration-file) for the complete `dw.json` format, supported fields, and multi-instance configuration.
28
-
29
-
**Example minimal configuration:**
15
+
Create a [`dw.json`](../guide/configuration#configuration-file) file in your project root. The MCP server uses the same format as the CLI and loads it automatically with project-level installation.
30
16
31
17
```json
32
18
{
@@ -40,107 +26,74 @@ Create a [`dw.json`](../guide/configuration#configuration-file) file in your pro
40
26
}
41
27
```
42
28
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.
29
+
With user-level Cursor configuration, add `--project-directory "${workspaceFolder}"` to the args array so the server can find `dw.json`. Claude Code and GitHub Copilot automatically detect the project location.
30
+
31
+
See the [CLI Configuration guide](../guide/configuration#configuration-file) for the complete `dw.json` format, supported fields, and multi-instance configuration.
|**MRT**|`mrtProject` (from `dw.json``mrtProject` field or `--project` flag), MRT API key (from `dw.json``mrtApiKey`, `~/.mobify``api_key`, or `--api-key` flag)|
52
-
|**PWAV3**| None (project directory auto-detected with project-level installation) |
53
-
|**STOREFRONTNEXT**| None (project directory auto-detected with project-level installation) |
39
+
|**MRT**|`mrtProject`, `mrtApiKey` (or `api_key` in `~/.mobify`, or `MRT_API_KEY` env var). `mrtEnvironment` required when deploying.|
**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.
56
44
57
-
#### MRT Credentials (`~/.mobify`)
58
-
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.
45
+
### `.env` File {#env-file}
60
46
61
-
Create the `~/.mobify`file manually:
47
+
As an alternative to `dw.json`, you can place a `.env`file in your project root. The server loads it automatically at startup via Node.js native `process.loadEnvFile()`.
62
48
63
-
```json
64
-
{
65
-
"api_key": "your-mrt-api-key"
66
-
}
49
+
```bash
50
+
SFCC_SERVER=xxx.demandware.net
51
+
SFCC_CLIENT_ID=...
52
+
SFCC_CLIENT_SECRET=...
53
+
SFCC_SHORTCODE=...
54
+
SFCC_TENANT_ID=...
67
55
```
68
56
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)).
57
+
> **Note:** The `.env` file is loaded from the process working directory. Claude Code and GitHub Copilot set cwd to the project root regardless of scope, so `.env` works in all cases. Cursor user-level config (`~/.cursor/mcp.json`) sets cwd to `~`, so `.env` in the project root **will not be found** — use `dw.json` or system environment variables instead. Cursor project-level config (`.cursor/mcp.json`) works as expected.
74
58
75
-
For complete setup instructions, including how to get your API key, see the [Authentication Guide](../guide/authentication#managed-runtime-api-key).
59
+
See the [Environment Variables Reference](#environment-variables-reference) for the complete list of supported variables.
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.
80
-
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)).
63
+
MRT tools require an API key. You can include `mrtApiKey`, `mrtProject`, and `mrtEnvironment` in `dw.json` (see [required fields](#dw-json) above), or store the API key in a separate [`~/.mobify`](../guide/configuration#mrt-api-key) file (user-level, shared across projects):
- With `--cloud-origin`: `~/.mobify--{hostname}` (e.g., `~/.mobify--custom.example.com`)
74
+
- With `--credentials-file` (or `MRT_CREDENTIALS_FILE`): uses the specified path
103
75
104
-
Pass credentials directly as command-line flags:
76
+
If both `dw.json` and `~/.mobify` contain an API key, `dw.json` takes precedence. For complete setup instructions, see the [Authentication Guide](../guide/authentication#managed-runtime-api-key).
105
77
106
-
```json
107
-
{
108
-
"mcpServers": {
109
-
"b2c-dx-mcp": {
110
-
"command": "npx",
111
-
"args": [
112
-
"-y",
113
-
"@salesforce/b2c-dx-mcp@latest",
114
-
"--server",
115
-
"xxx.demandware.net",
116
-
"--username",
117
-
"...",
118
-
"--password",
119
-
"...",
120
-
"--client-id",
121
-
"...",
122
-
"--client-secret",
123
-
"...",
124
-
"--allow-non-ga-tools"
125
-
]
126
-
}
127
-
}
128
-
}
129
-
```
78
+
## Configuration Priority
79
+
80
+
When the same setting is provided in multiple places, the server resolves values in this order:
130
81
131
-
> **Note:** Flags and environment variables in your MCP client configuration are less secure than config files (`dw.json`), especially if your MCP client configuration is shared or committed to version control. Use `dw.json` (which can be gitignored) for sensitive credentials.
82
+
1.**Flags** (highest) — e.g., `--server`, `--api-key` in the `args` array
83
+
2.**Environment variables** — via `.env` file, MCP client `env` object, or system environment
84
+
3.**Config files** (lowest) — `dw.json` and `~/.mobify`
132
85
133
-
See the [CLI Configuration guide](../guide/configuration#cli-flags) for complete flag and environment variable documentation.
86
+
In practice, you rarely need flags or env vars in `mcp.json` — `dw.json` and `.env` handle most cases. Flags and the `env` object are available for overrides or CI environments.
134
87
135
88
## Toolset Selection
136
89
137
90
### Auto-Discovery (Default)
138
91
139
-
By default, the server automatically detects your project type and enables relevant toolsets. See [Project Type Detection](./#project-type-detection) for details.
92
+
By default, the server automatically detects your project type and enables relevant toolsets. No configuration needed. See [Project Type Detection](./#project-type-detection) for details.
140
93
141
94
### Manual Selection
142
95
143
-
Override auto-discovery by specifying toolsets explicitly:
96
+
Override auto-discovery with `--toolsets` or `SFCC_TOOLSETS`:
144
97
145
98
```json
146
99
{
@@ -159,15 +112,9 @@ Override auto-discovery by specifying toolsets explicitly:
159
112
}
160
113
```
161
114
162
-
**Available toolsets:**
163
-
-`CARTRIDGES` - Cartridge deployment and code version management
164
-
-`MRT` - Managed Runtime bundle operations
165
-
-`PWAV3` - PWA Kit v3 development tools
166
-
-`SCAPI` - Salesforce Commerce API discovery
167
-
-`STOREFRONTNEXT` - Storefront Next development tools
Enable debug logging (equivalent to `--log-level debug`):
206
-
207
-
```json
208
-
{
209
-
"args": [
210
-
"--debug"
211
-
]
212
-
}
213
-
```
145
+
The `--debug` flag (or `SFCC_DEBUG`) is a shorthand for `--log-level debug`.
214
146
215
147
## Telemetry
216
148
217
149
Telemetry is enabled by default and collects anonymous usage data to help improve the developer experience.
218
150
219
-
### What We Collect
151
+
**What we collect:** server lifecycle events, tool usage (which tools and execution time), command metrics, and environment info (platform, Node.js version, package version).
152
+
153
+
**What we don't collect:** credentials, business data, tool arguments/results, or file contents.
154
+
155
+
To disable, set either variable in your `.env` file or MCP client `env` object:
156
+
157
+
| Variable | Description |
158
+
|----------|-------------|
159
+
|`SFCC_DISABLE_TELEMETRY`| Set to `true` to disable telemetry |
160
+
|`SF_DISABLE_TELEMETRY`| Set to `true` to disable telemetry (sf CLI standard) |
161
+
162
+
## MCP Server Flags Reference {#mcp-server-flags}
163
+
164
+
Flags specific to the MCP server (in addition to the shared CLI flags in the [CLI Configuration guide](../guide/configuration)):
165
+
166
+
| Flag | Type | Default | Description |
167
+
| ---- | ---- | ------- | ----------- |
168
+
|`--toolsets`| string | Auto-detect | Toolsets to enable (comma-separated) |
0 commit comments