b2c-debug
B2C Debug Skill
Debug server-side scripts on Salesforce B2C Commerce instances — set breakpoints, step through code, and inspect variables in SFRA controllers, hooks, jobs, and custom APIs.
Prefer MCP debugging when available:
debug_controlresumes/steps;debug_inspectreads stacks and variables;debug_evaluateevaluates expressions. Seeskill://mcp/debugger/SKILL.mdfor the MCP workflow. Use the CLI for a requested terminal session or when MCP is unavailable.
b2c debug provides a Debug Adapter Protocol (DAP) debug adapter for IDEs. For terminal or headless use without the MCP tools, b2c debug cli also offers an interactive REPL and a JSONL --rpc mode.
Tip: If
b2cis not installed globally, usenpx @salesforce/b2c-cliinstead (e.g.,npx @salesforce/b2c-cli debug cli).
Configuration & Authentication
The CLI resolves the target instance and debugger credentials from environment variables (including project .env), the selected project-local or shared dw.json, and configuration plugins. It does not search parent directories. package.json supplies only non-sensitive defaults; ~/.mobify supplies MRT credentials, not debugger credentials. Flags like --server, --username, and --password are usually unnecessary — only pass them to override what's auto-detected.
Run b2c setup inspect to see the resolved configuration and which source provided each value (use --json for scripting; keep secrets masked unless the user explicitly requests their values). For precedence rules and troubleshooting, see the b2c-cli:b2c-config skill.
For MCP debugging, pass projectDirectory to debug_start_session whenever the MCP server may have been launched outside the project. The tool uses that root to load the project's .env and default dw.json; pass configPath to select a different primary dw.json-format file and instanceName to select a named instance from the primary or shared default file. Cartridge discovery and local/server source mapping default to projectDirectory; pass cartridgeDirectory only when the cartridges live under a different root. The start call captures this information in resolution, which debug_list_sessions returns without requiring the caller to repeat it. The MCP server controls its SDAPI client identity internally, so callers do not pass a debugger client ID.