mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-10 19:27:14 +01:00
Expose diet_guard's read surface and one gated write action as typed MCP tools (diet_guard._mcp) so Claude Code and its subagents can query today's intake and -- with explicit confirmation -- log a meal without shelling out to the interactive gate CLI. - _mcp.py: FastMCP stdio server. Read tools get_status, list_today, get_slots expose today's CONSUMED kcal/macros and the qualitative consumption band only -- never the raw daily budget, remaining number, body weight, or protein target (those would back out the deliberately hidden budget). Gated write log_meal previews unless confirm=True and degrades gracefully on write failure. Nutrition is grouped into a Macros model (kcal + optional protein/carbs/fat) to keep the tool under the arg-count limits with no lint suppression, mirroring the CLI's grouping. Logs to stderr; no secret (HMAC key / sync token) is ever returned. - .mcp.json + scripts/setup_mcp.sh: registration via a dedicated ~/.venvs/diet-guard-mcp interpreter; mcp is an optional-dep, kept out of the systemd/CLI system-python path. - 100% coverage of the new module; verified end-to-end over stdio. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LQGQj8Ne6TriBExv91nG8v |
||
|---|---|---|
| .. | ||
| tests | ||
| __init__.py | ||
| __main__.py | ||
| _budget.py | ||
| _cli_gate.py | ||
| _cli_sync.py | ||
| _cli.py | ||
| _coerce.py | ||
| _constants.py | ||
| _estimator.py | ||
| _foodbank.py | ||
| _fuzzy.py | ||
| _gate.py | ||
| _gatelock_core.py | ||
| _gatelock_mealflow.py | ||
| _gatelock_nutrition.py | ||
| _gatelock_support.py | ||
| _gatelock_ui.py | ||
| _gatelock.py | ||
| _mcp.py | ||
| _meal.py | ||
| _portions.py | ||
| _resolve.py | ||
| _slots.py | ||
| _state.py | ||
| _sync_github.py | ||
| _sync_merge.py | ||
| _sync.py | ||