- Explore MCP Servers
- macro-tracker-mcp
Macro Tracker Mcp
What is Macro Tracker Mcp
Macro-tracker-mcp is a Model Context Protocol (MCP) server designed to track daily macro nutrients such as calories, protein, carbohydrates, and fat. It allows users to set daily goals, maintain a food database, log meals, and review nutritional progress through Claude Desktop or any MCP-compatible client.
Use cases
Use cases for macro-tracker-mcp include personal nutrition tracking, meal planning for weight loss or muscle gain, and dietary management for individuals with specific health conditions.
How to use
To use macro-tracker-mcp, first install the required dependencies and set up the server by following the installation instructions. Users can then set daily macro goals, add foods to their database, log food intake, and review their meals and macro progress using the provided tools.
Key features
Key features of macro-tracker-mcp include daily goal setting, a personal food database, meal logging with portion sizes, progress tracking, and support for flexible portion descriptions.
Where to use
Macro-tracker-mcp can be used in health and fitness domains, particularly for individuals looking to manage their dietary intake, track nutrition, and achieve specific health goals.
Overview
What is Macro Tracker Mcp
Macro-tracker-mcp is a Model Context Protocol (MCP) server designed to track daily macro nutrients such as calories, protein, carbohydrates, and fat. It allows users to set daily goals, maintain a food database, log meals, and review nutritional progress through Claude Desktop or any MCP-compatible client.
Use cases
Use cases for macro-tracker-mcp include personal nutrition tracking, meal planning for weight loss or muscle gain, and dietary management for individuals with specific health conditions.
How to use
To use macro-tracker-mcp, first install the required dependencies and set up the server by following the installation instructions. Users can then set daily macro goals, add foods to their database, log food intake, and review their meals and macro progress using the provided tools.
Key features
Key features of macro-tracker-mcp include daily goal setting, a personal food database, meal logging with portion sizes, progress tracking, and support for flexible portion descriptions.
Where to use
Macro-tracker-mcp can be used in health and fitness domains, particularly for individuals looking to manage their dietary intake, track nutrition, and achieve specific health goals.
Content
Macro Tracker MCP Server
A Model Context Protocol (MCP) server for tracking daily macro nutrients (calories, protein, carbohydrates, and fat). This server allows you to set daily goals, maintain a food database, log meals, and review your nutritional progress through Claude Desktop or any MCP-compatible client.
Features
- Daily Goal Setting: Set and track daily macro targets
- Food Database: Build a personal database of foods with their nutritional values
- Meal Logging: Log food intake with portion sizes and meal types
- Progress Tracking: Review daily meals and macro progress
- Flexible Portions: Support for various portion descriptions (grams, cups, pieces, etc.)
Available Tools
- set_daily_goals - Set daily macro targets (calories, protein, carbs, fat)
- add_food_to_database - Add foods to your reference database
- lookup_food - Search for foods in your database
- log_food_intake - Log meals with calculated macros
- review_meals - Review all meals for a specific day
- get_database_info - Check database status and statistics
Installation
Prerequisites
- Python 3.10 or higher
Setup
-
Install uv (if not already installed):
# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Restart your terminal after installation to ensure
uv
is available. -
Clone the repository:
git clone https://github.com/karlfoster/macro-tracker-mpc.git cd macro-tracker-mpc
-
Create and activate virtual environment:
# Create virtual environment uv venv # Activate virtual environment # macOS/Linux: source .venv/bin/activate # Windows: .venv\Scripts\activate
-
Install dependencies:
uv sync
-
Test the server (optional):
uv run main.py
Press
Ctrl+C
to stop the test.
Configuration
Claude Desktop Setup
-
Find your uv path:
# macOS/Linux which uv # Windows where uv
-
Get your project’s absolute path:
# In your macro-tracker-mcp directory pwd
-
Open Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
- macOS:
-
Add the macro tracker server configuration:
{ "globalShortcut": "Ctrl+Space", "mcpServers": { "macro": { "command": "/path/to/your/uv", "args": [ "--directory", "/absolute/path/to/macro-tracker-mcp", "run", "main.py" ] } } }
Replace:
/path/to/your/uv
with the output fromwhich uv
command/absolute/path/to/macro-tracker-mcp
with the output frompwd
command
-
Restart Claude Desktop for changes to take effect.
Database Location
By default, the database is stored at ~/macro_tracker.db
. You can specify a custom location using the --db-path
argument:
{
"globalShortcut": "Ctrl+Space",
"mcpServers": {
"macro": {
"command": "/path/to/your/uv",
"args": [
"--directory",
"/absolute/path/to/macro-tracker-mcp",
"run",
"main.py",
"--db-path",
"/custom/path/to/database.db"
]
}
}
}
Usage Examples
Setting Daily Goals
Set my daily macro goals to 2000 calories, 150g protein, 200g carbs, and 65g fat
Adding Foods to Database
Add chicken breast to my food database: 165 calories, 31g protein, 0g carbs, 3.6g fat per 100g
Logging Meals
I ate 200g of chicken breast for lunch
Reviewing Progress
Show me all my meals for today
What's my macro progress for yesterday?
Looking Up Foods
Look up chicken in my food database
Database Schema
The server creates three main tables:
foods
Stores nutritional information per 100g for reference foods.
name
(TEXT): Food namecalories
(REAL): Calories per 100gprotein
(REAL): Protein in grams per 100gcarbs
(REAL): Carbohydrates in grams per 100gfat
(REAL): Fat in grams per 100g
daily_goals
Stores daily macro targets.
date
(TEXT): Date in YYYY-MM-DD formattarget_calories
(REAL): Daily calorie goaltarget_protein
(REAL): Daily protein goal in gramstarget_carbs
(REAL): Daily carb goal in gramstarget_fat
(REAL): Daily fat goal in grams
daily_intake
Logs actual food consumption.
date
(TEXT): Date in YYYY-MM-DD formatfood_name
(TEXT): Name of consumed foodportion_description
(TEXT): Portion size descriptioncalories
(REAL): Total calories for portionprotein
(REAL): Total protein for portioncarbs
(REAL): Total carbs for portionfat
(REAL): Total fat for portionmeal_type
(TEXT): breakfast, lunch, dinner, snack, or other
Tips for Best Results
- Build Your Food Database: Start by adding commonly eaten foods to your database for quick lookups
- Be Specific with Portions: Use clear descriptions like “200g”, “1 cup”, “1 medium apple”
- Consistent Meal Types: Use standard meal types (breakfast, lunch, dinner, snack) for better organization
- Daily Goal Setting: Set realistic, consistent daily goals to track progress effectively
Troubleshooting
Server Not Appearing in Claude Desktop
- Check the configuration file path and syntax
- Verify the absolute paths to both
uv
and your project directory - Ensure Claude Desktop is restarted after configuration changes
- Test the server manually:
cd /path/to/macro-tracker-mcp uv run main.py
Database Issues
- Check database permissions for the specified path
- Verify disk space is available
- Use
get_database_info
tool to check database status
Common Error Messages
- “Food already exists”: The food name is already in your database
- “No foods found”: Your search didn’t match any foods in the database
- “No meals logged”: No food intake recorded for the specified date
Contributing
This is a personal macro tracking tool, but feel free to modify it for your needs:
- Add new nutritional metrics (fiber, sugar, sodium, etc.)
- Implement meal planning features
- Add data export/import functionality
- Create visualization tools
License
This project is provided as-is for personal use. Modify and distribute as needed for your macro tracking requirements.