pp-myfitnesspal
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMyFitnessPal — Printing Press CLI
MyFitnessPal — Printing Press CLI
Prerequisites: Install the CLI
前提条件:安装CLI
This skill drives the binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:
myfitnesspal-pp-cli- Install via the Printing Press installer:
bash
npx -y @mvanhorn/printing-press install myfitnesspal --cli-only - Verify:
myfitnesspal-pp-cli --version - Ensure (or
$GOPATH/bin) is on$HOME/go/bin.$PATH
If the install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.3 or newer):
npxbash
go install github.com/mvanhorn/printing-press-library/library/other/myfitnesspal/cmd/myfitnesspal-pp-cli@latestIf reports "command not found" after install, the install step did not put the binary on . Do not proceed with skill commands until verification succeeds.
--version$PATHMyFitnessPal closed their API, gates per-food export behind premium, and ships per-meal rows even there. This CLI imports your browser session, syncs your diary to local SQLite, and answers questions the official UI never can: which 5 foods drove 80% of your protein this quarter, what's your weekly weight slope vs your deficit, what changed since last sync. Built with agent-native output (, , ) so Claude can reason over your last 14 days in one tool call.
--json--selectcontext本技能基于二进制文件运行。在调用本技能的任何命令前,你必须确认CLI已安装。如果未安装,请先执行以下步骤:
myfitnesspal-pp-cli- 通过Printing Press安装器安装:
bash
npx -y @mvanhorn/printing-press install myfitnesspal --cli-only - 验证安装:
myfitnesspal-pp-cli --version - 确保(或
$GOPATH/bin)已添加到$HOME/go/bin环境变量中。$PATH
如果安装失败(如无Node环境、离线等),可改用Go直接安装(要求Go 1.26.3或更高版本):
npxbash
go install github.com/mvanhorn/printing-press-library/library/other/myfitnesspal/cmd/myfitnesspal-pp-cli@latest如果安装后执行提示“command not found”,说明安装程序未将二进制文件添加到中。请在验证成功前不要执行技能命令。
--version$PATHMyFitnessPal已关闭公开API,且仅向付费用户提供按餐导出的功能,即便如此导出的也是按餐汇总的数据。本CLI可导入你的浏览器会话,将饮食日记同步到本地SQLite数据库,并能解答官方UI无法回答的问题:比如过去三个月中哪5种食物贡献了你80%的蛋白质、你的每周体重变化趋势与热量缺口的关系、上次同步后数据有哪些变化等。它专为Agent设计输出格式(、、命令),让Claude可通过一次工具调用就能分析你过去14天的饮食数据。
--json--selectcontextWhen to Use This CLI
何时使用本CLI
Reach for this CLI when an agent needs to reason over a user's actual eating, exercise, or weight history — especially across windows longer than today. The local SQLite store + agent-shaped command means one tool call replaces the back-and-forth of pasting yesterday's diary into the chat. Use it for nutrition coaching, deficit calibration, macro analysis, recall questions ('every time I logged X'), and anywhere the official MFP UI's per-meal rollup blocks the question.
context当Agent需要分析用户实际的饮食、运动或体重历史时,尤其是时间跨度超过一天的情况,可使用本CLI。本地SQLite存储+适配Agent的命令,让Agent无需反复让用户粘贴饮食日记,一次工具调用就能获取所需信息。适用于营养指导、热量缺口校准、宏量营养素分析、饮食记录查询(如“我每次记录X食物的情况”),以及官方MFP UI按餐汇总数据无法满足需求的场景。
contextUnique Capabilities
独特功能
These capabilities aren't available in any other tool for this API.
这些功能是其他同类工具所不具备的。
Local state that compounds
可累积的本地状态
-
— Export your food diary to CSV with one row per logged food, not per meal. Premium MFP only ships per-meal CSVs.
export csvReach for this when an agent needs the user's full eating history at food granularity for analysis, training, or long-form coaching memory.bashmyfitnesspal-pp-cli export csv --from 2026-01-01 --to 2026-05-08 --out diary.csv -
— Pareto query: which N foods drove X% of your protein/carbs/fat/fiber/sugar/calories over a window?
analytics top-foodsUse when an agent is helping the user understand what's actually driving a macro target, not what they think is.bashmyfitnesspal-pp-cli analytics top-foods --nutrient protein --days 60 --cumulative-percent 80 --json -
— Full-text search across every diary entry and food in the local store. Returns date, meal, servings, calories per match.
findUse when an agent needs to recall every time the user logged a specific food without scrolling through months of diary.bashmyfitnesspal-pp-cli find --food "Chipotle Bowl" --from 2026-01-01 --json -
— Longest run of consecutive days where calorie totals fall within ±tolerance of your goal.
analytics streakUse when the user asks how their adherence is trending — answer arrives without subjective interpretation.bashmyfitnesspal-pp-cli analytics streak --days 60 --tolerance 0.05 --json
-
— 将饮食日记导出为CSV,每条记录对应一份单独的食物,而非按餐汇总。MyFitnessPal付费版仅提供按餐导出的CSV。
export csv当Agent需要获取用户完整的、按单份食物粒度的饮食历史用于分析、训练或长期指导记忆时,可使用此命令。bashmyfitnesspal-pp-cli export csv --from 2026-01-01 --to 2026-05-08 --out diary.csv -
— 帕累托查询:在指定时间段内,哪N种食物贡献了你X%的蛋白质/碳水/脂肪/膳食纤维/糖分/热量?
analytics top-foods当Agent帮助用户了解实际驱动宏量营养素目标的食物(而非用户自认为的食物)时,可使用此命令。bashmyfitnesspal-pp-cli analytics top-foods --nutrient protein --days 60 --cumulative-percent 80 --json -
— 在本地存储的所有饮食记录和食物中进行全文搜索,返回匹配结果的日期、餐次、份量、热量。
find当Agent需要查询用户每次记录某特定食物的情况,无需让用户手动翻阅数月的饮食日记时,可使用此命令。bashmyfitnesspal-pp-cli find --food "Chipotle Bowl" --from 2026-01-01 --json -
— 查询连续天数最长的、每日热量摄入在目标值±公差范围内的记录。
analytics streak当用户询问自己的饮食坚持趋势时,可使用此命令给出客观答案,无需主观解读。bashmyfitnesspal-pp-cli analytics streak --days 60 --tolerance 0.05 --json
Agent-native plumbing
Agent原生适配功能
-
— Single-call snapshot of the last N days: diary totals, weight trend, current goals, recent foods, macro deltas — sized for an agent context window.
contextFirst call any agent should make before reasoning about a user's nutrition — gives the full picture in one shot.bashmyfitnesspal-pp-cli context --days 14 --json
-
— 一次调用获取最近N天的快照:饮食总览、体重趋势、当前目标、近期食物、宏量营养素差值——数据大小适配Agent的上下文窗口。
contextAgent在分析用户营养情况前应首先调用此命令,一次获取完整的信息全貌。bashmyfitnesspal-pp-cli context --days 14 --json
Command Reference
命令参考
api-user — Authenticated user record on the v2 API (preferences, paid subs, profiles).
- — Get the v2 user record (units, goals preferences, paid subs, profiles).
myfitnesspal-pp-cli api-user
diary — Daily food diary (per-meal entries with full nutrient panel).
- — Get one day's food diary as scraped HTML (legacy surface python-myfitnesspal uses).
myfitnesspal-pp-cli diary get-day - — Load the recent-foods quick-pick list for a meal.
myfitnesspal-pp-cli diary load-recent
exercise — Cardio and strength exercises logged on a given day.
- — Get one day's exercise log (cardio + strength) as scraped HTML.
myfitnesspal-pp-cli exercise
food — Search the public food database, view food details, log custom foods.
- — Get full nutrient panel for a single food by MFP food id.
myfitnesspal-pp-cli food details - — Search the food database.
myfitnesspal-pp-cli food search - — Get common serving-size suggestions for a food (powers the '1 cup / 100g / medium' picker).
myfitnesspal-pp-cli food suggested-servings
goals — Daily calorie / macro / water / weight goals.
- — Get your current daily goals (calorie target, macro split, water target) as scraped HTML.
myfitnesspal-pp-cli goals
measurement — Weight, body fat, and other body measurements (time series).
- — Get a date range of values for one measurement type as scraped HTML.
myfitnesspal-pp-cli measurement get-range - — List the measurement types defined for your account (Weight, BodyFat, Neck, Waist, Hips, plus custom).
myfitnesspal-pp-cli measurement types
note — Free-text notes attached to a day's food or exercise diary.
- — Get the food note for a single day.
myfitnesspal-pp-cli note
reports — Aggregated time-series reports (any nutrient or weight as a date->value series).
- — Get a time-series report (e.g. nutrition/Net%20Calories/30 returns the last 30 days of net calories).
myfitnesspal-pp-cli reports
user — Authenticated user account info, units, and preferences.
- — Bootstrap a v2 bearer token from your session cookies.
myfitnesspal-pp-cli user auth-token - — Get your top-logged foods over a date range, computed server-side (powers the 'your most-eaten' insights).
myfitnesspal-pp-cli user top-foods-server
water — Daily water intake tracking.
- — Get water intake for a single day.
myfitnesspal-pp-cli water
api-user — v2 API上的已认证用户记录(偏好设置、付费订阅、个人资料)。
- — 获取v2用户记录(单位、目标偏好、付费订阅、个人资料)。
myfitnesspal-pp-cli api-user
diary — 每日饮食日记(按餐记录,包含完整营养成分表)。
- — 获取某一天的饮食日记(以抓取的HTML格式呈现,为python-myfitnesspal使用的遗留格式)。
myfitnesspal-pp-cli diary get-day - — 加载某一餐的近期食物快速选择列表。
myfitnesspal-pp-cli diary load-recent
exercise — 某一天记录的有氧和力量训练运动。
- — 获取某一天的运动记录(有氧+力量,以抓取的HTML格式呈现)。
myfitnesspal-pp-cli exercise
food — 搜索公共食物数据库、查看食物详情、记录自定义食物。
- — 通过MFP食物ID获取单份食物的完整营养成分表。
myfitnesspal-pp-cli food details - — 搜索食物数据库。
myfitnesspal-pp-cli food search - — 获取某食物的常见份量建议(支持“1杯/100克/中等大小”选择器)。
myfitnesspal-pp-cli food suggested-servings
goals — 每日热量/宏量营养素/饮水量/体重目标。
- — 获取当前每日目标(热量目标、宏量营养素分配、饮水量目标,以抓取的HTML格式呈现)。
myfitnesspal-pp-cli goals
measurement — 体重、体脂及其他身体测量数据(时间序列)。
- — 获取某一测量类型在指定日期范围内的数据(以抓取的HTML格式呈现)。
myfitnesspal-pp-cli measurement get-range - — 列出你的账户中定义的测量类型(体重、体脂、颈围、腰围、臀围及自定义类型)。
myfitnesspal-pp-cli measurement types
note — 附加在每日饮食或运动日记上的自由文本备注。
- — 获取某一天的饮食备注。
myfitnesspal-pp-cli note
reports — 聚合时间序列报告(任何营养素或体重的日期->值序列)。
- — 获取时间序列报告(例如nutrition/Net%20Calories/30返回过去30天的净热量数据)。
myfitnesspal-pp-cli reports
user — 已认证用户账户信息、单位及偏好设置。
- — 从会话Cookie中生成v2 Bearer令牌。
myfitnesspal-pp-cli user auth-token - — 获取指定日期范围内你记录最多的食物(由服务器计算,为“你最常吃的食物”洞察功能提供数据)。
myfitnesspal-pp-cli user top-foods-server
water — 每日饮水量追踪。
- — 获取某一天的饮水量。
myfitnesspal-pp-cli water
Finding the right command
查找合适的命令
When you know what you want to do but not which command does it, ask the CLI directly:
bash
myfitnesspal-pp-cli which "<capability in your own words>"which02--help当你知道要做什么但不知道对应的命令时,可直接询问CLI:
bash
myfitnesspal-pp-cli which "<用你自己的话描述功能>"which02--helpRecipes
使用示例
Build agent context for a coaching question
为指导问题构建Agent上下文
bash
myfitnesspal-pp-cli context --days 30 --json --select diary_totals,weight_trend,goalsOne tool call gives the agent everything it needs to answer 'should I cut more this week?' without back-and-forth pasting.
bash
myfitnesspal-pp-cli context --days 30 --json --select diary_totals,weight_trend,goals一次工具调用就能让Agent获取回答“我这周应该减少更多热量摄入吗?”所需的全部信息,无需反复让用户粘贴数据。
Find every time you logged a food
查询每次记录某食物的情况
bash
myfitnesspal-pp-cli find --food "Greek yogurt" --from 2026-01-01 --json --select date,meal,servings,caloriesLocal FTS over your synced diary; instant answer to recall questions the MFP web UI requires scrolling for.
bash
myfitnesspal-pp-cli find --food "Greek yogurt" --from 2026-01-01 --json --select date,meal,servings,calories在同步后的本地日记中进行全文搜索,可立即回答MFP网页UI需要手动翻阅才能找到的回忆类问题。
Per-food CSV for a quarter
导出一季度的按单份食物CSV
bash
myfitnesspal-pp-cli export csv --from 2026-01-01 --to 2026-03-31 --out q1-2026.csvOne row per food entry with full nutrients — the export premium MFP doesn't deliver.
bash
myfitnesspal-pp-cli export csv --from 2026-01-01 --to 2026-03-31 --out q1-2026.csv每条记录对应一份食物,包含完整营养成分——这是MyFitnessPal付费版都无法提供的导出功能。
Top foods driving a macro
查询驱动宏量营养素的主要食物
bash
myfitnesspal-pp-cli analytics top-foods --nutrient protein --days 60 --cumulative-percent 0.8 --jsonPareto query over the local diary: which foods drove most of your protein over the last 60 days.
bash
myfitnesspal-pp-cli analytics top-foods --nutrient protein --days 60 --cumulative-percent 0.8 --json对本地日记执行帕累托查询:找出过去60天中贡献了你大部分蛋白质的食物。
Adherence streak
饮食坚持记录
bash
myfitnesspal-pp-cli analytics streak --days 60 --tolerance 0.05 --jsonLongest run of days inside ±5% of your calorie goal. Goal value is read from the most recent synced into the local store; pass to override.
goal_snapshot--goal-calories <value>bash
myfitnesspal-pp-cli analytics streak --days 60 --tolerance 0.05 --json查询连续天数最长的、每日热量摄入在目标值±5%范围内的记录。目标值从同步到本地存储的最新中读取;可通过参数手动指定目标值。
goal_snapshot--goal-calories <value>Auth Setup
认证设置
MyFitnessPal closed their public API. This CLI uses your logged-in browser session — log in to myfitnesspal.com in Chrome, then run . Cookies are read from the .myfitnesspal.com domain. Sessions usually last 7-30 days; when they expire, log in again in Chrome and re-run .
myfitnesspal-pp-cli auth login --chromeauth login --chromeRun to verify setup.
myfitnesspal-pp-cli doctorMyFitnessPal已关闭公开API。本CLI使用你已登录的浏览器会话——在Chrome中登录myfitnesspal.com,然后执行。Cookie从.myfitnesspal.com域名读取。会话通常持续7-30天;过期后,在Chrome中重新登录并再次执行即可。
myfitnesspal-pp-cli auth login --chromeauth login --chrome执行验证设置是否正确。
myfitnesspal-pp-cli doctorAgent Mode
Agent模式
Add to any command. Expands to: .
--agent--json --compact --no-input --no-color --yes-
Pipeable — JSON on stdout, errors on stderr
-
Filterable —keeps a subset of fields. Dotted paths descend into nested structures; arrays traverse element-wise. Critical for keeping context small on verbose APIs:
--selectbashmyfitnesspal-pp-cli api-user --user-id 550e8400-e29b-41d4-a716-446655440000 --agent --select id,name,status -
Previewable —shows the request without sending
--dry-run -
Offline-friendly — sync/search commands can use the local SQLite store when available
-
Non-interactive — never prompts, every input is a flag
-
Explicit retries — useonly when an already-existing create should count as success
--idempotent
在任何命令后添加参数,等效于添加:。
--agent--json --compact --no-input --no-color --yes-
可管道传输 — JSON输出到标准输出,错误信息输出到标准错误
-
可过滤 —参数可保留指定字段。点路径可深入嵌套结构;数组可遍历元素。这对于在冗长API中缩小上下文大小至关重要:
--selectbashmyfitnesspal-pp-cli api-user --user-id 550e8400-e29b-41d4-a716-446655440000 --agent --select id,name,status -
可预览 —参数可显示请求内容但不发送
--dry-run -
离线友好 — 同步/搜索命令可在本地SQLite存储可用时使用本地数据
-
非交互式 — 从不弹出提示,所有输入均通过参数传递
-
显式重试 — 仅当已存在的创建操作应被视为成功时,使用参数
--idempotent
Response envelope
响应包
Commands that read from the local store or the API wrap output in a provenance envelope:
json
{
"meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
"results": <data>
}Parse for data and to know whether it's live or local. A human-readable summary is printed to stderr only when stdout is a terminal — piped/agent consumers get pure JSON on stdout.
.results.meta.sourceN results (live)从本地存储或API读取数据的命令会将输出包装在来源信息包中:
json
{
"meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
"results": <data>
}解析获取数据,通过判断数据是实时的还是本地的。仅当标准输出为终端时,才会在标准错误中打印人类可读的摘要;管道/Agent消费者仅会在标准输出获取纯JSON。
.results.meta.sourceN results (live)Agent Feedback
Agent反馈
When you (or the agent) notice something off about this CLI, record it:
myfitnesspal-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
myfitnesspal-pp-cli feedback --stdin < notes.txt
myfitnesspal-pp-cli feedback list --json --limit 10Entries are stored locally at . They are never POSTed unless is set AND either is passed or . Default behavior is local-only.
~/.myfitnesspal-pp-cli/feedback.jsonlMYFITNESSPAL_FEEDBACK_ENDPOINT--sendMYFITNESSPAL_FEEDBACK_AUTO_SEND=trueWrite what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.
当你(或Agent)发现本CLI存在问题时,可记录反馈:
myfitnesspal-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
myfitnesspal-pp-cli feedback --stdin < notes.txt
myfitnesspal-pp-cli feedback list --json --limit 10反馈条目存储在本地文件中。除非设置了且传递了参数或设置,否则反馈不会被发送。默认行为仅存储在本地。
~/.myfitnesspal-pp-cli/feedback.jsonlMYFITNESSPAL_FEEDBACK_ENDPOINT--sendMYFITNESSPAL_FEEDBACK_AUTO_SEND=true请记录让你感到意外的内容,而非正式的错误报告。简短、具体、一句话即可:这样的反馈才最有价值。
Output Delivery
输出交付
Every command accepts . The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:
--deliver <sink>| Sink | Effect |
|---|---|
| Default; write to stdout only |
| Atomically write output to |
| POST the output body to the URL ( |
Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.
所有命令均支持参数。输出会发送到指定的接收端,同时(或替代)输出到标准输出,让Agent无需手动管道即可路由命令结果。支持三种接收端:
--deliver <sink>| 接收端 | 效果 |
|---|---|
| 默认值;仅输出到标准输出 |
| 原子性地将输出写入 |
| 将输出体POST到指定URL(当使用 |
不支持的协议会返回结构化错误,并列出支持的协议类型。Webhook失败会返回非零退出码,并在标准错误中记录URL和HTTP状态码。
Named Profiles
命名配置文件
A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.
myfitnesspal-pp-cli profile save briefing --json
myfitnesspal-pp-cli --profile briefing api-user --user-id 550e8400-e29b-41d4-a716-446655440000
myfitnesspal-pp-cli profile list --json
myfitnesspal-pp-cli profile show briefing
myfitnesspal-pp-cli profile delete briefing --yesExplicit flags always win over profile values; profile values win over defaults. lists all available profiles under so introspecting agents discover them at runtime.
agent-contextavailable_profiles配置文件是一组保存的参数值,可在多次调用中复用。适用于定时Agent每次运行都使用相同配置调用同一命令的场景(即HeyGen的“Beacon”模式)。
myfitnesspal-pp-cli profile save briefing --json
myfitnesspal-pp-cli --profile briefing api-user --user-id 550e8400-e29b-41d4-a716-446655440000
myfitnesspal-pp-cli profile list --json
myfitnesspal-pp-cli profile show briefing
myfitnesspal-pp-cli profile delete briefing --yes显式参数始终优先于配置文件中的值;配置文件中的值优先于默认值。命令会在下列出所有可用配置文件,让Agent可在运行时自动发现它们。
agent-contextavailable_profilesExit Codes
退出码
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Usage error (wrong arguments) |
| 3 | Resource not found |
| 4 | Authentication required |
| 5 | API error (upstream issue) |
| 7 | Rate limited (wait and retry) |
| 10 | Config error |
| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 2 | 使用错误(参数错误) |
| 3 | 资源未找到 |
| 4 | 需要认证 |
| 5 | API错误(上游问题) |
| 7 | 速率限制(请等待后重试) |
| 10 | 配置错误 |
Argument Parsing
参数解析
Parse :
$ARGUMENTS- Empty, , or
help→ show--helpoutputmyfitnesspal-pp-cli --help - Starts with → ends with
install→ MCP installation; otherwise → see Prerequisites abovemcp - Anything else → Direct Use (execute as CLI command with )
--agent
解析的规则:
$ARGUMENTS- 为空、或
help→ 显示--help输出myfitnesspal-pp-cli --help - 以开头 → 若结尾为
install→ 安装MCP服务器;否则 → 参考上方前提条件中的安装步骤mcp - 其他情况 → 直接使用(添加参数执行CLI命令)
--agent
MCP Server Installation
MCP服务器安装
- Install the MCP server:
bash
go install github.com/mvanhorn/printing-press-library/library/other/myfitnesspal/cmd/myfitnesspal-pp-mcp@latest - Register with Claude Code:
bash
claude mcp add myfitnesspal-pp-mcp -- myfitnesspal-pp-mcp - Verify:
claude mcp list
- 安装MCP服务器:
bash
go install github.com/mvanhorn/printing-press-library/library/other/myfitnesspal/cmd/myfitnesspal-pp-mcp@latest - 注册到Claude Code:
bash
claude mcp add myfitnesspal-pp-mcp -- myfitnesspal-pp-mcp - 验证:
claude mcp list
Direct Use
直接使用
- Check if installed: If not found, offer to install (see Prerequisites at the top of this skill).
which myfitnesspal-pp-cli - Match the user query to the best command from the Unique Capabilities and Command Reference above.
- Execute with the flag:
--agentbashmyfitnesspal-pp-cli <command> [subcommand] [args] --agent - If ambiguous, drill into subcommand help: .
myfitnesspal-pp-cli <command> --help
- 检查是否已安装:若未找到,提供安装选项(参考顶部前提条件中的安装步骤)。
which myfitnesspal-pp-cli - 将用户查询匹配到上方独特功能和命令参考中最合适的命令。
- 添加参数执行:
--agentbashmyfitnesspal-pp-cli <command> [subcommand] [args] --agent - 若存在歧义,查看子命令帮助:。
myfitnesspal-pp-cli <command> --help