Install AI Tools

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

Claude

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.

Claude Desktop setup

Codex

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. This setup also works with the Codex IDE extension and the ChatGPT Work desktop app.

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.

ChatGPT online setup

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

b2c_tooling_sdk.operations.bm_users ​

Business Manager user operations for B2C Commerce instances.

Mirrors src/operations/bm-users/index.ts. Provides functions for querying and managing instance-level users via the OCAPI Data API. These are distinct from Account Manager users managed via operations/users.

Create-or-replace is supported via the backend's create_or_replace_user method (PUT), obtained from create_users_backend. On instances using SSO with Account Manager (the default for production) this is rejected with LocalUserCreationException -- local user creation must be enabled on the instance for it to succeed; otherwise provision users in Account Manager and use these operations for read/search/update/delete plus access-key administration.

Core user functions:

Access keys (externally-managed users):

Classes ​

CreateUserInput ​

python
class CreateUserInput

Body for create/replace (PUT). login and email are required.

Fields

NameTypeDefault
loginstr
emailstr
first_namestr | NoneNone
last_namestr | NoneNone
external_idstr | NoneNone
passwordstr | NoneNone
disabledbool | NoneNone
preferred_data_localestr | NoneNone
preferred_ui_localestr | NoneNone
roleslist[str] | NoneNone

ListBmUsersOptions ​

python
class ListBmUsersOptions

Options for listing BM users.

Fields

NameTypeDefault
startint | NoneNone
countint | NoneNone
selectstr | NoneNone

ListUsersOptions ​

python
class ListUsersOptions

Options for UsersBackend.list_users.

Fields

NameTypeDefault
startint | NoneNone
countint | NoneNone

ListUsersResult ​

python
class ListUsersResult

Result of listing users -- paginated.

Fields

NameTypeDefault
totalint
startint
countint
hitslist[UserInfo]field(default_factory=list)

OcapiUsersBackend ​

python
class OcapiUsersBackend

Manages BM users through the legacy OCAPI Data API /users resource.

Fields

NameType
nameLiteral['ocapi']

ScapiUsersBackend ​

python
class ScapiUsersBackend

Manages BM users through the SCAPI Merchant Users Admin API.

Fields

NameType
nameLiteral['scapi']

SearchBmUsersOptions ​

python
class SearchBmUsersOptions

Options for searching BM users.

Searchable fields per the Data API spec: login, email, first_name, last_name, external_id, last_login_date, is_locked, is_disabled.

Fields

NameTypeDefault
queryAnyNone
search_phrasestr | NoneNone
loginstr | NoneNone
emailstr | NoneNone
lockedbool | NoneNone
disabledbool | NoneNone
sort_bystr | NoneNone
sort_orderLiteral['asc', 'desc'] | NoneNone
startint | NoneNone
countint | NoneNone
selectstr | NoneNone

SearchUsersOptions ​

python
class SearchUsersOptions(ListUsersOptions)

Portable user search criteria supported by both backends.

Fields

NameTypeDefault
queryAnyNone
search_phrasestr | NoneNone
loginstr | NoneNone
emailstr | NoneNone
lockedbool | NoneNone
disabledbool | NoneNone
sort_bystr | NoneNone
sort_orderLiteral['asc', 'desc'] | NoneNone

UpdateBmUserChanges ​

python
class UpdateBmUserChanges

Updatable user fields for patch operations.

Note: locked and password cannot be modified via PATCH per the API spec.

Fields

NameTypeDefault
disabledbool | NoneNone
emailstr | NoneNone
external_idstr | NoneNone
first_namestr | NoneNone
last_namestr | NoneNone
preferred_data_localestr | NoneNone
preferred_ui_localestr | NoneNone

UpdateUserChanges ​

python
class UpdateUserChanges

Patch fields. SCAPI uses camelCase; the OCAPI backend translates to snake_case.

Fields

NameTypeDefault
emailstr | NoneNone
first_namestr | NoneNone
last_namestr | NoneNone
external_idstr | NoneNone
disabledbool | NoneNone
preferred_data_localestr | NoneNone
preferred_ui_localestr | NoneNone

UserInfo ​

python
class UserInfo

Canonical Business Manager user.

Field names match SCAPI (camelCase in TS, snake_case here); the OCAPI backend maps from OCAPI's own snake_case wire shape.

Fields

NameTypeDefault
loginstr
emailstr | NoneNone
first_namestr | NoneNone
last_namestr | NoneNone
external_idstr | NoneNone
disabledbool | NoneNone
lockedbool | NoneNone
last_login_datestr | NoneNone
password_expiration_datestr | NoneNone
password_modification_datestr | NoneNone
preferred_data_localestr | NoneNone
preferred_ui_localestr | NoneNone
roleslist[str] | NoneNone
rawAnyNone

UsersBackend ​

python
class UsersBackend(BackendBase, Protocol)

Backend contract for BM user operations.

Merchant Users has no server-side search endpoint, so the SCAPI backend implements portable search criteria over its paginated user listing. Raw OCAPI query DSL, access keys, and whoami remain OCAPI-only.

list_users method ​

python
async def list_users(options: ListUsersOptions | None = None) -> ListUsersResult

List users, paginated.

search_users method ​

python
async def search_users(options: SearchUsersOptions | None = None) -> ListUsersResult

Search users using portable criteria.

get_user method ​

python
async def get_user(login: str) -> UserInfo

Get a single user by login.

create_or_replace_user method ​

python
async def create_or_replace_user(login: str, input: CreateUserInput) -> UserInfo

Create or fully replace a user.

update_user method ​

python
async def update_user(login: str, changes: UpdateUserChanges) -> UserInfo

Update fields on an existing user.

delete_user method ​

python
async def delete_user(login: str) -> None

Delete a user.

Functions ​

create_bm_user_access_key ​

python
async def create_bm_user_access_key(instance: B2CInstance, login: str, scope: str) -> BmAccessKeyDetails

Creates a single access key for an externally-managed user.

Replaces any existing key for the same scope. The returned object includes the newly-generated access_key value -- this is the only time it is returned, so callers should record it.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.
scopestrAccess key scope.

Returns: Access key details (including the secret access_key value).

create_users_backend ​

python
def create_users_backend(config: UsersBackendConfig) -> UsersBackend

Create a UsersBackend, resolving SCAPI/OCAPI per config.

delete_bm_user ​

python
async def delete_bm_user(instance: B2CInstance, login: str) -> None

Deletes a user from an instance.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.

delete_bm_user_access_key ​

python
async def delete_bm_user_access_key(instance: B2CInstance, login: str, scope: str) -> None

Deletes a single access key for an externally-managed user.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.
scopestrAccess key scope.

get_bm_user ​

python
async def get_bm_user(instance: B2CInstance, login: str) -> BmUser

Gets a single user by login (email).

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.

Returns: User details.

get_bm_user_access_key ​

python
async def get_bm_user_access_key(instance: B2CInstance, login: str, scope: str) -> BmAccessKeyDetails

Gets a single access key for an externally-managed user.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.
scopestrAccess key scope (one of ACCESS_KEY_SCOPES).

Returns: Access key details.

list_bm_users ​

python
async def list_bm_users(instance: B2CInstance, options: ListBmUsersOptions | None = None) -> BmUsers

Lists all users on a B2C Commerce instance.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance to query.
optionsListBmUsersOptions | NonePagination options.

Returns: Users collection with pagination info.

search_bm_users ​

python
async def search_bm_users(instance: B2CInstance, options: SearchBmUsersOptions | None = None) -> BmUserSearchResult

Searches users on an instance.

Supports either a fully-formed OCAPI query (options.query) or convenience flags (search_phrase, login, email, locked, disabled) which are combined into a bool_query. If no criteria are provided a match_all_query is used.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
optionsSearchBmUsersOptions | NoneSearch options.

Returns: User search result.

set_bm_user_access_key_enabled ​

python
async def set_bm_user_access_key_enabled(instance: B2CInstance, login: str, scope: str, enabled: bool) -> BmAccessKeyDetails

Enables or disables an existing access key for an externally-managed user.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.
scopestrAccess key scope.
enabledboolWhether the access key should be enabled.

Returns: Updated access key details.

update_bm_user ​

python
async def update_bm_user(instance: B2CInstance, login: str, changes: UpdateBmUserChanges) -> BmUser

Updates an existing user.

The locked flag and the user password cannot be updated with this resource.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.
loginstrUser login.
changesUpdateBmUserChangesFields to update.

Returns: Updated user.

whoami_bm_user ​

python
async def whoami_bm_user(instance: B2CInstance) -> BmUser

Returns details for the currently authenticated user.

Useful for verifying which BM identity is in use on an instance.

Parameters

NameTypeDescription
instanceB2CInstanceB2C instance.

Returns: Current user details (includes password expiration info).

Attributes ​

ACCESS_KEY_SCOPES ​

python
ACCESS_KEY_SCOPES = ('WEBDAV_AND_STUDIO', 'AGENT_USER_AND_OCAPI', 'STOREFRONT')

AccessKeyScope ​

python
AccessKeyScope = Literal['WEBDAV_AND_STUDIO', 'AGENT_USER_AND_OCAPI', 'STOREFRONT']

BmAccessKeyDetails ​

python
BmAccessKeyDetails = dict[str, Any]

BmUser ​

python
BmUser = dict[str, Any]

BmUserSearchResult ​

python
BmUserSearchResult = dict[str, Any]

BmUsers ​

python
BmUsers = dict[str, Any]

ScapiUsersBackendConfig ​

python
ScapiUsersBackendConfig = ScapiBackendCtorConfig

UsersBackendConfig ​

python
UsersBackendConfig = DualBackendConfig