C
ChowAPI
Blog
tutorialaiclaude

Building an AI Nutrition Coach with Claude and ChowAPI

ChowAPI Team·

Building an AI Nutrition Coach with Claude and ChowAPI

Large language models are remarkably good at understanding nutrition questions. They can parse "how many calories in a grilled chicken breast" and respond with a confident, detailed answer. There is just one problem: the numbers are often wrong.

The Problem: AI Models Hallucinate Nutrition Data

LLMs generate nutrition facts from patterns in their training data. They do not look up values in a database. This means the calorie count for a banana might be 89 one day and 105 the next, depending on how the model samples its weights. For casual conversation, that is fine. For an app that helps people track macros, manage diabetes, or plan meals for athletes, it is a dealbreaker.

What you need is a way to give Claude access to real, verified nutrition data at inference time so it reasons over facts instead of guessing.

The Solution: Claude MCP + ChowAPI

The Model Context Protocol (MCP) lets you connect external tools to Claude. When Claude needs nutrition data, it calls ChowAPI through the MCP server, gets back real numbers from ChowAPI's nutrition database, and uses those in its response. No hallucination. No stale training data.

Here is how to set it up in under five minutes.

Step 1: Get a ChowAPI Key

Sign up at chowapi.dev/signup to get your API key. Credit packs start at $5 for 5,000 calls, which is more than enough for development and personal use.

Your key will look like chow_live_abc123.... Keep it somewhere safe. You will need it in the next step.

Step 2: Install the MCP Server

The ChowAPI MCP server runs as a local process that bridges Claude Desktop and the ChowAPI endpoints. Install it globally with npm:

npm install -g chowapi-mcp

Or run it directly without installing:

npx chowapi-mcp

The server exposes three tools to Claude: search_foods, get_food, and barcode_lookup. Each one maps to a ChowAPI endpoint and returns structured nutrition data.

Step 3: Configure Claude Desktop

Open your Claude Desktop settings and add ChowAPI to the MCP servers configuration. On macOS, edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "chowapi": {
      "command": "npx",
      "args": ["-y", "chowapi-mcp"],
      "env": {
        "CHOWAPI_KEY": "chow_live_your_key_here"
      }
    }
  }
}

On Windows, the config file is at %APPDATA%\Claude\claude_desktop_config.json. The format is identical.

Restart Claude Desktop after saving the file. You should see a small hammer icon indicating the MCP tools are connected.

Step 4: Test It

Open a new conversation in Claude Desktop and try a question:

"How much protein is in 200g of cooked chicken breast?"

Instead of generating a number from memory, Claude will call the search_foods tool, retrieve the entry for chicken breast, and calculate the answer from real per-100g data. You will see the tool call in the conversation, along with the source data.

Try a few more:

  • "Compare the macros of brown rice vs quinoa"
  • "What is the sugar content of a Clif Bar? Use the barcode 722252100900"
  • "I need high-protein, low-carb snacks under 200 calories. Give me five options with exact nutrition facts."

Every answer is grounded in verified nutrition data from ChowAPI's database.

Step 5: Build a Custom Nutrition Coach Prompt

Now that Claude has access to real data, you can shape its behavior with a system prompt. Here is a starting point for a nutrition coaching persona:

You are a nutrition coach. When the user asks about food, always look up
the real nutrition data using your available tools before answering.

Rules:
- Report values per serving, and state the serving size
- Always include calories, protein, fat, carbs, and fiber
- When comparing foods, use a table format
- If the user mentions a health goal (weight loss, muscle gain, etc.),
  tailor your recommendations to that goal
- Note the data quality score when relevant

With this prompt and the MCP server connected, Claude becomes a nutrition assistant that is both conversational and accurate. It can plan meals, compare products, scan barcodes, and answer detailed macro questions, all backed by verified nutrition data.

What You Can Build From Here

This setup is a foundation. Here are a few directions you can take it:

  • Meal planning agent - give Claude a calorie target and dietary restrictions, let it build a full day of meals with accurate totals.
  • Grocery list analyzer - paste a grocery list, get a full nutritional breakdown.
  • Recipe nutrition calculator - describe a recipe, get per-serving nutrition facts computed from individual ingredients.
  • Diet comparison tool - ask Claude to compare keto vs Mediterranean vs high-protein diets using real food data.

For more examples and ready-made prompts, check out our Claude integration guide and prompt library.

Get Started

Sign up for a ChowAPI key at chowapi.dev/signup and have a working AI nutrition coach in five minutes. Credit packs start at $5 for 5,000 calls (50% off PAYG), or pay as you go at $0.002 per call.