walmart-mcp

walmart-mcp

A MCP server for Walmart Marketplace and Affiliate APIs, enabling sellers to manage items, inventory, prices, and orders, and consumers to search, lookup products, reviews, and store locations.

Category
访问服务器

README

walmart-mcp

A TypeScript Walmart API client, delivered as an MCP server (stdio) with a reusable SDK underneath. It wraps two Walmart APIs behind one client:

  • Marketplace (seller) — manage your Walmart Marketplace catalog: items, inventory, prices, and orders. OAuth 2.0.
  • Affiliate / Catalog (consumer) — search the public Walmart catalog: product search, lookup, taxonomy, trending, reviews, and store locator. Read-only, RSA-signature auth.

Configure either or both surfaces. Tools register only for the surfaces you've configured.

Why this one

  • Importable SDK, not just a server. client/ + api/ are a standalone, fully unit-tested Walmart SDK with zero MCP knowledgeimport { WalmartSdk } and use it in any Node project. The MCP server is a thin wrapper.
  • Minimal footprint. Two runtime deps total (@modelcontextprotocol/sdk + zod). RSA signing and correlation UUIDs use Node's built-in crypto; .env is loaded via --env-file, no dotenv/node-rsa/uuid.
  • Two auth schemes done right. Marketplace's OAuth token is cached and auto-refreshed on 401; the Affiliate signature is regenerated (with a fresh timestamp) on every request.
  • Curated outputs. Search/list tools return compact, schema-validated structuredContent instead of raw, deeply-nested Walmart payloads, so agents don't shell out to parse JSON.

Which surface do I want?

You are… Use Credentials from Auth
A Walmart seller managing your listings/orders Marketplace developer.walmart.com → API Key Management OAuth 2.0 (Client ID + Secret)
An affiliate / app reading the public catalog Affiliate walmart.io (program approval required) RSA signature (Consumer ID + private key)

Setup

1. Install & build

npm install
npm run build

2. Configure credentials

cp .env.example .env   # then fill in whichever surface(s) you use
# Marketplace (seller)
WALMART_CLIENT_ID=...
WALMART_CLIENT_SECRET=...

# Affiliate / Catalog (consumer)
WALMART_CONSUMER_ID=...
WALMART_PRIVATE_KEY=...        # single-line Base64 PKCS#8 from the portal (or a full PEM)
WALMART_KEY_VERSION=1

The server reads credentials from its environment; it does not auto-load .env. Your MCP client supplies them via the config env block (step 4). For the CLI and standalone runs, Node's --env-file=.env loads them (the npm run check / npm start scripts do this).

Notes:

  • Private key handling. WALMART_PRIVATE_KEY accepts the single-line Base64 key the Walmart.io portal issues, or a full -----BEGIN PRIVATE KEY----- PEM. It's never logged. The matching public key is uploaded to the portal; WALMART_KEY_VERSION is shown next to it.
  • Marketplace tokens are short-lived (~15 min) and cached in your OS data dir ($XDG_DATA_HOME/walmart-mcp on Unix, %APPDATA%\walmart-mcp on Windows; files chmod 0600), then auto-refreshed on use.

3. Validate (optional but recommended)

npm run check

Mints a Marketplace token (proves CLIENT_ID/SECRET) and signs a live Affiliate request (proves CONSUMER_ID + private key), skipping whichever surface you didn't configure. Expected output:

Marketplace  validating OAuth client credentials… OK
Affiliate    signing a taxonomy request… OK
✅ Configured surfaces validated. The MCP server reuses these same credentials.

4. Register with your MCP client

{
  "mcpServers": {
    "walmart": {
      "command": "node",
      "args": ["/absolute/path/to/walmart-mcp/dist/mcp/server.js"],
      "env": {
        "WALMART_CLIENT_ID": "...",
        "WALMART_CLIENT_SECRET": "...",
        "WALMART_CONSUMER_ID": "...",
        "WALMART_PRIVATE_KEY": "...",
        "WALMART_KEY_VERSION": "1"
      }
    }
  }
}

5. Run

Your MCP client launches node dist/mcp/server.js, injects the env vars, and the server registers the tools for each configured surface. (To run standalone for testing: npm start.)

Tools

Affiliate / Catalog (read-only)

Tool Purpose
affiliate_search Full-text catalog search (compact results)
affiliate_product_lookup Look up products by item id(s), UPC, or GTIN
affiliate_taxonomy The catalog category tree
affiliate_trending Currently trending products
affiliate_reviews Customer reviews for a product
affiliate_stores Walmart stores near a lat/long, city, or ZIP

Marketplace (seller)

Tool Auth Purpose
mp_get_items OAuth List your catalog (compact, cursor-paginated)
mp_get_item OAuth One catalog item by SKU
mp_get_inventory OAuth A SKU's on-hand inventory
mp_update_inventory OAuth Write: set a SKU's available quantity
mp_update_price OAuth Write: update a SKU's price
mp_get_orders OAuth List orders by date/status (compact, cursor-paginated)
mp_get_order OAuth One order by purchaseOrderId
mp_acknowledge_order OAuth Write: acknowledge an order (required before shipping)

Search/list tools return compact, structured results (structuredContent validated by an output schema) — just the fields the workflow needs — rather than the raw, deeply-nested Walmart payload.

Troubleshooting

Symptom Cause / fix
Server logs "No Walmart credentials found" Neither surface configured. Fill the config env block (MCP) or .env (standalone).
A tool returns "… credentials are not configured" That surface's env vars are missing; the other surface still works.
401 / token errors on Marketplace Client ID/Secret wrong or revoked. Re-check with npm run check. The client already refreshes a normal expiry automatically.
401 / signature errors on Affiliate Wrong Consumer ID, key version, or private key; or large clock skew (timestamp TTL ≈ 180s). Verify with npm run check.
"Could not parse the affiliate private key" WALMART_PRIVATE_KEY isn't the Base64 PKCS#8 portal key or a valid PEM.
MCP server won't start / behaves like old code dist/ is missing or stale — the MCP launch runs the built file and does not auto-build. Run npm run build.
--env-file=.env errors with ENOENT .env doesn't exist. cp .env.example .env and fill it in.

Development

npm test         # vitest (fetch mocked, throwaway RSA keypair) — no credentials needed
npm run typecheck
npm run build    # also runs on install (prepare) and before start/check

Architecture

src/
  client/   WalmartClient, marketplaceAuth (OAuth), affiliateAuth + signature (RSA),
            tokenStore, correlation, errors
  api/      marketplace/{items,inventory,prices,orders}, affiliate/catalog   (zero MCP knowledge)
  types/    request/response shapes
  mcp/      server.ts (stdio) + config.ts + tools.ts + format.ts
  sdk.ts    WalmartSdk facade

The client/ + api/ layers are a standalone SDK, fully unit-tested with fetch mocked; mcp/ is a thin wrapper. Import the SDK directly via the package root (WalmartSdk).

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选