韦格曼mcp
一个MCP(模型上下文协议)服务器,允许AI助手与Wegmans杂货店进行交互。通过自然语言搜索产品、查找商店位置、管理购物车和访问购买历史记录。
它做什么
该服务器连接到Wegmans的Algolia搜索API和商业后端,以公开12个工具:
| 工具 | 身份验证? | 描述 |
|---|---|---|
search_products | 否 | 包含价格、过道位置、图片、评级的全文产品搜索 |
get_product_details | 否 | 按ID详细查找产品 |
browse_category | 否 | 按部门浏览(生产、熟食、烘焙等) |
find_stores | 否 | 按城市、州或邮政编码查找店铺编号 |
get_my_items | 否 | 您最常购买的商品,按购买频率排名 |
add_to_cart | 是 | 将产品添加到您的Wegmans购物车 |
get_cart | 是 | 查看当前购物车内容 |
refresh_my_items | 否 | 从浏览器捕获更新购买历史记录(旧版) |
sync_purchase_history | 是 | 从收据、订单和排名中获取完整的购买历史记录 |
get_purchase_patterns | 不\* | 分析你购买每件商品的频率以及何时会再次需要它 |
get_shopping_suggestions | 不\* | 智能购物清单——按紧急程度排序的您可能需要的物品 |
get_product_history | 不\* | 特定产品的完整购买时间表 |
*\*从同步的本地数据中读取 sync_purchase_history.*
未经身份验证的工具可以开箱即用,不需要帐户。购物车和同步操作需要您的Wegmans凭据。
设置
git clone https://github.com/BrianVia/wegmans-mcp.git
cd wegmans-mcp
npm install
npm run build添加到克劳德代码
{
"mcpServers": {
"wegmans": {
"command": "node",
"args": ["/path/to/wegmans-mcp/dist/index.js"],
"env": {
"WEGMANS_STORE": "133"
}
}
}
}添加到克劳德桌面
{
"mcpServers": {
"wegmans": {
"command": "node",
"args": ["/path/to/wegmans-mcp/dist/index.js"],
"env": {
"WEGMANS_STORE": "133",
"WEGMANS_EMAIL": "your-email@example.com",
"WEGMANS_PASSWORD": "your-password",
"WEGMANS_CUSTOMER_ID": "your-customer-uuid"
}
}
}
}环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
WEGMANS_STORE | 否 | 您的店铺号(默认值: 133).使用 find_stores 看看你的。 |
WEGMANS_EMAIL | 购物车操作 | 您的wegmans.com帐户电子邮件 |
WEGMANS_PASSWORD | 购物车操作 | 您的wegmans.com帐户密码 |
WEGMANS_CUSTOMER_ID | 对于购物车操作 | 您的Wegmans客户UUID(请参阅 查找您的客户ID) |
查找您的店铺编号
每个Wegmans都有一个数字商店ID,用于定价、库存和过道位置。
普通商店:
| 店铺 | 编号 |
|---|---|
| 弗吉尼亚州尚蒂伊(14361纽布鲁克博士) | 133 |
| 弗吉尼亚州雷斯顿(霍珀街11950号) | 146 |
使用 find_stores 查找他人的工具,或:
> find_stores("Reston")
Reston, VA — Store #146 — 11950 Hopper St., Reston, VA 20191
> find_stores("VA")
Dulles #7, Fairfax #16, Chantilly #133, Reston #146, Tysons #115, ...商店编号决定了哪些产品可用,您看到的价格以及退回的过道位置。商店有不同的库存,所以这很重要。
查找您的客户ID
您的客户ID是Wegmans分配给您帐户的UUID。要找到它:
- 登录 wegmans.com
- 打开DevTools(F12)→ 网络选项卡
- 搜索任何请求
algolia.net - 寻找
userToken在请求正文中,这是您的客户ID
它看起来像: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (UUID)
使用示例
搜索产品
搜索返回产品名称、店内和配送价格、过道位置、图像、评级、过敏原信息等。
> search_products("lactose free 2% milk")
1. fairlife 2% Reduced Fat Ultra-Filtered Milk, Lactose Free — $5.49 (Aisle: Dairy)
2. Lactaid Milk, Reduced Fat, 2% Milkfat — $5.99 (Aisle: Dairy)
3. Wegmans 2% Reduced Fat Lactose Free Milk — $3.79 (Aisle: Dairy)
4. Organic Valley Milk, Lactose Free, Reduced Fat, 2% — $6.29 (Aisle: Dairy)> search_products("bananas", { max_results: 2 })
1. Bananas, Sold by the Each — $0.19 ($0.49/lb.) — Aisle: Produce
2. Organic Bananas, Bunch — $1.38 ($0.69/lb.) — Aisle: Produce将商品添加到购物车
这 add_to_cart 该工具获取产品ID(来自搜索结果)和数量。它会查找完整的产品详细信息,与Wegmans进行身份验证,并将其添加到您的真实购物车中。
> add_to_cart("92685", 5)
Added to cart: 5x Bananas, Sold by the Each ($0.19 each)
> add_to_cart("116893", 1)
Added to cart: 1x Lactaid Milk, Reduced Fat, 2% Milkfat ($5.99 each)物品累积——每次添加都会先读取现有的购物车,然后将新物品合并进来,这样你就不会丢失已经存在的东西。
查看您购买最多的商品
这 get_my_items 该工具返回按频率排列的购买历史记录。这非常适合构建每周购物清单,或者让人工智能建议你可能需要什么。
> get_my_items({ limit: 10 })
Your top 10 most-purchased items (out of 546 total):
1. Wegmans Grade AA Large Eggs, 18 Count — $2.49 (Aisle: Dairy)
2. Lactaid Milk, Reduced Fat, 2% Milkfat — $5.99 (Aisle: Dairy)
3. Bananas, Sold by the Each — $0.19 (Aisle: Produce)
4. Large Fresh Limes — $0.50 (Aisle: Produce)
5. Strawberries — $2.99 (Aisle: Produce)
6. Wegmans Organic Lemonade — $3.49 (Aisle: 18A)
7. Wegmans Cherry Tomatoes on the Vine, Flavor Bombs — $5.79 (Aisle: Produce)
8. Wegmans Pancake Mix — $2.29 (Aisle: 11B)
9. Lemons — $0.69 (Aisle: Produce)
10. MadeGood Mornings Soft Baked Blueberry Flavor Oat Bars — $4.49 (Aisle: 04B)批量添加您的常规项目
AI助手可以结合 get_my_items 随着 add_to_cart 快速构建您的每周购物车:
"Add my regular top 10 shopping items"
OK — Wegmans Grade AA Large Eggs, 18 Count (10 items in cart)
OK — Lactaid Milk, Reduced Fat, 2% Milkfat (10 items in cart)
OK — Bananas, Sold by the Each (10 items in cart)
OK — Large Fresh Limes (10 items in cart)
OK — Strawberries (10 items in cart)
...购买情报——“本周我需要什么?”
真正的力量:同步你的完整购买历史,然后让人工智能找出你需要什么。
第一步:同步您的历史记录 (从Wegmans获取63+收据和71+订单)
> sync_purchase_history
Purchase history synced:
- 63 in-store receipts (862 line items)
- 71 online orders (1238 line items)
- 2100 total purchase events
- 818 unique products tracked第二步:看看你的模式
> get_purchase_patterns({ product_name: "milk" })
1. [~] Milk, Reduced Fat, 2% Milkfat (Dairy)
53 purchases | Every ~7 days | Last: 1d ago | Due in 6d
> get_purchase_patterns({ urgency: "overdue" })
1. [!!] Clementines, Bagged (Produce) — 68d ago, usually every 26d (42d overdue)
2. [!!] Whipped Cream Cheese Spread (Dairy) — 63d ago, usually every 24d (39d overdue)
...第三步:制定一份明智的购物清单
> get_shopping_suggestions({ lookahead_days: 7 })
1. [!!] Clementines, Bagged (Produce) [ID: 44091]
Last bought 68 days ago, you usually buy every 26 days (42 days overdue)
2. [!!] Cream Cheese Icing Cinnamon Rolls (Dairy) [ID: 139106]
Last bought 38 days ago, you usually buy every 24 days (15 days overdue)
3. [!] Bananas, Sold by the Each (Produce) [ID: 92685]
Last bought 5 days ago, you usually buy every 8 days (due in 3 days)第四步:深入了解特定产品
> get_product_history({ product_id: "116893" })
## Milk, Reduced Fat, 2% Milkfat (ID: 116893)
You buy this roughly every 7 days (based on 53 purchases). Last bought 1 day ago.
Summary: 53 purchases | Total spent: $351.49 | Avg per trip: $6.63
| Date | Qty | Price | Source | Store |
|------------|-----|--------|---------|-------|
| 2026-04-04 | 2 | $13.78 | order | - |
| 2026-03-26 | 1 | $6.89 | order | - |
| 2026-03-21 | 1 | $6.89 | order | - |
| ... | | | | |杀手组合:问人工智能助手“将本周我需要的一切添加到我的购物车中”——它调用 get_shopping_suggestions 然后 add_to_cart 对于每个项目。
传统:从浏览器刷新我的项目
这 refresh_my_items 该工具仍然适用于更新基于Algolia的频率排名。有关带有时间戳和模式的完整购买历史记录,请使用 sync_purchase_history 相反。
建筑
src/
index.ts # MCP server — tool definitions and handlers
algolia.ts # Algolia product search client
auth.ts # Azure AD B2C OAuth authentication (PKCE flow)
cart.ts # Cart operations (add to cart, get cart, product lookup)
stores.ts # Store locator (fetches from wegmans.com/api/stores)
receipts.ts # In-store receipt fetcher (63+ receipts with item detail)
orders.ts # Online order fetcher (71+ orders with line items)
my-items-api.ts # Wegmans My Items API (ranked list with lastPurchasedDate)
purchase-history.ts # Unified data layer — merges all sources, persists locally
patterns.ts # Pure analysis — intervals, predictions, shopping suggestions
my-items.ts # Query Algolia for scored product lists
refresh-my-items.ts # Parse and save purchase history data
data/
purchase-history.json # Unified purchase timeline (gitignored)
my-items.json # Legacy Algolia-based frequency cache (gitignored)
docs/
api-reference.md # Documented Wegmans API endpoints运作原理
产品搜索 使用他们的公共搜索API密钥直接点击Wegmans的Algolia指数。无需身份验证。每种产品都有特定于商店的定价、过道位置和可用性,因此 WEGMANS_STORE 设置事项。
购物车操作 使用Wegmans的商务API api.digitaldevelopment.wegmans.cloud身份验证通过Azure AD B2C和PKCE OAuth流进行——服务器处理完整的登录流(GET授权页面→ POST凭据→ GET身份验证码→ 交换令牌)并缓存访问令牌,直到其过期。
购买情报 同步三个API源:
/commerce/receipts--63+店内收据,包含商品级别的详细信息(产品、数量、价格、时间戳、店铺)/commerce/order/orders/{id}--71+在线订单/commerce/my-items--排名产品列表lastPurchasedDate
这些被合并到一个统一的时间线中 data/purchase-history.jsonThe patterns.ts 该模块使用中位数(对异常值具有鲁棒性)计算每种产品的购买间隔,对紧急情况进行分类,并生成购物建议。您停止购买的商品会被自动过滤掉。
存储感知数据
所有产品数据都是特定于商店的。同一产品在不同商店的价格、过道位置和可用性可能不同:
- 133号店(弗吉尼亚州尚蒂伊):香蕉售价0.49美元/磅,过道:农产品
- 146号商店(弗吉尼亚州雷斯顿):相同的产品,可能不同的过道位置
这 WEGMANS_STORE env变量(或 store_number 每个工具上的参数)控制您看到的存储数据。
API详细信息
看 docs/api-reference.md 有关此服务器使用的Wegmans API的完整文档,包括:
- Algolia产品搜索(公开,无身份验证)
- 存储定位器API(公共,无身份验证)
- 购物车管理API(认证)
- Azure AD B2C身份验证流程
速率限制
来自Wegmans的回复标题:
- 产品搜索(Algolia):每个时段50000个电话
- 购物车API:每个周期5000个呼叫
局限性
- 无优惠券管理 --Algolia数据包括数字优惠券ID,收据显示折扣金额,但剪切/应用优惠券尚未实现。
- 每个购物车的单一履行类型 -购物车API将每个购物车与一种履行类型(店内、提货或交货)联系起来。
- 图案精度取决于数据 --购买次数少于3次的产品不会得到间隔预测。您停止购买的商品将在通常间隔的3倍或90天后被过滤掉,以先到者为准。
- 同步是显式的 --你必须打电话
sync_purchase_history以获取新数据。没有背景调查。
现有技术
该项目由 韦格曼购物 该项目使用Playwright通过Algolia拦截来抓取产品数据。该MCP服务器采用了不同的方法-在没有浏览器的情况下直接访问Algolia进行搜索,并使用商业API进行购物车操作。
许可证
国际学生中心
