Recipe line in. Grams and nutrition out.
Pantry Grams takes a recipe ingredient line and returns quantity, unit, food, grams and nutrition from public USDA data.
Every result names the USDA FoodData Central entry it came from, so you can check it.
One real example
Input: the lines 2 cups all-purpose flour and 1 can black beans, for 4 servings, sent to the nutrition_for_recipe tool. Below is its answer, shown without the recipe totals. The second line has grams null: no USDA portion row fits a can of this food, so nothing is invented.
{
"lines": [
{
"line": "2 cups all-purpose flour",
"parsed": {
"quantity": 2,
"unit": "cup",
"food": "all-purpose flour",
"preparation": null,
"size": null
},
"fdcId": 168894,
"fdcDescription": "Wheat flour, white, all-purpose, enriched, bleached",
"matchConfidence": 0.84,
"matchReason": "3 of 3 query words found in \"Wheat flour, white, all-purpose, enriched, bleached\"; 4 extra description words",
"grams": 250,
"gramsBasis": "2 x FDC portion row \"1 cup\" = 125 g",
"calories": 910,
"protein_g": 25.83,
"fat_g": 2.45,
"carbs_g": 190.78,
"fiber_g": 6.75,
"sugars_g": 0.68,
"sodium_mg": 5,
"source": "USDA FoodData Central (SR Legacy | Foundation), CC0",
"note": "estimate"
},
{
"line": "1 can black beans",
"parsed": {
"quantity": 1,
"unit": "can",
"food": "black beans",
"preparation": null,
"size": null
},
"fdcId": 175188,
"fdcDescription": "Beans, black turtle, mature seeds, canned",
"matchConfidence": 0.84,
"matchReason": "2 of 2 query words found in \"Beans, black turtle, mature seeds, canned\"; 4 extra description words",
"grams": null,
"gramsBasis": "no FDC portion row for unit \"can\" on this food",
"calories": null,
"protein_g": null,
"fat_g": null,
"carbs_g": null,
"fiber_g": null,
"sugars_g": null,
"sodium_mg": null,
"source": "USDA FoodData Central (SR Legacy | Foundation), CC0",
"note": "estimate"
}
],
"unresolvedLines": [
{
"line": "1 can black beans",
"reason": "no FDC portion row for unit \"can\" on this food"
}
]
}
Install
Needs Node 22.13 or later.
npx -y @pantrygrams/ingredient-mcp
To add it to an agent's tool list, use command npx and arguments -y @pantrygrams/ingredient-mcp. As JSON:
{"mcpServers":{"ingredient-mcp":{"command":"npx","args":["-y","@pantrygrams/ingredient-mcp"]}}}
The package ships the USDA data. It needs no key and makes no network calls.
Three tools:
parse_ingredient: quantity, unit, food and preparation for one line.nutrition_for_recipe: per-line matches, recipe totals, per-serving totals and the lines it could not resolve.search_food: candidate USDA foods for a name, with a match confidence.
Accuracy, misses included
| Test | Pantry Grams | parse-ingredient 3.2.1 (free npm parser) |
|---|---|---|
| Quantity and unit right, 500 recipe lines | 89.2% | 79.8% |
| Food name right, same 500 lines | 72.2% | 21.6% |
| Grams within 10%, 59 checked lines | 91.5% | does not give grams |
| Calories within 10%, 59 checked lines | 84.7% | does not give calories |
| Hard lines, quantity and unit right, 30 lines | 21/30 | 10/30 |
The hard lines split three ways for Pantry Grams: ranges 10/10, "plus" amounts 2/10, container sizes 9/10.
How it was measured. The 500 lines are held-out lines from a public recipe dataset (New York Times, Apache-2.0). Its labels are noisy, and we count those lines as misses anyway. The 59 lines were checked against USDA entries by a separate check, not by this server; that check is not ground truth. Run by npm run bench, measured 2026-12-05.
Where it misses.
- It misses two of its own five pass lines: quantity and unit at 89.2% against a 90.0% line, and food name at 72.2% against an 85.0% line.
- "Plus" amounts, like "1 cup plus 2 tablespoons flour": 2 of 10 right.
- Container sizes: "1 can black beans" gives quantity 1 and unit can, but grams are null because no USDA portion row fits. Nothing is invented.
Cost
The package is free (MIT). Hosted calls on Apify are planned to be paid; no price is set yet.
Hosted version on Apify: coming soon.
Contact: [email protected]
Data
Nutrition data comes from USDA FoodData Central: the datasets "SR Legacy" (04/2018) and "Foundation Foods" (10/2026). They are public domain (CC0 1.0). Source: https://fdc.nal.usda.gov/. Pantry Grams is not endorsed by USDA.
Estimates, not advice. Real food varies.