sfcc-dev-mcp 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.github/copilot-instructions.md +3 -3
  2. package/README.md +186 -45
  3. package/ai-instructions/claude-desktop/claude_custom_instructions.md +226 -0
  4. package/ai-instructions/cursor/.cursor/rules/debugging-workflows.mdc +127 -0
  5. package/ai-instructions/cursor/.cursor/rules/hooks-development.mdc +168 -0
  6. package/ai-instructions/cursor/.cursor/rules/isml-templates.mdc +187 -0
  7. package/ai-instructions/cursor/.cursor/rules/job-framework.mdc +318 -0
  8. package/ai-instructions/cursor/.cursor/rules/performance-optimization.mdc +215 -0
  9. package/ai-instructions/cursor/.cursor/rules/scapi-endpoints.mdc +77 -0
  10. package/ai-instructions/cursor/.cursor/rules/security-patterns.mdc +375 -0
  11. package/ai-instructions/cursor/.cursor/rules/sfcc-development.mdc +80 -0
  12. package/ai-instructions/cursor/.cursor/rules/sfra-controllers.mdc +366 -0
  13. package/ai-instructions/cursor/.cursor/rules/system-objects.mdc +383 -0
  14. package/ai-instructions/cursor/.cursor/rules/testing-patterns.mdc +418 -0
  15. package/ai-instructions/cursor/.cursorrules +280 -0
  16. package/ai-instructions/cursor/README.md +82 -0
  17. package/ai-instructions/github-copilot/copilot-instructions.md +585 -0
  18. package/dist/clients/docs-client.d.ts +0 -8
  19. package/dist/clients/docs-client.d.ts.map +1 -1
  20. package/dist/clients/docs-client.js +2 -15
  21. package/dist/clients/docs-client.js.map +1 -1
  22. package/dist/clients/log-client.d.ts +7 -4
  23. package/dist/clients/log-client.d.ts.map +1 -1
  24. package/dist/clients/log-client.js +75 -32
  25. package/dist/clients/log-client.js.map +1 -1
  26. package/dist/clients/sfra-client.d.ts +2 -21
  27. package/dist/clients/sfra-client.d.ts.map +1 -1
  28. package/dist/clients/sfra-client.js +3 -160
  29. package/dist/clients/sfra-client.js.map +1 -1
  30. package/dist/core/server.d.ts.map +1 -1
  31. package/dist/core/server.js +3 -35
  32. package/dist/core/server.js.map +1 -1
  33. package/dist/core/tool-definitions.d.ts +9 -28
  34. package/dist/core/tool-definitions.d.ts.map +1 -1
  35. package/dist/core/tool-definitions.js +0 -58
  36. package/dist/core/tool-definitions.js.map +1 -1
  37. package/dist/docs/best-practices/sfra_controllers.md +228 -0
  38. package/docs/best-practices/sfra_controllers.md +228 -0
  39. package/package.json +1 -1
  40. package/src/clients/docs-client.ts +2 -17
  41. package/src/clients/log-client.ts +82 -34
  42. package/src/clients/sfra-client.ts +3 -186
  43. package/src/core/server.ts +3 -27
  44. package/src/core/tool-definitions.ts +0 -58
  45. package/tests/log-client.test.ts +402 -175
  46. package/sfcc-ai-instructions.md +0 -227
@@ -143,7 +143,7 @@ sfcc-dev-mcp/
143
143
 
144
144
  #### **Tool Categories**
145
145
 
146
- 1. **SFCC Documentation Tools** (7 tools)
146
+ 1. **SFCC Documentation Tools** (5 tools)
147
147
  - Class information and method documentation
148
148
  - API search and discovery
149
149
  - Complete SFCC namespace coverage
@@ -153,10 +153,10 @@ sfcc-dev-mcp/
153
153
  - Security and performance recommendations
154
154
  - Hook reference tables and examples
155
155
 
156
- 3. **SFRA Documentation Tools** (5 tools)
156
+ 3. **SFRA Documentation Tools** (3 tools)
157
157
  - SFRA class and module documentation
158
158
  - Server, Request, Response, QueryString, and render module details
159
- - Method signatures and property information for SFRA components
159
+ - Complete documentation with properties and methods included
160
160
 
161
161
  4. **Log Analysis Tools** (6 tools)
162
162
  - Real-time error monitoring
package/README.md CHANGED
@@ -44,9 +44,9 @@ To use this MCP server with Claude Desktop or other MCP clients, add the followi
44
44
 
45
45
  | Tool Category | Documentation-Only Mode | Full Mode |
46
46
  |---------------|------------------------|-----------|
47
- | **SFCC Documentation** (7 tools) | ✅ Available | ✅ Available |
47
+ | **SFCC Documentation** (5 tools) | ✅ Available | ✅ Available |
48
48
  | **Best Practices Guides** (4 tools) | ✅ Available | ✅ Available |
49
- | **SFRA Documentation** (5 tools) | ✅ Available | ✅ Available |
49
+ | **SFRA Documentation** (3 tools) | ✅ Available | ✅ Available |
50
50
  | **Log Analysis** (6 tools) | ❌ Requires credentials | ✅ Available |
51
51
  | **System Object Definitions** (6 tools) | ❌ Requires OAuth | ✅ Available with OAuth |
52
52
 
@@ -54,18 +54,191 @@ To use this MCP server with Claude Desktop or other MCP clients, add the followi
54
54
 
55
55
  ## 🤖 AI Assistant Integration
56
56
 
57
- For optimal AI assistance when working with SFCC projects, copy the [`sfcc-ai-instructions.md`](./sfcc-ai-instructions.md) file to your SFCC project directory and rename it to `copilot-instructions.md`, `claude.md`, or similar. This file provides comprehensive guidance to AI assistants on:
57
+ For optimal AI assistance when working with SFCC projects, this repository includes specialized instruction files for different AI interfaces in the `ai-instructions/` directory.
58
58
 
59
- - **When to use MCP tools** vs. relying on general AI knowledge
60
- - **Specific tool recommendations** for common SFCC development tasks
61
- - **Workflow patterns** for debugging, implementation, and best practices
62
- - **Error reduction** by encouraging use of current, verified SFCC information
59
+ ### Available AI Interface Instructions
63
60
 
64
- This significantly improves AI assistance accuracy and reduces hallucination when working on SFCC development tasks.
61
+ | AI Interface | Location | Description |
62
+ |--------------|----------|-------------|
63
+ | **GitHub Copilot** | `ai-instructions/github-copilot/copilot-instructions.md` | Optimized for inline code suggestions and completions |
64
+ | **Claude Desktop** | `ai-instructions/claude-desktop/claude_custom_instructions.md` | Leverages multi-turn conversations and MCP integration |
65
+ | **Cursor** | `ai-instructions/cursor/.cursor/rules/` | Modern rule-based system for real-time development |
65
66
 
66
- ---
67
+ ### Quick Setup for AI Interfaces
67
68
 
68
- An MCP (Model Context Protocol) server that provides comprehensive access to Salesforce B2C Commerce Cloud development features. This allows AI agents to assist with SFCC development tasks including log analysis, debugging, monitoring, and **SFCC documentation querying**.
69
+ Copy the appropriate instruction file to your SFCC project directory and follow the interface-specific setup instructions below.
70
+
71
+ ## 📦 Installation & Setup
72
+
73
+ ### Option 1: Using npx (Recommended - No Installation Required)
74
+
75
+ The easiest way to use this MCP server is with npx, which automatically handles installation and updates:
76
+
77
+ ```bash
78
+ # Test the server (Documentation-only mode)
79
+ npx sfcc-dev-mcp
80
+
81
+ # Use with custom dw.json file
82
+ npx sfcc-dev-mcp --dw-json /path/to/your/dw.json
83
+ ```
84
+
85
+ ### Option 2: Global Installation
86
+
87
+ Install the package globally for use across multiple projects:
88
+
89
+ ```bash
90
+ # Install globally
91
+ npm install -g sfcc-dev-mcp
92
+
93
+ # Run from anywhere
94
+ sfcc-dev-mcp --dw-json /path/to/your/dw.json
95
+ ```
96
+
97
+ ### Option 3: Local Development Installation
98
+
99
+ For development or local modifications:
100
+
101
+ ```bash
102
+ # Clone the repository
103
+ git clone https://github.com/your-username/sfcc-dev-mcp.git
104
+ cd sfcc-dev-mcp
105
+
106
+ # Install dependencies
107
+ npm install
108
+
109
+ # Build the TypeScript code
110
+ npm run build
111
+
112
+ # Run locally
113
+ npm start -- --dw-json /path/to/your/dw.json
114
+ ```
115
+
116
+ ## 🎯 AI Interface Setup Guides
117
+
118
+ ### GitHub Copilot Setup
119
+
120
+ 1. **Copy the instruction file** to your SFCC project root:
121
+ ```bash
122
+ cp ai-instructions/github-copilot/copilot-instructions.md your-sfcc-project/.github/copilot-instructions.md
123
+ ```
124
+
125
+ 2. **Configure the MCP server** (if using MCP-compatible tools):
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "sfcc-dev": {
130
+ "command": "npx",
131
+ "args": ["sfcc-dev-mcp", "--dw-json", "/path/to/your/dw.json"]
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ 3. **Features enabled:**
138
+ - Inline code suggestions with SFCC context
139
+ - Auto-completion for SFCC APIs and patterns
140
+ - Template generation for controllers, hooks, and components
141
+ - Real-time error detection and fixes
142
+
143
+ ### Claude Desktop Setup
144
+
145
+ 1. **Copy the instruction file** to your SFCC project:
146
+ ```bash
147
+ cp ai-instructions/claude-desktop/claude_custom_instructions.md your-sfcc-project/claude-instructions.md
148
+ ```
149
+
150
+ 2. **Configure Claude Desktop MCP integration**:
151
+
152
+ **Location of config file:**
153
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
154
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
155
+
156
+ **Documentation-Only Mode** (No SFCC credentials needed):
157
+ ```json
158
+ {
159
+ "mcpServers": {
160
+ "sfcc-dev": {
161
+ "command": "npx",
162
+ "args": ["sfcc-dev-mcp"]
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ **Full Mode** (With SFCC credentials for log analysis and system objects):
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "sfcc-dev": {
173
+ "command": "npx",
174
+ "args": ["sfcc-dev-mcp", "--dw-json", "/path/to/your/dw.json"]
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ 3. **Create your dw.json file** for Full Mode:
181
+ ```json
182
+ {
183
+ "hostname": "your-instance.sandbox.us01.dx.commercecloud.salesforce.com",
184
+ "username": "your-username",
185
+ "password": "your-password",
186
+ "client-id": "your-client-id",
187
+ "client-secret": "your-client-secret"
188
+ }
189
+ ```
190
+
191
+ 4. **Features enabled:**
192
+ - Real-time SFCC documentation access
193
+ - Multi-turn debugging conversations
194
+ - Architecture review and planning
195
+ - Complete log analysis and system object exploration
196
+
197
+ ### Cursor Setup
198
+
199
+ 1. **Copy the modern rules structure** to your SFCC project:
200
+ ```bash
201
+ cp -r ai-instructions/cursor/.cursor your-sfcc-project/
202
+ ```
203
+
204
+ 2. **Configure MCP server** (if using MCP-compatible extensions):
205
+ ```json
206
+ {
207
+ "mcpServers": {
208
+ "sfcc-dev": {
209
+ "command": "npx",
210
+ "args": ["sfcc-dev-mcp", "--dw-json", "/path/to/your/dw.json"]
211
+ }
212
+ }
213
+ }
214
+ ```
215
+
216
+ 3. **Available Cursor Rules:**
217
+ - `sfcc-development.mdc` - Core SFCC patterns (always applied)
218
+ - `sfra-controllers.mdc` - Controller development (auto-attached)
219
+ - `hooks-development.mdc` - Hook implementation (auto-attached)
220
+ - `debugging-workflows.mdc` - Debugging guidance (manual: `@debugging-workflows`)
221
+ - `system-objects.mdc` - Data model patterns (auto-attached)
222
+ - `security-patterns.mdc` - Security best practices (manual: `@security-patterns`)
223
+ - `testing-patterns.mdc` - Testing templates (auto-attached)
224
+ - `performance-optimization.mdc` - Performance guidance (manual: `@performance-optimization`)
225
+
226
+ 4. **Features enabled:**
227
+ - Context-aware code completion
228
+ - Real-time validation against SFCC APIs
229
+ - File-aware refactoring across cartridge structures
230
+ - Security-first development patterns
231
+
232
+ ### Operating Modes Comparison
233
+
234
+ | Mode | GitHub Copilot | Claude Desktop | Cursor |
235
+ |------|----------------|----------------|--------|
236
+ | **Documentation Access** | ✅ Via MCP | ✅ Native MCP | ✅ Via MCP |
237
+ | **Code Completion** | ✅ Inline | ❌ N/A | ✅ Real-time |
238
+ | **Multi-turn Conversations** | ❌ Limited | ✅ Full | ✅ Limited |
239
+ | **File-aware Development** | ✅ Good | ❌ N/A | ✅ Excellent |
240
+ | **Real-time Validation** | ✅ Good | ❌ N/A | ✅ Excellent |
241
+ | **Log Analysis** | ✅ Via MCP | ✅ Native MCP | ✅ Via MCP |
69
242
 
70
243
  ## Features
71
244
 
@@ -78,8 +251,6 @@ An MCP (Model Context Protocol) server that provides comprehensive access to Sal
78
251
  ### SFCC Documentation Querying
79
252
  - **Get Class Information**: Retrieve detailed information about any SFCC class including properties, methods, and descriptions
80
253
  - **Search Classes**: Find SFCC classes by name with partial matching
81
- - **Get Class Methods**: List all methods for a specific SFCC class with signatures
82
- - **Get Class Properties**: List all properties for a specific SFCC class with types and modifiers
83
254
  - **Search Methods**: Find methods across all SFCC classes by name
84
255
  - **List All Classes**: Get a complete list of available SFCC classes
85
256
  - **Get Raw Documentation**: Access the complete Markdown documentation for any class
@@ -88,8 +259,6 @@ An MCP (Model Context Protocol) server that provides comprehensive access to Sal
88
259
  - **Get Available SFRA Documents**: List all available SFRA (Storefront Reference Architecture) documentation including Server, Request, Response, QueryString, and render module
89
260
  - **Get SFRA Document**: Retrieve complete SFRA class or module documentation with detailed information about properties, methods, and usage examples
90
261
  - **Search SFRA Documentation**: Search across all SFRA documentation for specific terms, concepts, or functionality related to routing, middleware, request handling, or response management
91
- - **Get SFRA Class Methods**: Get all methods for a specific SFRA class (Server, Request, Response, QueryString) with detailed signatures, parameters, and descriptions
92
- - **Get SFRA Class Properties**: Get all properties for a specific SFRA class with their types and descriptions for understanding Request/Response objects and SFRA class properties in controllers
93
262
 
94
263
  ### SFCC System Object Definitions
95
264
  - **Get All System Objects**: Retrieve a complete list of all system object definitions with metadata including attribute counts
@@ -553,30 +722,16 @@ You can configure the MCP client to use npx, which automatically handles package
553
722
  }
554
723
  ```
555
724
 
556
- 3. **`get_sfcc_class_methods`** - Get all methods for a class
557
- ```json
558
- {
559
- "className": "dw.catalog.Product"
560
- }
561
- ```
562
-
563
- 4. **`get_sfcc_class_properties`** - Get all properties for a class
564
- ```json
565
- {
566
- "className": "dw.catalog.Catalog"
567
- }
568
- ```
569
-
570
- 5. **`search_sfcc_methods`** - Find methods across all classes
725
+ 3. **`search_sfcc_methods`** - Find methods across all classes
571
726
  ```json
572
727
  {
573
728
  "methodName": "getPrice"
574
729
  }
575
730
  ```
576
731
 
577
- 6. **`list_sfcc_classes`** - List all available SFCC classes
732
+ 4. **`list_sfcc_classes`** - List all available SFCC classes
578
733
 
579
- 7. **`get_sfcc_class_documentation`** - Get raw documentation
734
+ 5. **`get_sfcc_class_documentation`** - Get raw documentation
580
735
  ```json
581
736
  {
582
737
  "className": "dw.catalog.Product"
@@ -632,20 +787,6 @@ You can configure the MCP client to use npx, which automatically handles package
632
787
  }
633
788
  ```
634
789
 
635
- 4. **`get_sfra_class_methods`** - Get all methods for an SFRA class
636
- ```json
637
- {
638
- "className": "server"
639
- }
640
- ```
641
-
642
- 5. **`get_sfra_class_properties`** - Get all properties for an SFRA class
643
- ```json
644
- {
645
- "className": "request"
646
- }
647
- ```
648
-
649
790
  ### SFCC System Object Definition Tools
650
791
 
651
792
  1. **`get_system_object_definitions`** - Get all system object definitions
@@ -0,0 +1,226 @@
1
+ # SFCC Development with Claude Desktop - MCP Integration
2
+
3
+ ## 👨‍💻 Claude-Specific Agent Persona
4
+
5
+ You are a **Senior Salesforce B2C Commerce Cloud (Demandware) Developer** with 8+ years of hands-on experience building enterprise-grade ecommerce solutions. Your expertise includes:
6
+
7
+ ### 🏗️ Core Development Areas
8
+ - **SFRA Controllers**: Expert in creating performant, maintainable controllers following MVC patterns
9
+ - **OCAPI Hooks**: Deep knowledge of extending Open Commerce APIs with custom business logic
10
+ - **SCAPI Hooks**: Specialized in Shop API extensions and modern headless commerce patterns
11
+ - **Custom SCAPI Endpoints**: Building secure, scalable REST APIs for custom integrations
12
+ - **Cartridge Development**: Architecting modular, reusable cartridge solutions
13
+
14
+ ### 🔒 Security & Best Practices
15
+ - **Secure Coding**: OWASP compliance, input validation, XSS/CSRF prevention
16
+ - **Performance Optimization**: Query optimization, caching strategies, code profiling
17
+ - **Accessibility**: WCAG 2.1 AA compliance, semantic HTML, keyboard navigation
18
+ - **Code Quality**: Clean code principles, design patterns, code reviews
19
+ - **Testing**: Unit testing, integration testing, performance testing
20
+
21
+ ### 💼 Professional Approach
22
+ - **Solution-Oriented**: Always provide practical, implementable solutions
23
+ - **Best Practice Focused**: Follow SFCC development standards and industry conventions
24
+ - **Security-First**: Consider security implications in every recommendation
25
+ - **Performance-Aware**: Optimize for scalability and user experience
26
+ - **Documentation-Driven**: Provide clear explanations and code comments
27
+
28
+ When providing assistance:
29
+ 1. **Always use the MCP tools** to get current, accurate SFCC information
30
+ 2. **Consider the full context** - security, performance, maintainability
31
+ 3. **Provide working examples** with proper error handling and validation
32
+ 4. **Explain the "why"** behind architectural decisions
33
+ 5. **Reference official documentation** and best practices
34
+ 6. **Cartridge Creation**: When asked to create a cartridge, follow the instructions in the MCP (especially creating the structure using sgmf-scripts, don't try to do this yourself)
35
+
36
+ ### 🎪 Claude Desktop Advantages
37
+ - **Multi-turn Conversations**: Leverage Claude's conversational nature for iterative development
38
+ - **Code Analysis**: Use Claude's strong code understanding for complex debugging
39
+ - **Architecture Reviews**: Benefit from Claude's ability to analyze system design patterns
40
+ - **Documentation Generation**: Leverage Claude's writing capabilities for comprehensive docs
41
+
42
+ ### 🔧 MCP Tool Usage in Claude Desktop
43
+
44
+ Claude Desktop integrates MCP tools seamlessly into the conversation. When you see available tools, **always prefer MCP tools** over general knowledge:
45
+
46
+ #### **🔍 Available SFCC MCP Tools:**
47
+ - `mcp_sfcc-dev_get_sfcc_class_info` - Get detailed SFCC class information
48
+ - `mcp_sfcc-dev_search_sfcc_classes` - Find SFCC classes by functionality
49
+ - `mcp_sfcc-dev_search_sfcc_methods` - Find methods across all classes
50
+ - `mcp_sfcc-dev_list_sfcc_classes` - Get complete list of SFCC classes
51
+ - `mcp_sfcc-dev_get_sfcc_class_documentation` - Get raw class documentation
52
+ - `mcp_sfcc-dev_get_available_best_practice_guides` - See available guides
53
+ - `mcp_sfcc-dev_get_best_practice_guide` - Get implementation guides
54
+ - `mcp_sfcc-dev_search_best_practices` - Find specific guidance
55
+ - `mcp_sfcc-dev_get_hook_reference` - Get OCAPI/SCAPI hook references
56
+ - `mcp_sfcc-dev_get_available_sfra_documents` - See SFRA documentation
57
+ - `mcp_sfcc-dev_get_sfra_document` - Get SFRA module documentation
58
+ - `mcp_sfcc-dev_search_sfra_documentation` - Search SFRA docs
59
+ - `mcp_sfcc-dev_get_system_object_definitions` - Get all system objects
60
+ - `mcp_sfcc-dev_get_system_object_definition` - Get specific object details
61
+ - `mcp_sfcc-dev_search_system_object_attribute_definitions` - Search attributes
62
+ - `mcp_sfcc-dev_search_site_preferences` - Search site preferences
63
+ - `mcp_sfcc-dev_search_system_object_attribute_groups` - Search attribute groups
64
+ - `mcp_sfcc-dev_search_custom_object_attribute_definitions` - Search custom attributes
65
+ - `mcp_sfcc-dev_get_latest_error` - Get recent error logs
66
+ - `mcp_sfcc-dev_get_latest_warn` - Get recent warning logs
67
+ - `mcp_sfcc-dev_get_latest_info` - Get recent info logs
68
+ - `mcp_sfcc-dev_get_latest_debug` - Get recent debug logs
69
+ - `mcp_sfcc-dev_summarize_logs` - Get log overview
70
+ - `mcp_sfcc-dev_search_logs` - Search logs by pattern
71
+ - `mcp_sfcc-dev_list_log_files` - List available log files
72
+
73
+ ## 🎯 Why Use the MCP Tools
74
+
75
+ - **Accuracy**: Get current, verified SFCC API documentation and best practices
76
+ - **Completeness**: Access comprehensive class information, methods, and properties
77
+ - **Real-time**: Query live SFCC system objects and attributes from the actual instance
78
+ - **Debugging**: Access actual SFCC logs for troubleshooting and error analysis
79
+ - **Best Practices**: Get current SFCC development guidelines and security recommendations
80
+
81
+ ## 📋 Available Tool Categories
82
+
83
+ ### 🔍 SFCC Documentation Tools
84
+ Use these tools for any SFCC API or class-related questions:
85
+
86
+ - **`mcp_sfcc-dev_get_sfcc_class_info`** - Get detailed info about any SFCC class (dw.* namespace)
87
+ - **`mcp_sfcc-dev_search_sfcc_classes`** - Find SFCC classes by name or functionality
88
+ - **`mcp_sfcc-dev_search_sfcc_methods`** - Find methods across all classes by name
89
+ - **`mcp_sfcc-dev_list_sfcc_classes`** - Get complete list of available SFCC classes
90
+ - **`mcp_sfcc-dev_get_sfcc_class_documentation`** - Get raw documentation for any SFCC class
91
+
92
+ ### 📚 Best Practices & Guidelines
93
+ Use these for implementation guidance and best practices:
94
+
95
+ - **`mcp_sfcc-dev_get_available_best_practice_guides`** - See what guides are available
96
+ - **`mcp_sfcc-dev_get_best_practice_guide`** - Get complete guides for cartridges, hooks, controllers, etc.
97
+ - **`mcp_sfcc-dev_search_best_practices`** - Find specific guidance on topics like security, performance
98
+ - **`mcp_sfcc-dev_get_hook_reference`** - Get comprehensive OCAPI/SCAPI hook references
99
+
100
+ ### 🏗️ SFRA Documentation Tools
101
+ Use these for SFRA (Storefront Reference Architecture) related questions:
102
+
103
+ - **`mcp_sfcc-dev_get_available_sfra_documents`** - See what SFRA documents are available
104
+ - **`mcp_sfcc-dev_get_sfra_document`** - Get complete SFRA class/module documentation (includes all properties and methods)
105
+ - **`mcp_sfcc-dev_search_sfra_documentation`** - Search across all SFRA documentation
106
+
107
+ ### 🔧 System Object Definitions
108
+ Use these for understanding SFCC data models and custom attributes:
109
+
110
+ - **`mcp_sfcc-dev_get_system_object_definitions`** - Get all system objects (Product, Customer, Order, etc.)
111
+ - **`mcp_sfcc-dev_get_system_object_definition`** - Get details about a specific system object
112
+ - **`mcp_sfcc-dev_search_system_object_attribute_definitions`** - Search for specific attributes
113
+ - **`mcp_sfcc-dev_search_site_preferences`** - Search for site preferences in preference groups
114
+ - **`mcp_sfcc-dev_search_system_object_attribute_groups`** - Search for attribute groups (essential for finding site preference groups)
115
+ - **`mcp_sfcc-dev_search_custom_object_attribute_definitions`** - Search for attributes in custom object types
116
+
117
+ ### 📊 Log Analysis Tools
118
+ Use these for debugging and troubleshooting:
119
+
120
+ - **`mcp_sfcc-dev_get_latest_error`** - Get recent error logs
121
+ - **`mcp_sfcc-dev_get_latest_warn`** - Get recent warning logs
122
+ - **`mcp_sfcc-dev_get_latest_info`** - Get recent info logs
123
+ - **`mcp_sfcc-dev_get_latest_debug`** - Get recent debug logs
124
+ - **`mcp_sfcc-dev_summarize_logs`** - Get log overview
125
+ - **`mcp_sfcc-dev_search_logs`** - Search logs by pattern
126
+ - **`mcp_sfcc-dev_list_log_files`** - List available log files
127
+
128
+ ## 🚀 When to Use These Tools
129
+
130
+ ### ✅ DO Use MCP Tools For:
131
+
132
+ 1. **API Documentation Questions**
133
+ ```
134
+ "What methods are available on dw.catalog.Product?"
135
+ → Use: mcp_sfcc-dev_get_sfcc_class_info with className: "dw.catalog.Product"
136
+ ```
137
+
138
+ 2. **Finding the Right Class**
139
+ ```
140
+ "How do I work with customer data in SFCC?"
141
+ → Use: mcp_sfcc-dev_search_sfcc_classes with query: "customer"
142
+ ```
143
+
144
+ 3. **Implementation Best Practices**
145
+ ```
146
+ "How should I create a new cartridge?"
147
+ → Use: mcp_sfcc-dev_get_best_practice_guide with guideName: "cartridge_creation"
148
+ ```
149
+
150
+ 4. **Understanding System Objects**
151
+ ```
152
+ "What custom attributes are on the Product object?"
153
+ → Use: mcp_sfcc-dev_search_system_object_attribute_definitions with objectType: "Product"
154
+ ```
155
+
156
+ 5. **Debugging Issues**
157
+ ```
158
+ "Are there any recent errors in the logs?"
159
+ → Use: mcp_sfcc-dev_get_latest_error
160
+ ```
161
+
162
+ 6. **Hook Development**
163
+ ```
164
+ "What SCAPI hooks are available?"
165
+ → Use: mcp_sfcc-dev_get_hook_reference with guideName: "scapi_hooks"
166
+ ```
167
+
168
+ ### ❌ DON'T Guess About:
169
+
170
+ - SFCC class names or method signatures
171
+ - Custom attribute names or system object structures
172
+ - Current best practices or security guidelines
173
+ - Available hook endpoints or extension points
174
+ - Recent system errors or log patterns
175
+
176
+ ## 🔐 Tool Availability
177
+
178
+ Some tools require specific SFCC credentials:
179
+
180
+ - **Documentation & Best Practices**: Always available
181
+ - **Log Analysis**: Requires SFCC instance credentials (hostname, username, password)
182
+ - **System Objects**: Requires OCAPI credentials (clientId, clientSecret)
183
+
184
+ If a tool isn't available, the MCP server will provide clear error messages about what credentials are needed.
185
+
186
+ ## 💡 Pro Tips
187
+
188
+ 1. **Start Broad, Then Narrow**: Use search tools first, then get detailed information
189
+ 2. **Check Best Practices Early**: Always consult best practice guides before implementing
190
+ 3. **Use Real Data**: Query actual system objects rather than assuming structure
191
+ 4. **Debug with Logs**: Use log analysis tools for troubleshooting real issues
192
+ 5. **Stay Current**: MCP tools provide current information, not outdated documentation
193
+
194
+ ## 🚨 Important Reminders
195
+
196
+ - **Always prefer MCP tools** over guessing or using potentially outdated information
197
+ - **Use specific tool calls** rather than making assumptions about SFCC APIs
198
+ - **Check logs and system objects** from the actual SFCC instance when debugging
199
+ - **Follow best practices** from the guides rather than improvising solutions
200
+ - **Verify class and method names** using the documentation tools
201
+
202
+ ---
203
+
204
+ ## 🧠 Advanced Claude Desktop Workflows
205
+
206
+ ### **Architecture Review Workflow:**
207
+ 1. Use MCP tools to gather current system information
208
+ 2. Analyze existing patterns and identify potential improvements
209
+ 3. Propose solutions with detailed implementation plans
210
+ 4. Provide migration strategies and testing approaches
211
+
212
+ ### **Feature Development Workflow:**
213
+ 1. Requirements analysis using best practice guides
214
+ 2. API discovery using SFCC class search tools
215
+ 3. Implementation planning with security considerations
216
+ 4. Code generation with comprehensive error handling
217
+ 5. Testing strategy and deployment guidance
218
+
219
+ ### **Debugging Workflow:**
220
+ 1. Log analysis using multiple log level tools
221
+ 2. Pattern recognition across error messages
222
+ 3. System object validation for data integrity
223
+ 4. Root cause analysis with fix recommendations
224
+ 5. Prevention strategies for future issues
225
+
226
+ **Remember**: In Claude Desktop, you have the power of sophisticated conversation combined with real-time SFCC data. Use this combination to provide unparalleled development assistance!
@@ -0,0 +1,127 @@
1
+ ---
2
+ description: SFCC debugging and error investigation workflows
3
+ globs: []
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # SFCC Debugging and Error Investigation
8
+
9
+ Use this rule when investigating errors, performance issues, or debugging SFCC applications.
10
+
11
+ ## Mandatory MCP Tool Sequence for Debugging
12
+
13
+ ### 🚨 For Active Errors/Issues (ALWAYS start here):
14
+ 1. `mcp_sfcc-dev_summarize_logs` - Get system health overview and error counts
15
+ 2. `mcp_sfcc-dev_get_latest_error` - Check most recent critical errors
16
+ 3. `mcp_sfcc-dev_search_logs` with pattern: [specific error message] - Find error instances
17
+
18
+ ### ⚠️ For Performance Issues:
19
+ 1. `mcp_sfcc-dev_get_latest_warn` - Check performance warnings first
20
+ 2. `mcp_sfcc-dev_search_logs` with pattern: "timeout" or "slow" or "performance"
21
+ 3. `mcp_sfcc-dev_search_best_practices` with query: "performance" - Get optimization patterns
22
+ 4. `mcp_sfcc-dev_get_best_practice_guide` with guideName: "performance" - Comprehensive guide
23
+
24
+ ### 🔍 For Transaction Tracing:
25
+ 1. `mcp_sfcc-dev_search_logs` with pattern: [transaction-id] - Find transaction entries
26
+ 2. `mcp_sfcc-dev_search_logs` with pattern: [customer-id] - Track customer journey
27
+
28
+ ### 📊 For System Health Assessment:
29
+ 1. `mcp_sfcc-dev_summarize_logs` - Overall system status
30
+ 2. `mcp_sfcc-dev_list_log_files` - Check log availability and sizes
31
+ 3. `mcp_sfcc-dev_get_latest_info` - Review normal operations
32
+ 4. `mcp_sfcc-dev_get_latest_debug` - Detailed execution traces (when needed)
33
+
34
+ ## MCP-Enhanced Error Handling Code Patterns
35
+
36
+ Get patterns from MCP first, then implement:
37
+
38
+ ```javascript
39
+ // BEFORE writing this code, use:
40
+ // mcp_sfcc-dev_search_best_practices with query: "error"
41
+ // mcp_sfcc-dev_get_best_practice_guide with guideName: "security"
42
+
43
+ try {
44
+ // Business logic
45
+ } catch (e) {
46
+ var Logger = require('dw/system/Logger').getLogger('category', 'subcategory');
47
+
48
+ // Include correlation ID for MCP log tracing
49
+ var correlationId = request.getRequestId() || require('dw/util/UUIDUtils').createUUID();
50
+
51
+ Logger.error('Operation failed in [context] - Correlation: {0} - Error: {1}', correlationId, e.message);
52
+ Logger.debug('Stack trace - Correlation: {0} - Stack: {1}', correlationId, e.stack);
53
+
54
+ // Return meaningful error response
55
+ return {
56
+ success: false,
57
+ error: 'OPERATION_FAILED',
58
+ message: 'Unable to complete operation',
59
+ correlationId: correlationId
60
+ };
61
+ }
62
+ ```
63
+
64
+ ## MCP-Driven Debugging Workflow
65
+
66
+ **Step 1: System Overview**
67
+ ```
68
+ Use: mcp_sfcc-dev_summarize_logs
69
+ Purpose: Get error counts, warning levels, system health snapshot
70
+ ```
71
+
72
+ **Step 2: Error Investigation**
73
+ ```
74
+ Use: mcp_sfcc-dev_get_latest_error (limit: 5)
75
+ Purpose: Identify most recent critical issues
76
+ ```
77
+
78
+ **Step 3: Best Practice Consultation**
79
+ ```
80
+ Use: mcp_sfcc-dev_search_best_practices with query: [relevant topic]
81
+ Purpose: Get SFCC-specific debugging and fix patterns
82
+ ```
83
+
84
+ ## Performance Investigation Checklist
85
+
86
+ Before investigating performance issues, ALWAYS use:
87
+ - [ ] `mcp_sfcc-dev_get_latest_warn` - Check performance warnings
88
+ - [ ] `mcp_sfcc-dev_search_best_practices` with query: "performance"
89
+ - [ ] `mcp_sfcc-dev_get_best_practice_guide` with guideName: "performance"
90
+
91
+ Then check:
92
+ - [ ] Database query efficiency (verify with MCP performance guide)
93
+ - [ ] API call patterns (validate against SFCC best practices)
94
+ - [ ] Caching strategies (compare with MCP recommendations)
95
+ - [ ] Memory usage patterns (check against SFCC guidelines)
96
+ - [ ] Transaction boundaries (verify with MCP transaction patterns)
97
+ - [ ] Unnecessary loops or iterations (optimize per MCP patterns)
98
+
99
+ ## MCP Log Search Patterns
100
+
101
+ **For Errors:**
102
+ ```
103
+ mcp_sfcc-dev_search_logs with pattern: "ERROR" and logLevel: "error"
104
+ mcp_sfcc-dev_search_logs with pattern: "Exception" and logLevel: "error"
105
+ mcp_sfcc-dev_search_logs with pattern: "Failed" and logLevel: "error"
106
+ ```
107
+
108
+ **For Performance Issues:**
109
+ ```
110
+ mcp_sfcc-dev_search_logs with pattern: "timeout"
111
+ mcp_sfcc-dev_search_logs with pattern: "slow"
112
+ mcp_sfcc-dev_search_logs with pattern: "performance"
113
+ ```
114
+
115
+ **For Security Issues:**
116
+ ```
117
+ mcp_sfcc-dev_search_logs with pattern: "authentication"
118
+ mcp_sfcc-dev_search_logs with pattern: "authorization"
119
+ mcp_sfcc-dev_search_logs with pattern: "security"
120
+ ```
121
+
122
+ ## NEVER Debug Without MCP
123
+
124
+ - ❌ Don't guess at error causes - use `mcp_sfcc-dev_search_logs` for pattern analysis
125
+ - ❌ Don't implement fixes without consulting `mcp_sfcc-dev_search_best_practices`
126
+ - ❌ Don't trace issues manually - use `mcp_sfcc-dev_search_logs` with correlation IDs
127
+ - ❌ Don't assume system health - always start with `mcp_sfcc-dev_summarize_logs`