# Open Food Facts MCP

> Open Food Facts API connects your AI agent directly to a global database of food products. You can audit nutrition information, look up ingredients, and find product details using just a barcode or keyword search. It's built for researchers and health apps that need verified, structured data on everything from Nutri-Scores to specific ingredient lists.

## Overview
- **Category:** data-management
- **Price:** Free
- **Tags:** nutritional-data, barcode-lookup, food-safety, product-database, health-tracking, open-data

## Description

You're connecting your AI agent directly to a massive global food database with this Open Food Facts API. Forget wading through messy web forms or relying on incomplete label photos; this lets you run structured data queries against millions of products worldwide. Your agent can check the service status first by running `check_api_status`, making sure it's operational before you start any deep work.

When you need details for a specific item, you give your agent the barcode number—the EAN or UPC—and it uses the `get_food_product` tool. That function returns every known piece of data associated with that unique product ID. You'll get brand information, full descriptions, and core metadata right off the bat.

For deep research, your agent runs several audits on the retrieved product data. It checks for specific nutritional metrics, pulling out things like fat content or sugar levels. Crucially, it can find Nutri-Scores to give you a quick health grade assessment of what's actually in the food. Furthermore, when you need to verify dietary restrictions or manage allergies, your agent retrieves the full ingredient list from that product record—you get every single component used.

If you don't have a barcode, you can still find products. You run `list_food_categories` first; this pulls a master index of every high-level food category available in the entire database. Knowing those categories lets you define your search parameters precisely. Then, using `search_food_products`, you tell the agent to look for things based on keywords—say, 'cereal' or 'low sodium'—or filter results down to a specific category like 'dairy-free snacks.' The tool returns lists of relevant products that match your criteria.

So, whether you’re verifying if the whole service is up with `check_api_status`, running a barcode lookup via `get_food_product` for product details and ingredients, auditing the nutritional profile for specific metrics like sugar or fat, pulling a category index using `list_food_categories`, or narrowing down results with a keyword search through `search_food_products`, your agent handles it. It's structured data access—no guesswork needed.

## Tools

### check_api_status
Checks if the Open Food Facts service is currently operational and ready to receive queries.

### get_food_product
Retrieves comprehensive details for a food product using its unique barcode identifier (EAN/UPC).

### list_food_categories
Lists every available, high-level food category defined within the entire database.

### search_food_products
Searches for products based on keywords or filters by a specific food category.

## Prompt Examples

**Prompt:** 
```
Get details for product with barcode '3017620422003' (Nutella) using Open Food Facts.
```

**Response:** 
```
I've retrieved the details for the Nutella! It has a Nutri-Score grade of 'E'. Notable ingredients include sugar and palm oil. Would you like the full nutritional breakdown or categories for this product?
```

**Prompt:** 
```
Search for food products in the 'breakfast-cereals' category.
```

**Response:** 
```
I've identified several breakfast cereals in the database! Notable entries include [Brand Name] and [Brand Name]. I can provide the Nutri-Score and quantity metadata for each of these items if you'd like.
```

**Prompt:** 
```
List all food categories available in Open Food Facts.
```

**Response:** 
```
I've scanned the category catalog! There are thousands of groups available, including 'beverages', 'dairies', and 'snacks'. I can help you search for specific products in any of these thematic clusters.
```

## Capabilities

### Barcode Product Lookup
You give the agent a barcode number, and it returns all known details about that specific food item.

### Nutritional Profile Audit
The tool checks for Nutri-Scores and core nutritional metadata (like fat or sugar content) for any product ID.

### Ingredient Listing
It retrieves the full list of ingredients used in a product, which is critical for allergy or dietary research.

### Product Category Indexing
You can pull a master list of every food category available in the global database to define search parameters.

### Keyword and Filtered Search
The agent searches across thousands of products using keywords (e.g., 'cereal') or filters (e.g., 'dairy-free').

### API Status Check
It verifies that the Open Food Facts service is currently running and available for your workflow.

## Use Cases

### Comparing Diets for Research
A nutritionist needs to compare three different breakfast cereals. Instead of opening three browser tabs, they ask their agent: 'What is the Nutri-Score and sugar content for these three barcodes?' The agent runs `get_food_product` three times in sequence and presents a single comparison table.

### Checking Ingredient Compliance
A brand manager needs to know if any products contain 'palm oil.' They ask the agent to search for all products containing that keyword. The agent uses `search_food_products` and filters by ingredient name, quickly giving them a compliance report.

### Building an Internal Taxonomy
A data team needs to map out every possible food type they might encounter. They run the `list_food_categories` tool once to get the master list. This provides the necessary structure for their internal database schema.

### Verifying Data Integrity
A QA tester needs to ensure the data source is up. Before running any expensive query, they first run `check_api_status`. If the tool reports 'offline,' they stop immediately and don't waste time on failed searches.

## Benefits

- Instant Nutritional Audits: Stop manually checking sites. Use `get_food_product` to pull Nutri-Scores, fat content, and sugar data for any product barcode in seconds.
- Structured Ingredient Data: The tool provides the full ingredient list for a product, letting your agent flag potential allergens or restricted ingredients automatically.
- Precise Market Filtering: Instead of guessing, use `list_food_categories` to get a master index, then combine it with `search_food_products` to filter exactly what you need (e.g., 'dairy-free' cereals).
- Cross-Functional Data Retrieval: Your agent doesn't just read text; it pulls structured metadata like product identifiers and quantity details from the API call.
- Always On Connectivity: Before starting a major audit, run `check_api_status` to ensure your entire food research workflow stays operational. No guesswork required.

## How It Works

The bottom line is: you talk naturally to your AI client, and it handles the complex database lookups for you.

1. First, subscribe to this server on Vinkius. No API key is needed because Open Food Facts runs as a free public service.
2. Next, tell your AI client (e.g., Claude or Cursor) what you need: 'Find the Nutri-Score for product X' or 'List all beverage categories.'
3. Your agent calls the appropriate tool (`get_food_product` or `list_food_categories`), executes the query, and returns the raw structured data to your chat interface.

## Frequently Asked Questions

**How do I use `get_food_product` with the Open Food Facts API?**
You must provide the full EAN/UPC barcode number. The tool takes this ID and returns all associated data, including Nutri-Score and ingredient details.

**Is `search_food_products` better than listing categories?**
`list_food_categories` gives you the full list of groups available. Use that to define a scope (like 'breakfast cereals'), then use `search_food_products` with keywords within that category for targeted results.

**What if I don't have a barcode?**
If you lack a specific barcode, start by using `list_food_categories` to narrow your focus. You can then use `search_food_products` with keywords (e.g., 'low-sodium') within the chosen category.

**Does Open Food Facts API handle expired products?**
The tool queries a public database of product information, not real-time inventory or expiration dates. It provides data on known ingredients and nutritional makeup.

**How do I authenticate when using the `get_food_product` tool?**
You don't need an API key. The service is open and free to use, so authentication isn't required for your AI agent to process product data.

**If my calls fail or hit a rate limit, how do I check the service health using `check_api_status`?**
Call `check_api_status` first. This confirms if Open Food Facts is currently operational and available for your agent to use.

**When I run `get_food_product`, what specific metadata do I get for ingredient auditing?**
It returns high-resolution details, including the full list of ingredients, brand information, and nutritional scores like Nutri-Score.

**If I need to understand all product groups, what's the scope of `list_food_categories`?**
The tool lists thousands of available food categories. This gives your agent a comprehensive view of the entire global product database structure.

**Is an API Key required for Open Food Facts API?**
No. Open Food Facts is a free and open database. This server works out of the box without any static credentials required.

**Can the agent look up international products?**
Yes. Open Food Facts is a global database covering millions of food products from around the world using the same API metadata.

**What is the Nutri-Score?**
It is a nutrition label that converts the nutritional value of products into a simple code of 5 colors and letters (A to E).