Calorie Service
Single-tenant, agent-first nutrition logging for one user. REST and MCP expose the same ten operations.
Cloudflare Workers
D1
America/Denver
Bearer auth
Connect
MCP: https://calorie.txe.app/mcp (Streamable HTTP)
REST: https://calorie.txe.app/api/v1
Auth: Authorization: Bearer <SERVICE_TOKEN>
Connector guide: /docs/muse-connector
Documentation index: /docs
Machine-readable version: /llms.txt. Public routes contain no user data.
The service token is supplied by the owner and is never published here.
Wiring up
- Configure the MCP endpoint with the bearer header in your MCP client or Muse connector.
- Call
tools/listto discover the ten tools and their annotations. - Start with
get_settingsandget_today, then search and log.
npx @modelcontextprotocol/inspector@latest
Operations
| MCP tool | REST | Class | Description |
|---|---|---|---|
log_entry | POST /api/v1/entries | write | Log one food entry with pre-resolved totals. |
get_today | GET /api/v1/today | read | Get one day's entries and DayTotals. |
get_range | GET /api/v1/range?from=&to= | read | Get inclusive daily totals and entries. |
undo_last | POST /api/v1/entries/undo-last | write/destructive | Soft-delete the most recent entry. |
delete_entry | DELETE /api/v1/entries/{id} | write/destructive | Soft-delete one entry by id. |
log_weight | POST /api/v1/weights | write | Upsert one weight per local date. |
get_weights | GET /api/v1/weights?from=&to= | read | List weights in an inclusive range. |
search_food | GET /api/v1/foods/search?q=|upc= | read/open-world | Search cache, USDA, then Open Food Facts. |
get_settings | GET /api/v1/settings | read | Read targets, goal, and timezone. |
update_target | PATCH /api/v1/settings | write | Partially update or clear targets and goal. |
Conventions
- Dates are
YYYY-MM-DDin America/Denver; timestamps are RFC 3339 UTC. - Nutrition is integer kcal plus macros in grams to one decimal; weight is pounds to one decimal.
- Entries store totals for the logged quantity, not per-serving values.
log_entrynever looks up food;search_foodnever creates an entry.- Deletes are soft and excluded from totals and lists.
log_entryandlog_weightsupport an optional UUIDidempotency_key.
Example
curl -X POST https://calorie.txe.app/api/v1/entries \
-H "Authorization: Bearer $SERVICE_TOKEN" \
-H "content-type: application/json" \
-d '{"meal":"snack","description":"Greek yogurt","quantity":1,"serving_label":"1 cup (245g)","nutrition":{"kcal":150,"protein_g":20,"carbs_g":10,"fat_g":4},"source":"manual"}'