io.github.cphoskins/cronometer

编码与调试

by cphoskins

MCP server for Cronometer — food logs, macros, and micronutrient tracking

什么是 io.github.cphoskins/cronometer

MCP server for Cronometer — food logs, macros, and micronutrient tracking

README

cronometer-mcp

<!-- mcp-name: io.github.cphoskins/cronometer -->

An MCP (Model Context Protocol) server that provides access to your Cronometer nutrition data. Pull detailed food logs, daily macro/micro summaries, manage diary entries, fasting, biometrics, and recurring foods — all from Claude, Cursor, or any MCP-compatible client.

Requires a Cronometer Gold account (or any paid tier that supports web login).

Features

  • Food log — individual food entries with full macro and micronutrient breakdown
  • Daily nutrition — daily calorie, protein, carb, fat, and fiber totals
  • Micronutrients — detailed vitamin/mineral breakdown with period averages
  • Diary management — add/remove food entries, copy entire days, mark days complete
  • Recurring foods — create, list, and delete repeat items that auto-log on selected days
  • Macro targets — read/write daily targets, create templates, set weekly schedules
  • Fasting — view history and stats, cancel or delete fasts
  • Biometrics — log and remove weight, blood glucose, heart rate, body fat
  • Raw CSV export — servings, daily summary, exercises, biometrics, or notes
  • Sync to disk — download JSON exports and generate a markdown food log

Quick Start

1. Install

bash
pip install cronometer-mcp

Or install from source:

bash
git clone https://github.com/cphoskins/cronometer-mcp.git
cd cronometer-mcp
pip install -e .

2. Set credentials

bash
export CRONOMETER_USERNAME="your@email.com"
export CRONOMETER_PASSWORD="your-password"

Or add them to a .env file in your project root (if your MCP client supports it).

3. Configure your MCP client

Claude Code (.mcp.json)

json
{
  "mcpServers": {
    "cronometer": {
      "command": "cronometer-mcp",
      "env": {
        "CRONOMETER_USERNAME": "your@email.com",
        "CRONOMETER_PASSWORD": "your-password"
      }
    }
  }
}

Claude Desktop (claude_desktop_config.json)

json
{
  "mcpServers": {
    "cronometer": {
      "command": "cronometer-mcp",
      "env": {
        "CRONOMETER_USERNAME": "your@email.com",
        "CRONOMETER_PASSWORD": "your-password"
      }
    }
  }
}

If you installed from source with pip install -e ., you can also use the full Python path:

json
{
  "command": "/path/to/venv/bin/python",
  "args": ["-m", "cronometer_mcp.server"]
}

Available Tools

Food Log & Nutrition

ToolDescription
get_food_logIndividual food entries with macros + micros for a date range
get_daily_nutritionDaily macro totals (calories, protein, carbs, fat, fiber)
get_micronutrientsDetailed vitamin/mineral breakdown with period averages
export_raw_csvRaw CSV export for any data type (servings, exercises, biometrics, etc.)

Food Search & Diary Management

ToolDescription
search_foodsSearch the Cronometer food database
get_food_detailsGet full nutrition info and serving measure IDs for a food
add_food_entryAdd a food entry to the diary
remove_food_entryRemove a food entry from the diary
copy_dayCopy all diary entries from one date to another
set_day_completeMark a diary day as complete or incomplete

Recurring Foods (Repeat Items)

ToolDescription
get_repeated_itemsList all recurring food entries
add_repeat_itemAdd a recurring food entry that auto-logs on selected days
delete_repeat_itemDelete a recurring food entry

Macro Targets & Templates

ToolDescription
get_macro_targetsGet daily macro targets (or full weekly schedule with target_date="all")
set_macro_targetsUpdate daily macro targets (partial updates supported)
list_macro_templatesList all saved macro target templates
create_macro_templateCreate a new saved macro target template
set_weekly_macro_scheduleAssign a template to days of the week as the recurring default

Fasting

ToolDescription
get_fasting_historyView all fasts or fasts within a date range
get_fasting_statsAggregate fasting statistics (total hours, longest, averages)
cancel_active_fastCancel an in-progress fast while preserving the recurring schedule
delete_fastDelete a fast entry

Biometrics

ToolDescription
get_recent_biometricsGet recently logged biometric entries
add_biometricLog weight (lbs), blood glucose (mg/dL), heart rate (bpm), or body fat (%)
remove_biometricRemove a biometric entry

Sync

ToolDescription
sync_cronometerDownload JSON exports + generate food-log.md to disk

Tool Parameters

All date parameters use YYYY-MM-DD format. Most tools default to today or the last 7 days when dates are omitted.

Key parameter patterns:

  • diary_group — one of "Breakfast", "Lunch", "Dinner", "Snacks" (case-insensitive)
  • days_of_week"all", "weekdays", "weekends", or comma-separated day numbers (0=Sun through 6=Sat)
  • measure_id — pass 0 to use the universal gram-based measure (works for all food sources)
  • target_date — pass "all" on get_macro_targets to get the full weekly schedule

Sync Output

The sync_cronometer tool saves files to ~/.local/share/cronometer-mcp/ by default. Override with the CRONOMETER_DATA_DIR environment variable:

bash
export CRONOMETER_DATA_DIR="/path/to/your/project/data/cronometer"

Output files:

  • exports/servings_{start}_{end}.json
  • exports/daily_summary_{start}_{end}.json
  • exports/servings_latest.json
  • exports/daily_summary_latest.json
  • food-log.md

How It Works

Cronometer does not have a public API for individual users. This server uses the same GWT-RPC (Google Web Toolkit Remote Procedure Call) protocol that the Cronometer web app uses internally:

  1. Fetches the login page to get an anti-CSRF token
  2. POSTs credentials to authenticate
  3. Calls GWT-RPC authenticate to get a user ID
  4. Calls GWT-RPC generateAuthorizationToken for short-lived export tokens
  5. Downloads CSV exports using the token
  6. Calls GWT-RPC methods directly for diary edits, fasting, biometrics, macro targets, and repeat items

Session cookies are persisted to ~/.local/share/cronometer-mcp/.session_cookies so that subsequent invocations reuse the session without re-authenticating (Cronometer has aggressive login rate limiting).

GWT Magic Values

The GWT protocol uses a permutation hash and header value that are baked into each Cronometer web deploy. These values are hardcoded in the client and may break when Cronometer pushes a new build.

Current values (as of February 2026):

  • Permutation: 7B121DC5483BF272B1BC1916DA9FA963
  • Header: 2D6A926E3729946302DC68073CB0D550

If authentication starts failing with GWT errors, these values likely need updating. You can find the current values by:

  1. Opening Cronometer in your browser
  2. Going to Developer Tools → Network tab
  3. Looking for requests to cronometer.com/cronometer/app
  4. Checking the x-gwt-permutation header and the payload structure

You can override them via the CronometerClient constructor:

python
from cronometer_mcp import CronometerClient

client = CronometerClient(
    gwt_permutation="NEW_PERMUTATION_HASH",
    gwt_header="NEW_HEADER_VALUE",
)

Python API

You can also use the client directly in Python:

python
from datetime import date, timedelta
from cronometer_mcp import CronometerClient

client = CronometerClient()  # reads from env vars

# Get today's food log
foods = client.get_food_log()

# Get last 7 days of daily summaries
start = date.today() - timedelta(days=7)
summaries = client.get_daily_summary(start)

# Raw CSV export
csv_text = client.export_raw("exercises", start, date.today())

# Copy a day's diary entries
client.copy_day(date(2026, 3, 1), date(2026, 3, 8))

# Add a recurring food entry (every weekday)
client.add_repeat_item(
    food_source_id=12345,
    measure_id=0,        # universal gram-based measure
    quantity=200,
    food_name="Oatmeal",
    diary_group=1,       # Breakfast
    days_of_week=[1, 2, 3, 4, 5],
)

# Log a biometric
client.add_biometric("weight", 218.5, date.today())

License

MIT

常见问题

io.github.cphoskins/cronometer 是什么?

MCP server for Cronometer — food logs, macros, and micronutrient tracking

相关 Skills

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描114.1k

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描114.1k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描114.1k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
83.4k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
52.2k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
46.3k

评论