MCP Server
The B2C DX MCP Server enables AI assistants (like Claude Code, Cursor, GitHub Copilot, and others) to help with B2C Commerce development tasks. It provides toolsets for SCAPI, CARTRIDGES, MRT, PWAV3, and STOREFRONTNEXT development.
⚠️ Preview Release: This package is in preview. Tools are functional but require
--allow-non-ga-toolsto enable. Additional tools will be added in future releases.
Overview
The MCP server automatically detects your project type and enables relevant tools. It reads configuration from your project's configuration files and provides AI assistants with context-aware tools to help you:
- Discover and explore Salesforce Commerce APIs
- Deploy code and manage B2C instances
- Build and deploy applications to Managed Runtime
- Get development guidelines and best practices
- Generate components and scaffold new features
Quick Start
Installation
Claude Code:
cd /path/to/your/project
claude mcp add --transport stdio --scope project b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest --allow-non-ga-toolsclaude mcp add --transport stdio --scope user b2c-dx-mcp -- npx -y @salesforce/b2c-dx-mcp@latest --allow-non-ga-toolsCursor: Add to Cursor
See the Installation Guide for detailed setup instructions for Claude Code, Cursor, GitHub Copilot, and other MCP clients.
Configuration
The server automatically detects your project type and loads configuration from dw.json in your project root. See the Configuration Guide for details on:
- Credential management (config files, environment variables, flags)
- Project type detection
- Toolset selection (auto-discovery vs manual)
- Required credentials per toolset
For authentication setup instructions, see the Authentication Setup guide which covers API client creation, WebDAV access, SCAPI authentication, and MRT API keys.
Available Toolsets
The server provides five toolsets with specialized tools for different development workflows:
- CARTRIDGES - Cartridge deployment and code version management
- MRT - Managed Runtime bundle operations
- PWAV3 - PWA Kit v3 development tools
- SCAPI - Salesforce Commerce API discovery
- STOREFRONTNEXT - Storefront Next development tools
See the Toolsets & Tools Reference for detailed descriptions of each toolset and its tools.
Usage
Project Directory
With project-level installation (recommended), the server automatically detects your project location from the MCP config file location. This enables:
- Auto-discovery - Detects your project type and enables appropriate toolsets.
- Configuration loading - Reads
dw.jsonfrom your project for credentials. - Scaffolding - Creates new files in the correct location.
Note: If using user-level configuration on Cursor, add --project-directory "${workspaceFolder}" to the args array. Claude Code and GitHub Copilot don't require this flag.
Project Type Detection
The server analyzes your project directory and enables toolsets based on what it finds:
| Project Type | Detection | Toolsets Enabled |
|---|---|---|
| PWA Kit v3 | @salesforce/pwa-kit-*, @salesforce/retail-react-app, or ccExtensibility in package.json | PWAV3, MRT, SCAPI |
| Storefront Next | Root or a workspace package has @salesforce/storefront-next* dependency, or package name starting with storefront-next. | STOREFRONTNEXT, MRT, CARTRIDGES, SCAPI |
| Cartridges | .project file in cartridge directory | CARTRIDGES, SCAPI |
| No project detected | No B2C markers found | SCAPI (base toolset only) |
The SCAPI toolset is always enabled. Hybrid projects (e.g., cartridges + PWA Kit) get combined toolsets.
Prompting Tips
AI assistants automatically decide which MCP tools to use based on your prompts. To get the best results:
⚠️ IMPORTANT: Explicitly mention "Use the MCP tool" in your prompts for reliable tool usage. While AI assistants can automatically select MCP tools based on context, explicit instructions ensure the assistant prioritizes MCP tools over general knowledge, especially when multiple approaches are possible.
Best Practices
- Always explicitly request MCP tool usage: Start prompts with "Use the MCP tool to..." or include "Use the MCP tool" in your request
- Be specific about your goal: Instead of "help me with Storefront Next", say "Use the MCP tool to show me how to build a product detail page with authentication"
- Mention the tool or domain explicitly: Reference the framework (Storefront Next, PWA Kit), operation (deploy, discover), or domain (SCAPI, cartridges)
- Use natural language: Describe what you want to achieve, not the tool name
- Provide context: Mention your project type, what you're building, or what you need to learn
- Ask for guidelines first: When starting a new project or learning a framework, ask for development guidelines before writing code
- Combine related topics: Ask for multiple related sections in one request (e.g., "Use the MCP tool to show me data fetching and component patterns for Storefront Next")
- Specify operations clearly: For deployment operations, mention the target and what to deploy (for example, "Use the MCP tool to deploy my cartridges to the sandbox instance")
Example Prompts
Storefront Next Development:
- ✅ "I'm new to Storefront Next. Use the MCP tool to show me the critical rules I need to know."
- ✅ "I need to build a product detail page. Use the MCP tool to show me best practices for data fetching and component patterns."
- ✅ "I want to apply my brand colors to my Storefront Next site. Use the MCP tool to help me."
SCAPI Discovery:
- ✅ "Use the MCP tool to list all available SCAPI schemas."
- ✅ "Use the MCP tool to get the OpenAPI schema for shopper-baskets v1."
Cartridge Deployment:
- ✅ "Use the MCP tool to deploy my cartridges to the sandbox instance."
MRT Bundle Operations:
- ✅ "Use the MCP tool to build and push my Storefront Next bundle to staging."
Figma-to-Component:
- ✅ "Use the MCP tool to convert this Figma design to a Storefront Next component: [Figma URL with node-id]"
- ✅ "Use the MCP tool to create this homepage from the Figma design: [Figma URL with node-id]. Create new components or update existing components using the MCP tool if necessary, then update the home page. The expected result should be that the homepage matches as closely as possible to the provided Figma design."
- ✅ "Use the MCP tool to map Figma design tokens to my theme."
See the Toolsets & Tools Reference for more prompting examples for each toolset.
Plugins
The MCP server uses the B2C CLI under the hood, so CLI plugins automatically extend MCP functionality. Plugins can add new commands, provide custom configuration sources, integrate with external systems, and more.
See the CLI Plugin documentation for details on creating plugins and Third-Party Plugins for available community plugins.
Next Steps
- Installation Guide - Set up Claude Code, Cursor, GitHub Copilot, or other MCP clients
- Configuration - Configure credentials, flags, and toolset selection
- Toolsets & Tools - Explore available toolsets and tools
- CLI Reference - Learn about the B2C CLI commands
- API Reference - Explore the SDK API