Nutrition MCP
io.github.akutishevsky由 GitHub 账号 akutishevsky 发布v1.32.0更新于 Nov 3, 2026
营养追踪:记录餐食和宏量营养素,USDA 和 Open Food Facts 查询,历史记录,应用导入。
AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。
原文描述
Nutrition tracking: log meals and macros, USDA and Open Food Facts lookups, history, app import.
概览
Nutrition 的托管 MCP 服务(nutrition-mcp.com);需要 OAuth 登录;Streamable HTTP。
暂无 AI 概览:以下信息来自注册中心条目和服务本身。
- 端点
- nutrition-mcp.com
- 最近检查
安装
在 SourceWeft 中
- 打开 控制台中的 Nutrition MCP,将其添加到工作区。
- 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
交给智能体安装
把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。
阅读 https://sourceweft.com/mcp/io.github.akutishevsky%2Fnutrition-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。 客户端会在首次连接时完成 OAuth 登录。
{
"mcpServers": {
"nutrition": {
"type": "http",
"url": "https://nutrition-mcp.com/mcp"
}
}
}README
Nutrition MCP
A remote MCP server for personal nutrition tracking — log meals with calories, macros, fiber, total and added sugar, saturated and trans fat, sodium (with an optional daily ceiling) and caffeine (optionally ingredient by ingredient), look up generic foods in USDA FoodData Central and packaged products by barcode in Open Food Facts, record where each nutrient value came from, save meals you eat often and log them again by name, log water, body weight and body measurements, review nutrition history, and import an existing food diary from another app, all through conversation. Alcohol tracking is opt-in and off by default. The website and the in-chat widgets are available in English, German, Spanish, French, Dutch, Polish, Italian, Ukrainian, Japanese and Turkish; set_language picks the widget language.
Help me pay for the servers on Patreon
Table of Contents
- Quick Start
- Demo
- Tech Stack
- MCP Tools
- MCP Resources
- Self-hosting
- Development
- Connect to Claude.ai
- Apple Health sync
- Troubleshooting
- API Endpoints
- Deploy
- Support & security
- Data sources
- License
Quick Start
Already hosted and ready to use — just connect it to your MCP client:
On Claude.ai: open Nutrition MCP in the Claude directory and click Connect (see Connect to Claude.ai below)
On first connect, sign in with Google or enter an email and password and choose Create account. Your data persists across reconnections. Trouble connecting? See Troubleshooting.
By connecting you agree to the Terms of Service; how your data is handled is in the Privacy Policy.
Switching from another tracker? See the nutrition-app alternatives — how it compares to MyFitnessPal, Cronometer, Lose It!, MacroFactor, Yazio, and Lifesum. Bring your history with you: say "import my meals" and an importer opens in the chat, where you pick the CSV you exported from your old app, map its columns, and check what will be added before anything is saved. Exports from MyFitnessPal, Cronometer, Lose It! and MacroFactor are recognised automatically; any other CSV works by mapping its columns yourself. In clients that can't show in-chat panels, paste the export instead and the AI imports it for you. If your export has an alcohol column and you want it kept, turn alcohol tracking on before importing — the importer skips that column while tracking is off, and re-importing the same file later won't backfill it.
Demo
Read the story behind it: How I Replaced MyFitnessPal and Other Apps with a Single MCP Server
Tech Stack
- Bun — runtime and package manager
- Hono — HTTP framework
- MCP TypeScript SDK v2 (
@modelcontextprotocol/server) with Zod 4 schemas — Model Context Protocol over Streamable HTTP, answering both the2026-07-28and the2025-11-25protocol revisions - Supabase — PostgreSQL database + user authentication
- OAuth 2.0 — authentication for Claude.ai and other MCP clients: per-client dynamic client registration (RFC 7591) with exact redirect-URI matching, mandatory PKCE (
S256), token-endpoint client authentication (none,client_secret_post,client_secret_basic), codes and refresh tokens bound to the client they were issued to,isson every authorization response (RFC 9207), and client secrets, access tokens, refresh tokens and codes stored only as a SHA-256 hash. Access tokens last 24 hours; refresh tokens last 90 days from their last use and rotate on every refresh; expired tokens and never-used client registrations are swept hourly
MCP Tools
MCP Resources
In-chat widgets
On hosts that support MCP Apps, the tools also draw a card in the chat. Each card carries the same figures as the text answer:
- Nutrition summary (
get_nutrition_summary) and meal logged (log_meal,update_meal,log_saved_meal): a half-gauge of calories. For one day the arc is split into meals; for a range it shows the average against the peak day. Show more opens the nutrients: each one has its own mini gauge and, expanded, the meals and ingredients it came from, plus a by-day strip for a range and calories by meal. Sodium and saturated and trans fat are in that list. The meal-logged card only appears once goals are set. - Goal progress (
get_goal_progress): intake against targets and limits for a day, and latest weight against the target weight. - Trends (
get_trends): a 7/14/30-day toggle and a nutrient switcher over a bar chart, with one card per nutrient. - Weight trends (
get_weight_trends): weight over time, zoomed to 7 days, 30 days, 90 days, 1 year or all history. - Digest (
get_digest): one period in collapsible sections — calories and nutrients against goals, trends, water and weight, meals or logging habits, and highlights. - Import (
start_meal_import): the CSV importer. The file is read in the browser, mapped, and previewed before anything is saved.
Cards follow the light or dark theme of the host and the language set with set_language. They are on by default; set_widget_display turns them off, and the text answers are unchanged.
Self-hosting
For Cloudflare hosting options and an independent Workers reference, see Cloudflare hosting and email authentication. The guide distinguishes running this Bun/Supabase application in a container from adapting a smaller feature set to Workers and D1.
0. Get the code
Requires Bun 1.x (matches the Dockerfile's oven/bun:1 base image; no exact minor version is pinned).
bun run gen:all regenerates the public site pages without starting the server.
Making it yours: The public site includes the maintainer's personal bits — Google Analytics, Microsoft Clarity, Patreon/GitHub/contact links, and the
nutrition-mcp.comdomain. Runbun run gen:allto produce the public pages, thenbun run depersonalizeto strip the personal bits in one pass (the consent-gated analytics snippet, the consent banner and the footer "Cookie settings" button, plus the analytics CSP hosts, the Support/Contact sections, social links, and the domain → ayour-domain.complaceholder). Usebun run depersonalize --dryto preview without writing. Afterwards, swap in your ownpublic/og.png,favicon.ico,favicon.svg,apple-touch-icon.png,icon-192.pngandicon-512.png, replace the domain placeholder with your real domain, and rewrite the analytics paragraphs of the privacy policy and terms (src/copy/legal*.ts), which still name both services. Its edits to the generated pages are undone bybun run gen:all— to regenerate, first change the sources it reads from (inscripts/site-partials.ts, either your ownGA_MEASUREMENT_ID/CLARITY_PROJECT_ID, whichanalyticsHead()loads only after a visitor accepts the consent banner, orANALYTICS_ENABLEDset to false to drop the snippet, banner and button altogether;SITEinsrc/routes.ts), then run it again. This script only touches the generated files underpublic/, the import widget's support address,src/index.tsand the security.txt contact insrc/security-txt.ts(blanked, so/.well-known/security.txtanswers 404 until you set your own) — it doesn't touch this README orSECURITY.md, so if you're publishing your own fork, rewriteSECURITY.mdfor your deployment and also edit or remove the Patreon line near the top of this file and the Medium link in Demo.
1. Supabase setup
-
Create a Supabase project.
-
Enable Email Auth (Authentication → Providers → Email) and disable email confirmation.
-
Apply the schema. The full schema lives in
supabase/migrations/. With the Supabase CLI:This creates every table, index, RLS policy, and foreign key the app needs. No local Postgres is involved — migrations run against your hosted project.
-
Copy the service role key from Project Settings → API and use it as
SUPABASE_SECRET_KEY.
2. Environment variables
Legacy only — a fresh deploy doesn't need these, since every client registers its own credentials via POST /register. To set the optional OAUTH_CLIENT_* pair for the legacy static client:
or manually:
Patreon posts, one-time setup:
PATREON_ACCESS_TOKEN/PATREON_REFRESH_TOKENare only ever read once, at server boot, to seed thepatreon_tokenstable if it's still empty — the server refreshes and stores its own pair from then on, so leaving these two set permanently is safe (every later boot is a no-op). You never need to touch the database by hand.
3. Google sign-in (optional)
Email/password works out of the box. To also offer "Continue with Google",
follow docs/google-auth-setup.md to create a
Google OAuth client, enable the Google provider in Supabase, and set
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET. This adds the POST /authorize/google
and GET /auth/google/callback routes — see API Endpoints.
Development
The generated pages under public/ (index, tools, privacy, terms, login, /alternatives, locale mirrors, sitemap.xml) are build artifacts, not tracked in git — they're regenerated on every Docker build, in CI, and once at each bun run dev start. --watch only restarts the src/index.ts process on save, so it does not rerun generation — after editing src/copy/, src/routes.ts, or scripts/site-partials.ts, run bun run gen:all yourself to pick up the change.
Testing and quality
CI runs format:check and typecheck on every PR; typecheck is scoped to src/, so a type error in a test file or under scripts/ won't be caught by it.
For in-chat widget development (public/widgets/), bun run harness starts a local host simulator so you can test widgets without a real MCP client.
Connect to Claude.ai
- Open Nutrition MCP in the Claude directory
- Click Connect
- Sign in or register when prompted
- Done — Claude can now use your nutrition tools
Alternatively, add https://nutrition-mcp.com/mcp as a custom connector under Customize → Connectors. If you reconnect later, sign in with the same email and password to keep your data.
Apple Health sync
An optional iOS Shortcut, Nutrition MCP Health, copies your daily totals into Apple Health on your iPhone: calories (Dietary Energy), protein, carbohydrates, total fat, fiber and caffeine, plus water if you opt in when connecting. Alcohol is never sent, and neither are sodium, saturated and trans fat or sugar. There is no app to install and no new MCP tool — your AI app keeps doing the logging, and the shortcut only reads finished days. The setup guide — install link, connecting, automations and everyday use — is at nutrition-mcp.com/apple-health (the install link appears there once the shortcut is published); how the shortcut is built is in docs/apple-health-shortcut.md.
- Connecting: run the shortcut on your iPhone. It asks whether to include water and whether to send the last 7 days too, then opens a sign-in page in Safari — sign in with the same account your AI app uses. The page hands control back to the shortcut, which finishes connecting. The connect link works once, for 30 minutes, and only the iPhone that started it can finish it.
- What arrives: only finished days. A day counts as finished at 05:00 the next morning in your timezone, so yesterday appears after 05:00 today and today is never in Health. Each day is one entry per type at 12:00, labelled "Shortcuts". Every sync looks back over the last 7 finished days, so a missed morning catches up by itself.
- Later changes: a meal added to a day that was already sent follows as a small extra entry (12:01, 12:02, …) while the day is within those 7 days. Health cannot lower a value, so a deleted or smaller meal leaves Health higher and the shortcut shows a notice saying how to fix the day by hand.
- When it runs: whenever one of its automations fires — opening the Health app, stopping your alarm, optionally plugging in — or when you choose Sync now in the shortcut.
- What the server keeps: the connection, and for 8 days what it sent, so a day is sent once and afterwards only topped up. Both are in your data export (
health_sync.csv, and ahealth_syncrow inconnections.csv). The connection ends after 90 days without a sync and 365 days after connecting at the latest; Disconnect in the shortcut, or deleting your account, removes it at once. Nothing is ever removed from Apple Health — that data is on your iPhone. - Your profile timezone decides where one day ends. If you never set one, the timezone your iPhone reported when connecting is used.
get_profileshows whether the sync is connected and which day it has sent through.
Active calories from Apple Health (optional)
A second, separate shortcut, Nutrition MCP Activity, works the other way round: it reads your Active Energy total for today and the 2 days before from Apple Health and sends only those daily totals, which become your active calories beside what you ate. It reads nothing else from Health and never changes the calorie goal. It pairs through the same sign-in, has its own connection (so disconnecting one shortcut leaves the other connected), and is built step by step in docs/apple-health-activity-shortcut.md.
- One entry per day: each day is that day's whole Active Energy total, replaced on every sync, so syncing often never counts a day twice. A 0 sends and removes nothing.
- Hand-logged workouts: on a day it has sent, active calories logged in chat stay listed but aren't added on top, because the watch's total already includes them.
- Your data: those days are rows with
sourceapple_healthinactive_calories.csv, and the connection is ahealth_activity_syncrow inconnections.csv.
Your data
export_all_data returns everything stored about the account as one ZIP, behind a link that expires after 60 minutes. Each export replaces the last. The ZIP holds:
meals.csvandmeal_items.csv— every meal and its ingredients, with the source of each nutrient value.meals.csvuses the importer's column names, so it can be imported again.saved_meals.csvandsaved_meal_items.csv— saved meals and their ingredients.water.csv,active_calories.csv,weight.csvandbody_measurements.csv— every entry.goals.csvandgoals_history.csv— current targets and limits, and how they changed.profile.csvandaccount.csv— settings and account details.telemetry.csv— the tool-call log kept for the account.connections.csv— the apps connected to the account, including the Apple Health sync link.health_sync.csv— the days sent to Apple Health in the last 8 days.README.txt— the timezone the timestamps are written in, which columns are in milligrams, and which files can be imported.
Every timestamp has a timezone column next to it, and each file has its header even when it has no rows.
Troubleshooting
The full version, in 10 languages, is at nutrition-mcp.com/tools#troubleshooting. In short:
- Won't connect, or keeps asking to sign in: remove the connector and add it again with exactly
https://nutrition-mcp.com/mcp, then sign in with the same email and password (or Google account) as before — your data belongs to the account, not the connection. It stays connected as long as you use it at least every 90 days. {"error":"session_expired"}on the sign-in page: the page is valid for 10 minutes and resets when the server restarts; reload it or start connecting again.session_mismatchmeans sign-in was finished in a different browser from the one that opened it.- Can't sign in / forgot password: use Sign in for an existing account — a wrong email or password shows "Wrong email or password" and never creates a new account; Create account is only for a first visit. If you signed up with Google, use Continue with Google. There is no self-service reset yet — email [email protected] from your account's address.
- History gone after reconnecting: each email is a separate account; sign in with the one you used originally.
- The AI answers but doesn't log: check the connector is enabled for the conversation, ask explicitly, and approve tool permission prompts.
- Meals on the wrong day: days follow your timezone (UTC until you set one). Set it with
set_timezone; past entries regroup, but one given a specific time while the timezone was wrong keeps that moment — fix it withupdate_meal. Set it before importing history: re-importing another app's file after a timezone change adds the rows again (a Nutrition MCP export is recognized and not duplicated). - No charts or cards: widgets need a host that supports MCP Apps; after
set_widget_display, start a new conversation. The meal-logged card only appears once goals are set. - Importer won't open or can't save: ask the AI to import the file itself with
bulk_import_meals(duplicates are skipped, so re-sending is safe as long as your timezone hasn't changed in between; set it before the first import). If you use the importer panel and want an alcohol column kept, turn alcohol tracking on first; the panel skips it while tracking is off. - "Rate limit exceeded" / "Too many failed authentication attempts": 60 requests a minute per account, 30 a minute per network on the sign-in pages. After 20 rejected connection attempts in a row, a network is paused for 5 minutes, growing to at most an hour — usually an old connector retrying; remove and re-add it.
- Barcode not found or wrong: data comes from Open Food Facts (8–14 digits, no caffeine data; added sugar only when the product lists it, marked when Open Food Facts estimated it from the ingredients); when no product is found, the name or a label photo can supply the figures instead.
- USDA data unavailable until a time is named: USDA FoodData Central lookups (
search_foods,get_food_macros) share one hourly quota across all users. After USDA's limit is reached, or when the key's hourly allowance is nearly used up, lookups pause for 60 minutes; each user is also capped at 30 lookups per hour. Foods looked up in the last 30 days keep working during a pause. USDA's names are in English, so search with English food names. - Yesterday isn't in Apple Health yet: days are sent once they are finished, at 05:00 the next morning in your timezone; the next sync after that (opening Health, stopping your alarm, or Sync now) brings it. Every sync covers the last 7 days.
- Apple Health shows more than chat: Health can't lower a value it already has. Delete that day's entries from Shortcuts under Health → Browse → Nutrition → (type) → Show All Data and enter the right total by hand. Never use "Delete All Data from Shortcuts" — it also removes what your other shortcuts logged. If every day looks doubled, another app writes the same types; switch one off under Health → Sharing → Apps.
- Apple Health sync stopped: run Nutrition MCP Health by hand to see why. If it asks to connect again (90 days without a sync, 365 days after connecting, or after Disconnect), sign in on the page it opens within 30 minutes. If it only syncs by hand, check its automations are on and set to Run Immediately; if a notice says a day didn't reach Health, allow Shortcuts to write every nutrition type under Health → Sharing → Apps → Shortcuts.
- Export link doesn't work: links expire after 60 minutes and each export replaces the last; ask for a fresh one. An export reporting 0 meals when you expected history usually means you signed in with a different email.
- Deleting your account:
delete_accountpermanently removes everything after you confirm; export first if you want a copy. - Reporting a problem: bugs on GitHub Issues (never include your password); security issues privately, as SECURITY.md describes.
API Endpoints
Deploy
The project includes a Dockerfile for container-based deployment.
- Push your repo to a hosting provider (e.g. DigitalOcean App Platform)
- Set the environment variables listed above
- The app auto-detects the Dockerfile and deploys on port
8080 - Point your domain to the deployed URL
Support & security
- Help, bugs, feature requests: open a GitHub issue or email [email protected].
- Security vulnerabilities: do not open a public issue. Report privately via GitHub private vulnerability reporting or email [email protected] — see SECURITY.md. Machine-readable contact: https://nutrition-mcp.com/.well-known/security.txt
- Account deletion / your data: the
delete_accountandexport_all_datatools, or email the address above. See the privacy policy.
Food data sources
Nutrition figures come from three places, and each nutrient value records which one it came from (the user, a label or barcode record, USDA, or an estimate). The in-chat widgets show that source as a tag beside each number, per meal and per ingredient, and the export carries it in nutrient_sources. A value is tagged USDA or Open Food Facts only when it matches that record for the amount logged; the server checks this, so a value cannot claim a source it does not match.
USDA FoodData Central (search_foods, get_food_macros) covers generic, unbranded foods from the Foundation, SR Legacy and Survey (FNDDS) data types, with values per 100 g scaled to the grams eaten and the portion sizes USDA lists. Its data is English-only, so search with English food names. A nutrient USDA does not record for a food is reported as not recorded and is never shown as zero. Requests send the search words (cleaned and up to 200 characters) or a FoodData Central id to USDA's API with this server's key, and no user identifier.
Suggested citation for FoodData Central, from fdc.nal.usda.gov:
U.S. Department of Agriculture, Agricultural Research Service, Beltsville Human Nutrition Research Center. FoodData Central. [Internet]. [cited 2026-10-10]. Available from https://fdc.nal.usda.gov/.
Nutrition MCP is not endorsed by the U.S. Department of Agriculture.
Open Food Facts (lookup_barcode) uses product data from Open Food Facts for packaged products, looked up by barcode. Product data © Open Food Facts contributors, available under the Open Database License (ODbL). Every lookup result names Open Food Facts and the licence.
Values with no record behind them are estimates, or come from a label the user shares.
License
来源:README.md,提交 95188b6
工具
0版本历史
5- v1.32.0最新Nov 3, 2026
- v1.30.0Oct 25, 2026
- v1.29.0Oct 10, 2026
- v1.28.0Oct 4, 2026
- v1.27.2Sep 16, 2026
评分
已满足适用检查项的 85%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通必需25 分
- 已声明认证方式必需10 分
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分