@lehaotech/walmart-mcp 0.5.4
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 +25 -0
- package/CHANGELOG.md +247 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/build/api/advertising/ad-client.d.ts +24 -0
- package/build/api/advertising/ad-client.js +174 -0
- package/build/api/advertising/advertising-api.d.ts +50 -0
- package/build/api/advertising/advertising-api.js +89 -0
- package/build/api/client.d.ts +19 -0
- package/build/api/client.js +150 -0
- package/build/api/feeds/feeds-api.d.ts +15 -0
- package/build/api/feeds/feeds-api.js +53 -0
- package/build/api/fulfillment/fulfillment-api.d.ts +37 -0
- package/build/api/fulfillment/fulfillment-api.js +81 -0
- package/build/api/index.d.ts +44 -0
- package/build/api/index.js +56 -0
- package/build/api/inventory/inventory-api.d.ts +27 -0
- package/build/api/inventory/inventory-api.js +49 -0
- package/build/api/items/items-api.d.ts +33 -0
- package/build/api/items/items-api.js +67 -0
- package/build/api/notifications/notifications-api.d.ts +14 -0
- package/build/api/notifications/notifications-api.js +33 -0
- package/build/api/orders/orders-api.d.ts +32 -0
- package/build/api/orders/orders-api.js +47 -0
- package/build/api/pricing/pricing-api.d.ts +32 -0
- package/build/api/pricing/pricing-api.js +60 -0
- package/build/api/reports/reports-api.d.ts +37 -0
- package/build/api/reports/reports-api.js +51 -0
- package/build/api/returns/returns-api.d.ts +26 -0
- package/build/api/returns/returns-api.js +37 -0
- package/build/api/settings/settings-api.d.ts +9 -0
- package/build/api/settings/settings-api.js +21 -0
- package/build/auth/oauth.d.ts +16 -0
- package/build/auth/oauth.js +125 -0
- package/build/config/environment.d.ts +22 -0
- package/build/config/environment.js +50 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +180 -0
- package/build/scripts/client-configs.d.ts +36 -0
- package/build/scripts/client-configs.js +132 -0
- package/build/scripts/diagnose.d.ts +15 -0
- package/build/scripts/diagnose.js +320 -0
- package/build/scripts/setup.d.ts +17 -0
- package/build/scripts/setup.js +276 -0
- package/build/tools/definitions/advertising.d.ts +664 -0
- package/build/tools/definitions/advertising.js +315 -0
- package/build/tools/definitions/discovery.d.ts +24 -0
- package/build/tools/definitions/discovery.js +65 -0
- package/build/tools/definitions/feeds.d.ts +46 -0
- package/build/tools/definitions/feeds.js +42 -0
- package/build/tools/definitions/fulfillment.d.ts +1127 -0
- package/build/tools/definitions/fulfillment.js +272 -0
- package/build/tools/definitions/inventory.d.ts +392 -0
- package/build/tools/definitions/inventory.js +182 -0
- package/build/tools/definitions/items.d.ts +447 -0
- package/build/tools/definitions/items.js +223 -0
- package/build/tools/definitions/notifications.d.ts +84 -0
- package/build/tools/definitions/notifications.js +73 -0
- package/build/tools/definitions/orders.d.ts +2659 -0
- package/build/tools/definitions/orders.js +298 -0
- package/build/tools/definitions/pricing.d.ts +724 -0
- package/build/tools/definitions/pricing.js +254 -0
- package/build/tools/definitions/reports.d.ts +223 -0
- package/build/tools/definitions/reports.js +144 -0
- package/build/tools/definitions/returns.d.ts +441 -0
- package/build/tools/definitions/returns.js +126 -0
- package/build/tools/definitions/settings.d.ts +100 -0
- package/build/tools/definitions/settings.js +52 -0
- package/build/tools/definitions/shared-schemas.d.ts +40 -0
- package/build/tools/definitions/shared-schemas.js +47 -0
- package/build/tools/definitions/token-management.d.ts +16 -0
- package/build/tools/definitions/token-management.js +41 -0
- package/build/tools/index.d.ts +6924 -0
- package/build/tools/index.js +379 -0
- package/build/utils/api-error.d.ts +41 -0
- package/build/utils/api-error.js +97 -0
- package/build/utils/endpoint-catalog.d.ts +22 -0
- package/build/utils/endpoint-catalog.js +89 -0
- package/build/utils/env-file.d.ts +12 -0
- package/build/utils/env-file.js +27 -0
- package/build/utils/known-issues.d.ts +29 -0
- package/build/utils/known-issues.js +122 -0
- package/build/utils/logger.d.ts +15 -0
- package/build/utils/logger.js +56 -0
- package/build/utils/rate-limiter.d.ts +51 -0
- package/build/utils/rate-limiter.js +109 -0
- package/package.json +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Walmart shipping-settings payload structure (per Walmart docs):
|
|
3
|
+
// { shippingTemplates: [{ templateName, methods: [...] }] }
|
|
4
|
+
// Method enum / region structure varies — we gate the envelope.
|
|
5
|
+
const ShippingTemplateSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
templateName: z.string().min(1).max(100),
|
|
8
|
+
isDefault: z.boolean().optional(),
|
|
9
|
+
methods: z
|
|
10
|
+
.array(z
|
|
11
|
+
.object({
|
|
12
|
+
methodCode: z.enum(['Standard', 'Expedited', 'OneDay', 'TwoDay', 'Freight', 'Value']),
|
|
13
|
+
transitTime: z.number().int().min(0).max(99).optional(),
|
|
14
|
+
isActive: z.boolean().default(true),
|
|
15
|
+
})
|
|
16
|
+
.passthrough())
|
|
17
|
+
.min(1, 'Each shipping template must have at least 1 method'),
|
|
18
|
+
})
|
|
19
|
+
.passthrough();
|
|
20
|
+
const ShippingSettingsBodySchema = z
|
|
21
|
+
.object({
|
|
22
|
+
shippingTemplates: z
|
|
23
|
+
.array(ShippingTemplateSchema)
|
|
24
|
+
.min(1, 'Need at least 1 shipping template'),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
export const settingsTools = [
|
|
28
|
+
{
|
|
29
|
+
name: 'walmart_get_shipping_settings',
|
|
30
|
+
description: 'Get current shipping configuration including shipping methods, transit times, and regions.',
|
|
31
|
+
inputSchema: {},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'walmart_update_shipping_settings',
|
|
35
|
+
description: 'Update shipping configuration. Body: { shippingTemplates: [{ templateName, methods: ' +
|
|
36
|
+
'[{ methodCode, transitTime?, isActive? }] }] }. methodCode must be one of Standard, ' +
|
|
37
|
+
'Expedited, OneDay, TwoDay, Freight, Value.',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
settingsData: ShippingSettingsBodySchema,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'walmart_get_fulfillment_centers',
|
|
44
|
+
description: 'Get list of configured fulfillment centers (ship nodes) with addresses and capabilities.',
|
|
45
|
+
inputSchema: {},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'walmart_get_partner_info',
|
|
49
|
+
description: 'Get Walmart partner account information including seller ID, status, and onboarding state.',
|
|
50
|
+
inputSchema: {},
|
|
51
|
+
},
|
|
52
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared zod atom schemas used across multiple write tools.
|
|
3
|
+
*
|
|
4
|
+
* Keep this file conservative — only schemas that genuinely repeat across
|
|
5
|
+
* 2+ tools belong here. If a schema is unique to one tool's feed body,
|
|
6
|
+
* keep it inline in that tool's definition file.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/** Seller-defined SKU. Walmart allows up to 50 chars from a limited charset. */
|
|
10
|
+
export declare const SkuSchema: z.ZodString;
|
|
11
|
+
/** GTIN / UPC / EAN — Walmart accepts 8 / 12 / 13 / 14 digit numeric strings. */
|
|
12
|
+
export declare const GtinSchema: z.ZodString;
|
|
13
|
+
/** Walmart ship node ID. Numeric string in practice but kept as string for safety. */
|
|
14
|
+
export declare const ShipNodeSchema: z.ZodString;
|
|
15
|
+
export declare const Iso4217CurrencySchema: z.ZodEnum<["USD", "MXN", "CAD", "CLP"]>;
|
|
16
|
+
export declare const MoneySchema: z.ZodObject<{
|
|
17
|
+
currency: z.ZodEnum<["USD", "MXN", "CAD", "CLP"]>;
|
|
18
|
+
amount: z.ZodNumber;
|
|
19
|
+
}, "strict", z.ZodTypeAny, {
|
|
20
|
+
currency: "USD" | "MXN" | "CAD" | "CLP";
|
|
21
|
+
amount: number;
|
|
22
|
+
}, {
|
|
23
|
+
currency: "USD" | "MXN" | "CAD" | "CLP";
|
|
24
|
+
amount: number;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const Iso8601UtcSchema: z.ZodString;
|
|
27
|
+
/** Walmart inventory unit. EACH is overwhelmingly the common value. */
|
|
28
|
+
export declare const QuantityUnitSchema: z.ZodEnum<["EACH", "CASE"]>;
|
|
29
|
+
export declare const QuantitySchema: z.ZodObject<{
|
|
30
|
+
unit: z.ZodDefault<z.ZodEnum<["EACH", "CASE"]>>;
|
|
31
|
+
amount: z.ZodNumber;
|
|
32
|
+
}, "strict", z.ZodTypeAny, {
|
|
33
|
+
amount: number;
|
|
34
|
+
unit: "EACH" | "CASE";
|
|
35
|
+
}, {
|
|
36
|
+
amount: number;
|
|
37
|
+
unit?: "EACH" | "CASE" | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
/** Most feed entries support an UPSERT/DELETE process mode. */
|
|
40
|
+
export declare const ProcessModeSchema: z.ZodDefault<z.ZodEnum<["UPSERT", "DELETE"]>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared zod atom schemas used across multiple write tools.
|
|
3
|
+
*
|
|
4
|
+
* Keep this file conservative — only schemas that genuinely repeat across
|
|
5
|
+
* 2+ tools belong here. If a schema is unique to one tool's feed body,
|
|
6
|
+
* keep it inline in that tool's definition file.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
// ---------- Identifier atoms ----------
|
|
10
|
+
/** Seller-defined SKU. Walmart allows up to 50 chars from a limited charset. */
|
|
11
|
+
export const SkuSchema = z
|
|
12
|
+
.string()
|
|
13
|
+
.min(1, 'SKU cannot be empty')
|
|
14
|
+
.max(50, 'SKU max 50 chars')
|
|
15
|
+
.regex(/^[A-Za-z0-9._\-:/+]+$/, 'SKU may only contain letters, digits, and . _ - : / +');
|
|
16
|
+
/** GTIN / UPC / EAN — Walmart accepts 8 / 12 / 13 / 14 digit numeric strings. */
|
|
17
|
+
export const GtinSchema = z
|
|
18
|
+
.string()
|
|
19
|
+
.regex(/^[0-9]{8,14}$/, 'GTIN must be 8-14 digit numeric');
|
|
20
|
+
/** Walmart ship node ID. Numeric string in practice but kept as string for safety. */
|
|
21
|
+
export const ShipNodeSchema = z.string().min(1).max(50);
|
|
22
|
+
// ---------- Money / time atoms ----------
|
|
23
|
+
export const Iso4217CurrencySchema = z
|
|
24
|
+
.enum(['USD', 'MXN', 'CAD', 'CLP'])
|
|
25
|
+
.describe('ISO 4217 currency. us->USD, mx->MXN, ca->CAD, cl->CLP.');
|
|
26
|
+
export const MoneySchema = z
|
|
27
|
+
.object({
|
|
28
|
+
currency: Iso4217CurrencySchema,
|
|
29
|
+
amount: z.number().positive('Money amount must be positive'),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
export const Iso8601UtcSchema = z
|
|
33
|
+
.string()
|
|
34
|
+
.datetime({ offset: true })
|
|
35
|
+
.describe('ISO 8601 UTC datetime, e.g. 2026-06-01T00:00:00Z');
|
|
36
|
+
// ---------- Inventory / quantity atoms ----------
|
|
37
|
+
/** Walmart inventory unit. EACH is overwhelmingly the common value. */
|
|
38
|
+
export const QuantityUnitSchema = z.enum(['EACH', 'CASE']);
|
|
39
|
+
export const QuantitySchema = z
|
|
40
|
+
.object({
|
|
41
|
+
unit: QuantityUnitSchema.default('EACH'),
|
|
42
|
+
amount: z.number().int('Quantity amount must be integer').min(0, 'Quantity cannot be negative'),
|
|
43
|
+
})
|
|
44
|
+
.strict();
|
|
45
|
+
// ---------- Feed-control atoms ----------
|
|
46
|
+
/** Most feed entries support an UPSERT/DELETE process mode. */
|
|
47
|
+
export const ProcessModeSchema = z.enum(['UPSERT', 'DELETE']).default('UPSERT');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const tokenManagementTools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
clientId?: undefined;
|
|
7
|
+
clientSecret?: undefined;
|
|
8
|
+
};
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: {
|
|
13
|
+
clientId: z.ZodString;
|
|
14
|
+
clientSecret: z.ZodString;
|
|
15
|
+
};
|
|
16
|
+
})[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const tokenManagementTools = [
|
|
3
|
+
{
|
|
4
|
+
name: 'walmart_get_token',
|
|
5
|
+
description: 'Request a new access token from Walmart API. Tokens expire in 15 minutes. This tool automatically caches the token.',
|
|
6
|
+
inputSchema: {},
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'walmart_get_token_status',
|
|
10
|
+
description: 'Check the current token validity, scopes, and expiration time. Returns detailed token information from Walmart API.',
|
|
11
|
+
inputSchema: {},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'walmart_get_token_info',
|
|
15
|
+
description: 'Get local token cache info including expiry time and environment. Does not call the Walmart API.',
|
|
16
|
+
inputSchema: {},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'walmart_set_credentials',
|
|
20
|
+
description: 'Set Walmart API credentials (Client ID and Client Secret). Saves to .env file for persistence.',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
clientId: z.string().describe('Walmart API Client ID'),
|
|
23
|
+
clientSecret: z.string().describe('Walmart API Client Secret'),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'walmart_display_credentials',
|
|
28
|
+
description: 'Display current Walmart API credentials (Client ID shown in full, Client Secret masked). Shows environment and market configuration.',
|
|
29
|
+
inputSchema: {},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'walmart_setup_guide',
|
|
33
|
+
description: 'Get step-by-step setup instructions and a checklist for configuring this MCP server. Reports what is already configured (environment, market, whether marketplace and advertising credentials are set) and what is still needed. Call this first when getting started or when calls fail due to missing credentials.',
|
|
34
|
+
inputSchema: {},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'walmart_get_rate_budget',
|
|
38
|
+
description: 'Get current rate-limit budget for the Walmart Marketplace client. Returns the local sliding-window state (requests issued by this MCP in the last 60s) plus the latest Walmart-server-reported token bucket (x-current-token-count + x-next-replenish-time from the most recent response). Call this before bulk operations to see how much headroom you have. Note: Walmart Marketplace uses client_credentials + per-endpoint token buckets; there is no OAuth user-token flow to unlock higher rate limits, only the seller-account tier set by Walmart.',
|
|
39
|
+
inputSchema: {},
|
|
40
|
+
},
|
|
41
|
+
];
|