Macro Engine
Tracks macros and logs meals via plain language by exposing a local USDA food database as an MCP server.
README
Macro Engine
Macro tracking you talk to instead of tap at. A local food database built from open data (USDA FoodData Central), exposed as an MCP server so any Claude surface (a local Claude Code session, or any agent that speaks MCP) can log meals in plain language and answer the only question that matters: what's left today.
Setup
python3 -m venv .venv && .venv/bin/pip install mcp
.venv/bin/python -m macro_engine.etl_fdc # download + load USDA data (~15k foods)
.venv/bin/python -m unittest discover tests -v # run tests
Data lands in ~/.local/share/macro-engine/ (macros.db + cached raw/ zips).
Override the DB path with MACRO_ENGINE_DB.
MCP registration
claude mcp add macro-engine -- \
/path/to/macro-engine/.venv/bin/python \
/path/to/macro-engine/mcp_server.py
Or in a project .mcp.json:
{
"mcpServers": {
"macro-engine": {
"command": "/path/to/macro-engine/.venv/bin/python",
"args": ["/path/to/macro-engine/mcp_server.py"]
}
}
}
Tools: log_meal, remaining, day_summary, search_food, set_targets,
add_alias, delete_log_entry.
Architecture
macro_engine/db.py— SQLite schema (foods, per-100g nutrients, portions, aliases, log, targets, FTS5 index)macro_engine/etl_fdc.py— USDA FDC bulk-CSV loader (Foundation + SR Legacy- FNDDS Survey). Re-runnable; food ids stable across reloads.
macro_engine/resolve.py— phrase → food: learned aliases first, then FTS5 with source-quality re-rankingmacro_engine/tracker.py— logging, targets (append-only, latest wins), day totals, remainingmcp_server.py— FastMCP stdio server
Design rules: log rows carry denormalized macros (history survives data
reloads); unresolvable items are returned as problems or logged as flagged
estimates, never silently dropped; aliases are the product — every correction
teaches the resolver.
Roadmap
Core loop: USDA data + MCP server + fleet wiring(this)- Vault recipe indexer (
Wiki/Reference/Recipes/→ per-serving macros) - Open Food Facts import (Canadian packaged goods), miss-queue → recon sourcing, chain-restaurant adapters
- Optional UI (standalone PWA or Training Engine feature)
License
MIT. See LICENSE.
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.