
nagarjun226/food-tracker-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
A simple Model Context Protocol (MCP) server that connects Claude AI with the OpenFoodFacts database to create an intelligent nutritional assistant.
Обзор
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: - Search for food products by barcode or keyword - Analyze nutritional content of food products - Create meal plans based on specific nutrition goals and dietary restrictions - Track food consumption with meal logging - Manage dietary restrictions and allergies - Check product compatibility with user restrictions - View food logs and nutrition summaries - Python 3.8 or higher - pip (Python package manager) 1. Clone the repository or download the food_tracker.py file: 2. Create a virtual environment (recommended): 5. Ensure the data directories are created (the script will do this automatically on first run): The server will start and be ready to receive commands.
README
Показан фрагмент оригинального README. Открыть оригинал.
Food Tracker MCP
A Model Context Protocol (MCP) server for tracking food consumption, analyzing nutrition, and managing dietary restrictions.
Overview
Food Tracker MCP integrates with the OpenFoodFacts database to provide a comprehensive food tracking system with the following features:
- Search for food products by barcode or keyword
- Analyze nutritional content of food products
- Create meal plans based on specific nutrition goals and dietary restrictions
- Track food consumption with meal logging
- Manage dietary restrictions and allergies
- Check product compatibility with user restrictions
- View food logs and nutrition summaries
Installation
Prerequisites
- Python 3.8 or higher
pip(Python package manager)
Setup
- Clone the repository or download the
food_tracker.pyfile:
# 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
- Create a virtual environment (recommended):
python -m venv venv
- Activate the virtual environment:
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
- Install the required dependencies:
pip install httpx fastmcp pydantic
- Ensure the data directories are created (the script will do this automatically on first run):
mkdir -p data/users data/logs
Running the MCP Server
Run the server using:
python food_tracker.py
The server will start and be ready to receive commands.
Using with Claude
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:
- Visit https://console.anthropic.com/mcps or the relevant section in your Anthropic account
- Register the food-tracker MCP by providing the necessary information and endpoint
-
Once registered, you can interact with the Food Tracker through Claude by invoking the MCP’s tools.
Example prompts to use with Claude:
- “Scan this barcode to see nutrition information: 3270190119357”
- “Add a peanut allergy to my dietary restrictions”
- “Log that I had a granola bar for breakfast”
- “Search for products containing ‘oatmeal’”
- “Check if this product is compatible with my dietary restrictions”
- “Show me my food log for today”
Available Tools
This MCP provides the following tools that Claude can access:
1. get_product_by_barcode
Get detailed information about a food product using its barcode.
Parameters:
barcode: The product barcode (EAN, UPC, etc.)
2. 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)
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →