Skip to main content

FoodCalorie MCP Server

Chinese food & restaurant-chain nutrition data for AI agents — 6 MCP tools so your agent stops guessing how many calories are in a Luckin coconut latte.

Python MCP SDK License PyPI version PyPI downloads

English · 中文


English

Why this exists

English nutrition data is everywhere — OpenFoodFacts, USDA, MyFitnessPal. Chinese chain-restaurant menu data is not. Ask an agent "how many calories in a Luckin coconut latte?" and it will either hallucinate a number or hand you a US Starbucks value as if it were the same thing.

This server gives your agent the actual data, with source links, and — just as importantly — tells it when a field is missing instead of inventing one.

Install

Three ways in. Pick whichever fits your client.

1. Bundle (closest to one click) — build foodcalorie-mcp-0.1.4.mcpb from the source distribution and open it with Claude Desktop. No JSON, no terminal. Needs uv on your machine; the bundle installs the released package on first run. See Build the bundle for the one command.

2. pip

pip install foodcalorie-mcp

Mirror lag: Aliyun/Tsinghua mirrors can be a few days behind. To get the current version immediately, add --index-url https://pypi.org/simple.

3. uvx (no install step)

uvx --from foodcalorie-mcp foodcalorie-mcp

4. Docker — temporarily unavailable

docker run -i --rm ghcr.io/jihaochang1/foodcalorie-mcp:0.1.4

The image lives in GitHub Container Registry, and the registry account is currently suspended, so this command returns 401. The dataset ships inside the image and the server makes no outbound requests, so it will run correctly with --network none once the registry is reachable again. Until then use pip or uvx above — same data, same tools.

Configure

{
  "mcpServers": {
    "foodcalorie": {
      "command": "python",
      "args": ["-m", "foodcalorie_mcp.server"]
    }
  }
}

Works with Claude Desktop, Cursor, Cline, WorkBuddy — anything that speaks MCP over stdio.

Tools

Tool What it does
search_food_by_name Primary lookup. Keyword search, Chinese or English, brand-aware (瑞幸, luckin, 蜜雪)
get_daily_nutrition_summary Sum a day's intake and show % of daily reference values
compare_foods Side-by-side macro comparison across several items
list_foods_by_category Browse by category (drinks / fast food / snacks / dairy / fruit…)
get_health_tip Short dietary note for a given food
search_food_by_barcode Barcode lookup — see caveat below before relying on it

⚠️ Barcode caveat (read this first)

The free database is keyed on example barcodes (6901234567890-style sequential placeholders), not real EAN codes printed on packaging. So:

  • Scanning a real product barcode will not find it — that is not a bug, there is simply no real-barcode mapping in the free set.
  • Use search_food_by_name or list_foods_by_category instead.
  • search_food_by_barcode is kept for signature compatibility and for you to load your own mapping into.

We put this at the top rather than let you discover it after installing.

Data coverage (stated honestly)

Free tier: 103 items, calories/protein/fat/carbs 103/103.

Pro tier: 116 items across 14 Chinese chains — calories 116/116, official source link 116/116, but macros are only present where the official page actually publishes them:

Field Coverage
Calories · source link · brand · item name 116 / 116
Protein 59 / 116
Fat 61 / 116
Carbs 54 / 116
Sugar 15 / 116
Sodium 4 / 116
Caffeine 21 / 116
Allergens 0 — not provided

If you need "all 20 fields filled on every row", this is not that product — datasets like that are mostly fabricated. If you need "present means real, absent means absent", that is exactly the design premise here.

Pricing

Channel Price Delivery
Agensi (overseas, recommended) $6.99 USD one-time Instant, auto-delivered → https://www.agensi.io/skills/foodcalorie-pro-data
Direct (Alipay / WeChat, China) ¥29 early bird → ¥49 Manual, within 12h → https://foodcalorie-pro.app.workbuddy.host/?sharecode=3M6X52CI7M

Details: https://foodcalorie-pro.app.workbuddy.host/en.html?sharecode=3M6X52CI7M

Both are one-time purchases, not subscriptions. Code is Apache-2.0; the Pro data pack is single-user, non-transferable.

Maintainer

Upstream fixes were contributed to the official MCP SDKs (modelcontextprotocol/python-sdk and typescript-sdk). Those pull requests were opened from an account that has since been suspended, and GitHub removed them together with the account, so the pull request links no longer resolve. The fixes they carried are in the released package. Issue reports for this package go to the email address in Contact.


中文

中国食品营养数据 MCP 服务器 —— 让 AI Agent 查得到、算得准、不瞎猜

🍔 FoodCalorie Pro(¥49 一次性买断,早鸟 ¥29 限时至 2026-11-04) 在免费版 103 条通用食品之外,另含 116 条 / 14 个连锁品牌的菜单数据(肯德基 24、海底捞 20、蜜雪冰城 16、麦当劳 14、星巴克 14、瑞幸 11、喜茶 5、古茗 4…),卡路里 116/116 全覆盖,每条都带官方来源链接。 营养字段按实际覆盖如实标注:蛋白质 59/116、脂肪 61/116、碳水 54/116、糖 15/116、钠 4/116、咖啡因 21/116。不含过敏原数据——不是漏了,是不提供,也明确告诉 agent 不要猜。 👉 查看 Pro 详情与购买

🚀 快速开始

安装

三种方式,选一种即可:

# 1) 一键包:用 .mcpb 后用 Claude Desktop 打开,无需手写 JSON
#    .mcpb 由源码包构建,见「开发」章节

# 2) pip
pip install foodcalorie-mcp

# 3) uvx(免安装)
uvx --from foodcalorie-mcp foodcalorie-mcp

容器镜像(docker run ghcr.io/jihaochang1/foodcalorie-mcp)暂时不可用——镜像托管在 GitHub Container Registry,该账号已被处置,命令会返回 401。恢复之前用上面两种方式, 数据和工具完全一样。

国内镜像(阿里云/清华)可能滞后几天,要立刻拿到当前版本加 --index-url https://pypi.org/simple。

运行

foodcalorie-mcp

配置 Claude / Cursor / WorkBuddy

在 .claude/settings.json 或 cursorrules 中添加:

{
  "mcpServers": {
    "foodcalorie": {
      "command": "python",
      "args": ["-m", "foodcalorie_mcp.server"]
    }
  }
}

📖 可用工具

工具 描述 参数
search_food_by_barcode 通过条码查询(⚠️ 见下方「关于条码」) barcode: string
search_food_by_name 通过名称关键词搜索(中英文均可,支持品牌联想) keyword: string, limit: int
get_daily_nutrition_summary 计算每日营养摄入汇总及每日值占比 items: list[dict]
get_health_tip 获取健康饮食建议 food_name: string
list_foods_by_category 按类别列出食品 category: string?, limit: int
compare_foods 多食品营养成分对比 barcode_list: list[str]

⚠️ 关于条码(请先读这一段)

免费版数据库的键是示例条码(6901234567890 这类连号占位值),不是真实商品包装上的 EAN 条码。因此:

  • 拿真实商品扫码来查,查不到——这不是 bug,是数据里没有真实条码映射。
  • 可用的查询方式是 search_food_by_name(名称关键词),或用 list_foods_by_category 按类别浏览。
  • search_food_by_barcode 目前只对内置示例条码有效,保留它是为了兼容工具签名和自建映射(你可以把自己的条码表灌进来覆盖)。

我们宁可把这件事写在最前面,也不想你装上之后踩坑才发现。


💡 使用示例

按名称查询(推荐)

用户: 蜜雪冰城柠檬水多少卡?
AI: 调用 search_food_by_name(keyword="蜜雪冰城柠檬水")

计算每日摄入

用户: 我今天喝了可乐、一杯牛奶,还吃了鸡胸肉,算一下总热量
AI: 先 search_food_by_name 定位条目,再调用 get_daily_nutrition_summary(items=[...])

按类别浏览

AI: 调用 list_foods_by_category(category="快餐", limit=5)

对比食品

AI: 调用 compare_foods(barcode_list=["6901234567890", "6921234567896"])

🎯 免费版 vs Pro

Free(免费,Apache-2.0)

  • ✅ 103 条通用中国食品数据
  • ✅ 6 个 MCP 工具
  • ✅ 热量 / 蛋白质 / 脂肪 / 碳水 103/103 全覆盖
  • ✅ 名称搜索(中英文)、品类浏览、营养对比、每日汇总
  • ⚠️ 条码为示例值,非真实 EAN(见上)
  • ⚠️ 钠、糖、维生素、矿物质等字段部分条目才有,缺的会返回空而不是 0

Pro(¥49 买断,早鸟 ¥29 限时至 2026-11-04)

  • ✅ 免费版全部功能
  • ✅ 116 条 / 14 个连锁品牌菜单数据
  • ✅ 卡路里 116/116,来源链接 116/116(每条可溯源到官方营养页)
  • ✅ 蛋白质 59、脂肪 61、碳水 54、糖 15、钠 4、咖啡因 21(如实标注,不做填充猜测)
  • ✅ 明确告知 agent「缺失字段不要推算」,避免一本正经地编
  • ✅ 一个环境变量加载,小版本更新免费
  • ❌ 不含过敏原数据(当前没有可靠来源,宁缺勿造)

数据完整度(这是 Pro 的真实质量表)

字段 覆盖 说明
热量 116/116 全部有值
官方来源链接 116/116 全部可溯源
品牌 / 品名 / 规格 116/116 全部有值
蛋白质 59/116 官方页有标注的才录
脂肪 61/116 同上
碳水 54/116 同上
糖 15/116 中国区营养表常不标糖
钠 4/116 覆盖率低,别当完整数据用
咖啡因 21/116 仅咖啡/茶饮类品牌标注
过敏原 0 不提供

如果你需要的是「每条 20 个字段全满」的完美数据集,这个产品不适合你——那种数据市面上基本都是编的。如果你要的是「有就是有、没有就说没有」的数据,这是它的设计前提。

Enterprise(项目制报价,¥10,000 起)

  • ✅ 私有化部署 + 自有菜品/商品数据录入
  • ✅ 自定义 schema、对接你的内部系统
  • ✅ 培训 + 3 个月技术支持
  • ✅ 需求评估后报价,不做标准套餐

💳 购买方式

渠道 价格 交付 适合
官网直购(支付宝 / 微信) ¥29 早鸟(限时至 2026-11-04),之后 ¥49 人工发送(通常 12 小时内) 国内用户
Agensi 平台 $6.99 USD 自动交付、平台代扣税,即时下载 海外用户(推荐)
PayPal $6.99 USD 邮件索取收款请求,付完即发 海外用户,不想走平台

付款后请把订单截图或交易号发给下面的联系方式,换取下载链接(Agensi 购买会自动交付,无需邮件)。


📦 免费版覆盖情况

一级分类 数量 代表条目
饮料 22 可口可乐、元气森林、农夫山泉、瑞幸、喜茶…
快餐 11 麦当劳、肯德基、汉堡王、沙县、老乡鸡…
零食 10 乐事、奥利奥、三只松鼠、卫龙…
水果 8 苹果、香蕉、草莓、猕猴桃…
乳制品 7 伊利、蒙牛、安慕希、简爱…
肉类 6 鸡胸肉、牛肉、猪肉、三文鱼…
主食 6 米饭、面条、饺子、炒饭…
便利店 3 全家、7-11、罗森便当
火锅食材 3 毛肚、肥牛、虾滑
其他 27 蛋类、豆制品、海鲜、调味品、速食、甜点…

「快餐」里的品牌条目是通用参考值(如「汉堡王皇堡」),不是逐 SKU 的官方菜单数据。逐 SKU 的官方数据在 Pro 包里。


🛠️ 开发

源码随 PyPI 源码包分发(源码本体从不在别处托管):

pip download foodcalorie-mcp --no-binary :all: --no-deps -d ./
tar xzf foodcalorie_mcp-*.tar.gz && cd foodcalorie_mcp-*
pip install -e ".[dev]"

pytest tests/
ruff format src/

构建一键包:

python scripts/build_mcpb.py

📄 许可证

代码 Apache-2.0。Pro 数据包为单用户、不可转让授权,禁止再分发。


🤝 联系


数据能不编就不编,编一次就没人再信了。 🥗

📌 觉得有用就把它装进你自己的 agent —— 这是这个项目继续做下去的唯一理由。 (若某个 agent 平台的技能市场按调用量给反馈,同样欢迎你装完顺手留一句。)

Metadata

Release files for foodcalorie-mcp 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foodcalorie-mcp 0.1.4
File Size Uploaded Provenance Actions
foodcalorie_mcp-0.1.4.tar.gz 35.9 kB Without provenance Details for foodcalorie_mcp-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for foodcalorie-mcp 0.1.4
File Interpreter ABI Platform Actions
foodcalorie_mcp-0.1.4-py3-none-any.whl Python 3 none any Details for foodcalorie_mcp-0.1.4-py3-none-any.whl

Total release size: 60.8 kB

Release files / foodcalorie_mcp-0.1.4.tar.gz

Download URL foodcalorie_mcp-0.1.4.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
37aea3293e162580538e4a8229b88b04fef8c4bab79833bc6a5c725af67e6168
BLAKE2b-256 checksum
How to use checksums
48f184cde6322e6a18940890f0afa624c4e5893b4ea67d89650c34043d5b4e27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / foodcalorie_mcp-0.1.4-py3-none-any.whl

Download URL foodcalorie_mcp-0.1.4-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b8d800b41bc6347ddbd9700aa8845cfff2e4ac1f8a18dc740e68f6b5f837d1f
BLAKE2b-256 checksum
How to use checksums
f24d84f0fd058c712310f7672ae6693fcbd8bbe1d9ee6b37aaf6447a76d54926
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for foodcalorie-mcp 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page