a207-nutrition-calc-mcp
MCP server for pediatric CKD nutrition and food calculations, enabling energy/protein targets, food nutrient lookup, substitutions, meal summaries, and drug-nutrient interaction checks.
README
a207-nutrition-calc-mcp
儿童慢性肾脏病(CKD)营养与食物计算 MCP 包,供 CKDNutri 项目的医生、营养师、家长三类智能体共用(M5 营养/食物计算器)。
依据:PRNT 2020(儿童 CKD 能量与蛋白 SDI)、Schofield 方程、腹膜透析葡萄糖吸收折算。
注意:本包不提供目标计算(原
calc_nutrition_target已去重,目标计算统一由 M3calc_prnt_targets作为唯一权威引擎)。本包定位为纯食物层(查养分/份量换算/替换/磷蛋白比/腹透葡萄糖/药食交互)。
单位口径
- 能量:kcal;蛋白/钾/磷/钠:g 或 mg(食物成分表以 mg/100g 计);血电解质:mmol/L
- 体重:kg;身高:cm;年龄:岁(内部按月龄插值)
七个工具
| 工具 | 说明 |
|---|---|
lookup_food_nutrients |
食物营养素查询,支持份量(碗/个/掌心/克)与烹饪降钾降磷处理,返回高钾/高磷/高钠警示 |
substitute_food |
食物替换:低钾 / 低磷 / 低钠 / 低蛋白 / 等能量,优先同类食物候选 |
convert_to_household_measure |
克 ↔ 家庭量具双向换算,附家长可感知锚点(鸡蛋/掌心瘦肉/牛奶/瓷勺油/碗饭) |
sum_diet_intake |
多日饮食汇总,对比目标给出能量/蛋白达成率与钾磷钠来源排序及建议 |
calc_pnpr |
磷蛋白比(mg P/g 蛋白)计算,辅助低磷食物优选 |
calc_pd_glucose_absorption |
腹膜透析葡萄糖吸收量(按留腹时长 × 转运特性),折算 kcal |
check_drug_nutrient_interaction |
药物-营养素交互提示(磷结合剂、活性维 D、利尿剂、激素、铁剂等) |
目录结构
a207-nutrition-calc-mcp/
├── pyproject.toml
├── README.md
├── src/a207_nutrition_calc_mcp/
│ ├── __init__.py
│ ├── core.py # 7 工具门面(纯逻辑,无 MCP/pydantic 依赖)
│ ├── server.py # FastMCP >=2 服务定义(8 个 @mcp.tool)
│ ├── models.py # pydantic v2 入参模型(extra=forbid)
│ ├── constants.py # 参考表与阈值
│ ├── targets.py # 腹透葡萄糖吸收折算(目标计算已收归 M3)
│ ├── fooddb.py # 食物数据访问与分级
│ ├── measures.py # 家庭量具解析
│ ├── foods.py # 查询/替换/换算/磷蛋白比
│ ├── diary.py # 饮食汇总
│ ├── pharma.py # 药物-营养素交互
│ └── data/food_data.csv
└── tests/test_tools.py
设计约束
- 不依赖、不 import 任何其它
a207-*包(纯计算,无写权限) - 结果可解释:返回 guideline 引用与规则依据
- 仅正向/边界/超时分支齐全,错误以
{"ok": false, "error": ...}形式返回
运行与测试
# 编译(server.py/models.py 依赖 fastmcp/pydantic,仅做语法校验)
python -m py_compile src/a207_nutrition_calc_mcp/*.py
# 纯标准库自测(core 逻辑不依赖 fastmcp/pydantic,可独立运行)
python tests/test_tools.py
返回非零退出码表示存在失败用例。
启动 MCP 服务
pip install -e .
python -m a207_nutrition_calc_mcp.server
# 或
fastmcp dev src/a207_nutrition_calc_mcp/server.py
# 或(已注册 console script 后)
uvx --from . a207-nutrition-calc-mcp
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.