| description |
|---|
Configure the B2C DX MCP Server with credentials, flags, environment variables, and toolset selection. |
The B2C DX MCP Server supports multiple configuration methods for credentials, flags, and toolset selection.
Credentials are resolved in the following priority order.
- Flags (highest priority)
- Environment variables
- Config files (lowest priority)
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.
Create a dw.json file in your project root:
{
"hostname": "xxx.demandware.net",
"username": "...",
"password": "...",
"client-id": "...",
"client-secret": "..."
}The server automatically loads this file when --project-directory points to your project.
Required fields per toolset:
| Toolset | Required Fields |
|---|---|
| SCAPI | hostname, client-id, client-secret |
| CARTRIDGES | hostname, username, password (or OAuth) |
| MRT | (loaded from ~/.mobify) |
| PWAV3 | None (uses --project-directory only) |
| STOREFRONTNEXT | None (uses --project-directory only) |
Note: Some tools require specific scopes. See Configuring Scopes in the Authentication Setup guide and individual tool pages for scope requirements.
Create a ~/.mobify file in your home directory:
{
"api_key": "..."
}You can also create this file using the B2C CLI:
b2c mrt config set --api-key YOUR_API_KEYSet environment variables in your MCP client configuration:
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": ["-y", "@salesforce/b2c-dx-mcp", "--project-directory", "${workspaceFolder}", "--allow-non-ga-tools"],
"env": {
"SFCC_SERVER": "xxx.demandware.net",
"SFCC_USERNAME": "...",
"SFCC_PASSWORD": "...",
"SFCC_CLIENT_ID": "...",
"SFCC_CLIENT_SECRET": "...",
"SFCC_MRT_API_KEY": "..."
}
}
}
}Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": ["-y", "@salesforce/b2c-dx-mcp", "--project-directory", "/path/to/project", "--allow-non-ga-tools"],
"env": {
"SFCC_SERVER": "xxx.demandware.net",
"SFCC_USERNAME": "...",
"SFCC_PASSWORD": "..."
}
}
}
}Pass credentials directly as command-line flags:
{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": [
"-y",
"@salesforce/b2c-dx-mcp",
"--project-directory",
"${workspaceFolder}",
"--server",
"xxx.demandware.net",
"--username",
"...",
"--password",
"...",
"--client-id",
"...",
"--client-secret",
"...",
"--allow-non-ga-tools"
]
}
}
}Note: Flags are less secure than config files or environment variables, especially if your MCP client configuration is shared or committed to version control.
| Flag | Env Variable | Description |
|---|---|---|
--project-directory |
SFCC_PROJECT_DIRECTORY |
Project directory (enables auto-discovery and config loading) |
--toolsets |
— | Comma-separated toolsets to enable |
--tools |
— | Comma-separated individual tools to enable |
--allow-non-ga-tools |
— | Enable experimental (non-GA) tools |
--config |
— | Explicit path to dw.json (advanced) |
--log-level |
— | Logging verbosity (trace, debug, info, warn, error, silent) |
--debug |
— | Enable debug logging |
| Flag | Env Variable | Description |
|---|---|---|
--server |
SFCC_SERVER |
B2C instance hostname |
--username |
SFCC_USERNAME |
Username for Basic auth (WebDAV) |
--password |
SFCC_PASSWORD |
Password/access key for Basic auth |
--client-id |
SFCC_CLIENT_ID |
OAuth client ID |
--client-secret |
SFCC_CLIENT_SECRET |
OAuth client secret |
--code-version |
SFCC_CODE_VERSION |
Code version for deployments |
| Flag | Env Variable | Description |
|---|---|---|
--api-key |
SFCC_MRT_API_KEY |
MRT API key |
--project |
SFCC_MRT_PROJECT |
MRT project slug |
--environment |
SFCC_MRT_ENVIRONMENT |
MRT environment (staging, production) |
--cloud-origin |
SFCC_MRT_CLOUD_ORIGIN |
MRT cloud origin URL |
By default, the server automatically detects your project type and enables relevant toolsets. See Project Type Detection for details.
Override auto-discovery by specifying toolsets explicitly:
{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": [
"-y",
"@salesforce/b2c-dx-mcp",
"--project-directory",
"${workspaceFolder}",
"--toolsets",
"CARTRIDGES,MRT",
"--allow-non-ga-tools"
]
}
}
}Available toolsets:
CARTRIDGES- Cartridge deployment and code version managementMRT- Managed Runtime bundle operationsPWAV3- PWA Kit v3 development toolsSCAPI- Salesforce Commerce API discoverySTOREFRONTNEXT- Storefront Next development toolsall- Enable all toolsets
Note: The SCAPI toolset is always enabled, even if not explicitly specified.
Enable specific tools instead of entire toolsets:
{
"args": [
"--project-directory",
"${workspaceFolder}",
"--tools",
"cartridge_deploy,scapi_schemas_list",
"--allow-non-ga-tools"
]
}For authentication setup instructions, see the Authentication Setup guide which covers API client creation, WebDAV access, SCAPI authentication, and MRT API keys.
username- Your B2C Commerce usernamepassword- Your WebDAV access key
Used by: CARTRIDGES toolset
See the Authentication Setup guide for detailed WebDAV access configuration.
client-id- API client ID from Account Managerclient-secret- API client secret from Account Manager
Used by: SCAPI toolset
Note: Some tools require specific scopes. See Configuring Scopes in the Authentication Setup guide and individual tool pages for scope requirements.
See the Authentication Setup guide for creating and configuring API clients, and SCAPI Authentication for SCAPI-specific setup.
api-key- MRT API key from your Managed Runtime projectproject- MRT project slug (required)environment- MRT environment:stagingorproduction(required when deploying)
Used by: MRT toolset
Configuration location: ~/.mobify file
See the Authentication Setup guide for detailed MRT API key setup instructions.
Telemetry is enabled by default. Configure it via environment variables:
{
"env": {
"SF_DISABLE_TELEMETRY": "true"
}
}Or:
{
"env": {
"SFCC_DISABLE_TELEMETRY": "true"
}
}{
"env": {
"SFCC_APP_INSIGHTS_KEY": "your-key"
}
}Note: Telemetry is automatically disabled when using bin/dev.js (development mode).
Set logging verbosity:
{
"args": [
"--log-level",
"debug"
]
}Available levels: trace, debug, info, warn, error, silent
Enable debug logging (equivalent to --log-level debug):
{
"args": [
"--debug"
]
}{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": [
"-y",
"@salesforce/b2c-dx-mcp",
"--project-directory",
"${workspaceFolder}",
"--allow-non-ga-tools"
]
}
}
}Requires dw.json in project root for B2C credentials.
{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": [
"-y",
"@salesforce/b2c-dx-mcp",
"--project-directory",
"${workspaceFolder}",
"--allow-non-ga-tools"
],
"env": {
"SFCC_SERVER": "xxx.demandware.net",
"SFCC_CLIENT_ID": "...",
"SFCC_CLIENT_SECRET": "...",
"SFCC_MRT_API_KEY": "..."
}
}
}
}{
"mcpServers": {
"b2c-dx": {
"command": "npx",
"args": [
"-y",
"@salesforce/b2c-dx-mcp",
"--project-directory",
"${workspaceFolder}",
"--toolsets",
"CARTRIDGES,SCAPI",
"--allow-non-ga-tools"
]
}
}
}- Installation - Set up the MCP server
- Toolsets & Tools - Explore available toolsets and tools
- MCP Server Overview - Learn more about the MCP server