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

@salesforce/b2c-tooling-sdk / config / InstanceManager

Class: InstanceManager ​

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:57

Service for managing B2C instances across multiple config sources.

This class aggregates instance management operations from all sources that implement the optional instance management methods. Sources are used in priority order (lower number first), the same order configuration resolution uses.

Example ​

typescript
import { createInstanceManager } from '@salesforce/b2c-tooling-sdk/config';

// dw.json plus any globally registered (plugin) sources
const manager = createInstanceManager();

// List all instances
const instances = await manager.listAllInstances();

// Create a new instance
await manager.createInstance({
  name: 'staging',
  config: { hostname: 'staging.example.com' },
  setActive: true,
});

Constructors ​

Constructor ​

new InstanceManager(sources): InstanceManager

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:60

Parameters ​

sources ​

ConfigSource[]

Returns ​

InstanceManager

Methods ​

createInstance() ​

createInstance(options, targetSource?): Promise<InstanceCreateResult>

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:78

Create an instance in the specified source (or the highest-priority source that can create instances).

Credentials go to a credential store (a source declaring ConfigSource.credentialFields) when the store declares every field given for a credential pair, such as both clientId and clientSecret. Pairs always stay together, because configuration resolution reads a pair from one source only. Otherwise the credentials stay with the instance.

Parameters ​

options ​

CreateInstanceOptions & ResolveConfigOptions

Instance creation options

targetSource? ​

string

Source name to use (optional, defaults to first available)

Returns ​

Promise<InstanceCreateResult>

Where the instance and any routed credentials were stored

Throws ​

Error if no instance sources available or specified source not found


findInstance() ​

findInstance(name, options?): Promise<InstanceInfo | undefined>

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:130

Find an instance by name in the highest-priority source that lists it.

Parameters ​

name ​

string

Instance name

options? ​

ResolveConfigOptions

Resolution options

Returns ​

Promise<InstanceInfo | undefined>

The instance, or undefined if no source lists it


getCredentialSources() ​

getCredentialSources(field): ConfigSource[]

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:140

Get sources that can store a specific credential field.

Parameters ​

field ​

keyof NormalizedConfig

The credential field to check

Returns ​

ConfigSource[]

Array of sources that can store the field


getInstanceSources() ​

getInstanceSources(): ConfigSource[]

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:149

Get sources that can create instances.

Returns ​

ConfigSource[]

Array of sources with createInstance() method


listAllInstances() ​

listAllInstances(options?): Promise<InstanceInfo[]>

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:163

List instances from all sources that implement listInstances(), in source priority order.

Each instance's source is the name of the source that lists it. A source whose listing fails is skipped with a warning, so one broken plugin doesn't hide every other instance.

Parameters ​

options? ​

ResolveConfigOptions

Resolution options

Returns ​

Promise<InstanceInfo[]>

Array of all instances from all sources


removeInstance() ​

removeInstance(name, options?, sourceName?): Promise<InstanceInfo>

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:193

Remove an instance from the source that contains it.

Also asks every credential store to remove that instance's credentials, so no secrets are left behind. A store that fails to remove them is skipped with a warning.

Parameters ​

name ​

string

Instance name to remove

options? ​

ResolveConfigOptions

Resolution options

sourceName? ​

string

Source to remove it from (default: the highest-priority source that lists it)

Returns ​

Promise<InstanceInfo>

The removed instance

Throws ​

Error if instance not found in any source


setActiveInstance() ​

setActiveInstance(name, options?, sourceName?): Promise<InstanceInfo>

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:224

Set an instance as active in the source that contains it.

Parameters ​

name ​

string

Instance name to set as active

options? ​

ResolveConfigOptions

Resolution options

sourceName? ​

string

Source that holds it (default: the highest-priority source that lists it)

Returns ​

Promise<InstanceInfo>

The activated instance

Throws ​

Error if instance not found in any source


storeCredential() ​

storeCredential(instanceName, field, value, targetSource?, options?): Promise<void>

Defined in: packages/b2c-tooling-sdk/src/config/instance-manager.ts:240

Store a credential for an instance in the specified source.

Parameters ​

instanceName ​

string

Instance name

field ​

keyof NormalizedConfig

Config field to store

value ​

string

Value to store

targetSource? ​

string

Source name to use (optional)

options? ​

ResolveConfigOptions

Resolution options

Returns ​

Promise<void>

Throws ​

Error if no credential sources support the field