MCP server for Salesforce B2C Commerce Cloud development assistance
An AI-powered Model Context Protocol (MCP) server that provides comprehensive access to Salesforce B2C Commerce Cloud development tools, documentation, and runtime diagnostics.
notifications/progress updates when clients provide a progressToken{
"mcpServers": {
"sfcc-dev": {
"command": "npx",
"args": ["sfcc-dev-mcp"]
}
}
}{
"mcpServers": {
"sfcc-dev": {
"command": "npx",
"args": ["sfcc-dev-mcp", "--dw-json", "/path/to/your/dw.json"]
}
}
}Create a dw.json file with your SFCC credentials. You can use either auth mode (or both):
username + passwordclient-id + client-secret{
"hostname": "your-instance.sandbox.us01.dx.commercecloud.salesforce.com",
"username": "your-username",
"password": "your-password",
"client-id": "your-client-id",
"client-secret": "your-client-secret"
}At least one complete credential pair is required when hostname is set.
If credentials are provided, hostname is also required.
Simply open a VS Code workspace that contains a dw.json file - the server will automatically discover and use it:
{
"mcpServers": {
"sfcc-dev": {
"command": "npx",
"args": ["sfcc-dev-mcp"]
}
}
}The server discovers SFCC credentials in this order (highest priority first):
| Priority | Source | Description |
|---|---|---|
| 1 | --dw-json CLI parameter | Explicit path to dw.json file |
| 2 | Environment variables | SFCC_HOSTNAME, SFCC_USERNAME, SFCC_PASSWORD, SFCC_CLIENT_ID, SFCC_CLIENT_SECRET |
| 3 | MCP workspace roots | Automatically discovers dw.json in your VS Code workspace folder(s), and refreshes when the client sends notifications/roots/list_changed |
Note: The server no longer searches the current working directory by default, as MCP servers often start with
cwdset to the user's home directory. The MCP workspace roots mechanism provides reliable project context.
| Mode | Tools Available | SFCC Credentials Required |
|---|---|---|
| Documentation-Only | 18 tools | โ No |
| Full Mode | 40 tools | โ Yes |
Perfect for learning and development, no SFCC instance required:
Complete development experience with live SFCC instance access:
This server is built around a capability-gated, modular handler architecture that cleanly separates tool routing from domain logic:
src/core/tool-schemas/): Modular, category-based tool definitions (documentation, SFRA, ISML, logs, job logs, system objects, cartridge, code versions, agent instructions, script debugger). Re-exported via tool-definitions.ts.src/core/server-tool-catalog.ts, src/core/server-tool-call-lifecycle.ts, src/core/server-workspace-discovery.ts): Keeps server.ts focused by extracting capability-aware tool catalog logic, tools/call lifecycle (progress/cancellation/preflight), and workspace roots reconfiguration flow.src/core/tool-argument-validator.ts): Enforces runtime argument shape at the MCP boundary for all tools (required fields, primitive/object/array types, enum checks, integer/numeric ranges, string patterns/length, and strict unknown-key checks for object schemas at top-level and nested levels) before tool dispatch.src/core/tool-schemas/shared-schemas.ts): Shared search schemas include text_query, term_query, bool_query, filtered_query, and match_all_query so MCP boundary validation aligns with supported OCAPI query patterns.src/core/handlers/): Each category has a handler extending a common base for timing, structured logging, and error normalization, with config-driven wiring via ConfiguredClientHandler to reduce repetitive boilerplate (e.g. log-handler, docs-handler, isml-handler, system-object-handler).src/clients/): Encapsulate domain operations (OCAPI, SFRA docs, ISML docs, modular log analysis, script debugger, cartridge generation, agent-instruction sync). Handlers delegate to these so orchestration and computation remain separate.src/services/): Dependency-injected abstractions for filesystem and path operations โ improves testability and isolates side effects.src/clients/logs/): Reader (range/tail optimization), discovery, processor (line โ structured entry), analyzer (patterns & health), formatter (human output) for maintainable evolution.src/config/configuration-factory.ts): Determines capabilities (canAccessLogs, canAccessOCAPI) based on provided credentials and filters exposed tools accordingly (principle of least privilege).src/config/credential-validation.ts): Centralizes auth-pair completeness and hostname-format validation for both dw.json loading and runtime configuration creation.src/core/server.ts): Rejects execution of tools that are unavailable in the current mode, so hidden tools are not callable via direct tools/call requests.src/core/server.ts): tools/call handling supports cancellation via request abort signals and emits best-effort progress notifications when the caller provides _meta.progressToken.src/core/tool-error-response.ts): Sanitizes upstream execution errors before returning MCP tool responses, reducing accidental leakage of backend payload details.src/core/server.ts): For OAuth-only configurations (client-id/client-secret without username/password), log/job-log/script-debugger tool exposure is gated by a one-time WebDAV capability probe to avoid false-positive tool availability.src/config/cli-options.ts): Centralizes command-line parsing and environment credential detection for predictable startup behavior.src/config/path-security-policy.ts): Reuses allow/block path rules across workspace-root discovery and secure dw.json loading.src/utils/abort-utils.ts): Centralized timeout and abort-signal composition used by HTTP and debugger clients for consistent cancellation semantics and timer cleanup.cache.ts, log-cache.ts) reduce unnecessary I/O.src/core/tool-schemas/ (or create new file for new category).src/core/tool-schemas/index.ts if adding a new file.registerHandlers() in server.ts.npx aegis query before writing tests.For a deeper internal view, see the Development Guide in the docs site.
Choose your preferred AI assistant:
| Interface | Best For | Setup Guide |
|---|---|---|
| Claude Desktop | Multi-turn conversations, debugging | ๐ Setup Guide |
| GitHub Copilot | VS Code integration, inline suggestions | ๐ Setup Guide |
| Cursor | Modern AI-powered editor | ๐ Setup Guide |
Tip: Add
-y(or--yes) to suppress the interactive prompt npx shows before downloading a package. This prevents AI clients (Claude Desktop, Copilot, Cursor) from hanging waiting for confirmation.
# Test the server
npx -y sfcc-dev-mcp
# Use with your configuration
npx -y sfcc-dev-mcp --dw-json /path/to/your/dw.jsonnpm install -g sfcc-dev-mcp
sfcc-dev-mcp --dw-json /path/to/your/dw.json# Enable debug mode for detailed logging
npx -y sfcc-dev-mcp --debug
# Or with configuration file
npx -y sfcc-dev-mcp --dw-json /path/to/your/dw.json --debug--debug accepts true/false, 1/0, or yes/no. Invalid values fail fast with a clear error message.
The server writes logs to your system's temporary directory:
/var/folders/{user-id}/T/sfcc-mcp-logs//tmp/sfcc-mcp-logs/%TEMP%\sfcc-mcp-logs\Log Files Created:
sfcc-mcp-info.log - General application logs and startup messagessfcc-mcp-debug.log - Detailed debug information (only when --debug is enabled)sfcc-mcp-error.log - Error messages and stack tracessfcc-mcp-warn.log - Warning messages// The exact path varies by system - to find yours:
node -e "console.log(require('os').tmpdir() + '/sfcc-mcp-logs')"The publish workflow runs MCP tests against the just-published npm artifact (npx sfcc-dev-mcp@<version>) before publishing to the MCP Registry.
You can run the same validation locally:
# Ensure docs-site tool catalog stays in sync with runtime tool definitions
npm run validate:tools-sync
# Ensure docs-site skills catalog stays in sync with bundled skills
npm run validate:skills-sync
# Ensure MCP registry metadata stays in sync with package.json
npm run validate:server-json
# In a separate terminal, start the mock server first for full-mode MCP tests
npm run test:mock-server:start
# Uses latest published version by default
npm run test:mcp:published-npx
# Or pin a specific published version
bash ./scripts/test-published-npx.sh 1.0.21In GitHub Actions, the publish workflow manages the mock server lifecycle automatically.
๐ Complete Documentation - Comprehensive guides and references
Documentation source lives in docs-site-v2/ (VitePress). The legacy React site remains in docs-site/.
Quick Links:
๐งโ๐ป "Create a new SFCC controller for product search"
๐ค Generates complete controller with proper imports, route handling, and SFRA patterns
๐งโ๐ป "What's wrong with my checkout flow? Check the logs"
๐ค Analyzes recent error logs, identifies issues, and suggests fixes
๐งโ๐ป "Show me how to implement OCAPI hooks for order validation"
๐ค Retrieves related SFCC classes and methods, then proposes a concrete hook implementation patternWe're continuously improving the SFCC Development MCP Server with exciting new features planned:
Have ideas for new features or improvements? We'd love to hear from you!
Check out our Contributing Guide to get started, or browse our open issues to see where you can help.
Your expertise and feedback make this tool better for the entire SFCC community!
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Ready to supercharge your SFCC development with AI?