mcpField
D
dishmath

dishmath

本地服务
github.com/CloudCorpRecords商业与营销01 周前更新

关于 dishmath

dishmath 是面向餐饮经营者的本地计算服务,可计算食材成本、含增值税菜单价格、配方缩放和欧盟过敏原信息。它在本机计算,并通过 MCP 和命令行提供四种计算工具。

主要功能

  1. 01按食材计算菜品成本
  2. 02含增值税及取整的菜单定价
  3. 03缩放配方用量与成本
  4. 04涵盖 14 种过敏原的欧盟矩阵

适用场景

  1. 01计算菜品成本和目标售价
  2. 02制定含增值税的菜单价格
  3. 03按新份数调整食材用量
  4. 04筛查需避开的过敏原菜品

MCP 相关

向 MCP 客户端提供 `food_cost_calculator`、`menu_price_calculator`、`recipe_scaler` 和 `allergen_matrix`。计算在本机根据输入数据完成。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"cloudcorprecords-dishmath": {
"command": "npx",
"args": [
"-y",
"@reneturcios/dishmath"
]
}
}
}
启动命令npx -y @reneturcios/dishmath

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@reneturcios/dishmath0.1.0
ocighcr.io/cloudcorprecords/dishmath:0.1.0

工具

4

收录的工具列表 · 更新于 1 周前

参数类型必填说明
currencystring否货币代码,例如 USD。
ingredientsarray是本次调用的食材。
current_pricenumber否当前价格值。
target_food_cost_percentnumber否本次调用的目标食物成本百分比。

详细介绍

dishmath

完全在本机运行的餐厅算术:一道菜的制作成本、售价、食谱在不同份数之间如何调整,以及有过敏症的顾客必须避开哪些菜品。无需账号、密钥或网络请求——所有结果都根据你提供的数字在本地计算。

四种计算

  • 食品成本——逐项累加一道菜的食材成本。除了单份成本,你还可以查询达到目标食品成本百分比时的售价,以及按今天的售价计算出的实际百分比。
  • 菜单定价——输入单份成本和目标食品成本百分比。结果包括未税价格、加上 VAT 后的价格、向上取整到合适步长(0.50、1.00……)后的价格、扣除税费后的单份毛利,以及取整后的价格实际对应的食品成本百分比。
  • 食谱缩放——输入适用于指定份数的食谱,即可获得调整为另一份数后的所有用量。如果食材包含单位成本,还会同时给出整批成本和单份成本。
  • 过敏原矩阵——声明每道菜包含的过敏原,即可获得欧盟法规 1169/2011(附件 II)规定的菜品与过敏原对照表,以及按 14 种过敏原列出的需避开菜品清单。过敏原名称支持英文或意大利文,也支持常见称呼:“shrimp”会被识别为甲壳类,“dairy”会被识别为牛奶。工具不会根据菜名推测过敏原——未声明过敏原的菜品会明确标示为未声明。

金额采用四舍五入,精确到两位小数;百分比精确到一位小数。可选的 ISO 货币代码(默认为 EUR)只会影响金额的显示方式。

示例:单份成本为 €3.20,目标食品成本为 30%,VAT 为 10%,取整步长为 0.50:

Net price (before tax): €10.67
Price incl. 10% tax: €11.74
Menu price (rounded up to 0.5): €12.00
Gross profit per plate (net of tax): €7.71
Real food cost after rounding: 29.3%

CLI

npx @reneturcios/dishmath menu_price_calculator '{"plate_cost":3.20,"target_food_cost_percent":30,"vat_percent":10,"rounding_step":0.50}'
npx @reneturcios/dishmath food_cost_calculator '{"ingredients":[{"name":"flour","quantity":0.5,"unit":"kg","unit_cost":1.20}],"target_food_cost_percent":30}'
npx @reneturcios/dishmath recipe_scaler '{"ingredients":[{"name":"flour","quantity":500,"unit":"g"}],"original_portions":4,"target_portions":6}'
npx @reneturcios/dishmath allergen_matrix '{"dishes":[{"name":"Shrimp pasta","allergens":["shrimp","gluten"]}]}'
npx @reneturcios/dishmath --version

每个工具子命令都接受一个 JSON 参数字符串,并以纯文本形式输出结果。退出代码:成功时为 0;计算或验证错误时为 1;用法错误时为 2。

MCP

npx -y @reneturcios/dishmath mcp

MCP 客户端配置:

{
  "mcpServers": {
    "dishmath": {
      "command": "npx",
      "args": ["-y", "@reneturcios/dishmath", "mcp"]
    }
  }
}

通过 MCP 提供的工具:food_cost_calculator、menu_price_calculator、recipe_scaler、allergen_matrix。

Docker

docker run -i ghcr.io/cloudcorprecords/dishmath
docker run --rm ghcr.io/cloudcorprecords/dishmath menu_price_calculator '{"plate_cost":3.20,"target_food_cost_percent":30,"vat_percent":10,"rounding_step":0.50}'

容器的默认命令为 mcp,因此第一种形式会启动 stdio MCP 服务;其他参数则会传递给 CLI。

开发

npm install
npm run build
npm test
npm run dev

许可证

MIT——详见 LICENSE。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。