ChowAPI + Claude
Three ways to give Claude access to 1.6M+ foods with full nutrition data. Pick the one that matches how you use Claude.
Claude Desktop: MCP Server
One command gives Claude Desktop tools for food search, barcode lookup, and nutrient details. Claude can call them autonomously.
MCP server package coming soon. In the meantime, use the REST API directly.
Step 1: Install
npx chowapi-mcpStep 2: Add to Claude Desktop config
// Add to ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"chowapi": {
"command": "npx",
"args": ["chowapi-mcp"],
"env": {
"CHOWAPI_KEY": "chow_live_YOUR_KEY"
}
}
}
}Step 3: Restart Claude Desktop
Claude now has access to search_foods, barcode_lookup, and get_nutrientstools. Try asking: “What's the protein content of chicken breast?”
Claude Code: CLAUDE.md
Add this to your project's CLAUDE.md file so Claude Code knows how to use ChowAPI when building your app.
// Add to your project's CLAUDE.md
## Food Data
This project uses ChowAPI for food and nutrition data.
- API Base: https://api.chowapi.dev/v1
- Auth: Bearer token in Authorization header
- Key: stored in .env as CHOWAPI_KEY
### Available endpoints:
- GET /v1/search?q={query} - fuzzy food search (limit, offset params)
- GET /v1/barcode/{code} - UPC/EAN barcode lookup
- GET /v1/foods/{id} - get food by ID
- GET /v1/foods/{id}/nutrients - detailed nutrients with confidence levels
### Example:
```bash
curl "https://api.chowapi.dev/v1/search?q=chicken+breast" \
-H "Authorization: Bearer $CHOWAPI_KEY"
```
Response includes both `nutrients` (raw stored values) and `nutrients_per_serving` (computed per-serving values). Use `nutrients_per_serving` for display. Response also includes data_quality score (0-1)
and per-nutrient confidence levels (lab_verified, database, estimated).Or: MCP server in Claude Code
You can also add the MCP server directly to Claude Code for tool access:
// Add to your project's .claude/settings.json
{
"mcpServers": {
"chowapi": {
"command": "npx",
"args": ["chowapi-mcp"],
"env": {
"CHOWAPI_KEY": "chow_live_YOUR_KEY"
}
}
}
}Claude API: Tool Definitions
Building with the Claude API? Here are the tool definitions for function calling. Copy these into your tools array.
// Claude API tool definitions for function calling
const tools = [
{
name: "search_foods",
description: "Search for foods by name. Returns nutrition data for matching foods. Use for any food lookup query.",
input_schema: {
type: "object",
properties: {
query: { type: "string", description: "Food search query, e.g. 'chicken breast' or 'quaker oatmeal'" },
limit: { type: "number", description: "Max results (1-25, default 10)" }
},
required: ["query"]
}
},
{
name: "barcode_lookup",
description: "Look up a food by its barcode (UPC/EAN). Returns full nutrition data.",
input_schema: {
type: "object",
properties: {
barcode: { type: "string", description: "UPC-A or EAN-13 barcode (8-14 digits)" }
},
required: ["barcode"]
}
},
{
name: "get_nutrients",
description: "Get detailed nutrient breakdown for a food by ID. Includes confidence levels and %RDI.",
input_schema: {
type: "object",
properties: {
food_id: { type: "string", description: "ChowAPI food UUID" }
},
required: ["food_id"]
}
}
]