@storelayer/mcp-server 0.2.0 → 0.2.1
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/SKILL.md +4 -6
- package/dist/index.js +2 -2
- package/package.json +25 -25
package/SKILL.md
CHANGED
|
@@ -74,7 +74,6 @@ All tools are dynamically loaded from the Store Layer API. Tool names use unders
|
|
|
74
74
|
| `promotions_get_aggregate_stats` | Aggregate stats across all promotions |
|
|
75
75
|
| `promotions_create` | Create a promotion |
|
|
76
76
|
| `promotions_create_coupon` | Create a coupon for a promotion |
|
|
77
|
-
| `promotions_record_usage` | Record a redemption |
|
|
78
77
|
| `promotions_evaluate_cart` | **Evaluate a cart against active promotions** |
|
|
79
78
|
|
|
80
79
|
### Support (`support`)
|
|
@@ -211,7 +210,7 @@ Use `promotions_evaluate_cart` with:
|
|
|
211
210
|
}
|
|
212
211
|
```
|
|
213
212
|
|
|
214
|
-
Response includes: `summary` (originalTotal, totalDiscount, finalTotal), `items` (per-item discounts), `
|
|
213
|
+
Response includes: `summary` (originalTotal, totalDiscount, finalTotal, appliedCount), `items` (per-item discounts), `applied` (matched promotions with discounts), `notApplied` (unmatched promotions with reasons, human-readable messages, and suggestions), `discounts` (flat discount list), `warnings`, and `usageRecords` (when not dry run).
|
|
215
214
|
|
|
216
215
|
---
|
|
217
216
|
|
|
@@ -230,7 +229,6 @@ Rules trigger when events are ingested. Each rule has conditions (evaluated agai
|
|
|
230
229
|
```json
|
|
231
230
|
{
|
|
232
231
|
"name": "Dollar-to-Points",
|
|
233
|
-
"eventType": "purchase",
|
|
234
232
|
"conditions": {
|
|
235
233
|
"conditions": [{ "leftValue": "{{ event.type }}", "operator": "equals", "rightValue": "purchase", "rightType": "string" }],
|
|
236
234
|
"combinator": "AND"
|
|
@@ -245,7 +243,7 @@ Rules trigger when events are ingested. Each rule has conditions (evaluated agai
|
|
|
245
243
|
|
|
246
244
|
Events are sent externally via `POST /api/ingest/events` with an API key. The MCP server can read events but not ingest them directly.
|
|
247
245
|
|
|
248
|
-
**Processing flow:** Event stored → queued →
|
|
246
|
+
**Processing flow:** Event stored → queued → resources resolved → conditions evaluated → actions executed → event marked processed.
|
|
249
247
|
|
|
250
248
|
**Event payload example:**
|
|
251
249
|
```json
|
|
@@ -260,7 +258,7 @@ Resources provide runtime context for rule evaluation. Types:
|
|
|
260
258
|
- **event** — incoming event data
|
|
261
259
|
- **http** — external REST API call
|
|
262
260
|
- **database** — PostgreSQL query via integration
|
|
263
|
-
- **internal** —
|
|
261
|
+
- **internal** — Store Layer entity data (users, wallets, transactions via registry tools)
|
|
264
262
|
- **payload** — request body data
|
|
265
263
|
|
|
266
264
|
Resources are resolved before rule evaluation. Their data is accessible in condition expressions.
|
|
@@ -273,4 +271,4 @@ Resources are resolved before rule evaluation. Their data is accessible in condi
|
|
|
273
271
|
2. **Test before activating** — create promotions in `draft` status, use `promotions_evaluate_cart` to test with sample carts, then set to `active`.
|
|
274
272
|
3. **Use `project_test_conditions`** to validate rule conditions against sample data before saving.
|
|
275
273
|
4. **For destructive actions** (delete, debit), always confirm with the user first.
|
|
276
|
-
5. **Cart evaluation** returns detailed match info — check `
|
|
274
|
+
5. **Cart evaluation** returns detailed match info — check `applied` for matched promotions with discounts, `notApplied` for unmatched promotions with reasons/suggestions, and `warnings` for coupon validation issues.
|
package/dist/index.js
CHANGED
|
@@ -13678,7 +13678,7 @@ function apiHeaders() {
|
|
|
13678
13678
|
};
|
|
13679
13679
|
}
|
|
13680
13680
|
async function fetchToolManifest() {
|
|
13681
|
-
const url = `${API_URL}/
|
|
13681
|
+
const url = `${API_URL}/projects/${PROJECT_ID}/internal-tools`;
|
|
13682
13682
|
const res = await fetch(url, { headers: apiHeaders() });
|
|
13683
13683
|
if (!res.ok) {
|
|
13684
13684
|
const body = await res.text().catch(() => "");
|
|
@@ -13688,7 +13688,7 @@ async function fetchToolManifest() {
|
|
|
13688
13688
|
return json.data.tools;
|
|
13689
13689
|
}
|
|
13690
13690
|
async function executeTool(toolName, params, userId) {
|
|
13691
|
-
const url = `${API_URL}/
|
|
13691
|
+
const url = `${API_URL}/projects/${PROJECT_ID}/internal-tools/${toolName}/execute`;
|
|
13692
13692
|
const body = { params };
|
|
13693
13693
|
if (userId)
|
|
13694
13694
|
body.userId = userId;
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
"name": "@storelayer/mcp-server",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "MCP server for Store Layer — manage loyalty programs, promotions, wallets, and more from Claude Desktop, Claude Code, or Cursor.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"store-layer-mcp-server": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"SKILL.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "bun build src/index.ts --target=node --outdir=dist --format=esm",
|
|
15
|
+
"dev": "bun run src/index.ts",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"prepublishOnly": "bun run build",
|
|
18
|
+
"publish:npm": "bun run build && npm publish --access public"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.12.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^22.0.0",
|
|
25
|
+
"typescript": "^5.7.0"
|
|
26
|
+
}
|
|
27
27
|
}
|