Skip to content

Configuration

The B2C DX MCP Server uses the same configuration system as the B2C CLI.

See the CLI Configuration guide and Authentication Setup guide for credential formats and setup details.

Credentials

dw.json (Recommended)

Create a dw.json file in your project root. The MCP server uses the same format as the CLI and loads it automatically with project-level installation.

json
{
  "hostname": "xxx.demandware.net",
  "username": "...",
  "password": "...",
  "client-id": "...",
  "client-secret": "...",
  "short-code": "...",
  "tenant-id": "..."
}

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.

See the CLI Configuration guide for the complete dw.json format, supported fields, and multi-instance configuration.

Required fields per toolset:

ToolsetRequired Fields
SCAPIshort-code, tenant-id, client-id, client-secret
CARTRIDGEShostname, username, password (or OAuth: hostname, client-id, client-secret)
MRTmrtProject, mrtApiKey (or api_key in ~/.mobify, or MRT_API_KEY env var). mrtEnvironment required when deploying.
PWAV3None (project directory auto-detected)
STOREFRONTNEXTNone (project directory auto-detected)

Note: Some tools require specific scopes. See Configuring Scopes in the Authentication Setup guide and individual tool pages for scope requirements.

.env File

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().

bash
SFCC_SERVER=xxx.demandware.net
SFCC_CLIENT_ID=...
SFCC_CLIENT_SECRET=...
SFCC_SHORTCODE=...
SFCC_TENANT_ID=...

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.

See the Environment Variables Reference for the complete list of supported variables.

MRT Credentials (~/.mobify)

MRT tools require an API key. You can include mrtApiKey, mrtProject, and mrtEnvironment in dw.json (see required fields above), or store the API key in a separate ~/.mobify file (user-level, shared across projects):

json
{
  "api_key": "your-mrt-api-key"
}

~/.mobify file locations:

  • Default: ~/.mobify
  • With --cloud-origin: ~/.mobify--{hostname} (e.g., ~/.mobify--custom.example.com)
  • With --credentials-file (or MRT_CREDENTIALS_FILE): uses the specified path

If both dw.json and ~/.mobify contain an API key, dw.json takes precedence. For complete setup instructions, see the Authentication Guide.

Configuration Priority

When the same setting is provided in multiple places, the server resolves values in this order:

  1. Flags (highest) — e.g., --server, --api-key in the args array
  2. Environment variables — via .env file, MCP client env object, or system environment
  3. Config files (lowest) — dw.json and ~/.mobify

In practice, you rarely need flags or env vars in mcp.jsondw.json and .env handle most cases. Flags and the env object are available for overrides or CI environments.

Toolset Selection

Auto-Discovery (Default)

By default, the server automatically detects your project type and enables relevant toolsets. No configuration needed. See Project Type Detection for details.

Manual Selection

Override auto-discovery with --toolsets or SFCC_TOOLSETS:

json
{
  "mcpServers": {
    "b2c-dx-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@salesforce/b2c-dx-mcp@latest",
        "--toolsets",
        "CARTRIDGES,MRT",
        "--allow-non-ga-tools"
      ]
    }
  }
}

Available toolsets: CARTRIDGES, MRT, PWAV3, SCAPI, STOREFRONTNEXT, all

With auto-discovery, the SCAPI toolset is always included. When using --toolsets or --tools, only the specified toolsets/tools are enabled.

Individual Tool Selection

Enable specific tools instead of entire toolsets:

json
{
  "args": [
    "--tools",
    "cartridge_deploy,scapi_schemas_list",
    "--allow-non-ga-tools"
  ]
}

Logging

Set logging verbosity with --log-level or SFCC_LOG_LEVEL:

json
{
  "args": ["--log-level", "debug"]
}

Available levels: trace, debug, info, warn, error, silent

The --debug flag (or SFCC_DEBUG) is a shorthand for --log-level debug.

Telemetry

Telemetry is enabled by default and collects anonymous usage data to help improve the developer experience.

What we collect: server lifecycle events, tool usage (which tools and execution time), command metrics, and environment info (platform, Node.js version, package version).

What we don't collect: credentials, business data, tool arguments/results, or file contents.

To disable, set either variable in your .env file or MCP client env object:

VariableDescription
SFCC_DISABLE_TELEMETRYSet to true to disable telemetry
SF_DISABLE_TELEMETRYSet to true to disable telemetry (sf CLI standard)

MCP Server Flags Reference

Flags specific to the MCP server (in addition to the shared CLI flags in the CLI Configuration guide):

FlagTypeDefaultDescription
--toolsetsstringAuto-detectToolsets to enable (comma-separated)
--toolsstring-Individual tools to enable (comma-separated)
--allow-non-ga-toolsbooleanfalseEnable non-GA (experimental) tools

Environment variable equivalents for these flags are listed in MCP Server Environment Variables.

Environment Variables Reference

These can be set in a .env file, the MCP client env object, or as system environment variables.

MCP Server Environment Variables

MCP-specific environment variables (flag equivalents):

Env VariableEquivalent FlagTypeDefaultDescription
SFCC_TOOLSETS--toolsetsstringAuto-detectToolsets to enable (comma-separated)
SFCC_TOOLS--toolsstring-Individual tools to enable (comma-separated)
SFCC_ALLOW_NON_GA_TOOLS--allow-non-ga-toolsbooleanfalseEnable non-GA (experimental) tools

B2C instance:

VariableDescription
SFCC_SERVERB2C instance hostname
SFCC_CODE_VERSIONCode version for deployments
SFCC_USERNAMEUsername for Basic auth (WebDAV)
SFCC_PASSWORDPassword/access key for Basic auth
SFCC_CLIENT_IDOAuth client ID (SFCC_OAUTH_CLIENT_ID also supported)
SFCC_CLIENT_SECRETOAuth client secret (SFCC_OAUTH_CLIENT_SECRET also supported)
SFCC_SHORTCODESCAPI short code
SFCC_TENANT_IDOrganization/tenant ID

MRT:

VariableDescription
MRT_API_KEYMRT API key (SFCC_MRT_API_KEY also supported)
MRT_PROJECTMRT project slug (SFCC_MRT_PROJECT also supported)
MRT_ENVIRONMENTTarget environment (SFCC_MRT_ENVIRONMENT also supported)
MRT_CLOUD_ORIGINMRT API origin URL (SFCC_MRT_CLOUD_ORIGIN also supported)
MRT_CREDENTIALS_FILEPath to MRT credentials file (overrides ~/.mobify)

General:

VariableDescription
SFCC_PROJECT_DIRECTORYProject directory (SFCC_WORKING_DIRECTORY also supported)
SFCC_CONFIGPath to config file
SFCC_INSTANCEInstance name from configuration file
SFCC_LOG_LEVELLogging level
SFCC_DEBUGEnable debug logging

See the CLI Configuration guide for the complete list including OAuth and advanced options.

Next Steps

Released under the Apache-2.0 License.