Open Food Facts MCP Server
Enables LLMs to search for food products and retrieve detailed nutritional information from the Open Food Facts database using product names or barcodes.
README
Open Food Facts MCP Server Walkthrough
I have successfully created a Model Context Protocol (MCP) server that interfaces with the Open Food Facts API. This server allows LLMs (like Claude via Claude Desktop) to search for products and retrieve food product details using barcodes.
Components Created
1. Server Implementation (server.py)
This file uses FastMCP to expose two tools:
get_product_by_barcode(barcode): Retrieves detailed product info (Name, Brand, Nutri-Score, Ingredients).search_products(query): Searches for products by name and returns a list of matches.
2. Validation Script (validate_server.py)
A Python script that simulates an MCP client. It connects to the local server via standard input/output (stdio) and executes both tools to verify functionality.
How to Run
Prerequisites
Ensure you have the dependencies installed:
pip install -r requirements.txt
Running the Server
You can run the server directly (it listens on stdio):
python server.py
Note: This will not output anything visible to the console unless you speak JSON-RPC to it.
Verifying Functionality
Run the validation script to see the tools in action:
python validate_server.py
You should see output demonstrating a search for "nutella" and a lookup of a specific barcode.
Integration with Claude Desktop (Example)
To use this with Claude Desktop, add the following to your claude_desktop_config.json:
{
"mcpServers": {
"openfoodfacts": {
"command": "python",
"args": ["C:\\Users\\saipr\\.gemini\\antigravity\\scratch\\openfoodfacts_mcp\\server.py"]
}
}
}
## Frontend (Streamlit)
For a more interactive experience, I have built a local web interface using Streamlit.
### Running the Frontend
```bash
python -m streamlit run app.py
This will open a browser window where you can interactively search for products and look up barcodes without writing scripts.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Neon Database
MCP server for interacting with Neon Management API and databases