{
  "markdown": "# cronometer-api-mcp\n\n<!-- mcp-name: io.github.rwestergren/cronometer-api-mcp -->\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![CI](https://github.com/rwestergren/cronometer-api-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/rwestergren/cronometer-api-mcp/actions/workflows/ci.yml)\n[![Build Docker image](https://github.com/rwestergren/cronometer-api-mcp/actions/workflows/docker.yml/badge.svg)](https://github.com/rwestergren/cronometer-api-mcp/actions/workflows/docker.yml)\n[![PyPI](https://img.shields.io/pypi/v/cronometer-api-mcp.svg)](https://pypi.org/project/cronometer-api-mcp/)\n\n> **Hosted version for Claude.ai, ChatGPT, and Grok coming soon.** [**Join the waitlist →**](https://tally.so/r/A7WVge?ref=cronometer-api-mcp)\n\nAn [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server for [Cronometer](https://cronometer.com/) nutrition tracking, built on the reverse-engineered mobile REST API.\n\nUnlike [cronometer-mcp](https://github.com/cphoskins/cronometer-mcp), which takes a comprehensive GWT-RPC approach against Cronometer's web backend, this server talks to the same JSON REST API used by the Cronometer Android app -- with clean payloads and stable, versioned endpoints.\n\n## Features\n\n- **Food log** -- diary entries with food names, amounts, meal groups\n- **Nutrition data** -- daily macro/micro totals and nutrition scores with per-nutrient confidence\n- **Food search** -- search the Cronometer food database, get detailed nutrition info\n- **Diary management** -- add/remove entries, copy days, mark days complete\n- **Custom foods** -- create foods with custom nutrition data\n- **Macro targets** -- read weekly schedule and saved templates\n- **Fasting** -- view history and aggregate statistics\n- **Biometrics** -- weight, body fat, heart rate, and other tracked metrics over a date range\n\n## Quick Start\n\n### 1. Install [uv](https://docs.astral.sh/uv/)\n\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n### 2. Set credentials\n\n```bash\nexport CRONOMETER_USERNAME=\"your@email.com\"\nexport CRONOMETER_PASSWORD=\"your-password\"\n```\n\n#### Optional: two-factor authentication\n\nIf the account has two-factor authentication enabled, `/api/v2/login`\nanswers `TOTP_CODE_REQUIRED` unless the request carries the current 6-digit\ncode. Give the server the base32 key that Cronometer showed when 2FA was set\nup (the same key you scanned into your authenticator app) and it derives the\ncode itself at every login (RFC 6238, SHA-1, 30 s period):\n\n```bash\nexport CRONOMETER_TOTP_SECRET=\"ABCD EFGH IJKL MNOP QRST UVWX YZ23 4567\"\n```\n\nSpaces and lowercase are fine. Leave it unset for accounts without 2FA.\n\n#### Optional: override the account timezone\n\nDiary entries are stamped in your Cronometer account's timezone, which the\nserver reports at login. If that zone is wrong (for example, an older build\nhad reset it) you can force a specific IANA zone without changing your account\nsettings:\n\n```bash\nexport CRONOMETER_ACCOUNT_TZ=\"America/Los_Angeles\"\n```\n\nWhen set, this takes precedence over both the value reported at login and any\ncached session, so it also overrides a stale cached timezone.\n\n### 3. Configure your MCP client\n\n`uvx` downloads and runs the server on demand -- no separate install step.\n\n#### OpenCode (`opencode.json`)\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"cronometer\": {\n      \"type\": \"local\",\n      \"command\": [\"uvx\", \"cronometer-api-mcp\"],\n      \"environment\": {\n        \"CRONOMETER_USERNAME\": \"{env:CRONOMETER_USERNAME}\",\n        \"CRONOMETER_PASSWORD\": \"{env:CRONOMETER_PASSWORD}\",\n        \"CRONOMETER_TOTP_SECRET\": \"{env:CRONOMETER_TOTP_SECRET}\",\n        \"CRONOMETER_ACCOUNT_TZ\": \"{env:CRONOMETER_ACCOUNT_TZ}\"\n      },\n      \"enabled\": true\n    }\n  }\n}\n```\n\n#### Claude Desktop (`claude_desktop_config.json`)\n\n```json\n{\n  \"mcpServers\": {\n    \"cronometer\": {\n      \"command\": \"uvx\",\n      \"args\": [\"cronometer-api-mcp\"],\n      \"env\": {\n        \"CRONOMETER_USERNAME\": \"your@email.com\",\n        \"CRONOMETER_PASSWORD\": \"your-password\",\n        \"CRONOMETER_TOTP_SECRET\": \"your-base32-key\",\n        \"CRONOMETER_ACCOUNT_TZ\": \"America/Los_Angeles\"\n      }\n    }\n  }\n}\n```\n\n## Available Tools\n\n### Food Log & Nutrition\n\n| Tool | Description |\n|------|-------------|\n| `get_food_log` | Diary entries for a date, each enriched with food name, source, serving measure/count, and that food's per-entry nutrient contribution, plus an energy_summary (target/consumed/remaining kcal) and a nutrition_summary of consumed totals for every tracked nutrient |\n| `get_daily_nutrition` | Consumed macro and micronutrient totals for every nutrient tracked in Cronometer |\n| `get_nutrition_scores` | Category scores (Vitamins, Minerals, etc.) with per-nutrient consumed amounts and confidence levels |\n\n### Food Search & Details\n\n| Tool | Description |\n|------|-------------|\n| `search_foods` | Search the Cronometer food database by name |\n| `get_food_details` | Full nutrition profile and serving sizes for a food |\n\n### Diary Management\n\n| Tool | Description |\n|------|-------------|\n| `add_food_entry` | Log a food serving to the diary |\n| `remove_food_entry` | Remove one or more diary entries |\n| `add_custom_food` | Create a custom food with specified nutrition |\n| `add_recipe` | Create a recipe from existing foods referenced by ID and gram weight |\n| `import_recipe` | Create a recipe from a free-text ingredient list; Cronometer matches each line to a database food and converts the amount to grams |\n| `copy_day` | Copy all entries from the previous day |\n| `mark_day_complete` | Mark a diary day as complete or incomplete |\n\n### Targets & Tracking\n\n| Tool | Description |\n|------|-------------|\n| `get_macro_targets` | Weekly macro schedule and saved target templates |\n| `get_fasting_history` | Fasting history within a date range |\n| `get_fasting_stats` | Aggregate fasting statistics |\n| `list_biometrics` | List trackable biometric metrics and their units |\n| `get_biometrics` | Biometric time series (e.g. weight, body fat) within a date range |\n\nAll date parameters use `YYYY-MM-DD` format and default to today when omitted.\n\n## Transport\n\nstdio only. For remote/hosted use, the stdio server is wrapped by\n[supergateway](https://github.com/supercorp-ai/supergateway) (see `Dockerfile`),\nwhich owns the HTTP listener and exposes MCP streamable-HTTP at `/mcp`. The\nserver has **no built-in authentication** — any remote deployment must sit\nbehind an authenticating gateway or reverse proxy.\n\n## Development\n\nFor local development, copy `.env.example` to `.env` and fill in your credentials:\n\n```bash\ncp .env.example .env\n# edit .env\nuv run cronometer-api-mcp\n```\n\nThe CLI auto-loads `.env` on startup (dev convenience only). Real environment variables always win over `.env`, so production deployments and MCP client `env` blocks are unaffected.\n\n## How It Works\n\nThis server communicates with `mobile.cronometer.com` -- the same REST API used by the Cronometer Android/Flutter app. The API was reverse-engineered through:\n\n1. Static analysis of `libapp.so` (Dart AOT snapshot) from the APK to discover endpoint names\n2. Traffic interception via Frida + mitmproxy to capture exact request/response formats\n3. Trial-and-error against the live API to confirm payload shapes\n\nThe API uses two protocols:\n\n- **v2 (`POST /api/v2/*`)** -- JSON-body auth, used for most operations (food search, diary read/write, nutrition, fasting, macros, biometrics)\n- **v3 (`DELETE /api/v3/user/{id}/*`)** -- Header-based auth (`x-crono-session`), used for diary entry deletion\n\nRecipe import is the one asynchronous operation: `import_recipe` returns a job id, and `poll_async_result` is polled until the server reports 100% progress and attaches the parsed ingredients.\n\n## Python API\n\nYou can use the client directly:\n\n```python\nfrom cronometer_api_mcp.client import CronometerClient\nfrom datetime import date\n\nclient = CronometerClient()\n\n# Search for foods\nresults = client.search_food(\"chicken breast\")\n\n# Get food details\nfood = client.get_food(results[0][\"id\"])\n\n# Log a serving\nclient.add_serving(\n    food_id=food[\"id\"],\n    measure_id=food[\"defaultMeasureId\"],\n    grams=200,\n)\n\n# Get today's diary\ndiary = client.get_diary()\n\n# Import a recipe from a free-text ingredient list\nrecipe = client.import_recipe(\"one hot dog\\nketchup\\nbun\")\nprint(recipe[\"food_id\"], recipe[\"ingredients\"])\n\n# Parse without saving, to review the matches first\npreview = client.import_recipe(\"2 tbsp olive oil\\n200g chicken\", save=False)\n\n# Get nutrition scores\nscores = client.get_nutrition_scores()\n```\n\n## License\n\nMIT\n",
  "bytes": 8650,
  "sha": "6da2d0e6be4616a81a569e43463ca45d44b35a66ed045e58f15f6a95ea643661",
  "repo_slug": "rwestergren/cronometer-api-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_rwestergren_cronometer_api_mcp_b8d7c915/readme"
}