food-tracker
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@food-tracker log my lunch: two eggs and a bagel"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
food-tracker
A small MCP server that lets Claude log what I eat and drink. I send Claude a photo of my plate, a menu screenshot, or a sentence like "two eggs and a bagel." Claude estimates the macros, saves the meal here, and tells me where I am for the day. A private web dashboard shows the totals and the last two weeks.
I built it because I already pay for Claude Pro. Food-tracking apps that estimate meals from photos are mostly an AI model behind a subscription, and I didn't want to pay for a second one while in college. Claude can already look at a photo and estimate a meal, so all it was missing was somewhere to keep the numbers.
By Maximus Desir.
How it works
Claude does all the estimating. The server never guesses nutrition: every item arrives with calories, protein, carbs, and fat already filled in, plus where the numbers came from (photo, menu, manual, template) and how confident Claude was. The server stores, edits, and adds up. That keeps it small and testable, and the source field shows later which entries were guesses.
Claude gets these tools:
Tool | What it does |
| Save a meal as a list of items |
| Save water in fl oz |
| Saved meals for plates I eat often, with optional scaling ("1.5x the usual") |
| Fix mistakes ("that was two chicken breasts") |
| A day's entries and totals, or per-day totals and averages for a check-in |
| Daily targets, dated so past days keep the targets they had |
| Look up the dining hall's published nutrition for something I ate |
Every write returns the updated day totals, so Claude can answer in one message. Writes that add rows take a request_id, so a retried tool call doesn't log the same meal twice.
Optional fields cover portion weight and eight micronutrients (fiber, saturated fat, sodium, potassium, calcium, iron, magnesium, vitamin D). Totals for those report how many items had data, so a missing label doesn't read as a low intake.
Days follow local time (America/New_York by default), so an 11:30 pm snack counts toward that day. Timestamps are stored in UTC.
Dining hall menus
My dining hall publishes nutrition labels through Dine On Campus. POST /menu-import accepts the raw menu JSON the site loads in my own browser and stores the published numbers, so Claude can use real label values instead of estimating. The server never fetches the site itself. Screenshots of a nutrition panel work too: Claude copies the label and logs it as source="menu".
Dashboard
/dash is a read-only page: today's totals against targets, calorie and protein bars for the last 14 days, 7-day averages, today's meals, and micronutrients. It sits behind the same Google sign-in as Claude and doesn't refresh on its own, so an open tab doesn't keep the server awake.
Related MCP server: Cronometer MCP server
Security
Claude connects with MCP OAuth (dynamic client registration and PKCE). Signing in goes through Google, and only the one email in
FOOD_ALLOWED_EMAILgets in.Sign-in codes can only be sent to claude.ai's callback or to a loopback address, and tokens are issued only for this server's
/mcp.Access tokens last an hour. Refresh tokens last 90 days and rotate on every use. Reusing an old refresh token revokes the whole grant.
Codes, tokens, and dashboard sessions are stored as SHA-256 hashes. The dashboard cookie is
__Host-,HttpOnly,Secure, andSameSite=Lax.Open endpoints (registration, sign-in starts) are capped so strangers can't fill the database.
Request logs are off, so one-time codes never land in logs.
The container drops from root to an unprivileged user after taking ownership of the data volume.
Deleted entries are hidden immediately and erased for good after 30 days.
Running it
You need Python 3.12 and uv.
uv sync
uv run ruff check . && uv run ruff format --check .
uv run pyright
uv run python -m food_mcp.server # stdio, e.g. for Claude Code or the MCP InspectorDeploying to Fly.io
It runs on one Fly machine with a 1 GB volume for the SQLite file. The machine stops when idle and starts on the next request (about a second), which keeps the cost near the price of the disk. Fly snapshots the volume daily and keeps 14 days of snapshots. SQLite needs a single writer, so never scale past one machine.
Change
appandFOOD_PUBLIC_URLinfly.toml, thenfly apps create <name>andfly volumes create food_data --size 1 --region iad.In Google Cloud, create an OAuth client of type "Web application" with the redirect URI
https://<app>.fly.dev/auth/google/callback. Leave the consent screen in Testing with yourself as a test user.Set the secrets:
fly secrets set GOOGLE_CLIENT_ID=... GOOGLE_CLIENT_SECRET=... \ FOOD_ALLOWED_EMAIL=you@gmail.com FOOD_IMPORT_TOKEN=$(python3 -c "import secrets; print(secrets.token_urlsafe(32))")fly deploy --ha=falseIn claude.ai, open Settings, then Connectors, and add a custom connector with
https://<app>.fly.dev/mcp. Sign in with Google when asked.
Variable | Purpose |
| Public base URL; the OAuth issuer |
| The one Google account allowed to sign in |
| Google OAuth client |
| Bearer token for |
| SQLite file (default |
| Time zone for day boundaries (default |
| Optional goal Claude checks progress against, e.g. |
| Optional name of your dining hall, so "I ate at North" triggers a menu lookup |
| Cutoffs for guessing the meal type (defaults 10:30, 15:30, 21:00) |
Layout
src/food_mcp/
server.py MCP tools; thin wrappers over repo and summary
web.py HTTP app: /mcp, /dash, /auth/google/callback, /menu-import, /health
auth.py OAuth provider backed by SQLite, Google sign-in check
repo.py all SQL
summary.py day and range totals, remaining vs. targets
dashboard.py the dashboard page
menu_import.py Dine On Campus JSON to menu items
timeutil.py local day and UTC conversion
migrations/ numbered SQL files, applied in orderLimits
Photo estimates are rough, especially for big or mixed plates. Treat the numbers as ballpark figures: steady logging and a weekly look at the trend matter more than any single entry. It's built for one person: one allowed Google account and one database. The browser bookmarklet that sends the dining hall menu isn't written yet; for now, menu data comes from screenshots.
Available Tools
11 toolsdelete_entryA
Delete a meal or water entry by id (from get_day or a log result). Returns that day's updated totals.
Inputs: id (required), kind (required). Returns: object
edit_mealA
Correct a logged meal: replace its items or change its type, time, or notes. Unspecified fields stay as they are. Returns the updated meal and its day's totals.
Inputs: meal_id (required), items, notes, eaten_at, +1 more. Returns: object
get_dayA
Get every meal (with items and ids) and water entry for one local day, plus totals and remaining vs. that day's targets. Use for 'what did I eat' and before edits or deletes.
Inputs: date. Returns: object
get_rangeA
Per-day totals and averages over a date range (max 92 days). Use for weekly check-ins and trends rather than calling get_day repeatedly.
Inputs: end (required), start (required). Returns: object
list_templatesA
List saved meals with their total macros. Use to find the exact name for log_template.
Inputs: no named parameters. Returns: object
log_mealA
Log a meal you have already itemized with macros. Use this for any food except a saved meal the user names (use log_template). Returns meal_id and the day's totals vs. targets.
Inputs: items (required), source (required), confidence (required), request_id (required), +3 more. Returns: object
log_templateA
Log a saved meal by name, optionally scaled. Use when the user names a saved meal instead of describing food. Returns meal_id, the logged items, and the day's totals vs. targets.
Inputs: name (required), request_id (required), scale, eaten_at, +1 more. Returns: object
log_waterB
Log water in fl oz. Returns water_id and the day's totals, including water vs. target.
Inputs: fl_oz (required), request_id (required), logged_at. Returns: object
save_templateA
Create or overwrite a saved meal, from explicit items or from an existing meal_id. Returns the saved items and totals, plus today's totals.
Inputs: name (required), items, meal_id. Returns: object
set_targetsA
Set daily targets starting on a local date (default today). Omitted fields keep their current values; earlier days keep their old targets. Returns the stored targets row and today's totals.
Inputs: kcal, fat_g, carbs_g, fiber_g, +9 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clearly distinct purpose, and the descriptions explicitly resolve the riskiest overlaps: log_meal vs log_template (itemized vs named saved meal), log_template vs save_template vs list_templates, and get_day vs get_range (single day vs trend window). Even edge tools like find_menu_items and set_targets sit in unambiguous territory.
Every tool follows a strict verb_noun snake_case pattern (log_meal, get_range, save_template, edit_meal, delete_entry, set_targets, find_menu_items). Verbs are used consistently for their action class (log/save/list/get/set/edit/delete/find).
11 tools is well within the ideal range, and each one earns its place: meal logging, water logging, template management, retrieval, targets, and menu lookup. No redundant or filller tools.
Meal lifecycle (log/edit/delete/get), water logging with delete, template create/list/apply, target setting, and range queries are all covered. Minor gaps remain: no way to delete or rename a saved template, no editing of a water entry (only delete), and no standalone get_targets, but these are workable around.
Maintenance
Related MCP Connectors
Log meals and read your nutrition diary from Claude or ChatGPT.
Calorie, workout and body-weight log inside ChatGPT and Claude. Log meals by text, photo or voice.
Track calories and macros right in Claude or ChatGPT and build a personal nutrition diary
Calorie tracker app for ChatGPT and Claude: read meals, macros, weight and log meals from chat.
Related MCP Servers
- AlicenseAqualityBmaintenanceConnect MyFitnessPal to Claude or any MCP client. Log meals, search food database with macros, track trends, and export nutrition history against your real MyFitnessPal diary.18284 PyPI39MIT
- AlicenseAqualityBmaintenanceEnables reading and writing your Cronometer food diary from Claude.ai and Claude Code, including food entries, notes, biometrics, exercises, and fasts.412MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to access your MyFitnessPal diary—foods, portions, meal and daily nutrition totals, water, exercise, steps, and weight—through a custom connector on web, desktop, and mobile.MIT
- AlicenseNot gradedqualityCmaintenanceEnables logging meals, tracking calories and macros, reviewing daily and range summaries, setting weight goals, searching foods and recipes, and getting meal suggestions from any Claude client, with optional multi-user household support. Includes a local food database for items missing from FatSecret and OAuth-based authentication to FatSecret profiles.MIT