Back to MCP directory
publicPublicdnsLocal runtime

groceries-mcp

一个连接不同杂货供应商API的MCP服务器,提供商品搜索和购物车更新功能

article

README

🚀 食品杂货 MCP 服务器

本项目的食品杂货 MCP 服务器,能够实现自动创建购物车以及食品杂货搜索功能,为用户提供便捷的购物体验。

🚀 快速开始

若要使用此服务器,需进行环境变量配置,可参考“设置”章节的内容。配置完成后,可根据需求进行本地使用或在 Claude Desktop 中使用,同时也能通过 Docker 进行构建。

✨ 主要特性

  • 自动购物车创建:根据提供的商品列表将商品添加到购物车中。
  • 食品杂货搜索:通过 vendors API 查找食品杂货。

📦 安装指南

环境变量配置

Rami Levy

  1. 登录到 Rami Levy 网站。
  2. 在开发者工具(按 F12)中执行以下代码:
    const state = JSON.parse(localStorage.ramilevy);
    console.log({
        "VENDOR_ACCOUNT_ID": state.authuser.user.id,
        "VENDOR_API_KEY": state.authuser.user.token,
    });
    
  3. 使用打印出的值替换环境变量。

本地使用

  1. 使用 env.template 更新 .env 文件(需要 Gemini)。
  2. 更新 grocery.txt
  3. 运行 make compile start_agent

使用 Claude Desktop

要在 Claude Desktop 中使用此 MCP 服务器,请在您的 claude_desktop_config.json 中添加以下内容:

UV

{
  "mcpServers": {
    "groceries": {
      "command": "uv",
      "args": [
        "run",
        "mcp-groceries-server",
        "--vendor",
        vendorName # 示例:rami-levy, keshet 等
      ],
      "env":{
        "VENDOR_API_KEY": "<YOUR_API_TOKEN>",
        "VENDOR_ACCOUNT_ID": "<VENDOR_ACCOUNT_ID>"
      }
    }
  }
}

📚 详细文档

工具

  1. add_items_to_cart
    • 功能:将商品添加到购物车中。
    • 输入
      • items(list[CartItemScheam]): 要添加到购物车中的商品。
    • 输出:更新后的购物车。
  2. search
    • 功能:在 vendor 中查找商品。
    • 输入
      • item (string): 要查找的商品。
    • 输出:与搜索词对应的商品列表。

📦 构建

Docker 构建命令:

docker build -t mcp-groceries-server .

📄 许可证

此 MCP 服务器根据 MIT License 分发。这意味着您可以自由使用、修改和分发软件,但需遵守 MIT License 的条款和条件。有关详细信息,请参阅项目仓库中的 LICENSE 文件。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client