Mealary
Developers & AI agents

Nutrition API & MCP server

One API key. Analyze recipes, generate FDA labels and search USDA foods — from your app or an AI agent. Try everything now with the public sandbox key mly_test_sandbox.

Authentication

Pass your API key as a bearer token or an x-api-key header. Create keys in your dashboard, or use the public sandbox key for testing — it returns real data and is rate-limited.

Authorization: Bearer mly_live_xxx
# or
x-api-key: mly_live_xxx

Analyze a recipe

Send ingredient lines and a serving count. Returns FDA-rounded per-serving values with %DV, allergens and cited USDA sources.

curl -X POST https://mealary.com/api/v1/analyze \
  -H "Authorization: Bearer mly_test_sandbox" \
  -H "content-type: application/json" \
  -d '{
    "ingredients": ["2 cups all-purpose flour", "1 cup sugar", "2 large eggs"],
    "servings": 12
  }'
{
  "servings": 12,
  "nutrition_facts": {
    "calories": { "display": "180", "rounded": 180 },
    "totalFat":  { "display": "3",   "dv": 4 },
    "protein":   { "display": "4" }
  },
  "allergens": ["wheat", "eggs"],
  "contains_statement": "Contains: Wheat, Eggs.",
  "sources": [{ "fdcId": 168894, "description": "Wheat flour, white, all-purpose..." }],
  "request_id": "req_..."
}

Endpoints

POST/api/v1/analyzeRecipe → per-serving nutrition facts, %DV, allergens, sources
POST/api/v1/labelRecipe → FDA Nutrition Facts panel (SVG). Free = watermarked
GET/api/v1/foods/search?q=Search USDA foods (fdcId + description)
GET/api/v1/foods/{fdcId}Full per-100g nutrient profile for a USDA food

MCP server

Mealary ships a streamable-HTTP MCP server at https://mealary.com/api/mcp with four tools. Add it to any MCP-compatible agent (Claude, etc.):

{
  "mcpServers": {
    "mealary": {
      "url": "https://mealary.com/api/mcp",
      "headers": { "Authorization": "Bearer mly_test_sandbox" }
    }
  }
}
  • analyze_recipeCompute per-serving nutrition for a recipe
  • generate_labelGenerate an FDA Nutrition Facts panel (SVG)
  • search_foodsSearch USDA FoodData Central
  • get_foodGet a food's per-100g nutrients by fdcId

Generate an FDA label

Returns an SVG Nutrition Facts panel. Free/sandbox keys are watermarked; Pro keys are clean and print-ready.

curl -X POST https://mealary.com/api/v1/label \
  -H "Authorization: Bearer mly_test_sandbox" \
  -H "content-type: application/json" \
  -d '{"ingredients":["100g cheddar cheese"],"servings":1,"format":"svg"}' \
  -o label.svg

Errors, limits & idempotency

Errors are structured and stable, with a request_id for your logs:

{ "error": { "code": "quota_exceeded", "message": "...", "docs": "...", "request_id": "req_..." } }

Send an Idempotency-Key header to make retried writes safe. Rate limits and monthly quotas depend on your plan; 429 responses include a retry-after header.