Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

Configuration

The B2C DX MCP Server supports multiple configuration methods for credentials, flags, and toolset selection.

Configuration Priority

Credentials are resolved in the following priority order.

  1. Flags (highest priority)
  2. Environment variables
  3. Config files (lowest priority)

Credential Sources

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.

B2C Credentials (dw.json)

Create a dw.json file in your project root:

json
{
  "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:

ToolsetRequired Fields
SCAPIhostname, client-id, client-secret
CARTRIDGEShostname, username, password (or OAuth)
MRT(loaded from ~/.mobify)
PWAV3None (uses --project-directory only)
STOREFRONTNEXTNone (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.

MRT Credentials (~/.mobify)

Create a ~/.mobify file in your home directory:

json
{
  "api_key": "..."
}

You can also create this file using the B2C CLI:

bash
b2c mrt config set --api-key YOUR_API_KEY

Option 2: Environment Variables

Set environment variables in your MCP client configuration:

Cursor (.cursor/mcp.json):

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):

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": "..."
      }
    }
  }
}

Option 3: Flags

Pass credentials directly as command-line flags:

json
{
  "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 Reference

Core Flags

FlagEnv VariableDescription
--project-directorySFCC_PROJECT_DIRECTORYProject directory (enables auto-discovery and config loading)
--toolsetsComma-separated toolsets to enable
--toolsComma-separated individual tools to enable
--allow-non-ga-toolsEnable experimental (non-GA) tools
--configExplicit path to dw.json (advanced)
--log-levelLogging verbosity (trace, debug, info, warn, error, silent)
--debugEnable debug logging

B2C Instance Flags

FlagEnv VariableDescription
--serverSFCC_SERVERB2C instance hostname
--usernameSFCC_USERNAMEUsername for Basic auth (WebDAV)
--passwordSFCC_PASSWORDPassword/access key for Basic auth
--client-idSFCC_CLIENT_IDOAuth client ID
--client-secretSFCC_CLIENT_SECRETOAuth client secret
--code-versionSFCC_CODE_VERSIONCode version for deployments

MRT Flags

FlagEnv VariableDescription
--api-keySFCC_MRT_API_KEYMRT API key
--projectSFCC_MRT_PROJECTMRT project slug
--environmentSFCC_MRT_ENVIRONMENTMRT environment (staging, production)
--cloud-originSFCC_MRT_CLOUD_ORIGINMRT cloud origin URL

Toolset Selection

Auto-Discovery (Default)

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

Manual Selection

Override auto-discovery by specifying toolsets explicitly:

json
{
  "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 management
  • MRT - Managed Runtime bundle operations
  • PWAV3 - PWA Kit v3 development tools
  • SCAPI - Salesforce Commerce API discovery
  • STOREFRONTNEXT - Storefront Next development tools
  • all - Enable all toolsets

Note: The SCAPI toolset is always enabled, even if not explicitly specified.

Individual Tool Selection

Enable specific tools instead of entire toolsets:

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

Credential Details

For authentication setup instructions, see the Authentication Setup guide which covers API client creation, WebDAV access, SCAPI authentication, and MRT API keys.

B2C Credentials

Username/Password (WebDAV)

Used by: CARTRIDGES toolset

See the Authentication Setup guide for detailed WebDAV access configuration.

OAuth Client Credentials

  • client-id - API client ID from Account Manager
  • client-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.

MRT Credentials

  • api-key - MRT API key from your Managed Runtime project
  • project - MRT project slug (required)
  • environment - MRT environment: staging or production (required when deploying)

Used by: MRT toolset

Configuration location: ~/.mobify file

See the Authentication Setup guide for detailed MRT API key setup instructions.

Telemetry Configuration

Telemetry is enabled by default. Configure it via environment variables:

Disable Telemetry

json
{
  "env": {
    "SF_DISABLE_TELEMETRY": "true"
  }
}

Or:

json
{
  "env": {
    "SFCC_DISABLE_TELEMETRY": "true"
  }
}

Custom Telemetry Endpoint

json
{
  "env": {
    "SFCC_APP_INSIGHTS_KEY": "your-key"
  }
}

Note: Telemetry is automatically disabled when using bin/dev.js (development mode).

Logging Configuration

Log Level

Set logging verbosity:

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

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

Debug Mode

Enable debug logging (equivalent to --log-level debug):

json
{
  "args": [
    "--debug"
  ]
}

Examples

Minimal Configuration (Auto-Discovery)

json
{
  "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.

Full Configuration with Environment Variables

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_CLIENT_ID": "...",
        "SFCC_CLIENT_SECRET": "...",
        "SFCC_MRT_API_KEY": "..."
      }
    }
  }
}

Manual Toolset Selection

json
{
  "mcpServers": {
    "b2c-dx": {
      "command": "npx",
      "args": [
        "-y",
        "@salesforce/b2c-dx-mcp",
        "--project-directory",
        "${workspaceFolder}",
        "--toolsets",
        "CARTRIDGES,SCAPI",
        "--allow-non-ga-tools"
      ]
    }
  }
}

Next Steps

Released under the Apache-2.0 License.