Install AI Tools

B2C Commerce tools, documentation, and skills for your assistant.

Claude

Using Claude Desktop? See Claude Desktop (Cowork) setup.

Install the plugin Recommended

bash
claude plugin marketplace add SalesforceCommerceCloud/b2c-developer-tooling
claude plugin install b2c-dx-mcp@b2c-developer-tooling

Start a new Claude Code session. To install for the current project only, run it from your project directory with --scope project.

Manual MCP setup
bash
claude mcp add --transport stdio --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest

Start a new session. To configure the current project only, run it from your project directory with --scope project. See Claude Code MCP setup.

Codex/ChatGPT

Using the ChatGPT desktop app (ChatGPT Work)? See ChatGPT Work setup.

Install the plugin Recommended

bash
codex plugin marketplace add SalesforceCommerceCloud/b2c-developer-tooling
codex plugin add b2c-dx-mcp@b2c-developer-tooling

Start a new Codex session in your project. Codex plugins also work in ChatGPT Work.

Manual MCP setup
bash
codex mcp add b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest

Or add this to ~/.codex/config.toml (or $CODEX_HOME/config.toml if customized):

toml
[mcp_servers.b2c-dx-mcp]
command = "npx"
args = ["-y", "@salesforce/b2c-dx-mcp@latest"]

Start a new session. See Codex MCP configuration.

VS Code

Install the plugin Recommended

  1. Open the Command Palette (Cmd/Ctrl+Shift+P) and run Chat: Install Plugin from Source.
  2. Enter SalesforceCommerceCloud/b2c-developer-tooling.
  3. Select b2c-dx-mcp and follow the installation prompts.
  4. Start a new chat in GitHub Copilot.
Manual MCP setup

Add this to .vscode/mcp.json in your workspace:

json
{
  "servers": {
    "b2c-dx-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@salesforce/b2c-dx-mcp@latest"]
    }
  }
}

See VS Code MCP setup.

Copilot CLI setup

Cursor

Reload the MCP server in Cursor after installation.

Manual MCP setup

Add this to .cursor/mcp.json in your project:

json
{
  "mcpServers": {
    "b2c-dx-mcp": {
      "command": "npx",
      "args": ["-y", "@salesforce/b2c-dx-mcp@latest"]
    }
  }
}

For all projects, use ~/.cursor/mcp.json instead.

See Cursor's MCP documentation.

OpenCode

Add this to opencode.json in your project:

json
{
  "mcp": {
    "b2c-dx-mcp": {
      "type": "local",
      "command": ["npx", "-y", "@salesforce/b2c-dx-mcp@latest"],
      "enabled": true
    }
  }
}

Restart OpenCode. For all projects, use ~/.config/opencode/opencode.json. See OpenCode MCP setup.

Gemini

Run:

bash
gemini mcp add --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest

Start a new Gemini CLI session. To configure the current project only, run it from your project directory with --scope project. See Gemini CLI MCP setup.

No separate skills plugins needed.

Other clients and manual setup →
Skip to content
View as Markdown
View as Markdown

CLI Interoperability ​

The Python SDK and the B2C CLI (@salesforce/b2c-cli) share the same on-disk state, byte-for-byte. Nothing is copied, translated, or duplicated — both tools read and write the identical files. A token minted by the CLI works from Python, and a token the Python SDK refreshes is visible to the CLI.

What is shared ​

  • The auth-session store — auth-sessions.json in the oclif data directory for the @salesforce/b2c-cli application. Holds persisted OAuth sessions (PKCE / implicit / client-credentials), including long-lived refresh tokens.
  • Configuration files — dw.json (discovered by walking up from the working directory), ~/.mobify, and the CLI settings.json in the B2C config directory.

Session store locations per OS ​

get_default_data_dir() computes the oclif-compatible data directory, matching the CLI exactly:

PlatformDirectory
macOS~/Library/Application Support/@salesforce/b2c-cli
Windows%LOCALAPPDATA%\@salesforce\b2c-cli
Linux / other$XDG_DATA_HOME/@salesforce/b2c-cli (fallback ~/.local/share/@salesforce/b2c-cli)

The session file is auth-sessions.json inside that directory. The directory is created 0o700 and the file 0o600, since it holds refresh tokens. Writes are atomic (temp file + rename).

On-disk session format ​

The file is a JSON document — { "version": 1, "sessions": [ ... ] } — with each session keyed by clientId. Field names are camelCase on disk (the same keys the TypeScript SDK writes) even though the Python AuthSession dataclass uses snake_case attributes:

json
{
  "version": 1,
  "sessions": [
    {
      "clientId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "flow": "pkce",
      "accessToken": "eyJ...",
      "refreshToken": "...",
      "sub": "...",
      "expiresAt": "2026-01-01T00:00:00Z",
      "scopes": ["mail", "roles", "tenantFilter", "profile"],
      "accountManagerHost": "account.demandware.com",
      "lastUsedAt": "2025-12-31T23:00:00Z"
    }
  ]
}

flow is one of pkce, implicit, or client-credentials. None-valued fields are omitted on write (matching JSON.stringify).

The CLI-login-then-Python-call workflow ​

The recommended pattern is to authenticate interactively once with the CLI, then run non-interactive Python automation that reuses the persisted session with no browser prompt.

  1. Log in with the CLI:

    bash
    b2c auth login
  2. From Python, the session is picked up automatically by resolve_config() / interactive strategies, or you can inspect it directly:

    python
    from b2c_tooling_sdk.auth import (
        get_default_data_dir,
        find_auth_session,
        is_auth_session_token_valid,
        list_auth_sessions,
    )
    
    print("session store:", get_default_data_dir() / "auth-sessions.json")
    
    session = find_auth_session("your-client-id")
    if session and is_auth_session_token_valid(session):
        print("Reusing the CLI's token — no browser needed")
    
    for s in list_auth_sessions():
        print(s.client_id, s.flow, s.expires_at)

The reverse also holds: a Python interactive login (via create_user_auth_strategy) writes to the same store, and the CLI will reuse it.

Managing the store from Python ​

save_auth_session, delete_auth_session, and clear_all_auth_sessions mutate the shared file. For tests, swap the backend with set_auth_session_backend(InMemoryAuthSessionBackend()) so you never touch the real file.

API reference ​

See the session-store helpers in the auth reference.