Амаль/food-tracker-mcp
Built by Metorial, the integration platform for agentic AI.
Амаль/food-tracker-mcp
Server Summary
Search for food products by barcode or keyword
Analyze nutritional content of food products
Create personalized meal plans
Log meals and track food consumption
Manage dietary restrictions and allergies
Check product compatibility with user restrictions
View food logs and nutrition summaries
A Model Context Protocol (MCP) server for tracking food consumption, analyzing nutrition, and managing dietary restrictions.
Food Tracker MCP integrates with the OpenFoodFacts database to provide a comprehensive food tracking system with the following features:
pip
(Python package manager)food_tracker.py
file:# Option 1: Clone the repository (if available)
git clone https://github.com/yourusername/food-tracker-mcp.git
cd food-tracker-mcp
# Option 2: Create a new directory and save the file there
mkdir food-tracker-mcp
cd food-tracker-mcp
# Copy food_tracker.py into this directory
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
pip install httpx fastmcp pydantic
mkdir -p data/users data/logs
Run the server using:
python food_tracker.py
The server will start and be ready to receive commands.
To use this MCP with Claude, you'll need to register it with the Claude platform. Here's how to do it:
Follow Anthropic's documentation to register your MCP:
Once registered, you can interact with the Food Tracker through Claude by invoking the MCP's tools.
Example prompts to use with Claude:
This MCP provides the following tools that Claude can access:
get_product_by_barcode
Get detailed information about a food product using its barcode.
Parameters:
barcode
: The product barcode (EAN, UPC, etc.)search_products
Search for food products by name or description.
Parameters:
query
: The search querypage
: Page number for pagination (default: 1)page_size
: Number of results per page (default: 10)manage_user_restrictions
Manage a user's dietary restrictions.
Parameters:
user_id
: The user's unique identifieraction
: The action to perform (get, add, remove, update)restriction_type
: Type of restriction (allergen, diet, ingredient, medical, preference)restriction_value
: The specific restriction value (e.g., "peanuts", "vegetarian")severity
: How severe the restriction is (avoid, limit, fatal)notes
: Additional notes about the restrictioncheck_product_compatibility
Check if a product is compatible with a user's dietary restrictions.
Parameters:
user_id
: The user's unique identifierbarcode
: The product barcode to checkanalyze_nutrition
Analyze the nutritional content of a food product.
Parameters:
barcode
: The product barcodelog_food_consumption
Log food consumption for a user.
Parameters:
user_id
: The user's unique identifierbarcode
: The product barcodequantity
: Amount consumed (default: 1 serving)meal_type
: Type of meal (breakfast, lunch, dinner, snack)get_user_food_log
Get a user's food log for a specific date.
Parameters:
user_id
: The user's unique identifierdate
: Date in YYYY-MM-DD format (defaults to today)manage_user_restrictions(
user_id="user123",
action="add",
restriction_type="allergen",
restriction_value="gluten",
severity="avoid",
notes="Avoid all wheat products"
)
manage_user_restrictions(
user_id="user123",
action="add",
restriction_type="diet",
restriction_value="vegetarian"
)
# First get product info
product = get_product_by_barcode(barcode="3270190119357")
# Then log consumption
log_food_consumption(
user_id="user123",
barcode="3270190119357",
quantity=1,
meal_type="breakfast"
)
check_product_compatibility(
user_id="user123",
barcode="3270190119357"
)
analyze_nutrition(barcode="3270190119357")
get_user_food_log(user_id="user123")
The Food Tracker MCP stores data locally in JSON files:
./data/users/{user_id}.json
./data/logs/{user_id}_{date}.json
You can extend the MCP by: