
bodylog
io.github.abhaymettu由 GitHub 帳號 abhaymettu 發布v0.1.0更新於 Nov 3, 2026
Agent-first workout and food log: sets and meals from chat, USDA and Open Food Facts macros, cards.
概覽
在本機執行的健身與飲食紀錄 MCP 伺服器,把聊天式的組數與餐點轉成紀錄、巨量營養、連續打卡與可分享卡片。
- 可以做什麼
- 用聊天文字記錄訓練組數、修改或刪除最後一組、依使用者提供的時長結束訓練,並從貼上的日誌補登
- 查看進度:單一動作歷史、歷來最佳紀錄與每週訓練量
- 依文字、名稱、條碼或食物 ID 記錄飲食,修正或刪除項目,以及只查詢不記錄
- 查看某天的餐點、總計、目標、連續打卡與被標記的項目,並設定每日目標
- 把訓練卡與飲食日卡輸出為文字加 PNG 圖片,支援多種主題與樣式
- 適用情境
- 適合希望助理用日常聊天口吻維護個人訓練與營養紀錄的人,熱量與巨量營養來自 USDA 與 Open Food Facts,資料全部保存在本機,不需帳號或雲端同步。
- 執行需求
- 以本機 Python 套件執行(Python 3.10+),可透過 uvx 或 pip 啟動,不需帳號。選用設定:BODYLOG_DB 指定 SQLite 檔案,BODYLOG_CARDS 指定卡片圖片目錄,BODYLOG_UNIT 選擇 kg 或 lb,BODYLOG_OFFLINE 略過網路查詢,FDC_API_KEY 用於 USDA FoodData Central(否則使用 DEMO_KEY,每小時僅少數查詢)。除非開啟離線模式,查詢需要網路連線。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 bodylog,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
bodylog
A workout and food log for personal agents. You tell your agent your sets and your meals in chat, the way you would say them out loud. It stores them, counts calories and macros from real nutrition data, keeps your streaks, and sends back shareable cards.
One package for any agent: an MCP server (bodylog-mcp), a CLI (bodylog), a Python library and a
Claude skill. Everything lives in one local SQLite file. No accounts, no cloud, no social features.
More: food, light, food + training on one day (full), workout story, 8-exercise workout, two pages, mixed kg and lb, sticker for a photo.
Install
Python 3.10+.
Claude Code, as a plugin (skill and MCP server together):
Claude Code, MCP server only:
Any other MCP client:
Settings, all optional:
The skill is skills/bodylog/SKILL.md. Outside the plugin, copy or symlink skills/bodylog/ into
your agent's skills folder.
Food
The CLI prints what the MCP tools return (bodylog eat is log_food). A real run, offline:
A bare count uses USDA's portion for that food: a large egg (50 g), a slice of toast, a scoop of whey (the FNDDS "1 scoop, NFS", 26 g). Through MCP, the agent asks one short question about item 6 instead of guessing.
How a food gets its numbers:
- Bundled table. 62 common foods from USDA FoodData Central (SR Legacy and FNDDS), each with its
FDC id, per-100 g values and USDA's own portion weights (a large egg, a slice of bread, a cup of
rice). Works offline. Rebuilt from the USDA downloads by
scripts/build_common_foods.py. - Cache. Anything looked up before, stored in the SQLite file.
- USDA FoodData Central search (
POST /fdc/v1/foods/search, survey, SR Legacy and Foundation foods), withFDC_API_KEYorDEMO_KEY. - Open Food Facts search for branded and packaged foods, and product lookup by barcode
(
GET /api/v2/product/<barcode>.json, no key).
A search result is used only when its name contains every word you said. Otherwise the item is kept
as unknown with the closest candidates, so the agent can ask which one you meant. An item whose
amount cannot become grams (a handful, or millilitres of something with no USDA volume weight) is kept
as needs_amount. Neither counts toward totals until it is fixed, and neither is ever filled with
made-up numbers. Numbers you read off a label are stored as given (manual).
Also: daily goals for kcal, protein, carbs and fat; a logging streak in days (a day you have not logged yet does not break it) and a training streak in weeks; and a day card in dark, light, clear or story format. On a day you also trained, the card adds a Training block.
Workouts
30-second demo
The chat below comes from a real run through log_set(text=...). The right column shows what the
store recorded for each message.
The last message ends the workout, so the tool returns this card along with the workout PNG at the top of
this page (end_session does the same). PRs are counted against the three earlier sessions in
tests/fixtures/chat.txt.
How it reads chat
- Sets:
60kg x 8,60 x 8,50lbs for 9,8 reps at 60kg,3x10 @ 90lb,60kg 3x8,12 reps(bodyweight). Flags:warmup,drop set,to failure,rpe 9. - Exercises: named at the start of a message (
incline db press 55 lb x 10), announced (now squats), or named after the fact (this is tricep cable pushdowns btw). A set without a name continues the last exercise. - Naming after the fact takes the sets that have no exercise yet. If every set already has one, it
takes the trailing run of carried-over sets at the last set's weight. That covers the usual case
where you move to a new machine and name it a set or two later. If you changed weight before naming
it, use
edit_last_set(exercise=...)for the earlier sets. - Names are folded to one exercise: case, plurals,
db/bbshorthand, word order, filler (on the), and muscle words that don't change the movement. Sotricep cable pushdowns,cable pushdownandtriceps pushdowns on the cableare one exercise, whiletriceps curlandbiceps curlstay apart.bodylog aliasteaches any other name. - Commands:
same/one morerepeats the last set;done, 1h 5m/workout took 45 minends the workout. Agent replies in a pasted log (Agent:,Assistant:,Claude:) are skipped.
What the numbers mean
- Volume is weight x reps over working sets. Warmups are listed on the card but excluded from volume,
set counts and PRs. Each set shows the unit it was logged in. Totals convert every set exactly into
one unit: the
unityou pass, else$BODYLOG_UNIT, else whichever unit most sets used. - Muscle split is the share of working sets per primary muscle group, from a name map in
muscles.pythat covers the common lifts (unknown names count as Other). Percentages always add to 100. - Estimated 1RM uses the Epley formula,
weight x (1 + reps / 30). - PRs are counted against sessions that started earlier: heaviest weight, best estimated 1RM, best set volume (weight x reps in one set), and most reps at a weight you have lifted before (one per exercise, the largest gain). The first time you do an exercise sets no PRs, so a first workout does not show a PR on every set.
- The week line compares this week with last week up to the same weekday and time, so a Monday workout is not shown as a 90% drop.
- Duration is what you say at the end. The session start is set to end time minus that duration.
MCP tools
CLI and library
Why Python
The MCP Python SDK needs a few lines per tool, Pillow draws the cards with no browser, and sqlite3
and urllib ship with Python. Runtime dependencies are Pillow and mcp. Cards use Inter (SIL Open
Font License, bundled in src/bodylog/fonts/), so they look the same everywhere.
Development
Tests never touch the network or the repo: tests/fixtures/http/ holds real USDA and Open Food Facts
responses, and every file a test writes goes to a temp dir.
Layout: store.py (SQLite), names.py, chatlog.py, stats.py, muscles.py, card.py (workouts),
food.py (meal parsing, matching, totals, streaks), sources.py (USDA and Open Food Facts),
foodcard.py (day card), cli.py, server.py (MCP), data/common_foods.json (bundled USDA table).
Credits
Food data: USDA FoodData Central (public domain) and Open Food Facts (Open Database License; product data is attributed to Open Food Facts contributors).
來源:README.md,提交 c5a6ba5
工具
0版本歷史
1- v0.1.0最新Sep 23, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分