# Open Food Facts [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/domdomegg/openfoodfacts-mcp.git  
**GitHub Stars:** 4  
**npm Downloads (last month):** 1245  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/open-food-facts

## Description
Search and contribute to the Open Food Facts database.

## Tools
Capabilities this server exposes over MCP:

- **get_product** — Get product information from Open Food Facts by barcode. Reads the primary database directly (no sync lag), so this is always current even when search_products returns stale results. Prefer this over search whenever you have a barcode. If this returns "product not found", the product genuinely isn't in the database — you can add it with add_or_edit_product.
- **search_products_standard** — Search Open Food Facts with structured filters. Best for simple keyword queries and brand/category filtering. Returns exact result counts and well-populated products. If you have a barcode, use get_product instead.

How search works: strict AND against a keyword index built from product_name, generic_name, brands, categories, origins, labels. One unmatched query word → zero results.

Tips:
- Prefer 2-3 distinctive words over the full product name
- Put brand names in brands_tags, not the query text
- Brand normalization is generous: "sainsburys", "sainsbury's", "sainsbury-s" all match
- For fresh produce, use brands_tags + categories_tags rather than text search
- sort_by=popularity works well here (not supported in search_products_lucene)

If you get zero results, try dropping words or using search_products_lucene which has more flexible text matching.
- **search_products_lucene** — Search Open Food Facts using the Search-a-licious Elasticsearch backend. Powered by Lucene query syntax with full boolean logic and negation support.

Use this instead of search_products_standard when you need:
- Negation queries: find gluten-free cereals with allergens_tags_without="en:gluten"
- Filter-only browsing: categories_tags without any text query (standard API times out on this)
- Combined text + filter with relevance scoring: text matches are ranked by relevance within filter results
- Boolean logic in raw Lucene: brands:"kellogg*" OR brands:"nestle"

Trade-offs vs search_products_standard:
- Counts are approximate (capped at 10,000 for large result sets)
- Brand tag matching may be narrower (less normalization than standard)
- Data has a short sync delay (hours) from the primary database
- popularity sort uses scan counts rather than the standard popularity algorithm

Response format matches search_products_standard: { count, page, page_size, page_count, products: [...] }
- **autocomplete** — Get autocomplete suggestions for Open Food Facts taxonomy entries (brands, categories, labels, etc.).
- **add_or_edit_product** — Add a new product or edit an existing one on Open Food Facts. Requires OFF_USER_ID and OFF_PASSWORD.

The more fields you fill, the more useful the entry. At minimum provide product_name, brands, and categories — these feed the search index, and a sparse entry won't be findable. If you have a photo of the pack, transcribe everything you can read: ingredients, nutrition, origins, traceability stamps, recycling icons, certifications.

Fields that drive derived data:
- ingredients_text → allergens, additives, NOVA group, fruit/veg %
- nutrition + categories → Nutri-Score
- packagings + origins → Eco-Score
- product_name + brands + categories + labels → search _keywords

Pitfalls learned the hard way:
- Free-text packaging shapes get fuzzy-matched against the taxonomy. "Pouch" resolves to "en:pouch-flask" (a stand-up spouted pouch). Use taxonomy IDs like "en:bag" or "en:individual-bag" instead.
- OFF has no generic "pouch" shape in its taxonomy. For vacuum-sealed individual portions use "en:individual-bag"; for plastic film wrap use "en:film".

Recommended workflow for adding a product from photos:
1. Check if product exists with get_product first to avoid overwriting good data
2. Upload photos with upload_image. Prefer more photos over fewer — panels with text (ingredients, nutrition, certifications, recycling instructions) are highest value as OFF can OCR them. Plain sides with just a colour or logo are lowest value but still worth uploading if you have them. Use the most appropriate imagefield (front, ingredients, nutrition, packaging) and "other" for the rest.
3. Call this tool with all fields you can read from the photos. Set both quantity and serving_size.
4. Set packagings_complete: true only when all packaging components are listed

For products with only prepared nutrition (jelly mixes, powdered drinks, etc.), use nutrition_prepared instead of nutrition.
For values printed as "< 0.5g" on the packet, pass the string "< 0.5" — the less-than modifier will be preserved.

Nutrition fields mirror the label columns: nutrition (per 100g as sold), nutrition_per_serving (per serving as sold), nutrition_prepared (per 100g prepared), nutrition_prepared_per_serving (per serving prepared). OFF auto-derives per-serving from per-100g + serving_size, so nutrition_per_serving is only needed when the label shows explicit per-serving values you want to preserve.
- **upload_image** — Upload a product image to Open Food Facts. Requires OFF_USER_ID and OFF_PASSWORD.

Prefer more photos over fewer. Panels with text (ingredients, nutrition, certifications, recycling instructions) are highest value as OFF can OCR them. Plain sides with just a colour or logo are lowest value but still worth uploading if you have them.

Use the most appropriate imagefield (front, ingredients, nutrition, packaging). Use "other" for additional photos — this uploads without selecting the image as a display image, which is useful when a good display image already exists or for supplementary angles.

The OFF server auto-selects images for front/nutrition/ingredients/packaging on upload unless one is already selected. If you get "status not ok" but a positive imgid, the image uploaded successfully but was not selected (e.g. a display image already exists).

For images on disk, base64-encode them first (e.g. via shell: `base64 -i photo.jpg`).
- **select_image** — Select, crop, and rotate a previously uploaded product image on Open Food Facts. Requires OFF_USER_ID and OFF_PASSWORD.
- **call_api** — Make a direct call to any Open Food Facts API endpoint. Use get_api_docs to see available endpoints. Auth credentials are included automatically for write operations if configured.

Two body modes for writes:
- params: form-encoded (for /cgi/*.pl and /api/v2/* legacy endpoints)
- json_body: raw JSON (for /api/v3/* endpoints — required for structured fields like packagings)

Example v3 packagings write:
  method: PATCH
  endpoint: /api/v3/product/0123456789012
  json_body: {"fields":"packagings","product":{"packagings":[{"number_of_units":1,"shape":{"id":"en:bag"},"material":{"id":"en:plastic"},"recycling":{"id":"en:recycle"}}]}}

WARNING: Do NOT use old-style prepared nutrition params like nutriment_fat_prepared — they have a known server bug that stores data incorrectly. Use new-style params instead: nutrition_input_sets_prepared_100g_nutrients_fat_value_string=0.5
- **get_api_docs** — Get Open Food Facts API documentation. Useful for understanding available endpoints before using call_api.
- **get_skill** — Get the OFF upload skill document. This describes the recommended process for bulk uploading food packaging photos to Open Food Facts.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "open-food-facts": {
    "command": "npx",
    "args": ["-y","openfoodfacts-mcp"],
    "env": {
      "OFF_USER_AGENT": "",
      "OFF_USER_ID": "",
      "OFF_PASSWORD": "",
      "OFF_COUNTRY": ""
    }
  }
}
```

**Requires environment variables:** `OFF_USER_AGENT`, `OFF_USER_ID`, `OFF_PASSWORD`, `OFF_COUNTRY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Open Food Facts MCP server does

The Open Food Facts MCP server gives an MCP client access to product data from the Open Food Facts database and API. It supports both read and write workflows, so an agent can inspect an existing item, search across products, or contribute product details when authenticated.

Typical read tasks include finding a product from its barcode, retrieving nutrition information, locating products by brand or category, and filtering by Nutri-Score. The server can also help explore database vocabulary by suggesting brands, categories, labels, and similar values.

Write workflows can create or update a product, upload a product image, and select, crop, or rotate an image. These operations modify Open Food Facts data and should be used with the required account credentials.

## How it works

The Open Food Facts MCP server exposes the Open Food Facts API through MCP tools. A client sends a tool request, and the server performs the corresponding database or API operation. Product lookup uses a barcode, while standard search accepts structured filters such as brand, category, and Nutri-Score.

For more advanced queries, Lucene search supports syntax including negation and boolean logic. The `call_api` tool provides a lower-level way to reach Open Food Facts API endpoints directly, and `get_api_docs` returns API documentation for discovering endpoint details.

This server fits assistants that need food catalog data during conversations, product research, nutrition lookups, or data contribution tasks. It is less suitable when an application requires a separate private product database or capabilities not exposed by the Open Food Facts API.

## Setup and configuration

Configure the server in an MCP client using the installation instructions linked by the project. The referenced setup flow generates client configuration and lists support for Claude Code, Claude Desktop, Cursor, Cline, VS Code, and other clients.

`OFF_USER_AGENT` is required. Set it to an identifying value for the application, such as an application name, version, and contact address. The server uses the `world` country subdomain by default; set `OFF_COUNTRY` to select another country subdomain.

Read-only tools do not require an Open Food Facts account. To add or edit products or upload images, set both `OFF_USER_ID` and `OFF_PASSWORD`. The authentication requirement for `call_api` depends on the endpoint being called.

## Tools and capabilities

- `get_product`: Retrieves product information by barcode.
- `search_products_standard`: Searches with structured brand, category, and Nutri-Score filters.
- `search_products_lucene`: Runs Lucene queries with boolean logic and negation.
- `autocomplete`: Suggests brands, categories, labels, and other database terms.
- `add_or_edit_product`: Creates or updates a product record.
- `upload_image`: Uploads a product image.
- `select_image`: Selects, crops, and rotates an image.
- `call_api`: Calls an Open Food Facts API endpoint directly.
- `get_api_docs`: Retrieves Open Food Facts API documentation.

## Limitations and notes

Write tools need Open Food Facts credentials, while read tools do not. Direct API calls may also require authentication depending on the selected endpoint. The server depends on the data and endpoint behavior provided by Open Food Facts, and its country context defaults to the `world` subdomain unless configured otherwise.

_Full upstream README: https://allmcps.com/mcp/open-food-facts/readme_

