- Home
- MCP servers
- Openfood
Openfood
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"saiprasadthalluri-openfoods_mcp": {
"command": "python",
"args": [
"server.py"
]
}
}
}You have an MCP server that bridges the Open Food Facts API to enable large language models to search for food products and retrieve details by barcode. This server makes it easy to perform product lookups and name-based searches from any MCP client, including conversational agents, with minimal setup.
How to use
Use the MCP client to connect to the local server and call the available tools. You can search for products by name to get a list of matches, or retrieve detailed information for a specific product by scanning a barcode. The tools respond with structured product data such as Name, Brand, Nutri-Score, and Ingredients, making it straightforward to present concise product summaries or build shopping or nutrition-focused workflows.
How to install
Prerequisites you need before starting:
- Ensure Python is installed on your system
- Install project dependencies using the Python package manager
Install and run steps
- Install dependencies from the requirements file using pip.
pip install -r requirements.txt
- Start the MCP server. The server runs as a local stdio server and will listen for JSON-RPC calls on standard input/output.
python server.py
- Validate functionality with the provided validation script to ensure both tools work as expected.
python validate_server.py
Client configuration example
Configure your MCP client to connect via stdio to the local server. The following example shows how to launch the server process from constant command invocation in your client setup.
{
"mcpServers": {
"openfoodfacts": {
"command": "python",
"args": ["server.py"]
}
}
}
Frontend example for interactive use
For an interactive search experience, you can run a local frontend that communicates with the MCP server to search and look up barcodes without writing scripts.
python -m streamlit run app.py
Available tools
get_product_by_barcode
Retrieves detailed product info by barcode including Name, Brand, Nutri-Score, and Ingredients.
search_products
Searches for products by name and returns a list of matches.