@iflow-mcp/emenowicz-hybris-mcp 1.0.0

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.
package/.env.example ADDED
@@ -0,0 +1,44 @@
1
+ # Hybris MCP Configuration
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # ===========================================
5
+ # REQUIRED - Connection Settings
6
+ # ===========================================
7
+
8
+ # Base URL of your Hybris instance (no trailing slash)
9
+ HYBRIS_BASE_URL=https://localhost:9002
10
+
11
+ # Admin credentials (requires HAC access for admin tools)
12
+ HYBRIS_USERNAME=admin
13
+ HYBRIS_PASSWORD=nimda
14
+
15
+ # ===========================================
16
+ # OPTIONAL - Site Configuration
17
+ # ===========================================
18
+
19
+ # OCC API base site ID (for product search, orders, etc.)
20
+ # Default: electronics
21
+ # HYBRIS_BASE_SITE_ID=electronics
22
+
23
+ # Product catalog ID
24
+ # Default: electronicsProductCatalog
25
+ # HYBRIS_CATALOG_ID=electronicsProductCatalog
26
+
27
+ # Catalog version to use
28
+ # Default: Online
29
+ # HYBRIS_CATALOG_VERSION=Online
30
+
31
+ # ===========================================
32
+ # OPTIONAL - HAC Configuration
33
+ # ===========================================
34
+
35
+ # Path prefix for HAC (Hybris Administration Console)
36
+ # Default: /hac
37
+ # HYBRIS_HAC_PATH=/hac
38
+
39
+ # ===========================================
40
+ # OPTIONAL - Node.js Settings
41
+ # ===========================================
42
+
43
+ # Disable SSL certificate validation (for self-signed certs in dev)
44
+ # NODE_TLS_REJECT_UNAUTHORIZED=0
package/README.md ADDED
@@ -0,0 +1,450 @@
1
+ # Hybris MCP Server
2
+
3
+ MCP (Model Context Protocol) server for SAP Commerce Cloud (Hybris) integration. This server allows AI assistants like Claude to interact with your Hybris instance.
4
+
5
+ ## Features
6
+
7
+ - **Product Management**: Search products, get product details, browse categories
8
+ - **Order Management**: View orders and order details
9
+ - **FlexibleSearch**: Execute FlexibleSearch queries directly
10
+ - **Groovy Scripts**: Run Groovy scripts via the scripting console
11
+ - **ImpEx**: Import and export data using ImpEx format
12
+ - **Cron Jobs**: List and trigger cron jobs
13
+ - **Cache Management**: Clear Hybris caches
14
+ - **Catalog Sync**: Trigger catalog synchronization
15
+ - **Health Checks**: Monitor system health
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ git clone <repository-url>
21
+ cd hybris-mcp
22
+ npm install
23
+ npm run build
24
+ ```
25
+
26
+ ## Configuration
27
+
28
+ Configure via environment variables:
29
+
30
+ | Variable | Required | Description | Default |
31
+ |----------|----------|-------------|---------|
32
+ | `HYBRIS_BASE_URL` | **Yes** | Base URL of your Hybris instance | - |
33
+ | `HYBRIS_USERNAME` | **Yes** | Admin username (HAC access required) | - |
34
+ | `HYBRIS_PASSWORD` | **Yes** | Admin password | - |
35
+ | `HYBRIS_BASE_SITE_ID` | No | OCC base site ID | `electronics` |
36
+ | `HYBRIS_CATALOG_ID` | No | Product catalog ID | `electronicsProductCatalog` |
37
+ | `HYBRIS_CATALOG_VERSION` | No | Catalog version | `Online` |
38
+ | `HYBRIS_HAC_PATH` | No | HAC path prefix | `/hac` |
39
+
40
+ ### Common Configurations
41
+
42
+ **Standard Hybris (localhost):**
43
+ ```bash
44
+ HYBRIS_BASE_URL=https://localhost:9002
45
+ HYBRIS_USERNAME=admin
46
+ HYBRIS_PASSWORD=nimda
47
+ ```
48
+
49
+ **SAP Commerce Cloud (CCv2):**
50
+ ```bash
51
+ HYBRIS_BASE_URL=https://backoffice.your-environment.model-t.cc.commerce.ondemand.com
52
+ HYBRIS_USERNAME=admin
53
+ HYBRIS_PASSWORD=your-password
54
+ HYBRIS_HAC_PATH=/hac
55
+ ```
56
+
57
+ **Custom Site Configuration:**
58
+ ```bash
59
+ HYBRIS_BASE_URL=https://localhost:9002
60
+ HYBRIS_USERNAME=admin
61
+ HYBRIS_PASSWORD=nimda
62
+ HYBRIS_BASE_SITE_ID=yoursite
63
+ HYBRIS_CATALOG_ID=yourProductCatalog
64
+ HYBRIS_CATALOG_VERSION=Online
65
+ ```
66
+
67
+ ## Usage with Claude Code
68
+
69
+ Add the MCP server using the CLI:
70
+
71
+ ```bash
72
+ claude mcp add hybris \
73
+ -e HYBRIS_BASE_URL=https://localhost:9002 \
74
+ -e HYBRIS_USERNAME=admin \
75
+ -e HYBRIS_PASSWORD=nimda \
76
+ -- node /path/to/hybris-mcp/dist/index.js
77
+ ```
78
+
79
+ Or manually add to your Claude Code MCP settings (`~/.claude.json` or project config):
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "hybris": {
85
+ "type": "stdio",
86
+ "command": "node",
87
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
88
+ "env": {
89
+ "HYBRIS_BASE_URL": "https://localhost:9002",
90
+ "HYBRIS_USERNAME": "admin",
91
+ "HYBRIS_PASSWORD": "nimda"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ## Usage with Claude Desktop
99
+
100
+ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
101
+
102
+ ```json
103
+ {
104
+ "mcpServers": {
105
+ "hybris": {
106
+ "command": "node",
107
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
108
+ "env": {
109
+ "HYBRIS_BASE_URL": "https://localhost:9002",
110
+ "HYBRIS_USERNAME": "admin",
111
+ "HYBRIS_PASSWORD": "nimda"
112
+ }
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ ## Usage with Cursor
119
+
120
+ Add to your Cursor MCP configuration (`~/.cursor/mcp.json`):
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "hybris": {
126
+ "command": "node",
127
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
128
+ "env": {
129
+ "HYBRIS_BASE_URL": "https://localhost:9002",
130
+ "HYBRIS_USERNAME": "admin",
131
+ "HYBRIS_PASSWORD": "nimda"
132
+ }
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ ## Usage with Windsurf
139
+
140
+ Add to your Windsurf MCP configuration (`~/.codeium/windsurf/mcp_config.json`):
141
+
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "hybris": {
146
+ "command": "node",
147
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
148
+ "env": {
149
+ "HYBRIS_BASE_URL": "https://localhost:9002",
150
+ "HYBRIS_USERNAME": "admin",
151
+ "HYBRIS_PASSWORD": "nimda"
152
+ }
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ ## Usage with VS Code (Copilot/Continue/Cline)
159
+
160
+ For VS Code extensions that support MCP, add to your workspace `.vscode/mcp.json`:
161
+
162
+ ```json
163
+ {
164
+ "servers": {
165
+ "hybris": {
166
+ "command": "node",
167
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
168
+ "env": {
169
+ "HYBRIS_BASE_URL": "https://localhost:9002",
170
+ "HYBRIS_USERNAME": "admin",
171
+ "HYBRIS_PASSWORD": "nimda"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ ## Usage with Zed
179
+
180
+ Add to your Zed settings (`~/.config/zed/settings.json`):
181
+
182
+ ```json
183
+ {
184
+ "context_servers": {
185
+ "hybris": {
186
+ "command": {
187
+ "path": "node",
188
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
189
+ "env": {
190
+ "HYBRIS_BASE_URL": "https://localhost:9002",
191
+ "HYBRIS_USERNAME": "admin",
192
+ "HYBRIS_PASSWORD": "nimda"
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ ## Usage with JetBrains IDEs
201
+
202
+ For IntelliJ IDEA, WebStorm, PyCharm, and other JetBrains IDEs with AI Assistant, add to your MCP configuration:
203
+
204
+ **macOS/Linux:** `~/.config/JetBrains/mcp.json`
205
+ **Windows:** `%APPDATA%\JetBrains\mcp.json`
206
+
207
+ ```json
208
+ {
209
+ "mcpServers": {
210
+ "hybris": {
211
+ "command": "node",
212
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
213
+ "env": {
214
+ "HYBRIS_BASE_URL": "https://localhost:9002",
215
+ "HYBRIS_USERNAME": "admin",
216
+ "HYBRIS_PASSWORD": "nimda"
217
+ }
218
+ }
219
+ }
220
+ }
221
+ ```
222
+
223
+ ## Usage with Sourcegraph Cody
224
+
225
+ Add to your Cody MCP configuration (`~/.config/cody/mcp.json`):
226
+
227
+ ```json
228
+ {
229
+ "mcpServers": {
230
+ "hybris": {
231
+ "command": "node",
232
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
233
+ "env": {
234
+ "HYBRIS_BASE_URL": "https://localhost:9002",
235
+ "HYBRIS_USERNAME": "admin",
236
+ "HYBRIS_PASSWORD": "nimda"
237
+ }
238
+ }
239
+ }
240
+ }
241
+ ```
242
+
243
+ ## Usage with Raycast
244
+
245
+ Add to your Raycast AI extension MCP settings (`~/.config/raycast/mcp.json`):
246
+
247
+ ```json
248
+ {
249
+ "mcpServers": {
250
+ "hybris": {
251
+ "command": "node",
252
+ "args": ["/path/to/hybris-mcp/dist/index.js"],
253
+ "env": {
254
+ "HYBRIS_BASE_URL": "https://localhost:9002",
255
+ "HYBRIS_USERNAME": "admin",
256
+ "HYBRIS_PASSWORD": "nimda"
257
+ }
258
+ }
259
+ }
260
+ }
261
+ ```
262
+
263
+ ## Generic MCP Configuration
264
+
265
+ For any other MCP-compatible client, the server uses **stdio transport**. Run with:
266
+
267
+ ```bash
268
+ node /path/to/hybris-mcp/dist/index.js
269
+ ```
270
+
271
+ Required environment variables:
272
+ - `HYBRIS_BASE_URL`
273
+ - `HYBRIS_USERNAME`
274
+ - `HYBRIS_PASSWORD`
275
+
276
+ ## Available Tools
277
+
278
+ ### Administration (HAC) - Full Support
279
+
280
+ All HAC-based tools work reliably with Basic authentication:
281
+
282
+ | Tool | Description |
283
+ |------|-------------|
284
+ | `flexible_search` | Execute FlexibleSearch queries |
285
+ | `execute_groovy` | Run Groovy scripts |
286
+ | `import_impex` | Import ImpEx data |
287
+ | `export_impex` | Export data to ImpEx format |
288
+ | `get_cronjobs` | List cron jobs and their status |
289
+ | `trigger_cronjob` | Trigger a cron job to run |
290
+ | `clear_cache` | Clear Hybris caches |
291
+ | `get_system_info` | Get system information |
292
+ | `trigger_catalog_sync` | Sync catalog versions |
293
+
294
+ ### Product & Catalog (OCC API)
295
+
296
+ | Tool | Description | Notes |
297
+ |------|-------------|-------|
298
+ | `health_check` | Check system health | Always works |
299
+ | `get_product` | Get detailed product information by code | Works with Basic auth |
300
+ | `get_category` | Get category details by code | Works with Basic auth |
301
+ | `search_products` | Search for products in the catalog | Requires Solr indexing* |
302
+ | `get_categories` | List all categories in the catalog | Endpoint may not be exposed* |
303
+
304
+ ### Orders (OCC API)
305
+
306
+ | Tool | Description | Notes |
307
+ |------|-------------|-------|
308
+ | `get_orders` | Get orders for a user | Requires OAuth* |
309
+ | `get_order` | Get specific order details | Requires OAuth* |
310
+
311
+ *See [Known Limitations](#known-limitations) below.
312
+
313
+ ## Example Prompts
314
+
315
+ ### Search Products
316
+ ```
317
+ Search for "camera" products in Hybris
318
+ ```
319
+
320
+ ### FlexibleSearch
321
+ ```
322
+ Run a FlexibleSearch query: SELECT {pk}, {code}, {name[en]} FROM {Product} WHERE {code} LIKE '%camera%'
323
+ ```
324
+
325
+ ### Execute Groovy
326
+ ```
327
+ Execute this Groovy script to count products:
328
+ import de.hybris.platform.core.Registry
329
+ def ctx = Registry.getApplicationContext()
330
+ def flexibleSearchService = ctx.getBean("flexibleSearchService")
331
+ def query = "SELECT COUNT(*) FROM {Product}"
332
+ def result = flexibleSearchService.search(query)
333
+ println "Total products: ${result.result[0]}"
334
+ ```
335
+
336
+ ### Import ImpEx
337
+ ```
338
+ Import this ImpEx to create a product:
339
+ INSERT_UPDATE Product; code[unique=true]; name[lang=en]; catalogVersion(catalog(id),version)
340
+ ; testProduct001 ; Test Product ; electronicsProductCatalog:Online
341
+ ```
342
+
343
+ ### Trigger Catalog Sync
344
+ ```
345
+ Sync the electronics catalog from Staged to Online
346
+ ```
347
+
348
+ ## Known Limitations
349
+
350
+ ### OCC Order Endpoints Require OAuth
351
+
352
+ The `get_orders` and `get_order` tools require OAuth user authentication, not just Basic auth. These endpoints need a user-specific OAuth token obtained via the password grant flow:
353
+
354
+ ```bash
355
+ POST /authorizationserver/oauth/token
356
+ Content-Type: application/x-www-form-urlencoded
357
+
358
+ grant_type=password&username=user@example.com&password=secret&client_id=mobile_android&client_secret=secret
359
+ ```
360
+
361
+ **Workaround**: Use `flexible_search` to query orders directly:
362
+ ```sql
363
+ SELECT {pk}, {code}, {user}, {totalPrice} FROM {Order} WHERE {user} = ?user
364
+ ```
365
+
366
+ ### Product Search Requires Solr
367
+
368
+ The `search_products` tool uses the OCC search endpoint which requires Solr indexing. If your instance uses a different search provider (e.g., Algolia), this endpoint may return empty results.
369
+
370
+ **Workaround**: Use `flexible_search` to query products:
371
+ ```sql
372
+ SELECT {pk}, {code}, {name[en]} FROM {Product} WHERE {name[en]} LIKE '%search_term%'
373
+ ```
374
+
375
+ ### Categories Endpoint May Not Be Exposed
376
+
377
+ The `get_categories` tool uses an OCC endpoint that may not be exposed in all Hybris configurations.
378
+
379
+ **Workaround**: Use `flexible_search` to query categories:
380
+ ```sql
381
+ SELECT {pk}, {code}, {name[en]} FROM {Category} WHERE {catalogVersion} IN (
382
+ {{ SELECT {pk} FROM {CatalogVersion} WHERE {version} = 'Online' }}
383
+ )
384
+ ```
385
+
386
+ ## Security Notes
387
+
388
+ - Store credentials securely - never commit them to version control
389
+ - Use environment variables or secure secret management
390
+ - The server requires HAC admin access for administrative tools
391
+ - Consider using read-only credentials if you only need OCC API access
392
+
393
+ ## Security Considerations
394
+
395
+ This MCP server provides powerful administrative access to your Hybris instance:
396
+
397
+ - **FlexibleSearch**: Can query any data including sensitive tables (users, passwords, tokens)
398
+ - **Groovy Scripts**: Execute arbitrary code with full system access (file system, network, processes)
399
+ - **ImpEx**: Can modify any data in the system including user accounts and permissions
400
+
401
+ **Recommendations:**
402
+ 1. Use dedicated service accounts with minimal required permissions
403
+ 2. Enable audit logging on your Hybris instance to track all operations
404
+ 3. Never expose the MCP server to untrusted networks or users
405
+ 4. Review all Groovy scripts before execution in production environments
406
+ 5. Consider network segmentation to restrict access to HAC endpoints
407
+
408
+ ## Development
409
+
410
+ ```bash
411
+ # Watch mode for development
412
+ npm run dev
413
+
414
+ # Build
415
+ npm run build
416
+
417
+ # Run directly
418
+ HYBRIS_BASE_URL=https://localhost:9002 \
419
+ HYBRIS_USERNAME=admin \
420
+ HYBRIS_PASSWORD=nimda \
421
+ npm start
422
+ ```
423
+
424
+ ## Troubleshooting
425
+
426
+ ### Connection Issues
427
+
428
+ 1. Verify your Hybris instance is running and accessible
429
+ 2. Check if HAC is enabled and accessible at the configured path
430
+ 3. Ensure credentials have admin access to HAC
431
+
432
+ ### SSL Certificate Errors
433
+
434
+ For local development with self-signed certificates:
435
+ ```bash
436
+ NODE_TLS_REJECT_UNAUTHORIZED=0 node dist/index.js
437
+ ```
438
+
439
+ > **WARNING:** Never use `NODE_TLS_REJECT_UNAUTHORIZED=0` in production environments. This disables TLS certificate validation and exposes you to man-in-the-middle attacks. For production, configure proper SSL certificates.
440
+
441
+ ### CSRF Token Errors
442
+
443
+ The server handles CSRF tokens automatically. If you see CSRF errors:
444
+ 1. Check that HAC login is working manually
445
+ 2. Verify the HAC path is correct
446
+ 3. Try restarting the MCP server to get a fresh session
447
+
448
+ ## License
449
+
450
+ MIT