loseit
Reads a local SQLite database containing scraped LoseIt data and exposes it as tools, allowing AI agents to query daily summaries, food logs, weight history, and water logs stored on the local machine.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
LoseIt local MCP
A local pipeline: Playwright scrapes your LoseIt data daily → stores it in SQLite → an MCP server reads it into Claude Desktop. There is no public LoseIt API, so this reads your own account through the web UI and keeps the data on your machine. Login goes through the token endpoint the LoseIt iOS app uses, and the scraper refreshes that token on every run, so the daily job stays signed in without a manual re-login every 14 days. The scraper may need updates if LoseIt changes their site.
License: MIT (see LICENSE).
Dependency updates
Dependabot opens weekly PRs for Python packages and GitHub Actions, plus
security updates as they appear. CI runs the unit tests on every PR (including
Dependabot’s). When that CI run succeeds, a separate workflow auto-approves
and squash-merges Dependabot PRs — so broken bumps never merge, and tests
are only defined in one place. Re-run pip install -r requirements.txt (and
playwright install chromium after Playwright bumps) on machines that
already have a checkout.
Related MCP server: myfitnesspal-mcp
Privacy note
Login tokens (tokens.json), session cookies (state.json), SQLite
food/weight history, and logs live under ~/.loseit-data/ (outside this
repo). Do not commit that directory, any tokens.json or state.json, or
*.db files. Your password is never stored. The included .gitignore is set up to keep
them out.
1. Install dependencies
cd /path/to/loseit-mcp-local
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
playwright install chromium2. Log in once
python src/scraper.py loginEnter your LoseIt email and password at the prompt (the password is not
shown or stored). This logs in through the same token endpoint the iOS app
uses, which has no CAPTCHA, and saves an access/refresh token pair to
~/.loseit-data/tokens.json (mode 600). Every run trades the refresh
token for a new 14-day access token and writes it into the browser session
at ~/.loseit-data/state.json, so daily runs stay logged in on their own.
python src/scraper.py login --browser is the old flow: log in by hand in
a real browser window. It gets no refresh token, so it lasts 14 days.
3. Run the scraper
Selectors in src/scraper.py were captured against LoseIt's GWT web UI and
will break when that DOM changes. If a run fails after a LoseIt deploy,
re-record with:
playwright codegen --load-storage=~/.loseit-data/state.json https://www.loseit.com…and update the locators in src/scraper.py.
Test on a small range first, with a visible browser:
python src/scraper.py run --since 2026-07-10 --headedCheck the data landed correctly:
sqlite3 ~/.loseit-data/loseit.db "SELECT * FROM daily_summary ORDER BY date DESC LIMIT 5;"Headless (how the scheduled job runs):
python src/scraper.py run4. Schedule the daily run (+ optional email alerts)
Two launchd jobs (macOS):
Job | When | What |
| 06:00 | Scrape via |
| 12:00 | If |
Alerts send through local sendmail/postfix when LOSEIT_ALERT_EMAIL is
set. Attempts are logged to ~/.loseit-data/logs/alert.log. Test with:
LOSEIT_ALERT_EMAIL=you@example.com bash scripts/send-alert.sh --testDaily summary email (optional)
Set LOSEIT_DAILY_SUMMARY_EMAIL and, after each successful scrape, the job
emails the day it just fetched (yesterday) to that address, subject
LoseIt daily YYYY-MM-DD. It sends through the same sendmail path as the
alerts and is logged in alert.log; a send failure does not fail the scrape.
The body is plain text meant for a bot to parse but still readable:
format: loseit-daily/1
date: 2026-07-10
calorie_budget: 2000
calories_eaten: 1500
... (every daily_summary nutrient, same names as the DB)
weight: 180.2
weight_units: lb
water_fl_oz: 64
notes: Felt good
food: meal|name|brand|quantity|units|calories
Breakfast|Eggs||2|Each|140Every key is always present (empty when there is no value). Text never
contains | or newlines. Preview or resend a day by hand:
.venv/bin/python src/daily_email.py --date 2026-07-10
.venv/bin/python src/daily_email.py --date 2026-07-10 \
| LOSEIT_ALERT_EMAIL=you@example.com bash scripts/send-alert.sh --to bot@example.com "LoseIt daily 2026-07-10"The address lives only in the installed launchd plist, never in the repo.
Install the agents (paths are filled in from this checkout — nothing machine-specific is stored in the repo):
# recommended: pass your alert address at install time
bash scripts/install-launchd.sh --email you@example.com
# add the daily summary email
bash scripts/install-launchd.sh --email you@example.com --summary-email bot@example.com
# or without email (failures only show up in local logs)
bash scripts/install-launchd.shinstall-launchd.sh copies the shell wrappers to ~/.loseit-data/bin/ and
points launchd at those copies. macOS TCC blocks launchd from executing
scripts under ~/Documents (Python in the project tree is fine). Re-run
the installer after you edit the scripts so the copies stay in sync.
Test immediately:
launchctl start com.loseit-mcp.scraper
tail -f ~/.loseit-data/logs/scraper.logTest the health check:
launchctl start com.loseit-mcp.scraper-health
# or: bash scripts/health-check.shUninstall:
bash scripts/uninstall-launchd.sh5. Wire the MCP server into Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json
(merge into mcpServers if the file already has other entries). Use the
absolute path to this checkout:
{
"mcpServers": {
"loseit": {
"command": "/ABSOLUTE/PATH/TO/loseit-mcp-local/.venv/bin/python",
"args": ["/ABSOLUTE/PATH/TO/loseit-mcp-local/src/loseit_mcp.py"]
}
}
}Fully quit and reopen Claude Desktop. You should see 4 tools under a
loseit connector: get_daily_summary, get_food_log,
get_weight_history, get_water_log.
Notes
The MCP server only ever reads local SQLite — it never talks to LoseIt itself. All the network activity is in
scraper.py, run on its own schedule.Scope: daily summary (including aggregate exercise calories burned and the day's nutrient totals from the My Nutrients tab: protein, carbs, fat, saturated fat, fiber, sugars, sodium, cholesterol), food log, weight, and water. Food log rows carry calories only; per-item nutrients are not scraped. Individual exercise entries are not scraped.
Persistent logs live under
~/.loseit-data/logs/. Success stamp:~/.loseit-data/last_success.If LoseIt rejects the saved refresh token (for example after a password change, or if the Mac was off long enough for the access token to expire),
runfails with a message saying so; redo step 2 (.venv/bin/python src/scraper.py login), then.venv/bin/python src/scraper.py runto catch up.Each fetched day's food log is replaced with exactly what LoseIt shows, so edited and deleted entries drop out. A day is only replaced when its meal list loaded and adds up to the day's Food total.
A weight that exactly repeats the previous stored day is treated as a missed sync (LoseIt shows the last weigh-in on days with none) and is not stored. Neither that nor a day with no weigh-in fails the run.
If the food log, Weight, or Water Intake widget can't be read for a day (usually a LoseIt redeploy),
runstill saves everything else, then exits non-zero naming the widget and days, so the failure alert fires.After a Playwright version bump, run
.venv/bin/python -m playwright install chromiumor the nextrunfails with "Executable doesn't exist".
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Withings health data — sleep, activity, heart, and body metrics.
MCP server exposing supplements database used by iNutriPlan.com
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for USDA nutrition data lookup, meal logging, and daily macro tracking.40 npmMIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that connects AI assistants to your MyFitnessPal data, enabling reading food diaries, nutrition goals, weight measurements, and more via MFP's web scraping.MIT
- AlicenseNot gradedqualityBmaintenanceTracks macros and logs meals via plain language by exposing a local USDA food database as an MCP server.MIT
- AlicenseAqualityDmaintenanceAn MCP server and CLI for logging food to Lose It!, enabling food search, diary management, meal logging, and weight recording via unofficial API.83BSD Zero Clause