fitvete-food-cli
v1.3.0
Published
CLI for the FitVete Food & Nutrition API — clean JSON output for scripts and AI agents.
Downloads
171
Maintainers
Readme
fitvete-food-cli
Command-line interface for the FitVete Food & Nutrition API.
Zero dependencies (Node 18+, built-in fetch). Prints clean JSON to stdout, so it
pipes into jq and is trivial for AI agents to parse. Use --pretty for humans.
Install
# install globally from npm
npm install -g fitvete-food-cli
fitvete-food search-foods chicken
# or run without installing
npx fitvete-food-cli search-foods chickenAuthenticate
Get a free key at https://fitvete.com/api/, then:
export FITVETE_API_KEY=fv_live_your_key
# or pass --key on any commandCommands
| Command | Description |
| --- | --- |
| search-foods <query...> [--number N] | Search foods; calories, macros, confidence. |
| compute <ingredient...> | Full nutrient breakdown for an ingredient list. |
| recipes [query...] [filters] | Search recipes by name + filters (--diet --cuisine --type --intolerances --include-ingredients --exclude-ingredients --max-ready-time --min-calories --max-calories --min-protein --sort --offset --number). |
| recipe-random [--number N] [--tags ...] | Random recipes. |
| recipe-autocomplete <query...> [--number N] | Recipe title suggestions. |
| recipes-by-nutrients [--min-protein N --max-calories N ...] | Recipes matching nutrient ranges. |
| recipe-similar <id> [--number N] | Recipes similar to an id. |
| recipe-diets, recipe-meal-types, recipe-cuisines | Supported filter values. |
| recipe <id> [--servings N] | Full recipe detail (ingredients, steps, nutrition); optional servings scaler. |
| drinks <query...> [--number N] | Search drinks/cocktails. |
| score <name...>\|--barcode CODE [--goals ... --diet ... --allergies ... --avoid ... --explain] | Personalized 0–100 health score + grade. |
| analyze-ingredients <text...> | Additives, allergens, NOVA level, diet flags. |
| parse <text...> | Free-text meal → structured items + nutrition (NLP). |
| alternatives <name...>\|--barcode CODE [--number N] | Healthier swaps, ranked. |
| foods-autocomplete <query...> [--number N] | Food name typeahead. |
| barcode <code> | Look up a packaged food by UPC/EAN barcode. |
| photo <image-path> | Estimate meal nutrition from a JPEG, PNG, or WebP image. |
| label <image-path> | Parse a Nutrition Facts label from a JPEG, PNG, or WebP image. |
| tools | Print a JSON tool manifest for AI agents (function-calling). |
| help, version | Help / version. |
Options
--key <key>— API key (overridesFITVETE_API_KEY).--number, -n <N>— result count for search commands (1–25).--base <url>— API base URL (overridesFITVETE_API_BASE).--pretty— human-readable table instead of JSON.--json— force JSON (default).
Exit codes
0 ok · 1 request/HTTP error · 2 usage error · 3 auth or rate-limit.
Examples
fitvete-food search-foods "greek yogurt" --number 3
fitvete-food compute "1 cup rice" "2 eggs" | jq '.calories'
fitvete-food recipe 715538 | jq '.title'
fitvete-food drinks margarita --pretty
fitvete-food barcode 012345678905
fitvete-food photo ./meal.jpg
fitvete-food label ./nutrition-label.jpg | jq '.nutrients[] | select(.name=="Sodium")'Using it from an AI agent
The CLI is designed to be driven by autonomous agents:
- Output is pure JSON — no prompts, spinners, or colour codes.
- Failures return a non-zero exit code and a JSON error body.
fitvete-food toolsprints a function-calling manifest describing every command and its parameters, so a model can discover the available functions at runtime.
fitvete-food tools # → { "tools": [ { "name": "fitvete_search_foods", "input_schema": {...} }, ... ] }As an MCP tool
Expose the CLI to any MCP client (Claude Desktop, Cursor, …) by running it from a shell tool, or wrap each command as an MCP tool. Minimal stdio wrapper sketch:
// mcp-server.js (pseudocode) — map each manifest tool to a CLI call
import { execFile } from "node:child_process";
const run = (cmd, args) => new Promise((res, rej) =>
execFile("fitvete-food", [cmd, ...args], (e, out) => (e ? rej(e) : res(JSON.parse(out)))));
// tool "fitvete_search_foods" -> run("search-foods", [query, "--number", String(n)])The same key (FITVETE_API_KEY) and JSON contract apply.
License
MIT
