mcp-recipe-shopping-list
Recipe Shopping List — MCP 服务器
MCP 服务器(Model Context Protocol),能够:
从 food.ru 读取食谱 — 通过链接获取食材、步骤、营养成分
在 magnit.ru 搜索商品 — 结合具体门店
生成购物清单 — 根据食谱找到带价格的商品并计算总计
显示门店信息 — 通过门店代码
结果:您提供食谱链接 — 即可获得现成的购物清单, 包含来自 Магнит 的价格和商品直链。
🎓 教学项目: 该项目用于教授零售连锁店的品类经理如何创建 MCP 服务器。这是一个完整的实践案例:从构思和技术规格书到可运行的、由 AI 助手使用的 MCP 服务器。学员在 AI 代理的帮助下构建一个可用的应用——解析 food.ru 上的食谱、在 magnit.ru 上搜索商品、生成带价格的购物清单——并在一次课程时间内获得积极成果。
🌐 网页版: 除了 MCP 接口外,还有一个本地网页界面——它不需要 MCP 客户端,在浏览器中即可运行。一条命令启动:
./start.sh # запустить и открыть страницу в браузере (http://127.0.0.1:8000)
./stop.sh # остановить сервер在网页版中,您可以粘贴食谱链接,获得购物清单表格, 并将其保存为 Excel。详情见 网页界面 一节。
安装
快速方式:install.py 安装器
脚本 install.py(仅使用 Python 标准库——无需额外安装任何东西)会自行完成一切:创建虚拟环境、安装依赖和 Playwright 浏览器、创建 .env、将服务器注册到所选的 MCP 客户端,并检查一切是否正常。
需要 Python 3.11+(推荐使用 uv——安装器会同时找到 uv 和普通 Python)。
python install.py # или: python3 install.py所有标志均为可选:
标志 | 作用 |
| 对所有问题使用默认值回答 |
| Магнит 的门店代码(默认 543440) |
| 门店类型(默认 dostavka) |
| 将服务器注册到哪些 MCP 客户端(逗号分隔) |
| 不下载 Chromium 浏览器 |
| 重新创建 |
| 仅检查环境——不做任何更改 |
| 项目文件夹(默认为安装器所在文件夹) |
示例:
python install.py --check # проверка окружения без изменений
python install.py --yes # установка «на все по умолчанию»
python install.py --shop-code 992301 --clients opencode,claude手动方式
需要 Python 3.11+(推荐使用 uv)。
# 1. Виртуальное окружение и зависимости
uv venv --python 3.11 .venv
uv pip install --python .venv/bin/python -r requirements.txt
# 2. Браузер для Playwright (оба сайта — SPA, без браузера никак)
.venv/bin/python -m playwright install chromium
# 3. Секреты
cp .env.example .env # при необходимости поправь код магазина по умолчаниюRelated MCP server: Recipe Commerce Intelligence MCP
启动
.venv/bin/python src/server.py服务器通过 stdio 的 MCP 协议工作——由 AI 助手(Claude Desktop、LM Studio 等)调用,它自身在终端中“保持沉默”。
网页界面
网页版是针对不想连接 MCP 客户端的用户的本地网页:粘贴食谱链接——即可获得购物清单表格和保存为 Excel 的按钮。
启动(服务器会自己在浏览器中打开页面):
./start.sh # запустить и открыть браузер
./stop.sh # остановить сервер如果服务器已在运行,再次执行 ./start.sh 只会打开页面。手动方式(如果脚本不适合):
.venv/bin/python src/web/server.py在浏览器中打开:http://127.0.0.1:8000
页面的功能:
粘贴 food.ru 的食谱链接并点击按钮——服务器会生成购物清单(请求网站需要 30–90 秒,期间显示加载指示器);
显示表格:食材、数量、Магнит 中的商品、价格、需购买数量、合计、商品链接;
通过「保存为 Excel」按钮将清单保存为 Excel 文件。
Excel 文件保存在项目根目录的 exports/ 文件夹中(文件名格式为 shopping_list_<рецепт>_<дата>.xlsx)。
连接 OpenCode
在 ~/.config/opencode/opencode.jsonc(全局)或项目根目录的 opencode.json 中添加 mcp 部分——格式与 Claude Desktop 不同(键为 mcp,command 为数组,变量为 environment):
{
"mcp": {
"recipe-shopping-list": {
"type": "local",
"command": [
"/ПОЛНЫЙ/ПУТЬ/К/MCP_rec/.venv/bin/python",
"/ПОЛНЫЙ/ПУТЬ/К/MCP_rec/src/server.py"
],
"environment": {
"MAGNIT_SHOP_CODE": "543440",
"MAGNIT_SHOP_TYPE": "dostavka",
"LOG_LEVEL": "INFO"
},
"enabled": true
}
}
}重启 OpenCode 后,服务器将出现在 MCP 列表中(应用内使用 /mcp 命令)。在通过 OpenCode.app 安装的版本中,从终端运行(opencode mcp list)不可用——CLI 是 Electron 封装。
连接 Claude Desktop
在 claude_desktop_config.json 中添加(路径必须是绝对路径):
{
"mcpServers": {
"recipe-shopping-list": {
"command": "/ПОЛНЫЙ/ПУТЬ/К/MCP_rec/.venv/bin/python",
"args": ["/ПОЛНЫЙ/ПУТЬ/К/MCP_rec/src/server.py"],
"env": {
"MAGNIT_SHOP_CODE": "543440",
"MAGNIT_SHOP_TYPE": "dostavka",
"LOG_LEVEL": "INFO"
}
}
}
}工具
工具 | 作用 |
| 来自 food.ru 的食谱:食材、步骤、营养成分 |
| 在 magnit.ru 上搜索商品 |
| 带价格和总计的购物清单 |
| 门店信息 |
示例
«这是食谱:https://food.ru/recipes/269806-sous-iz-iogurta-s-ukropom-i-chesnokom-1766588076»
代理将调用 get_shopping_list 并返回:
Греческий йогурт — 100г → Йогурт греческий Teos 2% 140г — 89,90 ₽ [ссылка]
Чеснок — 2 зубчик =10г → Чеснок свежий 100г — 45,00 ₽ [ссылка]
...
Итого: 356,70 ₽ · 6 товаров测试
快速逻辑测试(不访问网站——解析器用 mock 代替):
.venv/bin/python -m pytest tests/ -v实时集成测试——通过 Playwright 真实打开 food.ru 和 magnit.ru,就像工作服务器一样(约 1 分钟,请求之间带停顿):
.venv/bin/python -m pytest -m integration -v实时测试规则:网站不可访问(网络问题)——测试跳过;网站有响应但结构不符——测试失败(页面结构已更改,该更新选择器并记录经验到 LESSONS.md 了)。
结构
src/
├── server.py # Точка входа MCP-сервера
├── tools/ # MCP-инструменты (бизнес-логика)
├── integrations/ # Парсеры сайтов (Playwright)
├── models/ # Pydantic-модели
├── utils/ # Кэш, ограничитель запросов, валидаторы
└── config/ # Настройки (.env) и селекторы重要须知
这两个网站(food.ru、magnit.ru)都是 SPA:数据通过 JavaScript 加载。因此解析器使用 Playwright(无头浏览器)工作,而不是简单的 HTTP。
对网站的请求之间会有 2–5 秒的停顿,结果会被缓存(食谱缓存 24 小时,商品缓存 15 分钟)。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server for the Pepesto API — give your agent the ability to turn any recipe (a URL, plain text, or a photo) into a matched basket of real supermarket products with live prices, across 26 European supermarkets. The MCP covers the recipe → matched cart half of the grocery shopping workflow (parse / search / map ingredients to SKUs / check catalogs).7815MIT
- AlicenseAqualityDmaintenanceExtracts branded ingredients and kitchen tools from recipes, matches them to affiliate products, and generates shoppable ingredient lists to turn recipes into affiliate revenue.3481MIT
- FlicenseNot gradedqualityDmaintenanceEnables cross-store price comparison and recipe-driven cart automation for Israeli grocery stores Shufersal and Tiv Taam, with an extensible architecture for additional stores.
- AlicenseNot gradedqualityFmaintenanceEnables automated weekly meal planning and grocery price comparison across Swedish supermarkets through a Claude/GPT interface.3MIT
Related MCP Connectors
Search direct grocery storefronts and create product-link pickup handoffs.
Shopping MCP for AI agents: search, compare, Amazon buy links. Auto-register.
Agent-native product catalog for AI shopping agents. 296M+ products, 28 countries.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/KrivchenkoEgor/mcp-recipe-shopping-list'
If you have feedback or need assistance with the MCP directory API, please join our Discord server