@commercetools/commerce-mcp 1.0.7 → 3.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.
Files changed (3) hide show
  1. package/LICENSE +17 -8
  2. package/dist/index.js +12 -149
  3. package/package.json +5 -4
package/LICENSE CHANGED
@@ -1,12 +1,21 @@
1
- License and Scope of Use for Commerce MCP
1
+ MIT License
2
2
 
3
- Commerce MCP is provided under a dual-tier usage model based on the highly permissive MIT License with specific limitations on commercial use.
3
+ Copyright (c) 2025 commercetools GmbH
4
4
 
5
- Permitted Use
6
- Access to and use of Commerce MCP is governed by the following terms:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
7
11
 
8
- - Non-Commercial Use (No Charge): The use of Commerce MCP is permitted for development, evaluation, and testing purposes at no charge. This non-commercial use is subject to a hard cap of 1,000,000 (one million) total tool invocations.
9
- - Commercial/Production Use (Required License): Any use of Commerce MCP in a production environment or for any other commercial purpose requires a paid license or subscription.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
10
14
 
11
- License Enforcement
12
- While the underlying code adheres to the principles of the MIT License, the terms above constitute the binding agreement for utilizing Commerce MCP. commercetools reserves the right to review how customers are using Commerce MCP and to restrict or terminate access for unlicensed production use or for any non-commercial use that exceeds the stated 1,000,000 invocation limit.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ACCEPTED_TOOLS = void 0;
4
+ exports.resolveToolsForConfiguration = exports.applyResolvedToolsToConfiguration = exports.ACCEPTED_TOOLS = void 0;
5
5
  exports.parseArgs = parseArgs;
6
6
  exports.main = main;
7
7
  const modelcontextprotocol_1 = require("@commercetools/commerce-agent/modelcontextprotocol");
8
- const modelcontextprotocol_2 = require("@commercetools/commerce-agent/modelcontextprotocol");
8
+ const processors_1 = require("@commercetools/processors");
9
9
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
10
10
  const colors_1 = require("colors");
11
11
  const HIDDEN_ARGS = ['customerId', 'isAdmin', 'storeKey', 'businessUnitKey'];
@@ -22,111 +22,10 @@ const PUBLIC_ARGS = [
22
22
  'toolOutputFormat',
23
23
  ];
24
24
  const ACCEPTED_ARGS = [...PUBLIC_ARGS, ...HIDDEN_ARGS];
25
- exports.ACCEPTED_TOOLS = [
26
- 'business-unit.read',
27
- 'business-unit.create',
28
- 'business-unit.update',
29
- 'products.read',
30
- 'products.create',
31
- 'products.update',
32
- 'project.read',
33
- 'product-search.read',
34
- 'category.read',
35
- 'category.create',
36
- 'category.update',
37
- 'channel.read',
38
- 'channel.create',
39
- 'channel.update',
40
- 'product-selection.read',
41
- 'product-selection.create',
42
- 'product-selection.update',
43
- 'order.read',
44
- 'order.create',
45
- 'order.update',
46
- 'cart.read',
47
- 'cart.create',
48
- 'cart.update',
49
- 'customer.create',
50
- 'customer.read',
51
- 'customer.update',
52
- 'customer-group.read',
53
- 'customer-group.create',
54
- 'customer-group.update',
55
- 'quote.read',
56
- 'quote.create',
57
- 'quote.update',
58
- 'quote-request.read',
59
- 'quote-request.create',
60
- 'quote-request.update',
61
- 'staged-quote.read',
62
- 'staged-quote.create',
63
- 'staged-quote.update',
64
- 'standalone-price.read',
65
- 'standalone-price.create',
66
- 'standalone-price.update',
67
- 'product-discount.read',
68
- 'product-discount.create',
69
- 'product-discount.update',
70
- 'cart-discount.read',
71
- 'cart-discount.create',
72
- 'cart-discount.update',
73
- 'discount-code.read',
74
- 'discount-code.create',
75
- 'discount-code.update',
76
- 'product-type.read',
77
- 'product-type.create',
78
- 'product-type.update',
79
- 'bulk.create',
80
- 'bulk.update',
81
- 'inventory.read',
82
- 'inventory.create',
83
- 'inventory.update',
84
- 'store.read',
85
- 'store.create',
86
- 'store.update',
87
- 'review.read',
88
- 'review.create',
89
- 'review.update',
90
- 'tax-category.read',
91
- 'tax-category.create',
92
- 'tax-category.update',
93
- 'shipping-methods.read',
94
- 'shipping-methods.create',
95
- 'shipping-methods.update',
96
- 'payments.read',
97
- 'payments.create',
98
- 'payments.update',
99
- 'zone.read',
100
- 'zone.create',
101
- 'zone.update',
102
- 'product-tailoring.read',
103
- 'product-tailoring.create',
104
- 'product-tailoring.update',
105
- 'payment-methods.read',
106
- 'payment-methods.create',
107
- 'payment-methods.update',
108
- 'recurring-orders.read',
109
- 'recurring-orders.create',
110
- 'recurring-orders.update',
111
- 'shopping-lists.read',
112
- 'shopping-lists.create',
113
- 'shopping-lists.update',
114
- 'extensions.read',
115
- 'extensions.create',
116
- 'extensions.update',
117
- 'subscriptions.read',
118
- 'subscriptions.create',
119
- 'subscriptions.update',
120
- 'custom-objects.read',
121
- 'custom-objects.create',
122
- 'custom-objects.update',
123
- 'types.read',
124
- 'types.create',
125
- 'types.update',
126
- 'payment-intents.update',
127
- 'transactions.read',
128
- 'transactions.create',
129
- ];
25
+ var modelcontextprotocol_2 = require("@commercetools/commerce-agent/modelcontextprotocol");
26
+ Object.defineProperty(exports, "ACCEPTED_TOOLS", { enumerable: true, get: function () { return modelcontextprotocol_2.ACCEPTED_TOOLS; } });
27
+ Object.defineProperty(exports, "applyResolvedToolsToConfiguration", { enumerable: true, get: function () { return modelcontextprotocol_2.applyResolvedToolsToConfiguration; } });
28
+ Object.defineProperty(exports, "resolveToolsForConfiguration", { enumerable: true, get: function () { return modelcontextprotocol_2.resolveToolsForConfiguration; } });
130
29
  function parseArgs(args) {
131
30
  const options = {};
132
31
  const env = {};
@@ -134,7 +33,7 @@ function parseArgs(args) {
134
33
  if (arg.startsWith('--')) {
135
34
  const [key, value] = arg.slice(2).split('=');
136
35
  if (key == 'tools') {
137
- options.tools = value.split(',');
36
+ options.tools = value.replace(/\s+/g, '').split(',');
138
37
  }
139
38
  else if (key == 'authType') {
140
39
  env.authType = value;
@@ -212,8 +111,8 @@ function parseArgs(args) {
212
111
  if (tool == 'all' || tool == 'all.read') {
213
112
  return;
214
113
  }
215
- if (!exports.ACCEPTED_TOOLS.includes(tool.trim())) {
216
- throw new Error(`Invalid tool: ${tool}. Accepted tools are: ${exports.ACCEPTED_TOOLS.join(', ')}`);
114
+ if (!modelcontextprotocol_1.ACCEPTED_TOOLS.includes(tool.trim())) {
115
+ throw new Error(`Invalid tool: ${tool}. Accepted tools are: ${modelcontextprotocol_1.ACCEPTED_TOOLS.join(', ')}`);
217
116
  }
218
117
  });
219
118
  // Check for commercetools env vars
@@ -383,48 +282,12 @@ async function main() {
383
282
  businessUnitKey: options.businessUnitKey,
384
283
  logging: options.logging,
385
284
  fieldFiltering: options.fieldFiltering
386
- ? new modelcontextprotocol_2.FieldFilteringHandler(options.fieldFiltering)
285
+ ? new processors_1.FieldFilteringHandler(options.fieldFiltering)
387
286
  : undefined,
388
287
  },
389
288
  };
390
- if (selectedTools[0] === 'all') {
391
- exports.ACCEPTED_TOOLS.forEach((tool) => {
392
- if (!configuration.actions) {
393
- configuration.actions = {};
394
- }
395
- const [namespace, action] = tool.split('.');
396
- configuration.actions[namespace] = {
397
- ...configuration.actions[namespace],
398
- [action]: true,
399
- };
400
- });
401
- }
402
- else if (selectedTools[0] === 'all.read') {
403
- exports.ACCEPTED_TOOLS.forEach((tool) => {
404
- if (!configuration.actions) {
405
- configuration.actions = {};
406
- }
407
- const [namespace, action] = tool.split('.');
408
- if (action === 'read') {
409
- configuration.actions[namespace] = {
410
- ...configuration.actions[namespace],
411
- [action]: true,
412
- };
413
- }
414
- });
415
- }
416
- else {
417
- selectedTools.forEach((tool) => {
418
- if (!configuration.actions) {
419
- configuration.actions = {};
420
- }
421
- const [namespace, action] = tool.split('.');
422
- configuration.actions[namespace] = {
423
- ...(configuration.actions[namespace] || {}),
424
- [action]: true,
425
- };
426
- });
427
- }
289
+ const resolution = (0, modelcontextprotocol_1.resolveToolsForConfiguration)(selectedTools, Boolean(options.isAdmin));
290
+ (0, modelcontextprotocol_1.applyResolvedToolsToConfiguration)(configuration, resolution);
428
291
  const authConfig = createAuthConfig(env);
429
292
  // eslint-disable-next-line require-await
430
293
  async function getServer() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/commerce-mcp",
3
- "version": "1.0.7",
3
+ "version": "3.0.0",
4
4
  "mcpName": "io.github.commercetools/commerce-mcp",
5
5
  "homepage": "https://github.com/commercetools/commerce-mcp",
6
6
  "description": "A command line tool for setting up commercetools MCP server",
@@ -19,11 +19,12 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@modelcontextprotocol/sdk": "^1.24.0",
22
+ "@modelcontextprotocol/sdk": "^1.26.0",
23
23
  "colors": "^1.4.0",
24
24
  "dotenv": "^17.2.1",
25
25
  "mcp-remote": "^0.1.18",
26
- "@commercetools/commerce-agent": "1.1.0"
26
+ "@commercetools/commerce-agent": "3.0.0",
27
+ "@commercetools/processors": "0.0.0"
27
28
  },
28
29
  "keywords": [
29
30
  "mcp",
@@ -55,7 +56,7 @@
55
56
  },
56
57
  "scripts": {
57
58
  "preinstall": "npx only-allow pnpm",
58
- "prebuild": "pnpm --filter @commercetools/commerce-agent run build",
59
+ "prebuild": "pnpm --filter @commercetools/processors run build && pnpm --filter @commercetools/commerce-agent run build",
59
60
  "dev": "concurrently -n BUILD,SERVER -c magenta,cyan \"pnpm dev:build\" \"pnpm dev:run\"",
60
61
  "dev:build": "tsup --env.NODE_ENV dev",
61
62
  "dev:run": "nodemon dist/index.js --watch",