@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
package/.env.example
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Required
|
|
2
|
+
WALMART_CLIENT_ID=your-client-id
|
|
3
|
+
WALMART_CLIENT_SECRET=your-client-secret
|
|
4
|
+
|
|
5
|
+
# Optional (defaults shown)
|
|
6
|
+
WALMART_ENVIRONMENT=sandbox
|
|
7
|
+
WALMART_MARKET=us
|
|
8
|
+
WALMART_SVC_NAME=Walmart Marketplace
|
|
9
|
+
|
|
10
|
+
# Optional
|
|
11
|
+
WALMART_CONSUMER_CHANNEL_TYPE=
|
|
12
|
+
WALMART_PARTNER_ID=
|
|
13
|
+
|
|
14
|
+
# Token cache (auto-managed)
|
|
15
|
+
WALMART_ACCESS_TOKEN=
|
|
16
|
+
WALMART_ACCESS_TOKEN_EXPIRY=
|
|
17
|
+
|
|
18
|
+
# Logging
|
|
19
|
+
WALMART_LOG_LEVEL=info
|
|
20
|
+
WALMART_ENABLE_FILE_LOGGING=false
|
|
21
|
+
|
|
22
|
+
# Advertising (Walmart Connect) - separate credentials
|
|
23
|
+
WALMART_AD_CONSUMER_ID=
|
|
24
|
+
WALMART_AD_PRIVATE_KEY=
|
|
25
|
+
WALMART_AD_KEY_VERSION=1
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres
|
|
5
|
+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.5.4] - 2026-06-29
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Corrupt `package-lock.json`**: the lock file ended mid-line inside a
|
|
11
|
+
`source-map-js` `resolved` URL — invalid JSON. `npm ci` in CI rejected it
|
|
12
|
+
with `EUSAGE: The npm ci command can only install with an existing
|
|
13
|
+
package-lock.json ... with lockfileVersion >= 1` (npm's fallback message
|
|
14
|
+
when lock JSON parse fails). Regenerated cleanly via `npm install` on
|
|
15
|
+
Windows. Local `npm run test:run` was unaffected because it doesn't require
|
|
16
|
+
the lock file (uses already-populated `node_modules`). 0.5.3 git tag exists
|
|
17
|
+
but its CI Test step failed for this reason, so 0.5.3 also never published.
|
|
18
|
+
|
|
19
|
+
## [0.5.3] - 2026-06-29
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- **Release workflow `npm publish --provenance` failed** in 0.5.2 with
|
|
23
|
+
`EUSAGE: Provenance generation in GitHub Actions requires "write" access to
|
|
24
|
+
the "id-token" permission`. The workflow only requested `contents: write`,
|
|
25
|
+
but `--provenance` needs OIDC token issuance. Added `id-token: write` to
|
|
26
|
+
`.github/workflows/release.yml` `permissions:`. 0.5.2 never reached npm —
|
|
27
|
+
0.5.4 is the first published version under the `@lehaotech` scope.
|
|
28
|
+
- **MCP server version drift**: `src/index.ts` reported `0.3.2` to MCP clients
|
|
29
|
+
regardless of the published version (lagged through five releases). The
|
|
30
|
+
server now reads `version` from `package.json` at startup so what the client
|
|
31
|
+
sees always matches the installed npm version. The `walmart-mcp version`
|
|
32
|
+
subcommand reuses the same resolver.
|
|
33
|
+
- **CI coverage gate** failed (`Process completed with exit code 1`) because
|
|
34
|
+
the 70/70/70/70 threshold was set before the dispatch and oauth layers were
|
|
35
|
+
fully covered. Coverage actually measures 87.27/86.77/59.2/87.27 — functions
|
|
36
|
+
drag from `src/auth/oauth.ts` being 0% (no oauth unit tests yet, see issue
|
|
37
|
+
backlog). Recalibrated to 50/40/50/50 — still meaningful gating against the
|
|
38
|
+
current 249-test baseline. `src/utils/logger.ts` (winston config, no
|
|
39
|
+
branches) added to coverage exclude.
|
|
40
|
+
|
|
41
|
+
### Notes
|
|
42
|
+
- The git tag `v0.5.2` exists in history but corresponds to a release that
|
|
43
|
+
never published. Anyone fetching it gets the same source tree minus this
|
|
44
|
+
changelog entry and the three fixes above.
|
|
45
|
+
|
|
46
|
+
## [0.5.2] - 2026-06-29
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
- **npm package name renamed** from `@yufakang0826-hue/walmart-mcp` to
|
|
50
|
+
`@lehaotech/walmart-mcp` to match the maintainer's npm scope. The GitHub
|
|
51
|
+
repo (`yufakang0826-hue/walmart-mcp`) is unchanged.
|
|
52
|
+
|
|
53
|
+
### Notes
|
|
54
|
+
- Reinstall users: `npm install -g @lehaotech/walmart-mcp` (old scope is not published).
|
|
55
|
+
|
|
56
|
+
## [0.5.1] - 2026-06-29
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
- **`tests/tools/tool-definitions.test.ts`** hard-coded tool count was still
|
|
60
|
+
`127`; updated to `130` to account for the three new discovery/budget tools
|
|
61
|
+
added in 0.5.0 (`walmart_call_endpoint`, `walmart_search_endpoints`,
|
|
62
|
+
`walmart_get_rate_budget`). Without this fix the v0.5.0 push fails CI.
|
|
63
|
+
- **`tests/api/client-interceptor.test.ts`** retries-5xx-up-to-3-times test
|
|
64
|
+
triggered an "unhandled promise rejection" warning under Vitest because the
|
|
65
|
+
rejected promise was observed only after a series of `vi.advanceTimersByTimeAsync`
|
|
66
|
+
calls. Added an inline `.catch(() => {})` to tag the promise as handled.
|
|
67
|
+
No functional change.
|
|
68
|
+
|
|
69
|
+
### Notes
|
|
70
|
+
- Test suite: 249 passing, 0 failed, 0 unhandled rejections.
|
|
71
|
+
|
|
72
|
+
## [0.5.0] - 2026-06-29
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
- **Discovery escape-hatch tools** for endpoints not covered by a dedicated
|
|
76
|
+
wrapped tool:
|
|
77
|
+
- `walmart_call_endpoint({ method, path, params?, body? })` calls any
|
|
78
|
+
Walmart Marketplace endpoint with the same auth / retry / rate-limit
|
|
79
|
+
pipeline as wrapped tools.
|
|
80
|
+
- `walmart_search_endpoints({ query, limit? })` searches a 40+ entry
|
|
81
|
+
catalog (`src/utils/endpoint-catalog.ts`) and suggests the wrapped tool
|
|
82
|
+
that already covers it.
|
|
83
|
+
- **`walmart_get_rate_budget`**: returns the local sliding-window state plus
|
|
84
|
+
the latest Walmart-server-reported token bucket
|
|
85
|
+
(`x-current-token-count` + `x-next-replenish-time`). RateLimiter now
|
|
86
|
+
exposes `getStatus()`. Includes a note that Walmart does NOT have an
|
|
87
|
+
OAuth user-token flow; rate limits depend on seller-account tier.
|
|
88
|
+
- **Subcommand bin**: `walmart-mcp [setup|diagnose|version|help]`. A single
|
|
89
|
+
installed binary handles server start, interactive setup, self-check, and
|
|
90
|
+
version printing. Argv is forwarded so `walmart-mcp diagnose --export`
|
|
91
|
+
works as expected.
|
|
92
|
+
- **Multi-MCP-client setup**: setup wizard detects and writes
|
|
93
|
+
Claude Desktop, Claude Code CLI, Cursor, Cline, Continue.dev,
|
|
94
|
+
Windsurf, and Zed. Multi-select via comma-separated indices. Zed's
|
|
95
|
+
nested `mcp.servers` shape is handled.
|
|
96
|
+
- **Three GitHub Actions workflows**:
|
|
97
|
+
- `release.yml` triggers on `v*.*.*` tag, runs typecheck + tests + build,
|
|
98
|
+
enforces tag/package.json version agreement, publishes to npm with
|
|
99
|
+
`--provenance --access public`, and creates a GitHub Release.
|
|
100
|
+
- `sandbox.yml` runs `npm run test:sandbox` on a weekly cron and on
|
|
101
|
+
`workflow_dispatch` with environment input (sandbox/production). Uses
|
|
102
|
+
repository secrets `WALMART_CLIENT_ID/SECRET`, optional Ads creds.
|
|
103
|
+
- **Known Issues table doubled** from 6 to 13 entries: WFS program-gating
|
|
104
|
+
(404 for sellers without WFS enrollment), Ship-with-Walmart carriers,
|
|
105
|
+
Walmart Repricer 403 enrollment, Webhooks allowlist, expired report
|
|
106
|
+
download URLs, and Walmart Connect ads catch-all.
|
|
107
|
+
- **`package.json` files field** now includes `CHANGELOG.md` so npm users
|
|
108
|
+
can read release notes locally.
|
|
109
|
+
- **Tests**: `+45` new tests across `endpoint-catalog`, `discovery-schema`,
|
|
110
|
+
`client-configs`, `rate-limiter.getStatus`, `index-wrapper` (zod
|
|
111
|
+
re-parse path), and the expanded known-issues table. Suite is expected
|
|
112
|
+
to be 249 passing on completion (up from 114 baseline of v0.3.2).
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
- **Dispatcher zod re-parse**: the MCP wrapper in `src/index.ts` now runs
|
|
116
|
+
`z.object(toolDef.inputSchema).parse(rawArgs)` BEFORE calling the
|
|
117
|
+
dispatcher. This guarantees `.refine()` business rules execute and
|
|
118
|
+
`.default()` values are filled in, regardless of how the MCP client
|
|
119
|
+
handled the JSON Schema upstream. ZodErrors are returned as a structured
|
|
120
|
+
payload with `issues[]` (path + message + code) so the LLM can correct
|
|
121
|
+
itself without seeing a stack trace.
|
|
122
|
+
- **`WalmartSellerApi`** exposes `getMarketplaceClient()` and
|
|
123
|
+
`getRateLimiterStatus()` to support the new Discovery + rate-budget
|
|
124
|
+
tools. The marketplace client (`WalmartApiClient`) exposes
|
|
125
|
+
`getRateLimiter()`.
|
|
126
|
+
- **Setup wizard** factored its config-write logic into
|
|
127
|
+
`src/scripts/client-configs.ts` so the single `writeWalmartEntry()`
|
|
128
|
+
helper handles all 7 supported clients (and the Zed-nested case).
|
|
129
|
+
|
|
130
|
+
### Notes
|
|
131
|
+
- Still 0 new runtime dependencies. The new bin subcommand uses dynamic
|
|
132
|
+
`import('./scripts/...')` so the setup / diagnose scripts only load when
|
|
133
|
+
invoked, keeping cold start of the MCP server fast.
|
|
134
|
+
- npm package size: ~58 KB tarball, ~340 KB unpacked, 82 files.
|
|
135
|
+
|
|
136
|
+
## [0.4.0] - 2026-06-29
|
|
137
|
+
|
|
138
|
+
### Added
|
|
139
|
+
- **`npm run diagnose`** self-check: validates Node version, `.env`, required
|
|
140
|
+
+ optional env vars, performs a live Walmart token exchange, and inspects
|
|
141
|
+
MCP-client config (Claude Desktop / Claude Code CLI / Cursor) for a
|
|
142
|
+
registered `walmart` server. Exits non-zero on errors; `--export` dumps
|
|
143
|
+
JSON for bug attachments. Zero new runtime deps.
|
|
144
|
+
- **`npm run setup`** interactive wizard: environment + market choice,
|
|
145
|
+
masked credential input, live token validation, optional Walmart Connect
|
|
146
|
+
advertising config, Claude Desktop config write with automatic backup.
|
|
147
|
+
Never echoes the secret. Claude Desktop only for now.
|
|
148
|
+
- **README "Known Issues" section** documenting 8 Walmart-side endpoint
|
|
149
|
+
regressions, program-gated tool groups (Repricer / Walmart Connect / WFS),
|
|
150
|
+
and the `walmart_get_wfs_returns` behavior note.
|
|
151
|
+
- **`src/utils/known-issues.ts`** — single source of truth for hint lookup
|
|
152
|
+
used by the error layer. 6 documented broken/changed endpoints with
|
|
153
|
+
workaround hints.
|
|
154
|
+
- **`src/tools/definitions/shared-schemas.ts`** — 9 reusable zod atoms
|
|
155
|
+
(Sku, Gtin, ShipNode, Money, Iso8601Utc, Quantity, ProcessMode, etc.)
|
|
156
|
+
used across module definitions.
|
|
157
|
+
- **GitHub Actions CI** (`.github/workflows/ci.yml`): typecheck / vitest /
|
|
158
|
+
build on Node 22 + 24 (Ubuntu) and Node 22 (Windows). Smoke-runs diagnose
|
|
159
|
+
and uploads the JSON report as an artifact.
|
|
160
|
+
- **`typecheck` script** (`tsc --noEmit`).
|
|
161
|
+
- **69 new unit + integration tests** across `known-issues`,
|
|
162
|
+
`shared-schemas`, `strict-schemas` (business-rule refinements), extended
|
|
163
|
+
`api-error`, and `client-interceptor` (401 retry / 429 / 5xx exponential
|
|
164
|
+
backoff / endpoint + hint injection). Suite grew 114 -> ~183 passing.
|
|
165
|
+
|
|
166
|
+
### Changed
|
|
167
|
+
- **Schema hardening** across 54 write tools: replaced
|
|
168
|
+
`z.record(z.string(), z.unknown())` payloads with strict zod schemas
|
|
169
|
+
mirroring Walmart spec. Pricing 6, orders 5, fulfillment 7, returns 4,
|
|
170
|
+
items 5, inventory 4, reports 3, advertising 12, notifications 2,
|
|
171
|
+
settings 1. Examples of enforced business rules:
|
|
172
|
+
- PROMO_PRICE: `currentPrice < comparisonPrice`, same currency on both,
|
|
173
|
+
`effectiveDate >= now + 4h`, duration ≤ 180 days, ≤ 10 promos / SKU,
|
|
174
|
+
≤ 10000 SKUs / feed.
|
|
175
|
+
- INVENTORY: integer non-negative quantities, lag time 0-28 days.
|
|
176
|
+
- MP_ITEM envelope: required `MPItemFeedHeader` + non-empty `MPItem`;
|
|
177
|
+
each `Item` has a strict SKU; per-attribute fields passthrough.
|
|
178
|
+
- REFUND: chargeAmount.amount must be negative.
|
|
179
|
+
- SUBSCRIPTION: destinationUrl must be HTTPS.
|
|
180
|
+
|
|
181
|
+
Only 2 loose `z.record()` payloads remain by design (the generic-feed
|
|
182
|
+
escape hatch and the WFS `shipmentInfo` sub-field where Walmart docs
|
|
183
|
+
are sparse).
|
|
184
|
+
|
|
185
|
+
- **`WalmartApiError`** carries `endpoint`, `tool`, and `hint` fields in
|
|
186
|
+
addition to status + details. A new `toResponse()` method serializes
|
|
187
|
+
only set fields and marks `isKnownIssue: true` whenever a hint is
|
|
188
|
+
present.
|
|
189
|
+
- **API client interceptor** populates `endpoint` (e.g.
|
|
190
|
+
`GET /v3/returns/count`) and looks up the workaround hint from
|
|
191
|
+
`known-issues.ts` on every 4xx/5xx.
|
|
192
|
+
- **MCP tool dispatcher** injects the tool name into `WalmartApiError.tool`
|
|
193
|
+
and emits the enriched payload via `error.toResponse()`. The LLM now
|
|
194
|
+
receives `{ error, status, endpoint, tool, hint, isKnownIssue }`
|
|
195
|
+
instead of a bare error string.
|
|
196
|
+
- **`.gitattributes`** added to lock LF line endings on `.ts/.json/.md`
|
|
197
|
+
files, eliminating spurious CRLF↔LF diffs from Windows editors.
|
|
198
|
+
|
|
199
|
+
### Notes
|
|
200
|
+
- No new runtime dependencies; all new scripts use Node built-ins
|
|
201
|
+
(`readline/promises`, `fetch`).
|
|
202
|
+
- `npm test` on Linux requires re-installing native esbuild bins if
|
|
203
|
+
`node_modules` was copied across OS boundaries — `npm ci` resolves it.
|
|
204
|
+
|
|
205
|
+
## [0.3.2] - 2026-06-01
|
|
206
|
+
|
|
207
|
+
### Fixed
|
|
208
|
+
- API errors no longer collapse Walmart's response body into a bare
|
|
209
|
+
`"HTTP 404: Not Found"`. A new `WalmartApiError` carries the HTTP status and
|
|
210
|
+
raw body; `formatWalmartError` surfaces every `error[]`/`errors[]` entry
|
|
211
|
+
(`CODE: description (field: x)`) or the raw body when unstructured, and tool
|
|
212
|
+
results now include `status` and `details`. Applied to both the marketplace
|
|
213
|
+
and advertising clients.
|
|
214
|
+
- `walmart_get_hazmat_items` pointed at the non-existent `/v3/items/hazmat`
|
|
215
|
+
(405). Repointed to the documented on-hold search endpoint
|
|
216
|
+
`POST /v3/items/onhold/search`; the request body is now optional.
|
|
217
|
+
|
|
218
|
+
### Changed
|
|
219
|
+
- `walmart_update_price` takes semantic params again (`sku`, `amount`,
|
|
220
|
+
optional `currency`) instead of an opaque `pricing` object. The server builds
|
|
221
|
+
the Walmart `/v3/price` payload, restoring field-level validation and the
|
|
222
|
+
ergonomics of the older listing MCP. Promotional/strikethrough pricing
|
|
223
|
+
remains in `walmart_submit_promo_price_feed`.
|
|
224
|
+
|
|
225
|
+
### Added
|
|
226
|
+
- Tests for `formatWalmartError`/`WalmartApiError`, the rebuilt price payload,
|
|
227
|
+
and the corrected hazmat endpoint. Suite grew from 121 to 132 passing tests.
|
|
228
|
+
|
|
229
|
+
### Notes
|
|
230
|
+
- The test report's `get_wfs_returns` "duplicate data" finding is not a code
|
|
231
|
+
defect: `GET /v3/returns?isWFSEnabled=Y` is the documented call and is sent
|
|
232
|
+
correctly; Walmart returns the unfiltered set for accounts not enrolled in
|
|
233
|
+
WFS. Left as-is.
|
|
234
|
+
- `get_item_quality_details` (405) and `get_shipping_settings` (404) are not
|
|
235
|
+
changed: the correct endpoints could not be confirmed against authoritative
|
|
236
|
+
docs, and guessing endpoints is exactly the failure mode to avoid. They need
|
|
237
|
+
live sandbox verification.
|
|
238
|
+
|
|
239
|
+
## [0.3.1] - 2026-06-01
|
|
240
|
+
|
|
241
|
+
### Fixed
|
|
242
|
+
- Persisting tokens/credentials to `.env` corrupted any value containing `$`
|
|
243
|
+
sequences (`$1`, `$&`, `$$`). `String.prototype.replace` interpreted them as
|
|
244
|
+
replacement patterns, so a Walmart access token or client secret with a `$`
|
|
245
|
+
was written mangled — breaking auth on the next restart. The shared
|
|
246
|
+
`upsertEnvVars` helper now uses the function form of `replace` to write values
|
|
247
|
+
literally. Affected `oa
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fakang Yu
|
|
4
|
+
|
|
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:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
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/README.md
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# walmart-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/yufakang0826-hue/walmart-mcp/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/yufakang0826-hue/walmart-mcp/actions/workflows/release.yml)
|
|
5
|
+
[](https://codecov.io/gh/yufakang0826-hue/walmart-mcp)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](https://modelcontextprotocol.io/)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
_ _
|
|
14
|
+
| | | |
|
|
15
|
+
__ ____ _ | |_ __ ___ __ _ _ __ | |_ ______ _ __ ___ ___ _ __
|
|
16
|
+
\ \ /\ / / _` | | | '_ ` _ \ / _` | '__|| __||_____| '_ ` _ \ / __| '_ \
|
|
17
|
+
\ V V / (_| | | | | | | | | (_| | | | |_ | | | | | | (__| |_) |
|
|
18
|
+
\_/\_/ \__,_| |_|_| |_| |_|\__,_|_| \__| |_| |_| |_|\___| .__/
|
|
19
|
+
| |
|
|
20
|
+
AI-native Walmart Marketplace toolkit — 130 strict-zod tools |_|
|
|
21
|
+
Discovery escape hatch · Token bucket monitor · Hint-driven errors
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| | |
|
|
25
|
+
|---|---|
|
|
26
|
+
| **Install** | `npm install -g @lehaotech/walmart-mcp` |
|
|
27
|
+
| **Onboard** | `walmart-mcp setup` (7 MCP clients auto-detected) |
|
|
28
|
+
| **Self-check** | `walmart-mcp diagnose --export` |
|
|
29
|
+
| **Docs** | [Quick Start](#5-minute-quick-start) · [Tools](#modules) · [Known Issues](#known-issues) · [Contributing](./CONTRIBUTING.md) · [Architecture](./docs/architecture.md) |
|
|
30
|
+
| **Status** | v0.5.0 (npm) · 249 tests passing · 70% coverage threshold · 3 GitHub Actions workflows |
|
|
31
|
+
| **License** | MIT |
|
|
32
|
+
|
|
33
|
+
A Model Context Protocol (MCP) server for the Walmart Marketplace Seller API.
|
|
34
|
+
130 tools covering items, inventory, orders, pricing, fulfillment (WFS),
|
|
35
|
+
returns, reports, notifications, and advertising (Walmart Connect) — plus a
|
|
36
|
+
Discovery escape hatch that lets AI agents call any other Walmart endpoint
|
|
37
|
+
through the same auth + retry + rate-limit pipeline.
|
|
38
|
+
|
|
39
|
+
## 5-minute Quick Start
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 1. Install the published package
|
|
43
|
+
npm install -g @lehaotech/walmart-mcp
|
|
44
|
+
|
|
45
|
+
# 2. Run the interactive setup wizard. It will:
|
|
46
|
+
# - ask for environment + market (sandbox / production, us / mx / ca / cl)
|
|
47
|
+
# - take your Walmart Client ID + Secret (masked input)
|
|
48
|
+
# - LIVE-VALIDATE the credentials by exchanging an OAuth token
|
|
49
|
+
# - detect which MCP clients you have installed (Claude Desktop, Cursor,
|
|
50
|
+
# Cline, Continue.dev, Windsurf, Zed, Claude Code CLI) and write the
|
|
51
|
+
# walmart MCP entry into each one you pick — with automatic backup
|
|
52
|
+
walmart-mcp setup
|
|
53
|
+
|
|
54
|
+
# 3. Restart your AI client. Try a prompt like:
|
|
55
|
+
# "Show me my recent Walmart orders"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If something does not work, run the built-in self-check:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
walmart-mcp diagnose # 7-step health check
|
|
62
|
+
walmart-mcp diagnose --export # also dumps walmart-mcp-diagnose.json for bug reports
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Other subcommands: `walmart-mcp version`, `walmart-mcp help`.
|
|
66
|
+
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
- **130 tools** across 13 modules (items / inventory / orders / pricing /
|
|
70
|
+
fulfillment / returns / reports / notifications / advertising / settings
|
|
71
|
+
/ token / discovery)
|
|
72
|
+
- **Strict zod schemas on every write tool**: 54 write tools enforce Walmart
|
|
73
|
+
business rules (promo < base, `effectiveDate >= now + 4h`, refunds must be
|
|
74
|
+
negative, subscription URLs must be HTTPS, etc.) BEFORE the API call so
|
|
75
|
+
LLMs get structured validation errors and self-correct without burning
|
|
76
|
+
Walmart API quota.
|
|
77
|
+
- **LLM-friendly error responses**: every 4xx/5xx carries `endpoint`, `tool`,
|
|
78
|
+
and (for documented broken Walmart endpoints) a `hint` field with the
|
|
79
|
+
workaround the LLM should try next — backed by a single source of truth
|
|
80
|
+
`src/utils/known-issues.ts` mirrored into this README.
|
|
81
|
+
- **Token refresh, rate limiting, and retry built in**: 15-minute OAuth Bearer
|
|
82
|
+
auto-refresh, sliding-window throttle, 401 (refresh + retry once), 429
|
|
83
|
+
(rate-limit error with `retry-after`), 423 (resource lock retry), and
|
|
84
|
+
5xx (exponential backoff up to 3 retries).
|
|
85
|
+
- **Rate budget monitor**: `walmart_get_rate_budget` returns the local
|
|
86
|
+
sliding-window state plus the latest Walmart-server-reported token bucket
|
|
87
|
+
(`x-current-token-count` + `x-next-replenish-time`).
|
|
88
|
+
- **Discovery escape hatch**: `walmart_call_endpoint` + `walmart_search_endpoints`
|
|
89
|
+
cover the long tail. Same auth / retry / rate-limit pipeline as wrapped tools.
|
|
90
|
+
- **CI + sandbox + release workflows**: typecheck + tests run on every PR
|
|
91
|
+
(Node 22 + 24, Ubuntu + Windows); tag pushes auto-publish to npm with
|
|
92
|
+
provenance; weekly cron hits the real Walmart sandbox.
|
|
93
|
+
|
|
94
|
+
## Modules
|
|
95
|
+
|
|
96
|
+
| Module | Tools | Description |
|
|
97
|
+
|--------|-------|-------------|
|
|
98
|
+
| Token Management | 7 | Credentials, token lifecycle, setup guide, rate budget |
|
|
99
|
+
| Items | 12 | CRUD, taxonomy, feeds, WFS conversion |
|
|
100
|
+
| Inventory | 10 | Single/multi-node, lag time, feeds |
|
|
101
|
+
| Orders | 10 | Fulfill, ship, cancel, refund, labels |
|
|
102
|
+
| Pricing | 10 | Price updates, repricer strategies |
|
|
103
|
+
| Feeds | 5 | Submit, poll, status tracking |
|
|
104
|
+
| WFS Fulfillment | 19 | Inbound shipments, MCS, carrier booking |
|
|
105
|
+
| Returns | 8 | Approve, reject, refund, labels |
|
|
106
|
+
| Reports | 12 | On-demand, scheduled, listing quality |
|
|
107
|
+
| Notifications | 6 | Webhook subscriptions |
|
|
108
|
+
| Advertising | 25 | Campaigns, keywords, bids, analytics |
|
|
109
|
+
| Settings | 4 | Shipping, fulfillment centers, partner |
|
|
110
|
+
| **Discovery** | **2** | **`walmart_call_endpoint` + `walmart_search_endpoints`** |
|
|
111
|
+
|
|
112
|
+
## Installation
|
|
113
|
+
|
|
114
|
+
### From npm (recommended)
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm install -g @lehaotech/walmart-mcp
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The unscoped name `walmart-mcp` on npm belongs to a different author. Use the
|
|
121
|
+
scoped package above.
|
|
122
|
+
|
|
123
|
+
### From source
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git clone https://github.com/yufakang0826-hue/walmart-mcp.git
|
|
127
|
+
cd walmart-mcp
|
|
128
|
+
npm install
|
|
129
|
+
npm run build
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Configuration
|
|
133
|
+
|
|
134
|
+
The simplest path is `walmart-mcp setup` — it writes the MCP config for you and
|
|
135
|
+
validates credentials against Walmart before saving.
|
|
136
|
+
|
|
137
|
+
If you want to configure manually, the entry looks like:
|
|
138
|
+
|
|
139
|
+
```jsonc
|
|
140
|
+
{
|
|
141
|
+
"mcpServers": {
|
|
142
|
+
"walmart": {
|
|
143
|
+
"type": "stdio",
|
|
144
|
+
"command": "walmart-mcp",
|
|
145
|
+
"env": {
|
|
146
|
+
"WALMART_CLIENT_ID": "your-client-id",
|
|
147
|
+
"WALMART_CLIENT_SECRET": "your-client-secret",
|
|
148
|
+
"WALMART_ENVIRONMENT": "sandbox",
|
|
149
|
+
"WALMART_MARKET": "us"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Setup wizard auto-detects these locations:
|
|
157
|
+
|
|
158
|
+
| Client | Config path |
|
|
159
|
+
|---|---|
|
|
160
|
+
| Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
161
|
+
| Claude Desktop (Windows) | `%APPDATA%/Claude/claude_desktop_config.json` |
|
|
162
|
+
| Claude Desktop (Linux) | `~/.config/Claude/claude_desktop_config.json` |
|
|
163
|
+
| Claude Code CLI | `~/.claude.json` |
|
|
164
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
165
|
+
| Cline (VSCode) | `~/.../globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` |
|
|
166
|
+
| Continue.dev | `~/.continue/config.json` |
|
|
167
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
168
|
+
| Zed | OS-dependent, with `mcp.servers` nesting |
|
|
169
|
+
|
|
170
|
+
### Environment Variables
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Required — Marketplace API
|
|
174
|
+
WALMART_CLIENT_ID=your-client-id
|
|
175
|
+
WALMART_CLIENT_SECRET=your-client-secret
|
|
176
|
+
|
|
177
|
+
# Optional (defaults shown)
|
|
178
|
+
WALMART_ENVIRONMENT=sandbox # sandbox | production
|
|
179
|
+
WALMART_MARKET=us # us | mx | ca | cl
|
|
180
|
+
WALMART_SVC_NAME=Walmart Marketplace
|
|
181
|
+
|
|
182
|
+
# Optional — Advertising (Walmart Connect)
|
|
183
|
+
WALMART_AD_CONSUMER_ID=your-ad-consumer-id
|
|
184
|
+
WALMART_AD_PRIVATE_KEY=your-private-key
|
|
185
|
+
WALMART_AD_KEY_VERSION=1
|
|
186
|
+
|
|
187
|
+
# Logging
|
|
188
|
+
WALMART_LOG_LEVEL=info # error | warn | info | http | debug
|
|
189
|
+
WALMART_ENABLE_FILE_LOGGING=false
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Getting Walmart API Credentials
|
|
193
|
+
|
|
194
|
+
1. Sign up at [Walmart Developer Portal](https://developer.walmart.com/)
|
|
195
|
+
2. Create a new application under **Marketplace**
|
|
196
|
+
3. Copy the **Client ID** and **Client Secret**
|
|
197
|
+
4. For advertising, apply for [Walmart Connect](https://www.walmartconnect.com/) access
|
|
198
|
+
|
|
199
|
+
## Usage Examples
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
"Get all my Walmart orders from the last 7 days"
|
|
203
|
+
→ walmart_get_all_orders({ createdStartDate, createdEndDate })
|
|
204
|
+
|
|
205
|
+
"Update inventory for SKU ABC-123 to 50 units"
|
|
206
|
+
→ walmart_update_inventory({ sku, quantity })
|
|
207
|
+
|
|
208
|
+
"Submit a 7-day 20% promo on SKU XYZ starting tomorrow"
|
|
209
|
+
→ walmart_submit_promo_price_feed({ feedData: { ... } })
|
|
210
|
+
(zod refinements enforce promo<base, >=4h lead, <=180 days, etc.)
|
|
211
|
+
|
|
212
|
+
"What is my current Walmart rate-limit budget?"
|
|
213
|
+
→ walmart_get_rate_budget()
|
|
214
|
+
{ localRemaining: 996, serverTokensRemaining: 18,
|
|
215
|
+
serverReplenishTime: "2026-06-29T15:30:00Z", ... }
|
|
216
|
+
|
|
217
|
+
"Find the right Walmart tool for downloading a settlement report"
|
|
218
|
+
→ walmart_search_endpoints({ query: "settlement report" })
|
|
219
|
+
[{ wrappedTool: "walmart_create_report", signature: "POST /v3/reports/reportRequests", ... }]
|
|
220
|
+
|
|
221
|
+
"Call GET /v3/items/walmart-item/<wpid>" (no wrapped tool yet)
|
|
222
|
+
→ walmart_call_endpoint({ method: "GET", path: "/v3/items/walmart-item/123" })
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run build # tsc + tsc-alias -> build/
|
|
229
|
+
npm run dev # tsx src/index.ts (no build step)
|
|
230
|
+
npm run typecheck # tsc --noEmit
|
|
231
|
+
npm run inspect # MCP Inspector against built bin
|
|
232
|
+
npm test # vitest watch
|
|
233
|
+
npm run test:run # vitest single run (CI)
|
|
234
|
+
npm run test:sandbox # real Walmart sandbox smoke (skips when no creds)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The unit suite covers the tool dispatcher, every API module, the RSA-SHA256
|
|
238
|
+
advertising signature, the sliding-window rate limiter, the zod schemas (atom
|
|
239
|
+
+ business-rule refinements), the API client's response interceptor (401 / 429
|
|
240
|
+
/ 423 / 5xx retry + endpoint/hint injection), the known-issues lookup, the
|
|
241
|
+
endpoint catalog search, the multi-client config write, and the dispatcher's
|
|
242
|
+
zod re-parse path.
|
|
243
|
+
|
|
244
|
+
`test:sandbox` exercises ~15 read-only calls (token, partner info, items,
|
|
245
|
+
orders, returns, feeds, pricing strategies, listing quality, rate budget,
|
|
246
|
+
endpoint search) end-to-end. It requires real credentials and **skips
|
|
247
|
+
gracefully** (exit 0) when they are absent, so it is safe to run in CI.
|
|
248
|
+
|
|
249
|
+
The `sandbox.yml` workflow runs this weekly on a cron + on `workflow_dispatch`,
|
|
250
|
+
using repo secrets `WALMART_CLIENT_ID` / `WALMART_CLIENT_SECRET` (+ optional
|
|
251
|
+
Ads creds).
|
|
252
|
+
|
|
253
|
+
## Architecture
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
src/
|
|
257
|
+
├── index.ts # MCP server entry + subcommand dispatch
|
|
258
|
+
├── scripts/
|
|
259
|
+
│ ├── diagnose.ts # walmart-mcp diagnose (7-step self-check)
|
|
260
|
+
│ ├── setup.ts # walmart-mcp setup (interactive wizard)
|
|
261
|
+
│ └── client-configs.ts # 7 MCP client config paths + write helper
|
|
262
|
+
├── config/environment.ts # Config & env vars
|
|
263
|
+
├── auth/oauth.ts # OAuth 2.0 token management
|
|
264
|
+
├── utils/
|
|
265
|
+
│ ├── logger.ts # Winston logger (stderr only)
|
|
266
|
+
│ ├── rate-limiter.ts # Sliding-window + getStatus() snapshot
|
|
267
|
+
│ ├── api-error.ts # WalmartApiError w/ endpoint+tool+hint
|
|
268
|
+
│ ├── known-issues.ts # Lookup table for hint injection
|
|
269
|
+
│ ├── endpoint-catalog.ts # 40+ entries for walmart_search_endpoints
|
|
270
|
+
│ └── env-file.ts # .env upsert helper
|
|
271
|
+
├── api/
|
|
272
|
+
│ ├── client.ts # Marketplace HTTP client + interceptors
|
|
273
|
+
│ ├── index.ts # API facade (WalmartSellerApi)
|
|
274
|
+
│ ├── advertising/ # RSA-SHA256 signed Ads client + 25 methods
|
|
275
|
+
│ └── (items|inventory|orders|pricing|feeds|fulfillment|returns|reports|notifications|settings)/
|
|
276
|
+
└── tools/
|
|
277
|
+
├── index.ts # Tool registry + dispatcher
|
|
278
|
+
└── definitions/
|
|
279
|
+
├── shared-schemas.ts # 9 atomic zod schemas reused across modules
|
|
280
|
+
├── discovery.ts # walmart_call_endpoint + walmart_search_endpoints
|
|
281
|
+
└── <module>.ts # 12 per-module wrapped tools
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Known Issues
|
|
285
|
+
|
|
286
|
+
This MCP wraps Walmart's public Marketplace API. A handful of tools surface
|
|
287
|
+
known limitations from Walmart's side (broken endpoints, programs you have
|
|
288
|
+
not enrolled in) rather than MCP-side bugs. The tools are kept in place for
|
|
289
|
+
forward compatibility and will work once Walmart restores the endpoint or
|
|
290
|
+
you enroll in the program.
|
|
291
|
+
|
|
292
|
+
When these endpoints fail, the MCP error response includes a `hint` field
|
|
293
|
+
pointing the LLM at the recommended workaround. The complete list is
|
|
294
|
+
maintained in `src/utils/known-issues.ts` (single source of truth).
|
|
295
|
+
|
|
296
|
+
### Walmart-side endpoint regressions
|
|
297
|
+
|
|
298
|
+
| Tool | Symptom | Workaround |
|
|
299
|
+
| --- | --- | --- |
|
|
300
|
+
| `walmart_get_unpublished_items` | HTTP 404 from Insights `/v3/insights/items/unpublished/counts` (Aurora backend regression since 2026-05) | `walmart_get_all_items` + filter on `publishedStatus = "UNPUBLISHED"` client-side |
|
|
301
|
+
| `walmart_get_quality_categories` | HTTP 404 from Insights API | None — endpoint removed. Use `walmart_get_item_quality_details` per SKU when fixed. |
|
|
302
|
+
| `walmart_get_item_quality_details` | HTTP 405 Method Not Allowed | None right now — endpoint signature changed |
|
|
303
|
+
| `walmart_get_return_count` | HTTP 404 | Compute client-side from `walmart_get_all_returns`, group by `status` |
|
|
304
|
+
| `walmart_get_shipping_settings` | HTTP 404 | Check Seller Center settings UI manually |
|
|
305
|
+
|
|
306
|
+
### Requires seller-program enrollment
|
|
307
|
+
|
|
308
|
+
| Tool group | Requires |
|
|
309
|
+
| --- | --- |
|
|
310
|
+
| `walmart_*_repricer_*` | Walmart Repricer enrollment (Pro Seller badge usually required) |
|
|
311
|
+
| `walmart_ad_*` (25 tools) | Walmart Connect — set `WALMART_AD_CONSUMER_ID` + `WALMART_AD_PRIVATE_KEY` |
|
|
312
|
+
| `walmart_*_wfs_*` / `walmart_create_inbound_order` / `walmart_get_fulfillment_centers` etc. | Walmart Fulfillment Services (WFS) enrollment |
|
|
313
|
+
|
|
314
|
+
### Behavior to be aware of
|
|
315
|
+
|
|
316
|
+
| Tool | Note |
|
|
317
|
+
| --- | --- |
|
|
318
|
+
| `walmart_get_wfs_returns` | Sends the documented `GET /v3/returns?isWFSEnabled=Y` call. For sellers **without** WFS enrollment, Walmart returns the unfiltered return set (same data as `walmart_get_all_returns`). Upstream behavior, not an MCP defect. |
|
|
319
|
+
|
|
320
|
+
### Region restrictions
|
|
321
|
+
|
|
322
|
+
Walmart's Insights API (which `walmart_get_listing_quality` is built on) is
|
|
323
|
+
US-Marketplace exclusive. Setting `WALMART_MARKET=mx|ca|cl` will surface a
|
|
324
|
+
Walmart 404 on these calls; switch back to `us` to use them.
|
|
325
|
+
|
|
326
|
+
If you hit something that is not on this list, open an issue with the tool
|
|
327
|
+
name, the arguments, and the full error response (`walmart-mcp diagnose
|
|
328
|
+
--export` produces a JSON dump suited for attachments).
|
|
329
|
+
|
|
330
|
+
## Contributing
|
|
331
|
+
|
|
332
|
+
PRs welcome. Before opening:
|
|
333
|
+
|
|
334
|
+
1. `npm run typecheck && npm run test:run && npm run build` must all pass.
|
|
335
|
+
2. New tools should follow the strict-zod-schema pattern in
|
|
336
|
+
`src/tools/definitions/<module>.ts`. The dispatcher (`src/tools/index.ts`)
|
|
337
|
+
re-parses args through the schema before calling the API layer.
|
|
338
|
+
3. Walmart-side regressions belong in `src/utils/known-issues.ts` with a
|
|
339
|
+
matching workaround hint — keep this file aligned with the README "Known
|
|
340
|
+
Issues" section.
|
|
341
|
+
|
|
342
|
+
## License
|
|
343
|
+
|
|
344
|
+
MIT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type WalmartConfig } from '../../config/environment.js';
|
|
2
|
+
export declare class WalmartAdClient {
|
|
3
|
+
private config;
|
|
4
|
+
private http;
|
|
5
|
+
private accessToken;
|
|
6
|
+
private tokenExpiry;
|
|
7
|
+
private rateLimiter;
|
|
8
|
+
constructor(config: WalmartConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Serialize request params into a query string deterministically (insertion
|
|
11
|
+
* order, scalars and arrays). Used to embed params into the request URL so
|
|
12
|
+
* the signed URL is byte-for-byte identical to what is actually sent —
|
|
13
|
+
* Walmart Connect validates the signature against the full request URL,
|
|
14
|
+
* including the query string.
|
|
15
|
+
*/
|
|
16
|
+
private serializeParams;
|
|
17
|
+
private generateSignature;
|
|
18
|
+
private getAccessToken;
|
|
19
|
+
private setupInterceptors;
|
|
20
|
+
get<T = unknown>(endpoint: string, params?: object): Promise<T>;
|
|
21
|
+
post<T = unknown>(endpoint: string, data?: object): Promise<T>;
|
|
22
|
+
put<T = unknown>(endpoint: string, data?: object): Promise<T>;
|
|
23
|
+
delete<T = unknown>(endpoint: string, params?: object): Promise<T>;
|
|
24
|
+
}
|