loseit

loseit

MCP server that reads local SQLite database populated by a Playwright scraper to provide daily summary, food log, weight history, and water log from LoseIt.

Category
访问服务器

README

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. 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.

Privacy note

Session cookies, SQLite food/weight history, and logs live under ~/.loseit-data/ (outside this repo). Do not commit that directory, any state.json, or *.db files. 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 chromium

2. Log in once (saves your session)

python src/scraper.py login

A real browser window opens. Log into LoseIt manually (this sidesteps any CAPTCHA/bot-check LoseIt might show, since it's genuinely you clicking). Once you're on your dashboard, go back to the terminal and press Enter. Your session is saved to ~/.loseit-data/state.json.

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 --headed

Check 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 run

4. Schedule the daily run (+ optional email alerts)

Two launchd jobs (macOS):

Job When What
com.loseit-mcp.scraper 06:00 Scrape via scripts/run-scraper.sh. On failure, emails you if configured. On success, writes ~/.loseit-data/last_success.
com.loseit-mcp.scraper-health 12:00 If last_success is older than 36h (or missing and DB is stale), emails a STALE alert (at most once per day) if configured.

Alerts use the local mail command and only send when LOSEIT_ALERT_EMAIL is set. 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

# or without email (failures only show up in local logs)
bash scripts/install-launchd.sh

install-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.log

Test the health check:

launchctl start com.loseit-mcp.scraper-health
# or: bash scripts/health-check.sh

Uninstall:

bash scripts/uninstall-launchd.sh

5. 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), food log, weight, and water. Individual exercise entries are not scraped.
  • Persistent logs live under ~/.loseit-data/logs/. Success stamp: ~/.loseit-data/last_success.
  • Session cookies can expire or get invalidated; if run starts failing across the board, redo step 2 (python src/scraper.py login).

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选