Open Food Facts MCP Server
Uses Codecov for code coverage reporting and tracking test coverage metrics
Supports Docker deployment with containerization and Docker Compose orchestration for production environments
Uses environment variable configuration management for API settings and rate limiting parameters
Integrates with Git version control for development workflow and repository management
Hosted on GitHub with CI/CD workflows, issue tracking, and collaborative development features
Uses npm for package management, dependency installation, and build script execution
Displays project status badges for test results, code coverage, and license information
Implemented in TypeScript with full type safety and comprehensive type definitions for food product data
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Open Food Facts MCP Serverlook up product with barcode 3017620422003"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Open Food Facts MCP Server
A comprehensive Model Context Protocol (MCP) server that provides AI assistants with access to the Open Food Facts database. Query detailed food product information, nutritional data, and environmental scores to help users make informed food choices.
๐ Features
Product Lookup: Get detailed information by barcode including nutritional facts, ingredients, and scores
Smart Search: Find products with advanced filtering by categories, brands, nutrition grades, and more
Nutritional Analysis: Interpret Nutri-Score, NOVA processing groups, and Eco-Score ratings
Product Comparison: Compare multiple products side-by-side across different criteria
Dietary Recommendations: Get suggestions based on dietary preferences and restrictions
Rate Limiting: Built-in rate limiting respects Open Food Facts API constraints
Docker Ready: Production deployment with Docker and Docker Compose
Related MCP server: Food Data Central MCP Server
๐ Quick Start
Docker Deployment (Recommended)
# Clone and run
git clone https://github.com/conner/open-food-facts-mcp
cd open-food-facts-mcp
docker-compose up --buildLocal Development
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Build and start
npm run build
npm start
# Development mode
npm run dev๐ง Configuration
Configure the server via environment variables:
# API Configuration
OPEN_FOOD_FACTS_BASE_URL=https://world.openfoodfacts.net
OPEN_FOOD_FACTS_USER_AGENT=YourApp/1.0 (contact@example.com)
# Rate Limits (requests per minute)
RATE_LIMIT_PRODUCTS=100
RATE_LIMIT_SEARCH=10
RATE_LIMIT_FACETS=2๐ Available Tools
get_product
Retrieve comprehensive product information by barcode.
{
"barcode": "3017620422003"
}Returns: Product name, brand, nutritional scores, ingredients, nutrition facts, and metadata.
search_products
Search products with advanced filtering capabilities.
{
"search": "organic chocolate",
"categories": "snacks",
"nutrition_grades": "a,b,c",
"page_size": 10
}Filters: Categories, brands, countries, nutrition grades, NOVA groups, sorting options.
analyze_product
Get detailed nutritional analysis and score interpretations.
{
"barcode": "3017620422003"
}Returns: Score explanations, nutritional breakdown with health assessments, and processing level details.
compare_products
Compare multiple products across different aspects.
{
"barcodes": ["3017620422003", "8712566073219"],
"focus": "nutrition"
}Focus Options: nutrition, environmental, processing, ingredients.
get_product_suggestions
Get personalized product recommendations.
{
"category": "beverages",
"dietary_preferences": ["vegan", "organic"],
"min_nutriscore": "b",
"max_results": 5
}Dietary Options: vegan, vegetarian, gluten-free, organic, low-fat, low-sugar, high-protein.
๐ค MCP Integration
Add to your MCP client configuration:
{
"mcpServers": {
"open-food-facts": {
"command": "docker",
"args": ["run", "-i", "--rm", "open-food-facts-mcp"]
}
}
}Or for local development:
{
"mcpServers": {
"open-food-facts": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/path/to/open-food-facts-mcp"
}
}
}๐ Data & Scores
Nutri-Score
A-E rating indicating overall nutritional quality
Green (A/B): Healthier choices
Red (D/E): Less healthy options
NOVA Groups
Group 1: Unprocessed/minimally processed foods
Group 2: Processed culinary ingredients
Group 3: Processed foods
Group 4: Ultra-processed foods
Eco-Score
A-E rating for environmental impact
Considers packaging, transportation, and production methods
๐งช Development
Testing
# Run all tests
npm test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverage
# Validate code quality
npm run validateCode Quality
# Type checking
npm run typecheck
# Linting
npm run lint
npm run lint:fixProject Structure
src/
โโโ client.ts # HTTP client with rate limiting
โโโ handlers.ts # MCP tool implementations
โโโ index.ts # MCP server entry point
โโโ tools.ts # Tool definitions
โโโ types.ts # TypeScript types and schemas
tests/
โโโ client.test.ts # Client unit tests
โโโ handlers.test.ts # Handler unit tests
โโโ server.test.ts # Integration tests
โโโ validation.test.ts # Schema validation tests
โโโ rate-limiting.test.ts # Rate limiting tests
โโโ e2e.test.ts # End-to-end tests
โโโ fixtures/ # Test data
โโโ utils/ # Test utilities๐ Performance
Rate Limiting: Automatic enforcement of API limits
Efficient Caching: Smart request deduplication
Batch Operations: Optimized multi-product comparisons
Error Recovery: Graceful handling of API failures
๐ API Limits
The server respects Open Food Facts API rate limits:
Product queries: 100 requests/minute
Search queries: 10 requests/minute
Facet queries: 2 requests/minute
Rate limits are enforced automatically with proper error messaging.
๐ Data Source
All data comes from Open Food Facts, the largest open food database in the world:
900,000+ products from 150+ countries
Collaborative data maintained by contributors worldwide
Open Database License ensuring free access to food information
Real-time updates from the global community
๐ Examples
Basic Product Information
**Nutella**
Brand: Ferrero
Quantity: 400g
Categories: Sweet spreads, Chocolate spreads
Scores:
Nutri-Score: E | NOVA Group: 4 | Eco-Score: D
Ingredients:
Sugar, palm oil, hazelnuts (13%), skimmed milk powder...
Nutrition (per 100g):
Energy: 539 kcal | Fat: 30.9g | Carbs: 57.5g | Sugars: 56.3gNutritional Analysis
Nutritional Analysis: Nutella
Scores:
โข Nutri-Score E: Very poor nutritional quality
โข NOVA Group 4: Ultra-processed foods
โข Eco-Score D: High environmental impact
Nutritional Breakdown:
โข Energy: 539 kcal (high)
โข Fat: 30.9g (high)
โข Sugars: 56.3g (high)
โข Salt: 0.107g (low)๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes with tests
Run quality checks (
npm run validate)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Open Food Facts for providing the comprehensive food database
Model Context Protocol for the MCP specification
The global community of contributors maintaining food data quality
Need help? Open an issue or check the examples for detailed usage patterns.
Available Tools
5 toolsanalyze_productC
Get nutritional analysis and scores for a product by barcode
| Name | Required | Description | Default |
|---|---|---|---|
| barcode | Yes | The barcode/ID of the product to analyze |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves nutritional analysis and scores, implying a read-only operation, but doesn't cover aspects like authentication needs, rate limits, error handling, or what specific data is returned. This leaves significant gaps in understanding the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to parse and understand quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a tool that analyzes nutritional data, the lack of annotations and output schema means the description is incomplete. It doesn't explain what 'nutritional analysis and scores' entail, the format of the response, or any behavioral traits, leaving the agent with insufficient context for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'barcode' parameter fully documented in the schema. The description adds no additional meaning beyond implying it's used for product identification, so it meets the baseline score of 3 where the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get nutritional analysis and scores') and resource ('for a product by barcode'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_product' or 'search_products', which might also retrieve product information, so it falls short of a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_product' or 'search_products'. It implies usage by specifying the barcode parameter but offers no context, exclusions, or comparisons to sibling tools, leaving the agent to infer usage scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compare_productsC
Compare nutritional information between multiple products
| Name | Required | Description | Default |
|---|---|---|---|
| barcodes | Yes | Array of product barcodes to compare (max 10) | |
| focus | No | Focus comparison on specific aspect |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool compares nutritional information, implying a read-only operation, but doesn't clarify aspects like data sources, rate limits, authentication needs, or what happens if barcodes are invalid. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence: 'Compare nutritional information between multiple products.' It is front-loaded with the core purpose, has no redundant words, and every part earns its place by clearly stating the tool's function. This is an excellent example of conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of comparing multiple products and the lack of annotations and output schema, the description is incomplete. It doesn't explain the return format, error handling, or how the comparison is presented (e.g., side-by-side table, summary). For a tool with no structured output documentation, more context is needed to guide the agent effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, with clear descriptions for both parameters (e.g., 'Array of product barcodes to compare (max 10)' and 'Focus comparison on specific aspect'). The description adds no additional parameter semantics beyond what the schema provides, such as explaining the 'focus' enum values in context. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Compare nutritional information between multiple products.' It specifies the verb ('compare') and resource ('nutritional information between multiple products'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'analyze_product' or 'get_product,' which might also involve product data retrieval, so it doesn't reach the highest score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'analyze_product' or 'search_products,' nor does it specify prerequisites or exclusions. The agent must infer usage from the name and schema alone, which is insufficient for optimal tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_productB
Retrieve detailed information about a food product by its barcode
| Name | Required | Description | Default |
|---|---|---|---|
| barcode | Yes | The barcode/ID of the product (e.g., '3017620422003') |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Retrieve' implies a read operation, it doesn't specify whether this requires authentication, rate limits, error conditions (e.g., invalid barcode), or what 'detailed information' includes (e.g., nutritional data, pricing). For a tool with zero annotation coverage, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero waste. It front-loads the core purpose ('Retrieve detailed information') and specifies the key constraint ('by its barcode') without unnecessary elaboration. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read operation with one well-documented parameter and no output schema, the description is minimally adequate. However, it lacks context about the nature of 'detailed information' returned, which could be critical for an agent. Without annotations or output schema, the description should ideally hint at the response structure or data scope to be fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the single parameter 'barcode' fully documented in the schema. The description adds no additional parameter semantics beyond implying the barcode identifies a food product, which is already clear from the schema's example. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Retrieve detailed information') and target resource ('about a food product by its barcode'), distinguishing it from siblings like 'search_products' (which likely returns multiple results) or 'analyze_product' (which might perform analysis rather than basic retrieval). The verb+resource combination is precise and unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'search_products' or 'get_product_suggestions'. It doesn't mention prerequisites (e.g., needing a barcode), exclusions, or comparative use cases. The agent must infer usage from the description alone without explicit direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_product_suggestionsC
Get product suggestions based on dietary preferences or restrictions
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | Product category to search within | |
| dietary_preferences | No | Dietary preferences or restrictions | |
| max_results | No | Maximum number of suggestions (default: 10) | |
| min_nutriscore | No | Minimum Nutri-Score grade (a, b, c, d, e) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It only states what the tool does ('Get product suggestions') without describing how it behavesโsuch as whether it's a read-only operation, how results are returned, potential rate limits, or authentication needs. This is inadequate for a tool with 4 parameters and no output schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits, result format, and usage context, which are essential for an agent to effectively invoke this tool without structured support.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description mentions 'dietary preferences or restrictions', which aligns with one parameter, but adds minimal value beyond the input schema, which has 100% coverage and detailed descriptions for all parameters. Since schema coverage is high, the baseline score is 3, as the description doesn't significantly enhance parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as 'Get product suggestions based on dietary preferences or restrictions', which specifies the verb ('Get'), resource ('product suggestions'), and key input criteria. However, it doesn't explicitly differentiate from sibling tools like 'search_products' or 'get_product', which might have overlapping functionality.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'search_products' or 'get_product'. It mentions the input criteria but doesn't specify use cases, prerequisites, or exclusions, leaving the agent to infer usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_productsC
Search for food products with various filters and criteria
| Name | Required | Description | Default |
|---|---|---|---|
| search | No | Search terms for product names, brands, or ingredients | |
| categories | No | Filter by categories (e.g., 'beverages', 'dairy') | |
| brands | No | Filter by brand names | |
| countries | No | Filter by countries (e.g., 'france', 'united-states') | |
| nutrition_grades | No | Filter by Nutri-Score grades (a, b, c, d, e) | |
| nova_groups | No | Filter by NOVA processing groups (1, 2, 3, 4) | |
| sort_by | No | Sort results by: popularity, product_name, created_datetime, last_modified_datetime | |
| page | No | Page number for pagination (default: 1) | |
| page_size | No | Number of results per page (default: 20, max: 100) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It mentions filtering and sorting capabilities but doesn't address key behavioral aspects like whether this is a read-only operation, expected response format, pagination behavior beyond schema hints, rate limits, or authentication requirements. The description is too minimal for a tool with 9 parameters and no output schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized for a search tool and front-loads the core functionality without unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 9 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what kind of results to expect, how results are structured, whether there are limitations on search scope, or how to interpret empty results. The agent would need to guess about important behavioral aspects despite the comprehensive parameter schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all 9 parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'various filters and criteria' but doesn't provide additional context about parameter interactions, default behaviors, or usage examples. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('search') and resource ('food products'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_product_suggestions' or 'analyze_product' which might also involve searching or retrieving product information, so it doesn't achieve full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_product' (for single product retrieval) or 'get_product_suggestions' (which might offer recommendations). It mentions 'various filters and criteria' but doesn't specify contexts where this comprehensive search is preferred over simpler sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose with no ambiguity: analyze_product focuses on nutritional analysis, compare_products on comparisons, get_product on retrieval, get_product_suggestions on recommendations, and search_products on filtered searches. The descriptions make it easy for an agent to select the right tool for each specific task.
All tool names follow a consistent verb_noun pattern (e.g., analyze_product, compare_products, get_product, get_product_suggestions, search_products). This predictability enhances usability and reduces cognitive load for agents navigating the toolset.
With 5 tools, the server is well-scoped for its food product domain, covering core operations like retrieval, search, analysis, comparison, and suggestions. Each tool earns its place without feeling excessive or insufficient for the intended functionality.
The toolset provides strong coverage for querying and analyzing food products, including CRUD-like retrieval and search, plus value-added features like analysis and suggestions. A minor gap might be the lack of update or creation tools, but this is reasonable for a read-only data source like Open Food Facts.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Unlock the power of food transparency with our Open Food Facts MCP server. Easily look up any food
Barcode lookup, nutrition search, and product comparison for 3M+ crowd-sourced food products.
Food and nutrition data: search, macros, and comparisons
Can this person eat this? Allergens, additives and nutrition from a barcode.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to search for food products and retrieve detailed nutritional information from the Open Food Facts database using product names or barcodes.
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to search the USDA's FoodData Central database and retrieve detailed nutritional information and ingredient lists. It supports comprehensive food data access through keyword searches and structured queries for specific food items.3MIT
- FlicenseBqualityCmaintenanceEnables AI assistants to access food product information, providing nutritional analysis, product comparisons, and recipe suggestions using the Open Food Facts database.21
- FlicenseBqualityCmaintenanceEnables AI assistants to access food product information from Open Food Facts, including nutritional analysis, product comparisons, recipe suggestions, and allergen checks.21
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/caleb-conner/open-food-facts-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server