FMF Food Facts

Nutrition for a meal written in plain words ("2 large eggs, 1 cup cooked white rice, 1 tbsp olive oil"): each item matched to a USDA FoodData Central record, quantity converted to grams from USDA portion weights, 19 nutrients per item and totals, with the match and the gram basis shown so nothing is a guess. Also barcode lookup (Open Food Facts: nutrients, Nutri-Score, NOVA, allergens) and BMR / TDEE / BMI / macro targets (Mifflin-St Jeor, Harris-Benedict, Katch-McArdle).

No account and no API key. Pay per successful call with MPP on Tempo (USDC.e or pathUSD). Invalid input or an upstream failure returns 402 and is not charged.

Routes

RoutePriceWhat you get
POST /v1/food/nutrition$0.002Meal / ingredient nutrition (USDA)
Nutrition for a meal written in plain words ("2 large eggs, 1 cup cooked white rice, 1 tbsp olive oil"): each item matched to a USDA FoodData Central record, quantity converted to grams from USDA portion weights, 19 nutrients per item and totals, with the match and the gram basis shown so nothing is a guess. Also barcode lookup (Open Food Facts: nutrients, Nutri-Score, NOVA, allergens) and BMR / TDEE / BMI / macro targets (Mifflin-St Jeor, Harris-Benedict, Katch-McArdle).
POST /v1/food/search$0.001Find USDA foods by name
Search the bundled USDA FoodData Central foods (SR Legacy + FNDDS, 13,224 foods) by name: fdc_id, description, nutrients per 100 g and every USDA portion weight. Use the fdc_id with /v1/food/nutrition for an exact pick.
POST /v1/food/barcode$0.001Packaged food by barcode (Open Food Facts)
Look up a packaged food by EAN/UPC barcode on Open Food Facts: name, brand, nutrients per 100 g and per serving, Nutri-Score, NOVA group, allergens, traces, vegan/vegetarian/palm-oil flags, ingredients. Not found returns found:false.
POST /v1/food/tdee$0.001BMR, TDEE, BMI and macro targets
Daily calorie needs from sex, age, height, weight and activity: BMR and TDEE by Mifflin-St Jeor, revised Harris-Benedict and (with body fat %) Katch-McArdle, a goal target (lose / maintain / gain), protein / fat / carb grams and BMI. Exact formulas, computed in the worker.

Copy-paste examples

These call POST /v1/food/barcode ($0.001) — Packaged food by barcode (Open Food Facts). Swap the path for any other route in the table.

mppx CLI

npx mppx https://food-facts.fmf-x402.workers.dev/v1/food/barcode -X POST -H 'content-type: application/json' -d '{"barcode":"3017620422003"}'

The CLI creates or reuses a Tempo account in your keychain and pays the 402 automatically. See mpp.dev/sdk.

curl (unpaid — shows the 402, not charged)

curl -i -X POST https://food-facts.fmf-x402.workers.dev/v1/food/barcode -H 'content-type: application/json' -d '{"barcode":"3017620422003"}'

TypeScript SDK (mppx)

import { Mppx, tempo } from 'mppx/client'
import { privateKeyToAccount } from 'viem/accounts'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount(process.env.TEMPO_PRIVATE_KEY) })],
})

// Global fetch now pays the 402 automatically.
const res = await fetch('https://food-facts.fmf-x402.workers.dev/v1/food/barcode', {
  method: 'POST',  headers: {
    'content-type': 'application/json',
  },
  body: JSON.stringify({"barcode":"3017620422003"}),
})
console.log(await res.json())

Python SDK (pympp)

# pip install pympp
# Docs: https://mpp.dev/sdk/python
import asyncio
from mpp.client import Mpp
from mpp.methods.tempo import TempoAccount
from mpp.methods.tempo import client as tempo

account = TempoAccount.from_key("0x...")

async def main():
    async with Mpp(methods=[tempo.charge(account=account)]) as mpp:
        response = await mpp.fetch("https://food-facts.fmf-x402.workers.dev/v1/food/barcode", method="POST", json={"barcode":"3017620422003"})
        print(await response.json())

asyncio.run(main())

MCP config (Cursor, Claude Desktop, VS Code)

{
  "mcpServers": {
    "fmf-mpp-food-facts": {
      "url": "https://food-facts.fmf-x402.workers.dev/mcp"
    }
  }
}

Transport is Streamable HTTP at https://food-facts.fmf-x402.workers.dev/mcp. tools/list is free. Paid tools/call needs an MPP Payment header, or just use mppx against the HTTP route.

Sources and licences

Data: USDA FoodData Central SR Legacy + FNDDS (public domain, CC0), bundled; Open Food Facts (ODbL 1.0) for barcodes. Formulas computed in the worker. Operated by FMF Tools (fmf-tools@agentmail.to). Pay per call; invalid input or an upstream failure returns 402 and is not charged.

Sister services