loseit-mcp

loseit-mcp

An MCP server and CLI for logging food to Lose It!, enabling food search, diary management, meal logging, and weight recording via unofficial API.

Category
访问服务器

README

loseit-mcp

An MCP server and CLI for logging food to Lose It!.

⚠️ Unofficial. Lose It! publishes no public API. This talks to the private GWT-RPC endpoint used by the Lose It! web app, so it can break whenever they ship a new web build.

Tools

Tool Description
search_food Search the food database; returns food_ids
describe_food Full nutrition and serving detail for one food
get_diary A day's entries with calories and macros, plus totals
log_food Log a database food to a meal
log_custom_food Log arbitrary calories/macros with no database match
log_weight Record a weigh-in
get_weight_history Read weigh-ins over a range, with min/max/change
delete_entry Delete a diary entry
whoami Show the authenticated account

log_custom_food exists because updateFoodLogEntry carries the food's name, brand, and nutrient map inline — so an entry can describe a food the database has never heard of. Use it for restaurant meals, homemade dishes, or any portion where forcing a database match would distort the numbers.

Setup

uv sync
cp .env.example .env   # then fill in your credentials

Configuration

Settings resolve in priority order: CLI flags → environment → .env → JSON config file → defaults.

Variable Required Description
LOSEIT_EMAIL yes* Lose It! account email
LOSEIT_PASSWORD yes* Lose It! account password
LOSEIT_TOKEN no A liauth JWT, used instead of email/password
LOSEIT_HOURS_FROM_GMT no UTC offset in whole hours; auto-detected
LOSEIT_STRONG_NAME no GWT permutation, if Lose It ships a new build
LOSEIT_POLICY_HASH no GWT policy hash, if Lose It ships a new build

* Not required if LOSEIT_TOKEN is set.

.env is gitignored. The session token is cached at ~/.config/loseit-mcp/session.json with owner-only permissions and refreshes automatically when it expires.

Running the server

loseit-mcp serve                                  # stdio (default)
loseit-mcp serve --transport streamable-http --port 8000

Register the stdio server with an MCP client:

{
  "mcpServers": {
    "loseit": {
      "command": "uv",
      "args": ["run", "loseit-mcp", "serve"],
      "cwd": "/absolute/path/to/loseit-mcp"
    }
  }
}

To host one server for multiple accounts, see DEPLOYMENT.md.

CLI

The same operations are available directly, which is the easiest way to test:

loseit-mcp search "greek yogurt" -n 5
loseit-mcp describe <food_id>
loseit-mcp diary 2026-07-25
loseit-mcp log <food_id> -m lunch -a 120 -u g
loseit-mcp log-custom "Caesar Salad" 620 -m lunch -b "Gastrohub" -p 46 -c 18 -f 40
loseit-mcp weigh 199.2
loseit-mcp weights -n 14
loseit-mcp delete <entry_id> -d 2026-07-25

Add --dry-run to either log command to preview the math without writing, and --json for machine-readable output.

Two more, for hosted deployments:

loseit-mcp gen-secret                      # a secret for LOSEIT_URL_SECRET
loseit-mcp enroll https://<host>           # get a credential URL for a client

Notes

  • Deleting writes a recoverable copy to local trash before the wire call.
  • When Lose It changes their private API, tools return an explanation of what broke and what the operator needs to refresh, rather than a decoder traceback — see errors.py.
  • Hosted deployments rate-limit per client address and per credential, since an address alone is a weak identity behind a NAT pool.
  • /healthz reports the running version and commit, so you can tell what is actually deployed without reading logs.
  • Weights carry no unit over the wire; the number is interpreted in whatever unit the account displays (lb or kg).
  • saturated_fat_g is not recorded. The upstream SDK's payload builder filters that nutrient ordinal out, so log_custom_food reports it in an ignored_nutrients field rather than claiming to have logged it. Every other macro goes through.
  • Weight history is fetched in windows and bisected further when a response is too large for the SDK decoder — an unchunked year-long query would otherwise silently return "no weigh-ins".
  • Relative dates (today / yesterday) resolve in the account's timezone, not the host's, so a server in another region doesn't log to the wrong day.
  • Fractional portions of database foods can display a misleading unit (half a banana rendering as "1/4 Each") because the server's canonical serving count differs from the food's native unit. Calories stay correct, but log-custom is the more predictable route for odd portions.

Architecture

The GWT-RPC wire format is handled by the phitoduck/lose-it SDK. This project adds email/password authentication (the SDK expects you to supply a JWT yourself, and its browser-cookie import does not support Windows), the custom-food logging path, weight recording via saveRecordedWeight (captured from the web app's weigh-in widget), and the MCP server and CLI layers.

License

0BSD — the BSD Zero Clause License. Use it, change it, ship it, sell it. No attribution, no notice, no conditions of any kind.

This is deliberate. If FitNow (the makers of Lose It!) want any part of this, they should take it and treat it as their own — no permission needed, nothing to negotiate, no obligation to credit me. The same goes for anyone else.

Two things a license cannot do, stated plainly:

  • Trademark is separate. "Lose It!" is a registered trademark of FitNow, Inc. This project is unofficial and unaffiliated; the license grants no rights in their marks.
  • Dependencies keep their own terms. They are all permissive (MIT, BSD-3, Apache-2.0), but the lose-it SDK is MIT and asks that its copyright notice be preserved. Anyone vendoring this code should either keep that notice or replace the dependency.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选