{
  "markdown": "# cronometer-mcp\n\n<!-- mcp-name: io.github.cphoskins/cronometer -->\n\nAn [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server that provides access to your [Cronometer](https://cronometer.com/) 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.\n\n**Requires a Cronometer Gold account** (or any paid tier that supports web login).\n\n## Features\n\n- **Food log** — individual food entries with full macro and micronutrient breakdown\n- **Daily nutrition** — daily calorie, protein, carb, fat, and fiber totals\n- **Micronutrients** — detailed vitamin/mineral breakdown with period averages\n- **Diary management** — add/remove food entries, copy entire days, mark days complete\n- **Recurring foods** — create, list, and delete repeat items that auto-log on selected days\n- **Macro targets** — read/write daily targets, create templates, set weekly schedules\n- **Fasting** — view history and stats, cancel or delete fasts\n- **Biometrics** — log and remove weight, blood glucose, heart rate, body fat\n- **Raw CSV export** — servings, daily summary, exercises, biometrics, or notes\n- **Sync to disk** — download JSON exports and generate a markdown food log\n\n## Quick Start\n\n### 1. Install\n\n```bash\npip install cronometer-mcp\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/cphoskins/cronometer-mcp.git\ncd cronometer-mcp\npip install -e .\n```\n\n### 2. Set credentials\n\n```bash\nexport CRONOMETER_USERNAME=\"your@email.com\"\nexport CRONOMETER_PASSWORD=\"your-password\"\n```\n\nOr add them to a `.env` file in your project root (if your MCP client supports it).\n\n### 3. Configure your MCP client\n\n#### Claude Code (`.mcp.json`)\n\n```json\n{\n  \"mcpServers\": {\n    \"cronometer\": {\n      \"command\": \"cronometer-mcp\",\n      \"env\": {\n        \"CRONOMETER_USERNAME\": \"your@email.com\",\n        \"CRONOMETER_PASSWORD\": \"your-password\"\n      }\n    }\n  }\n}\n```\n\n#### Claude Desktop (`claude_desktop_config.json`)\n\n```json\n{\n  \"mcpServers\": {\n    \"cronometer\": {\n      \"command\": \"cronometer-mcp\",\n      \"env\": {\n        \"CRONOMETER_USERNAME\": \"your@email.com\",\n        \"CRONOMETER_PASSWORD\": \"your-password\"\n      }\n    }\n  }\n}\n```\n\nIf you installed from source with `pip install -e .`, you can also use the full Python path:\n\n```json\n{\n  \"command\": \"/path/to/venv/bin/python\",\n  \"args\": [\"-m\", \"cronometer_mcp.server\"]\n}\n```\n\n## Available Tools\n\n### Food Log & Nutrition\n\n| Tool | Description |\n|------|-------------|\n| `get_food_log` | Individual food entries with macros + micros for a date range |\n| `get_daily_nutrition` | Daily macro totals (calories, protein, carbs, fat, fiber) |\n| `get_micronutrients` | Detailed vitamin/mineral breakdown with period averages |\n| `export_raw_csv` | Raw CSV export for any data type (servings, exercises, biometrics, etc.) |\n\n### Food Search & Diary Management\n\n| Tool | Description |\n|------|-------------|\n| `search_foods` | Search the Cronometer food database |\n| `list_diary_groups` | List this account's diary groups and the values `diary_group` accepts |\n| `get_food_details` | Get full nutrition info and serving measure IDs for a food |\n| `add_food_entry` | Add a food entry to the diary |\n| `remove_food_entry` | Remove a food entry from the diary |\n| `copy_day` | Copy all diary entries from one date to another |\n| `set_day_complete` | Mark a diary day as complete or incomplete |\n\n### Recurring Foods (Repeat Items)\n\n| Tool | Description |\n|------|-------------|\n| `get_repeated_items` | List all recurring food entries |\n| `add_repeat_item` | Add a recurring food entry that auto-logs on selected days |\n| `delete_repeat_item` | Delete a recurring food entry |\n\n### Macro Targets & Templates\n\n| Tool | Description |\n|------|-------------|\n| `get_macro_targets` | Get daily macro targets (or full weekly schedule with `target_date=\"all\"`) |\n| `set_macro_targets` | Update daily macro targets (partial updates supported) |\n| `list_macro_templates` | List all saved macro target templates |\n| `create_macro_template` | Create a new saved macro target template |\n| `set_weekly_macro_schedule` | Assign a template to days of the week as the recurring default |\n\n### Fasting\n\n| Tool | Description |\n|------|-------------|\n| `get_fasting_history` | View all fasts or fasts within a date range |\n| `get_fasting_stats` | Aggregate fasting statistics (total hours, longest, averages) |\n| `cancel_active_fast` | Cancel an in-progress fast while preserving the recurring schedule |\n| `delete_fast` | Delete a fast entry |\n\n### Biometrics\n\n| Tool | Description |\n|------|-------------|\n| `get_recent_biometrics` | Get recently logged biometric entries |\n| `add_biometric` | Log weight (lbs), blood glucose (mg/dL), heart rate (bpm), or body fat (%) |\n| `remove_biometric` | Remove a biometric entry |\n\n### Sync\n\n| Tool | Description |\n|------|-------------|\n| `sync_cronometer` | Download JSON exports + generate food-log.md to disk |\n\n### Tool Parameters\n\nAll date parameters use `YYYY-MM-DD` format. Most tools default to today or the last 7 days when dates are omitted.\n\nKey parameter patterns:\n- `diary_group` — a diary group **name** (case-insensitive) or a **0-based index**.\n  Cronometer Gold gives every account 8 diary group slots and lets you rename and\n  enable them freely, so the names are account-specific and are *not* always\n  Breakfast/Lunch/Dinner/Snacks. Call `list_diary_groups` to see yours. On an\n  untouched account the four standard meals are indices `1`–`4` (index `0` is a\n  slot that ships disabled). Unknown names, disabled groups, and out-of-range\n  indices are rejected rather than silently defaulting — Cronometer itself\n  accepts a bad index without complaint and the entry becomes unreachable.\n- `days_of_week` — `\"all\"`, `\"weekdays\"`, `\"weekends\"`, or comma-separated day numbers (`0`=Sun through `6`=Sat)\n- `measure_id` — pass `0` to use the universal gram-based measure (works for all food sources)\n- `target_date` — pass `\"all\"` on `get_macro_targets` to get the full weekly schedule\n\n### Sync Output\n\nThe `sync_cronometer` tool saves files to `~/.local/share/cronometer-mcp/` by default. Override with the `CRONOMETER_DATA_DIR` environment variable:\n\n```bash\nexport CRONOMETER_DATA_DIR=\"/path/to/your/project/data/cronometer\"\n```\n\nOutput files:\n- `exports/servings_{start}_{end}.json`\n- `exports/daily_summary_{start}_{end}.json`\n- `exports/servings_latest.json`\n- `exports/daily_summary_latest.json`\n- `food-log.md`\n\n## How It Works\n\nCronometer 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:\n\n1. Fetches the login page to get an anti-CSRF token\n2. POSTs credentials to authenticate\n3. Calls GWT-RPC `authenticate` to get a user ID\n4. Calls GWT-RPC `generateAuthorizationToken` for short-lived export tokens\n5. Downloads CSV exports using the token\n6. Calls GWT-RPC methods directly for diary edits, fasting, biometrics, macro targets, and repeat items\n\nSession 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).\n\n### GWT Magic Values\n\nThe 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**.\n\nCurrent values (as of February 2026):\n- Permutation: `7B121DC5483BF272B1BC1916DA9FA963`\n- Header: `2D6A926E3729946302DC68073CB0D550`\n\nIf authentication starts failing with GWT errors, these values likely need updating. You can find the current values by:\n\n1. Opening Cronometer in your browser\n2. Going to Developer Tools → Network tab\n3. Looking for requests to `cronometer.com/cronometer/app`\n4. Checking the `x-gwt-permutation` header and the payload structure\n\nYou can override them via the `CronometerClient` constructor:\n\n```python\nfrom cronometer_mcp import CronometerClient\n\nclient = CronometerClient(\n    gwt_permutation=\"NEW_PERMUTATION_HASH\",\n    gwt_header=\"NEW_HEADER_VALUE\",\n)\n```\n\n## Python API\n\nYou can also use the client directly in Python:\n\n```python\nfrom datetime import date, timedelta\nfrom cronometer_mcp import CronometerClient\n\nclient = CronometerClient()  # reads from env vars\n\n# Get today's food log\nfoods = client.get_food_log()\n\n# Get last 7 days of daily summaries\nstart = date.today() - timedelta(days=7)\nsummaries = client.get_daily_summary(start)\n\n# Raw CSV export\ncsv_text = client.export_raw(\"exercises\", start, date.today())\n\n# Copy a day's diary entries\nclient.copy_day(date(2026, 3, 1), date(2026, 3, 8))\n\n# Add a recurring food entry (every weekday)\nclient.add_repeat_item(\n    food_source_id=12345,\n    measure_id=0,        # universal gram-based measure\n    quantity=200,\n    food_name=\"Oatmeal\",\n    diary_group=1,       # 0-based wire index; 1 == Breakfast on a default account\n    days_of_week=[1, 2, 3, 4, 5],\n)\n\n# Diary groups are user-configured - check what this account actually has\nfor g in client.diary_groups:\n    print(g[\"wire_index\"], g[\"name\"], g[\"enabled\"])\n\n# Log a biometric\nclient.add_biometric(\"weight\", 218.5, date.today())\n```\n\n## License\n\nMIT\n",
  "bytes": 9343,
  "sha": "56d22865494127753fa40f237a879b09962ad17761f416e0a62a9ceb1263201d",
  "repo_slug": "cphoskins/cronometer-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cphoskins_cronometer_a65b6d51/readme"
}