Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/retire-preview-walkthrough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'b2c-vs-extension': patch
---

Remove the preview walkthrough, role-based onboarding panel, and agent-install instructions. Standalone configuration and CLI setup commands remain available as beta features, disabled by default; enable `b2c-dx.features.setup` and reload the editor to use them.
7 changes: 7 additions & 0 deletions .changeset/vscode-agent-context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'b2c-vs-extension': minor
'@salesforce/b2c-dx-mcp': minor
'@salesforce/b2c-dx-docs': patch
---

Connect VS Code and Cursor chat to the B2C Commerce MCP server and expose the IDE's selected instance, project, and live code-sync status. Assistants can use that selection unless you specify another target; Cursor receives live context through an optional connection to the running extension.
23 changes: 20 additions & 3 deletions docs/_partials/mcp-setup-cursor.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
<McpInstallButtons client="cursor" />
**Use the IDE Extension** <span class="recommended VPBadge">Recommended</span>

Install the [B2C IDE Extension](/vscode-extension/), then open your project in a
trusted workspace. The extension automatically registers **salesforce-b2c-commerce**
with Cursor. Enable the server and its tools in Cursor's MCP settings if prompted.
The default launcher needs Node.js 22 or later and `npx` on the extension host.

This one server includes the B2C Commerce tools and live IDE context: your selected
instance and code-sync status. No `.cursor/mcp.json` entry or context URL is needed.
See [AI Chat settings](/vscode-extension/configuration#ai-chat).

Reload the MCP server in Cursor after installation.
If you already installed the B2C MCP through a plugin or configuration file,
disable or remove that duplicate entry when using the extension-managed server.
To keep your existing installation instead, set `b2c-dx.mcp.enabled` to `false`;
that also disables Cursor's live IDE-context connection.

<details class="details custom-block" data-setup-anchor="cursor-manual">
<summary>Manual MCP setup</summary>
<summary>Install MCP without the IDE Extension</summary>

<McpInstallButtons client="cursor" />

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

<!--@include: ./mcp-manual-json.md-->

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

Reload the MCP server in Cursor after installation. This standalone installation
does not receive the extension's live instance selection or code-sync status.

</details>

See [Cursor's MCP documentation](https://cursor.com/docs/context/mcp).
22 changes: 20 additions & 2 deletions docs/_partials/mcp-setup-vscode.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
<McpInstallButtons client="vscode" />
**Use the IDE Extension** <span class="recommended VPBadge">Recommended</span>

Install the [B2C IDE Extension](/vscode-extension/), then open your project in a
trusted workspace. The extension provides the **B2C Commerce** MCP server to
VS Code. Enable the server and its tools in chat; no `.vscode/mcp.json` entry is
needed. The default launcher needs Node.js 22 or later and `npx` on the extension host.

Attach **#b2cContext** in chat to include the selected instance and live code-sync
status. See [AI Chat settings](/vscode-extension/configuration#ai-chat).

If you already installed the B2C MCP through a plugin or configuration file,
disable or remove that duplicate entry when using the extension-managed server.
To keep your existing installation instead, set `b2c-dx.mcp.enabled` to `false`;
the native **#b2cContext** tool remains available.

**Install the plugin** <span class="recommended VPBadge">Recommended</span>
<details class="details custom-block">
<summary>Install the plugin without the IDE Extension</summary>

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.

</details>

<details class="details custom-block" data-setup-anchor="vscode-manual">
<summary>Manual MCP setup</summary>

<McpInstallButtons client="vscode" />

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

```json
Expand Down
26 changes: 26 additions & 0 deletions docs/mcp/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ startup default, use the shared `--project-directory`, `--config`, or `--instanc
options. See [Configuration](../guide/configuration) for their values and file formats.
These defaults do not restrict which projects the assistant can access.

### IDE selection

The [IDE Extension](../vscode-extension/configuration#ai-chat) registers the
Commerce MCP server in VS Code and Cursor. In Cursor, it also supplies a private
connection for reading the selected instance and live code-sync status. VS Code
provides the same context through the extension's native chat tool.

The optional `--ide-context-url` launch flag and `SFCC_IDE_CONTEXT_TOKEN`
environment variable are supplied together by the extension. It starts a private
HTTP endpoint on an OS-assigned loopback port inside the extension host, then
passes that endpoint's URL and a generated authentication token when registering
the Commerce MCP process with Cursor. This is one MCP server with a connection
back to the extension, not a second MCP registration. You do not generate the URL
or add it to your MCP configuration yourself.

The URL and token identify one running editor window and are not project
configuration to save or share. The
MCP process must run on the same host as the extension. Without that connection,
the MCP server does not expose IDE context. Restarting the editor requires a new
connection; a failed connection never substitutes the shared default instance.

The assistant can use this context unless you explicitly select another target.
This does not automatically override every MCP operation. Configuration
inspection still reports what the MCP process resolves, which can differ from
the editor's credentials or environment.

## Tools and toolsets {#toolset-selection}

All toolsets are enabled by default. Use names from [MCP Tools](./toolsets) to
Expand Down
10 changes: 7 additions & 3 deletions docs/mcp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ connected tasks use your existing [B2C configuration](../guide/configuration).

## Set up your assistant {#setup}

Choose your assistant. **Plugin installation is recommended where supported**;
manual setup includes the same tools, documentation, and skills.
Choose your assistant. In VS Code and Cursor, the **IDE Extension provides the MCP
registration** and live editor context. For other compatible clients, plugin
installation is recommended. Manual setup includes the same B2C Commerce tools,
documentation, and skills, without the extension's live context.
Our plugins use the open [Agent Plugins standard](https://agent-plugins.org/).

<AssistantInstall sync-url>
Expand Down Expand Up @@ -211,7 +213,9 @@ For clients with a command array, such as OpenCode, use
## Updates and customization

Use your client's plugin update controls to update a plugin installation, then
start a new session. For direct installations, `@latest` follows the current npm
start a new session. Extension-managed installations use the MCP version matched
to the IDE Extension; update the extension to update that version.
For direct installations, `@latest` follows the current npm
release; use a specific version when your team needs a fixed version.

The default installation includes all toolsets. If you want a smaller selection
Expand Down
7 changes: 4 additions & 3 deletions docs/mcp/toolsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,10 @@ See [analytics access](./security#cip).

## Configuration inspection

| Tool | Capability | Toolsets |
| ---------------- | ------------------------------------------------------------------------ | ---------------- |
| `config_inspect` | Check resolved configuration and targets; secrets are masked by default. | DIAGNOSTICS, CIP |
| Tool | Capability | Toolsets |
| --------------------- | ---------------------------------------------------------------------------------------------- | ------------------- |
| `config_inspect` | Check resolved configuration and targets; secrets are masked by default. | DIAGNOSTICS, CIP |
| `b2c_get_ide_context` | Read the selected IDE instance and live code-sync status when launched with an IDE connection. | All, when connected |

## Toolsets for customization

Expand Down
6 changes: 4 additions & 2 deletions docs/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ version constraints; use `@latest` for a new installation rather than a memorize

## Connect the MCP

Use the existing B2C MCP connection when available. For a new connection, prefer
the plugin on compatible clients:
Use the existing B2C MCP connection when available. In VS Code and Cursor, the
B2C IDE Extension registers the server and provides live editor context; do not
add a duplicate plugin or manual MCP entry. See [AI Chat settings](vscode-extension/configuration.md#ai-chat).
For other compatible clients, prefer the plugin:

- Marketplace source: `SalesforceCommerceCloud/b2c-developer-tooling`
- Marketplace name: `b2c-developer-tooling`
Expand Down
41 changes: 38 additions & 3 deletions docs/vscode-extension/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This page covers:
- [Connecting to a B2C Instance](#connecting-to-a-b2c-instance) — credentials per feature.
- [How the Extension Chooses a Project](#how-the-extension-chooses-a-project) — parent folders and multi-root workspaces.
- [Selecting an Instance](#selecting-an-instance) — workspace-specific and shared defaults.
- [AI Chat](#ai-chat) — MCP setup and the current IDE context.
- [Safety Mode](#safety-mode) — restrict changes and require confirmation for selected actions.
- [Settings Reference](#settings-reference) — the `b2c-dx.*` toggles and verbosity controls.

Expand All @@ -29,7 +30,7 @@ For the selected project, the extension loads all variables from its `.env` and

The global default is the same fallback used by the CLI and MCP server. The extension automatically refreshes when that shared setting changes.

The extension's instance picker combines instances from the primary and global files. Same-name primary entries shadow global entries, and each instance remains a complete entry rather than having fields merged across files. Switching an instance updates the file that owns it and clears the previous active selection across the catalog.
The extension's instance picker combines instances from the primary and global files. Same-name primary entries shadow global entries, and each instance remains a complete entry rather than having fields merged across files. Setting the shared default updates the file that owns it and clears the previous active selection across the catalog. Selecting an instance only for this workspace leaves those files unchanged.

### Per-feature requirements

Expand Down Expand Up @@ -100,12 +101,43 @@ To keep a particular project directory selected, right-click that folder in Expl

## Selecting an Instance

When your configuration defines multiple named instances (the recommended pattern for working across dev / staging / sandbox), click the cloud icon in the status bar to open a quick pick. Selecting an instance applies it only to the current VS Code workspace and refreshes every extension view. Other VS Code workspaces, the CLI, and MCP continue using their own selection or the shared default.
When your configuration defines multiple named instances (the recommended pattern for working across dev / staging / sandbox), click the cloud icon in the status bar to open a quick pick. Selecting an instance applies it only to the current VS Code workspace and refreshes every extension view. Other editor workspaces and the CLI continue using their own selection or the shared default. See [AI Chat](#ai-chat) for how assistants use the IDE selection.

The picker distinguishes the instance **selected for this workspace** with a check mark and the shared **default instance** with a star. Use the star action on a row—or run **B2C DX: Set Default Instance**—to intentionally change the default used by other consumers. Run **B2C DX: Follow Default Instance** to remove the workspace-specific selection.

For named entries, setting the default writes `active: true`; a root configuration without an explicit `active` value remains an implicit default. This is equivalent to running `b2c setup instance set-active <name>` and is separate from selecting an instance only for VS Code.

## AI Chat

The extension makes the **B2C Commerce MCP server** available in VS Code and Cursor without creating an MCP configuration file. In a trusted workspace, enable the server and its tools in your editor's chat settings. The default launcher requires Node.js 22 or later and `npx` on the extension host's PATH; it downloads the MCP version matched to the extension. Remote workspaces need these prerequisites on the remote host.

Chat can check the selected instance and live code-sync status in your editor window. Shared context includes connection details, never credentials.

<ExamplePrompt>

> Check the logs on my selected B2C instance. Is code sync currently active for that instance?

</ExamplePrompt>

Assistants can use the current IDE selection unless you specify another target. The context includes the project root, configuration file, instance name, hostname, configured code version, and whether code sync is actually running. When active, code sync reports its upload hostname and code version separately.

Both editors let your assistant check the current selection and code-sync status:

- **VS Code:** attach **#b2cContext** to your chat.
- **Cursor:** ask your assistant to check the selected B2C instance; the extension-provided MCP server includes this capability without additional setup.

After switching instances, ask the assistant to check your selection again. Explicit targets in your request take precedence. Existing debug and log sessions stay on their original instance; restarting MCP ends those sessions. In VS Code, restart MCP if it still uses the previous default instance. Cursor may restart it when you change instances.

The native context tool is specific to VS Code chat integrations that consume extension tools. Cursor uses its own MCP registration API. Other assistants sharing the directory do not automatically inherit editor context. In remote workspaces, the MCP process and extension host must run on the same host.

| Setting | Default | Purpose |
| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `b2c-dx.mcp.enabled` | `true` | Register MCP servers with the editor. Disable when managing the Commerce server yourself to avoid duplicate registrations. In Cursor this also closes the IDE-context connection. |
| `b2c-dx.mcp.command` | `npx` | MCP executable on the extension host. |
| `b2c-dx.mcp.args` | `null` | Optional replacement launcher arguments. By default, uses the MCP package version matched to the extension. The extension appends project, configuration, and instance flags. |

The command and argument settings are machine-scoped. For local MCP development, set the command to `node` and the arguments to the absolute path of the built MCP package's `bin/run.js`.

## Safety Mode

The extension honors the selected instance's `safety` settings in `dw.json`.
Expand All @@ -119,11 +151,13 @@ There is no separate safety-level toggle in VS Code Settings.

## Settings Reference

Standalone configuration and CLI setup commands are beta features, disabled by default. Enable `b2c-dx.features.setup` and reload the window to use them from the Command Palette. The retired guided walkthrough and role-based onboarding panel are no longer included.

These VS Code settings live under the `b2c-dx.*` namespace. **You usually don't need to change any of them** — they exist for niche cases like disabling a feature you don't use, or quieting the log channel for a bug report. To browse: **Settings** (Cmd+,) → search for `b2c-dx`.

### Feature toggles

Each feature is enabled by default. Set to `false` to skip its activation entirely (no tree views, no commands, no context-menu entries). Useful for trimming the UI, isolating activation issues, or running in a project where a feature isn't applicable.
Most features are enabled by default; beta setup commands are off by default. Set a feature to `false` to skip its activation entirely (no tree views, no commands, no context-menu entries). Useful for trimming the UI, isolating activation issues, or running in a project where a feature isn't applicable.

| Setting | Default |
| ---------------------------------- | ------- |
Expand All @@ -135,6 +169,7 @@ Each feature is enabled by default. Set to `false` to skip its activation entire
| `b2c-dx.features.scaffold` | `true` |
| `b2c-dx.features.apiBrowser` | `true` |
| `b2c-dx.features.cap` | `true` |
| `b2c-dx.features.setup` | `false` |

The B2C Script Debugger registers regardless of these toggles — it activates only when a `b2c-script` launch configuration is used.

Expand Down
4 changes: 4 additions & 0 deletions docs/vscode-extension/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Available on the [Visual Studio Marketplace](https://marketplace.visualstudio.co

## Highlights

### AI Chat Context

Use B2C Commerce tools in VS Code and Cursor chat with MCP registration supplied by the extension. Assistants can read the selected instance, project root, and live code-sync status. In VS Code, reference **#b2cContext** explicitly; Cursor receives the same context through the Commerce MCP server. See [AI Chat configuration](./configuration#ai-chat) for setup and targeting behavior.

### ISML and Script API Editor Support

Write storefront code with ISML syntax highlighting, snippets, formatting, tag completion, diagnostics, and Emmet support. Cartridge JavaScript files automatically provide autocomplete and hover documentation for `dw/*` modules without writing a `jsconfig.json` into your project. See the [Script API IntelliSense guide](../guide/ide-integration#script-api-intellisense) for more detail.
Expand Down
18 changes: 18 additions & 0 deletions guidance/mcp/b2c-config/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ For MCP installation or tool selection, see [server setup](skill://mcp/server/SK

## Inspect resolved values

When `b2c_get_ide_context` is available from the IDE extension and the user has
not specified a target, read it before configuration-dependent calls. Pass its
`projectDirectory`, `configPath`, and `instanceName` to the MCP tools. The IDE
selection can differ from the active entry on disk; names alone are not unique
across configuration files. Explicit user targets take precedence: resolve them
independently rather than combining another instance name with the IDE's file.
If IDE context is unavailable or unconfigured, report that instead of guessing
or falling back silently. Without the IDE tool, use normal MCP configuration.

Refresh IDE context after a selection change or when beginning another task;
it is a snapshot, not a persistent binding. Compare returned `resolution` with
the intended target. Environment/plugin overrides and different credential
stores can make IDE and MCP resolution differ. Stop on a target mismatch before
mutating data. Existing debugger/log sessions retain their original targets.
`codeSync.active` reports the actual watcher state, not the auto-upload setting;
its hostname/code version can differ while an old upload is draining. Do not
assume active sync means every file has finished uploading.

Call `config_inspect` directly with the task's absolute `projectDirectory`.
No prior skill read is required. Secrets are masked by default (`unmask: false`).
The result includes effective values, contributing sources, warnings, and
Expand Down
3 changes: 2 additions & 1 deletion packages/b2c-dx-mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"sinon": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"typescript-eslint": "catalog:"
"typescript-eslint": "catalog:",
"msw": "catalog:"
},
"engines": {
"node": ">=22.16.0"
Expand Down
Loading
Loading