@unchainedshop/api 5.0.0-alpha.2 → 5.0.0-alpha.3
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/README.md +6 -4
- package/lib/adminUiPlugins.d.ts +73 -0
- package/lib/adminUiPlugins.js +164 -0
- package/lib/adminUiTheme.d.ts +25 -0
- package/lib/adminUiTheme.js +34 -0
- package/lib/chat/generateImageHandler.d.ts +273 -7
- package/lib/chat/utils.d.ts +8 -0
- package/lib/chat/utils.js +54 -2
- package/lib/createGraphQLServer.js +6 -0
- package/lib/express/chatHandler.js +52 -61
- package/lib/express/createMCPMiddleware.js +19 -78
- package/lib/express/index.d.ts +8 -2
- package/lib/express/index.js +55 -7
- package/lib/fastify/chatHandler.js +52 -61
- package/lib/fastify/index.d.ts +7 -1
- package/lib/fastify/index.js +58 -11
- package/lib/fastify/mcpHandler.js +24 -75
- package/lib/loaders/cartLoader.d.ts +13 -0
- package/lib/loaders/cartLoader.js +8 -0
- package/lib/loaders/index.d.ts +9 -0
- package/lib/loaders/index.js +2 -0
- package/lib/locale-context.d.ts +2 -4
- package/lib/locale-context.js +2 -1
- package/lib/mcp/handleMcpHttpRequest.d.ts +2 -0
- package/lib/mcp/handleMcpHttpRequest.js +83 -0
- package/lib/mcp/index.d.ts +1 -1
- package/lib/mcp/nodeHttpBridge.d.ts +3 -0
- package/lib/mcp/nodeHttpBridge.js +64 -0
- package/lib/mcp/resources/localization.d.ts +5 -1
- package/lib/mcp/resources/localization.js +93 -69
- package/lib/mcp/tools/assortment/index.d.ts +1 -1
- package/lib/mcp/tools/assortment/index.js +4 -1
- package/lib/mcp/tools/assortment/schemas.d.ts +2 -2
- package/lib/mcp/tools/filter/handlers/createFilter.js +2 -4
- package/lib/mcp/tools/filter/handlers/createFilterOption.js +2 -4
- package/lib/mcp/tools/filter/handlers/removeFilterOption.js +2 -4
- package/lib/mcp/tools/filter/handlers/updateFilter.js +2 -2
- package/lib/mcp/tools/filter/index.d.ts +1 -1
- package/lib/mcp/tools/filter/index.js +4 -1
- package/lib/mcp/tools/filter/schemas.d.ts +2 -2
- package/lib/mcp/tools/localization/index.d.ts +1 -1
- package/lib/mcp/tools/localization/index.js +4 -1
- package/lib/mcp/tools/localization/schemas.d.ts +2 -2
- package/lib/mcp/tools/order/index.d.ts +1 -1
- package/lib/mcp/tools/order/index.js +4 -1
- package/lib/mcp/tools/order/schemas.d.ts +2 -2
- package/lib/mcp/tools/product/index.d.ts +1 -1
- package/lib/mcp/tools/product/index.js +4 -1
- package/lib/mcp/tools/product/schemas.d.ts +7 -7
- package/lib/mcp/tools/product/schemas.js +3 -2
- package/lib/mcp/tools/provider/index.d.ts +1 -1
- package/lib/mcp/tools/provider/index.js +4 -1
- package/lib/mcp/tools/provider/schemas.d.ts +2 -2
- package/lib/mcp/tools/quotation/index.d.ts +1 -1
- package/lib/mcp/tools/quotation/index.js +4 -1
- package/lib/mcp/tools/quotation/schemas.d.ts +2 -2
- package/lib/mcp/tools/system/index.d.ts +1 -1
- package/lib/mcp/tools/system/index.js +4 -1
- package/lib/mcp/tools/users/index.d.ts +1 -1
- package/lib/mcp/tools/users/index.js +4 -1
- package/lib/mcp/tools/users/schemas.d.ts +2 -2
- package/lib/mcp/utils/sharedSchemas.d.ts +1 -0
- package/lib/mcp/utils/sharedSchemas.js +1 -0
- package/lib/resolvers/index.js +2 -1
- package/lib/resolvers/mutations/bookmarks/createBookmark.d.ts +1 -1
- package/lib/resolvers/mutations/bookmarks/createBookmark.js +4 -3
- package/lib/resolvers/mutations/filters/createFilter.js +3 -4
- package/lib/resolvers/mutations/filters/createFilterOption.d.ts +1 -1
- package/lib/resolvers/mutations/filters/createFilterOption.js +3 -4
- package/lib/resolvers/mutations/filters/removeFilterOption.d.ts +1 -1
- package/lib/resolvers/mutations/filters/removeFilterOption.js +2 -8
- package/lib/resolvers/mutations/filters/updateFilter.d.ts +1 -1
- package/lib/resolvers/mutations/filters/updateFilter.js +2 -5
- package/lib/resolvers/mutations/index.js +3 -3
- package/lib/resolvers/mutations/products/updateProductCommerce.js +10 -1
- package/lib/resolvers/scalars/LowerCaseString.d.ts +1 -1
- package/lib/resolvers/scalars/index.d.ts +1 -1
- package/lib/resolvers/type/filter/loaded-filter-types.d.ts +1 -1
- package/lib/resolvers/type/filter/loaded-filter-types.js +1 -1
- package/lib/resolvers/type/index.d.ts +9 -5
- package/lib/resolvers/type/product/product-bundle-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts +1 -1
- package/lib/resolvers/type/quotation-types.d.ts +4 -0
- package/lib/resolvers/type/quotation-types.js +1 -0
- package/lib/resolvers/type/user-types.js +2 -2
- package/lib/roles/index.js +2 -0
- package/lib/roles/loggedIn.js +11 -0
- package/lib/schema/inputTypes.js +3 -3
- package/lib/schema/scalars.js +1 -0
- package/lib/schema/types/filter.js +2 -2
- package/lib/schema/types/product/product.js +1 -1
- package/lib/schema/types/quotation.js +5 -0
- package/lib/utils/optionalPeerError.d.ts +1 -0
- package/lib/utils/optionalPeerError.js +6 -0
- package/package.json +37 -13
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../context.ts';
|
|
3
|
+
export declare function getShopLanguagesText(context: Context): Promise<string>;
|
|
4
|
+
export declare function getShopCurrenciesText(context: Context): Promise<string>;
|
|
5
|
+
export declare function getShopCountriesText(context: Context): Promise<string>;
|
|
6
|
+
export declare function buildChatResourceContext(context: Context | undefined): Promise<string>;
|
|
3
7
|
export declare const registerLocalizationResources: (server: McpServer, context: Context) => void;
|
|
@@ -1,77 +1,101 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
const logger = createLogger('unchained:api:mcp');
|
|
3
|
+
export async function getShopLanguagesText(context) {
|
|
4
|
+
const [languages, countries] = await Promise.all([
|
|
5
|
+
context.modules.languages.findLanguages({ includeInactive: false }),
|
|
6
|
+
context.modules.countries.findCountries({ includeInactive: false }),
|
|
7
|
+
]);
|
|
8
|
+
const baseLanguageCodes = languages.map((l) => l.isoCode.toLowerCase());
|
|
9
|
+
const availableCountryCodes = countries.map((c) => c.isoCode.toUpperCase());
|
|
10
|
+
return JSON.stringify({
|
|
11
|
+
baseLanguages: languages.map((l) => ({
|
|
12
|
+
isoCode: l.isoCode,
|
|
13
|
+
name: l.isoCode,
|
|
14
|
+
isActive: l.isActive,
|
|
15
|
+
})),
|
|
16
|
+
availableCountries: availableCountryCodes,
|
|
17
|
+
localeFormat: 'Use base language codes (e.g., "en", "fr", "de") or language-country combinations (e.g., "en-US", "fr-CH") following BCP 47 format',
|
|
18
|
+
validationRule: `Any combination of base languages [${baseLanguageCodes.join(', ')}] with available countries [${availableCountryCodes.join(', ')}] is acceptable for locale codes, as long as it makes contextual sense (e.g., "en-US" , "de-CH" , but "ja-DE" would be unusual)`,
|
|
19
|
+
note: 'If a required base language is missing, ask the user if they want to add it using localization_management tool with action: CREATE',
|
|
20
|
+
}, null, 2);
|
|
21
|
+
}
|
|
22
|
+
export async function getShopCurrenciesText(context) {
|
|
23
|
+
const currencies = await context.modules.currencies.findCurrencies({ includeInactive: false });
|
|
24
|
+
return JSON.stringify({
|
|
25
|
+
currencies: currencies.map((c) => ({
|
|
26
|
+
isoCode: c.isoCode,
|
|
27
|
+
name: c.isoCode,
|
|
28
|
+
isActive: c.isActive,
|
|
29
|
+
decimals: c.decimals,
|
|
30
|
+
})),
|
|
31
|
+
note: 'If a required currency is missing, ask the user if they want to add it using localization_management tool with action: CREATE',
|
|
32
|
+
}, null, 2);
|
|
33
|
+
}
|
|
34
|
+
export async function getShopCountriesText(context) {
|
|
35
|
+
const countries = await context.modules.countries.findCountries({ includeInactive: false });
|
|
36
|
+
return JSON.stringify({
|
|
37
|
+
countries: countries.map((c) => ({
|
|
38
|
+
isoCode: c.isoCode,
|
|
39
|
+
name: c.isoCode,
|
|
40
|
+
isActive: c.isActive,
|
|
41
|
+
})),
|
|
42
|
+
note: 'If a required country is missing, ask the user if they want to add it using localization_management tool with action: CREATE',
|
|
43
|
+
}, null, 2);
|
|
44
|
+
}
|
|
45
|
+
export async function buildChatResourceContext(context) {
|
|
46
|
+
if (!context?.user?.roles?.includes('admin'))
|
|
47
|
+
return '';
|
|
48
|
+
const sections = await Promise.all([
|
|
49
|
+
['shop-languages', getShopLanguagesText],
|
|
50
|
+
['shop-currencies', getShopCurrenciesText],
|
|
51
|
+
['shop-countries', getShopCountriesText],
|
|
52
|
+
].map(async ([name, getText]) => {
|
|
53
|
+
try {
|
|
54
|
+
return `${name}:\n${await getText(context)}`;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
logger.error(`Failed to read resource ${name}: ${error.message}`);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
const body = sections.filter(Boolean).join('\n\n');
|
|
62
|
+
return body ? `\n\nAVAILABLE SHOP CONFIGURATION:\n${body}` : '';
|
|
63
|
+
}
|
|
1
64
|
export const registerLocalizationResources = (server, context) => {
|
|
2
|
-
server.
|
|
65
|
+
server.registerResource('shop-languages', 'unchained://shop/languages', {
|
|
3
66
|
description: 'Available languages configured in the shop. Use these ISO codes when creating or updating products, filters, and assortments. Includes valid language-country dialect combinations.',
|
|
4
67
|
mimeType: 'application/json',
|
|
5
|
-
}, async () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
uri: 'unchained://shop/languages',
|
|
16
|
-
mimeType: 'application/json',
|
|
17
|
-
text: JSON.stringify({
|
|
18
|
-
baseLanguages: languages.map((l) => ({
|
|
19
|
-
isoCode: l.isoCode,
|
|
20
|
-
name: l.isoCode,
|
|
21
|
-
isActive: l.isActive,
|
|
22
|
-
})),
|
|
23
|
-
availableCountries: availableCountryCodes,
|
|
24
|
-
localeFormat: 'Use base language codes (e.g., "en", "fr", "de") or language-country combinations (e.g., "en-US", "fr-CH") following BCP 47 format',
|
|
25
|
-
validationRule: `Any combination of base languages [${baseLanguageCodes.join(', ')}] with available countries [${availableCountryCodes.join(', ')}] is acceptable for locale codes, as long as it makes contextual sense (e.g., "en-US" , "de-CH" , but "ja-DE" would be unusual)`,
|
|
26
|
-
note: 'If a required base language is missing, ask the user if they want to add it using localization_management tool with action: CREATE',
|
|
27
|
-
}, null, 2),
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
server.resource('shop-currencies', 'unchained://shop/currencies', {
|
|
68
|
+
}, async () => ({
|
|
69
|
+
contents: [
|
|
70
|
+
{
|
|
71
|
+
uri: 'unchained://shop/languages',
|
|
72
|
+
mimeType: 'application/json',
|
|
73
|
+
text: await getShopLanguagesText(context),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
}));
|
|
77
|
+
server.registerResource('shop-currencies', 'unchained://shop/currencies', {
|
|
33
78
|
description: 'Available currencies configured in the shop. Check decimal points for price conversions. All prices are stored as integers.',
|
|
34
79
|
mimeType: 'application/json',
|
|
35
|
-
}, async () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
name: c.isoCode,
|
|
46
|
-
isActive: c.isActive,
|
|
47
|
-
decimals: c.decimals,
|
|
48
|
-
})),
|
|
49
|
-
note: 'If a required currency is missing, ask the user if they want to add it using localization_management tool with action: CREATE',
|
|
50
|
-
}, null, 2),
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
server.resource('shop-countries', 'unchained://shop/countries', {
|
|
80
|
+
}, async () => ({
|
|
81
|
+
contents: [
|
|
82
|
+
{
|
|
83
|
+
uri: 'unchained://shop/currencies',
|
|
84
|
+
mimeType: 'application/json',
|
|
85
|
+
text: await getShopCurrenciesText(context),
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
}));
|
|
89
|
+
server.registerResource('shop-countries', 'unchained://shop/countries', {
|
|
56
90
|
description: 'Available countries configured in the shop. Use these ISO codes for geographic operations.',
|
|
57
91
|
mimeType: 'application/json',
|
|
58
|
-
}, async () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isoCode: c.isoCode,
|
|
68
|
-
name: c.isoCode,
|
|
69
|
-
isActive: c.isActive,
|
|
70
|
-
})),
|
|
71
|
-
note: 'If a required country is missing, ask the user if they want to add it using localization_management tool with action: CREATE',
|
|
72
|
-
}, null, 2),
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
};
|
|
76
|
-
});
|
|
92
|
+
}, async () => ({
|
|
93
|
+
contents: [
|
|
94
|
+
{
|
|
95
|
+
uri: 'unchained://shop/countries',
|
|
96
|
+
mimeType: 'application/json',
|
|
97
|
+
text: await getShopCountriesText(context),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
}));
|
|
77
101
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerAssortmentTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { assortmentManagement, AssortmentManagementSchema } from "./assortmentManagement.js";
|
|
2
2
|
export const registerAssortmentTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('assortment_management', {
|
|
4
|
+
description: 'Unified assortment management system with comprehensive action-based operations: CREATE/UPDATE/REMOVE/GET/LIST/COUNT assortments, UPDATE_STATUS (activate/deactivate), ADD_MEDIA/REMOVE_MEDIA/REORDER_MEDIA/GET_MEDIA/UPDATE_MEDIA_TEXTS, ADD_PRODUCT/REMOVE_PRODUCT/GET_PRODUCTS/REORDER_PRODUCTS, ADD_FILTER/REMOVE_FILTER/GET_FILTERS/REORDER_FILTERS, ADD_LINK/REMOVE_LINK/GET_LINKS/REORDER_LINKS, GET_CHILDREN/SET_BASE, SEARCH_PRODUCTS, GET_TEXTS/GET_MEDIA_TEXTS. Supports comprehensive assortment management with type-specific validations and error handling.',
|
|
5
|
+
inputSchema: AssortmentManagementSchema,
|
|
6
|
+
}, async (params) => assortmentManagement(context, params));
|
|
4
7
|
};
|
|
@@ -193,11 +193,11 @@ export declare const AssortmentManagementSchema: {
|
|
|
193
193
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
194
194
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
195
195
|
action: z.ZodEnum<{
|
|
196
|
+
LIST: "LIST";
|
|
196
197
|
GET: "GET";
|
|
197
198
|
CREATE: "CREATE";
|
|
198
199
|
UPDATE: "UPDATE";
|
|
199
200
|
REMOVE: "REMOVE";
|
|
200
|
-
LIST: "LIST";
|
|
201
201
|
COUNT: "COUNT";
|
|
202
202
|
GET_TEXTS: "GET_TEXTS";
|
|
203
203
|
UPDATE_STATUS: "UPDATE_STATUS";
|
|
@@ -285,11 +285,11 @@ export declare const AssortmentManagementZodSchema: z.ZodObject<{
|
|
|
285
285
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
286
286
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
287
287
|
action: z.ZodEnum<{
|
|
288
|
+
LIST: "LIST";
|
|
288
289
|
GET: "GET";
|
|
289
290
|
CREATE: "CREATE";
|
|
290
291
|
UPDATE: "UPDATE";
|
|
291
292
|
REMOVE: "REMOVE";
|
|
292
|
-
LIST: "LIST";
|
|
293
293
|
COUNT: "COUNT";
|
|
294
294
|
GET_TEXTS: "GET_TEXTS";
|
|
295
295
|
UPDATE_STATUS: "UPDATE_STATUS";
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { FilterDirector } from '@unchainedshop/core';
|
|
2
1
|
import { getNormalizedFilterDetails } from "../../../utils/getNormalizedFilterDetails.js";
|
|
3
2
|
export default async function createFilter(context, params) {
|
|
4
|
-
const { modules } = context;
|
|
3
|
+
const { modules, services } = context;
|
|
5
4
|
const { filter, texts } = params;
|
|
6
5
|
const { key, type, options = [] } = filter;
|
|
7
|
-
const newFilter = await
|
|
6
|
+
const newFilter = await services.filters.createFilter({
|
|
8
7
|
key,
|
|
9
8
|
type,
|
|
10
9
|
options,
|
|
11
10
|
isActive: true,
|
|
12
11
|
});
|
|
13
|
-
await FilterDirector.invalidateProductIdCache(newFilter, context);
|
|
14
12
|
if (texts && texts.length > 0) {
|
|
15
13
|
await modules.filters.texts.updateTexts({ filterId: newFilter._id }, texts);
|
|
16
14
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { FilterDirector } from '@unchainedshop/core';
|
|
2
1
|
import { FilterNotFoundError } from "../../../../errors.js";
|
|
3
2
|
import { getNormalizedFilterDetails } from "../../../utils/getNormalizedFilterDetails.js";
|
|
4
3
|
export default async function createFilterOption(context, params) {
|
|
5
|
-
const { modules } = context;
|
|
4
|
+
const { modules, services } = context;
|
|
6
5
|
const { filterId, option, optionTexts } = params;
|
|
7
6
|
if (!(await modules.filters.filterExists({ filterId }))) {
|
|
8
7
|
throw new FilterNotFoundError({ filterId });
|
|
9
8
|
}
|
|
10
|
-
const newOption = await
|
|
9
|
+
const newOption = await services.filters.createFilterOption(filterId, { value: option });
|
|
11
10
|
if (!newOption)
|
|
12
11
|
return { filter: null };
|
|
13
|
-
await FilterDirector.invalidateProductIdCache(newOption, context);
|
|
14
12
|
if (optionTexts && optionTexts.length > 0) {
|
|
15
13
|
await modules.filters.texts.updateTexts({ filterId, filterOptionValue: option }, optionTexts);
|
|
16
14
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { FilterDirector } from '@unchainedshop/core';
|
|
2
1
|
import { FilterNotFoundError } from "../../../../errors.js";
|
|
3
2
|
import { getNormalizedFilterDetails } from "../../../utils/getNormalizedFilterDetails.js";
|
|
4
3
|
export default async function removeFilterOption(context, params) {
|
|
5
|
-
const { modules } = context;
|
|
4
|
+
const { modules, services } = context;
|
|
6
5
|
const { filterId, option } = params;
|
|
7
6
|
if (!(await modules.filters.filterExists({ filterId }))) {
|
|
8
7
|
throw new FilterNotFoundError({ filterId });
|
|
9
8
|
}
|
|
10
|
-
const removedFilterOption = await
|
|
9
|
+
const removedFilterOption = await services.filters.removeFilterOption({
|
|
11
10
|
filterId,
|
|
12
11
|
filterOptionValue: option,
|
|
13
12
|
});
|
|
14
13
|
if (!removedFilterOption)
|
|
15
14
|
return { filter: null };
|
|
16
|
-
await FilterDirector.invalidateProductIdCache(removedFilterOption, context);
|
|
17
15
|
const normalizedFilter = await getNormalizedFilterDetails(filterId, context);
|
|
18
16
|
return { filter: normalizedFilter };
|
|
19
17
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FilterNotFoundError } from "../../../../errors.js";
|
|
2
2
|
import { getNormalizedFilterDetails } from "../../../utils/getNormalizedFilterDetails.js";
|
|
3
3
|
export default async function updateFilter(context, params) {
|
|
4
|
-
const { modules } = context;
|
|
4
|
+
const { modules, services } = context;
|
|
5
5
|
const { filterId, updateData } = params;
|
|
6
6
|
if (!(await modules.filters.filterExists({ filterId }))) {
|
|
7
7
|
throw new FilterNotFoundError({ filterId });
|
|
8
8
|
}
|
|
9
|
-
await
|
|
9
|
+
await services.filters.updateFilter(filterId, updateData);
|
|
10
10
|
const normalizedFilter = await getNormalizedFilterDetails(filterId, context);
|
|
11
11
|
return { filter: normalizedFilter };
|
|
12
12
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerFilterTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { filterManagement, FilterManagementSchema } from "./filterManagement.js";
|
|
2
2
|
export const registerFilterTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('filter_management', {
|
|
4
|
+
description: 'Comprehensive filter management system with unified CRUD operations. Supports: CREATE (new filters with localized texts), UPDATE (modify filter properties), REMOVE (delete with assortment cleanup), GET (retrieve single filter), LIST (paginated search with sorting), COUNT (total counts), CREATE_OPTION/REMOVE_OPTION (manage filter options), UPDATE_TEXTS/GET_TEXTS (localization management). Action-based routing with proper validation and error handling.',
|
|
5
|
+
inputSchema: FilterManagementSchema,
|
|
6
|
+
}, async (params) => filterManagement(context, params));
|
|
4
7
|
};
|
|
@@ -133,11 +133,11 @@ export declare const FilterManagementSchema: {
|
|
|
133
133
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
134
134
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
135
135
|
action: z.ZodEnum<{
|
|
136
|
+
LIST: "LIST";
|
|
136
137
|
GET: "GET";
|
|
137
138
|
CREATE: "CREATE";
|
|
138
139
|
UPDATE: "UPDATE";
|
|
139
140
|
REMOVE: "REMOVE";
|
|
140
|
-
LIST: "LIST";
|
|
141
141
|
COUNT: "COUNT";
|
|
142
142
|
CREATE_OPTION: "CREATE_OPTION";
|
|
143
143
|
REMOVE_OPTION: "REMOVE_OPTION";
|
|
@@ -189,11 +189,11 @@ export declare const FilterManagementZodSchema: z.ZodObject<{
|
|
|
189
189
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
190
190
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
191
191
|
action: z.ZodEnum<{
|
|
192
|
+
LIST: "LIST";
|
|
192
193
|
GET: "GET";
|
|
193
194
|
CREATE: "CREATE";
|
|
194
195
|
UPDATE: "UPDATE";
|
|
195
196
|
REMOVE: "REMOVE";
|
|
196
|
-
LIST: "LIST";
|
|
197
197
|
COUNT: "COUNT";
|
|
198
198
|
CREATE_OPTION: "CREATE_OPTION";
|
|
199
199
|
REMOVE_OPTION: "REMOVE_OPTION";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerLocalizationTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { localizationManagement, LocalizationManagementSchema } from "./localizationManagement.js";
|
|
2
2
|
export const registerLocalizationTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('localization_management', {
|
|
4
|
+
description: 'Unified localization management tool for localization operations across geographic, monetary, and language entities. Countries use 2-letter codes (US, DE, FR), currencies use 3-letter codes (USD, EUR, CHF) with optional blockchain support, languages use locale codes (en, de-CH).. Actions: CREATE (add new), UPDATE (modify existing), REMOVE (delete).',
|
|
5
|
+
inputSchema: LocalizationManagementSchema,
|
|
6
|
+
}, async (params) => localizationManagement(context, params));
|
|
4
7
|
};
|
|
@@ -132,11 +132,11 @@ export declare const LocalizationManagementSchema: {
|
|
|
132
132
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
133
133
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
134
134
|
action: z.ZodEnum<{
|
|
135
|
+
LIST: "LIST";
|
|
135
136
|
GET: "GET";
|
|
136
137
|
CREATE: "CREATE";
|
|
137
138
|
UPDATE: "UPDATE";
|
|
138
139
|
REMOVE: "REMOVE";
|
|
139
|
-
LIST: "LIST";
|
|
140
140
|
COUNT: "COUNT";
|
|
141
141
|
}>;
|
|
142
142
|
localizationType: z.ZodEnum<{
|
|
@@ -165,11 +165,11 @@ export declare const LocalizationManagementZodSchema: z.ZodObject<{
|
|
|
165
165
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
166
166
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
167
167
|
action: z.ZodEnum<{
|
|
168
|
+
LIST: "LIST";
|
|
168
169
|
GET: "GET";
|
|
169
170
|
CREATE: "CREATE";
|
|
170
171
|
UPDATE: "UPDATE";
|
|
171
172
|
REMOVE: "REMOVE";
|
|
172
|
-
LIST: "LIST";
|
|
173
173
|
COUNT: "COUNT";
|
|
174
174
|
}>;
|
|
175
175
|
localizationType: z.ZodEnum<{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerOrderTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { orderManagement, OrderManagementSchema } from "./orderManagement.js";
|
|
2
2
|
export const registerOrderTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('order_management', {
|
|
4
|
+
description: 'Unified order management and analytics system. Supports: LIST (get orders with filters and pagination), SALES_SUMMARY (daily sales analytics), MONTHLY_BREAKDOWN (12-month sales analysis), TOP_CUSTOMERS (highest spending customers), TOP_PRODUCTS (best-selling products). All actions support date filtering and provider-based segmentation with proper aggregation and normalization.',
|
|
5
|
+
inputSchema: OrderManagementSchema,
|
|
6
|
+
}, async (params) => orderManagement(context, params));
|
|
4
7
|
};
|
|
@@ -178,8 +178,8 @@ export declare const OrderManagementSchema: {
|
|
|
178
178
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
179
179
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
180
180
|
action: z.ZodEnum<{
|
|
181
|
-
GET: "GET";
|
|
182
181
|
LIST: "LIST";
|
|
182
|
+
GET: "GET";
|
|
183
183
|
SALES_SUMMARY: "SALES_SUMMARY";
|
|
184
184
|
MONTHLY_BREAKDOWN: "MONTHLY_BREAKDOWN";
|
|
185
185
|
TOP_CUSTOMERS: "TOP_CUSTOMERS";
|
|
@@ -234,8 +234,8 @@ export declare const OrderManagementZodSchema: z.ZodObject<{
|
|
|
234
234
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
235
235
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
236
236
|
action: z.ZodEnum<{
|
|
237
|
-
GET: "GET";
|
|
238
237
|
LIST: "LIST";
|
|
238
|
+
GET: "GET";
|
|
239
239
|
SALES_SUMMARY: "SALES_SUMMARY";
|
|
240
240
|
MONTHLY_BREAKDOWN: "MONTHLY_BREAKDOWN";
|
|
241
241
|
TOP_CUSTOMERS: "TOP_CUSTOMERS";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerProductTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { productManagement, ProductManagementSchema } from "./productManagement.js";
|
|
2
2
|
export const registerProductTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('product_management', {
|
|
4
|
+
description: 'Unified product management system with comprehensive action-based operations: CREATE/UPDATE/REMOVE/GET/LIST/COUNT products, UPDATE_STATUS (publish/unpublish), ADD_MEDIA/REMOVE_MEDIA/REORDER_MEDIA/GET_MEDIA/UPDATE_MEDIA_TEXTS, CREATE_VARIATION/REMOVE_VARIATION/ADD_VARIATION_OPTION/REMOVE_VARIATION_OPTION/UPDATE_VARIATION_TEXTS, ADD_ASSIGNMENT/REMOVE_ASSIGNMENT/GET_ASSIGNMENTS/GET_VARIATION_PRODUCTS, ADD_BUNDLE_ITEM/REMOVE_BUNDLE_ITEM/GET_BUNDLE_ITEMS, SIMULATE_PRICE/SIMULATE_PRICE_RANGE/GET_CATALOG_PRICE, GET_PRODUCT_TEXTS/GET_MEDIA_TEXTS/GET_VARIATION_TEXTS, GET_REVIEWS/COUNT_REVIEWS, GET_SIBLINGS. Supports all product types (SIMPLE, CONFIGURABLE, BUNDLE, PLAN, TOKENIZED) with type-specific validations and comprehensive error handling.',
|
|
5
|
+
inputSchema: ProductManagementSchema,
|
|
6
|
+
}, async (params) => productManagement(context, params));
|
|
4
7
|
};
|
|
@@ -108,7 +108,7 @@ export declare const ProductSchema: z.ZodObject<{
|
|
|
108
108
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
109
109
|
pricing: z.ZodArray<z.ZodObject<{
|
|
110
110
|
amount: z.ZodNumber;
|
|
111
|
-
|
|
111
|
+
minQuantity: z.ZodOptional<z.ZodNumber>;
|
|
112
112
|
isTaxable: z.ZodOptional<z.ZodBoolean>;
|
|
113
113
|
isNetPrice: z.ZodOptional<z.ZodBoolean>;
|
|
114
114
|
currencyCode: z.ZodString;
|
|
@@ -164,7 +164,7 @@ export declare const actionValidators: {
|
|
|
164
164
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
165
165
|
pricing: z.ZodArray<z.ZodObject<{
|
|
166
166
|
amount: z.ZodNumber;
|
|
167
|
-
|
|
167
|
+
minQuantity: z.ZodOptional<z.ZodNumber>;
|
|
168
168
|
isTaxable: z.ZodOptional<z.ZodBoolean>;
|
|
169
169
|
isNetPrice: z.ZodOptional<z.ZodBoolean>;
|
|
170
170
|
currencyCode: z.ZodString;
|
|
@@ -237,7 +237,7 @@ export declare const actionValidators: {
|
|
|
237
237
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
238
238
|
pricing: z.ZodArray<z.ZodObject<{
|
|
239
239
|
amount: z.ZodNumber;
|
|
240
|
-
|
|
240
|
+
minQuantity: z.ZodOptional<z.ZodNumber>;
|
|
241
241
|
isTaxable: z.ZodOptional<z.ZodBoolean>;
|
|
242
242
|
isNetPrice: z.ZodOptional<z.ZodBoolean>;
|
|
243
243
|
currencyCode: z.ZodString;
|
|
@@ -476,11 +476,11 @@ export declare const ProductManagementSchema: {
|
|
|
476
476
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
477
477
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
478
478
|
action: z.ZodEnum<{
|
|
479
|
+
LIST: "LIST";
|
|
479
480
|
GET: "GET";
|
|
480
481
|
CREATE: "CREATE";
|
|
481
482
|
UPDATE: "UPDATE";
|
|
482
483
|
REMOVE: "REMOVE";
|
|
483
|
-
LIST: "LIST";
|
|
484
484
|
COUNT: "COUNT";
|
|
485
485
|
UPDATE_STATUS: "UPDATE_STATUS";
|
|
486
486
|
ADD_MEDIA: "ADD_MEDIA";
|
|
@@ -565,7 +565,7 @@ export declare const ProductManagementSchema: {
|
|
|
565
565
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
566
566
|
pricing: z.ZodArray<z.ZodObject<{
|
|
567
567
|
amount: z.ZodNumber;
|
|
568
|
-
|
|
568
|
+
minQuantity: z.ZodOptional<z.ZodNumber>;
|
|
569
569
|
isTaxable: z.ZodOptional<z.ZodBoolean>;
|
|
570
570
|
isNetPrice: z.ZodOptional<z.ZodBoolean>;
|
|
571
571
|
currencyCode: z.ZodString;
|
|
@@ -640,11 +640,11 @@ export declare const ProductManagementZodSchema: z.ZodObject<{
|
|
|
640
640
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
641
641
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
642
642
|
action: z.ZodEnum<{
|
|
643
|
+
LIST: "LIST";
|
|
643
644
|
GET: "GET";
|
|
644
645
|
CREATE: "CREATE";
|
|
645
646
|
UPDATE: "UPDATE";
|
|
646
647
|
REMOVE: "REMOVE";
|
|
647
|
-
LIST: "LIST";
|
|
648
648
|
COUNT: "COUNT";
|
|
649
649
|
UPDATE_STATUS: "UPDATE_STATUS";
|
|
650
650
|
ADD_MEDIA: "ADD_MEDIA";
|
|
@@ -729,7 +729,7 @@ export declare const ProductManagementZodSchema: z.ZodObject<{
|
|
|
729
729
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
730
730
|
pricing: z.ZodArray<z.ZodObject<{
|
|
731
731
|
amount: z.ZodNumber;
|
|
732
|
-
|
|
732
|
+
minQuantity: z.ZodOptional<z.ZodNumber>;
|
|
733
733
|
isTaxable: z.ZodOptional<z.ZodBoolean>;
|
|
734
734
|
isNetPrice: z.ZodOptional<z.ZodBoolean>;
|
|
735
735
|
currencyCode: z.ZodString;
|
|
@@ -73,11 +73,12 @@ export const ProductSchema = z.object({
|
|
|
73
73
|
pricing: z
|
|
74
74
|
.array(z.object({
|
|
75
75
|
amount: z.number().int().describe('Price amount in smallest currency unit.'),
|
|
76
|
-
|
|
76
|
+
minQuantity: z
|
|
77
77
|
.number()
|
|
78
78
|
.int()
|
|
79
|
+
.min(0)
|
|
79
80
|
.optional()
|
|
80
|
-
.describe('Optional
|
|
81
|
+
.describe('Optional inclusive minimum quantity (tier floor) this price applies to; defaults to the base tier (0).'),
|
|
81
82
|
isTaxable: z.boolean().optional().describe('Whether tax applies to this price'),
|
|
82
83
|
isNetPrice: z.boolean().optional().describe('Whether this is a net price (without tax)'),
|
|
83
84
|
currencyCode: z
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerProviderTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { providerManagement, ProviderManagementSchema } from "./providerManagement.js";
|
|
2
2
|
export const registerProviderTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('provider_management', {
|
|
4
|
+
description: 'Unified provider management tool for all provider operations (CREATE, UPDATE, REMOVE, GET, LIST, INTERFACES) across payment processing (Stripe, PayPal), delivery services (FedEx, UPS), and warehousing systems. Use action parameter to specify operation type.',
|
|
5
|
+
inputSchema: ProviderManagementSchema,
|
|
6
|
+
}, async (params) => providerManagement(context, params));
|
|
4
7
|
};
|
|
@@ -133,11 +133,11 @@ export declare const ProviderManagementSchema: {
|
|
|
133
133
|
queryString: z.ZodOptional<z.ZodString>;
|
|
134
134
|
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
135
135
|
action: z.ZodEnum<{
|
|
136
|
+
LIST: "LIST";
|
|
136
137
|
GET: "GET";
|
|
137
138
|
CREATE: "CREATE";
|
|
138
139
|
UPDATE: "UPDATE";
|
|
139
140
|
REMOVE: "REMOVE";
|
|
140
|
-
LIST: "LIST";
|
|
141
141
|
INTERFACES: "INTERFACES";
|
|
142
142
|
}>;
|
|
143
143
|
providerType: z.ZodEnum<{
|
|
@@ -182,11 +182,11 @@ export declare const ProviderManagementZodSchema: z.ZodObject<{
|
|
|
182
182
|
queryString: z.ZodOptional<z.ZodString>;
|
|
183
183
|
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
184
184
|
action: z.ZodEnum<{
|
|
185
|
+
LIST: "LIST";
|
|
185
186
|
GET: "GET";
|
|
186
187
|
CREATE: "CREATE";
|
|
187
188
|
UPDATE: "UPDATE";
|
|
188
189
|
REMOVE: "REMOVE";
|
|
189
|
-
LIST: "LIST";
|
|
190
190
|
INTERFACES: "INTERFACES";
|
|
191
191
|
}>;
|
|
192
192
|
providerType: z.ZodEnum<{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerQuotationTools: (server: McpServer, context: Context) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { quotationManagement, QuotationManagementSchema } from "./quotationManagement.js";
|
|
2
2
|
export const registerQuotationTools = (server, context) => {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool('quotation_management', {
|
|
4
|
+
description: 'Unified quotation management system. Supports: LIST (get quotations with filters and pagination), GET (single quotation by ID), COUNT (count quotations), VERIFY (verify a REQUESTED quotation), MAKE_PROPOSAL (create proposal for PROCESSING quotation), REJECT (reject any quotation except FULFILLED). Quotations go through lifecycle: REQUESTED → PROCESSING → PROPOSED → FULFILLED/REJECTED.',
|
|
5
|
+
inputSchema: QuotationManagementSchema,
|
|
6
|
+
}, async (params) => quotationManagement(context, params));
|
|
4
7
|
};
|
|
@@ -94,8 +94,8 @@ export declare const QuotationManagementSchema: {
|
|
|
94
94
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
95
95
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
96
96
|
action: z.ZodEnum<{
|
|
97
|
-
GET: "GET";
|
|
98
97
|
LIST: "LIST";
|
|
98
|
+
GET: "GET";
|
|
99
99
|
COUNT: "COUNT";
|
|
100
100
|
VERIFY: "VERIFY";
|
|
101
101
|
MAKE_PROPOSAL: "MAKE_PROPOSAL";
|
|
@@ -131,8 +131,8 @@ export declare const QuotationManagementZodSchema: z.ZodObject<{
|
|
|
131
131
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
132
132
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
133
133
|
action: z.ZodEnum<{
|
|
134
|
-
GET: "GET";
|
|
135
134
|
LIST: "LIST";
|
|
135
|
+
GET: "GET";
|
|
136
136
|
COUNT: "COUNT";
|
|
137
137
|
VERIFY: "VERIFY";
|
|
138
138
|
MAKE_PROPOSAL: "MAKE_PROPOSAL";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { Context } from '../../../context.ts';
|
|
3
3
|
export declare const registerSystemTools: (server: McpServer, context: Context) => void;
|