Let AI Help You Eat Right and Exercise: A First Look at the MacroFactor MCP Skill
To be honest, I've been using MacroFactor to track my diet and training for a while now, but it's always a bit of a hassle to open the app and dig through historical data. Wouldn't it be great if I could just say to an AI, "Check how much protein I ate yesterday"? I stumbled upon this MacroFactor MCP skill, and it was a total game-changer—it actually lets an AI assistant directly interact with MacroFactor data!
This skill is essentially an MCP server, bundled with a CLI tool and a web interface. The author, sjawhar, open-sourced the code on GitHub (the repository is named macrofactor, though it's now archived, but the functionality works perfectly). It uses the Model Context Protocol, a standard protocol, to wrap MacroFactor's official API into various "tools" that AI can understand. For example: "Get daily nutrition summary," "Query workout plan," "Log food entry," and so on. You just ask the AI to call these tools, and it can perform the same operations as the MacroFactor app.
Actually, Installation Is Really Simple
Just use npx in one go:
npx skills add https://github.com/sjawhar/macrofactor --skill macrofactor-mcp
The prerequisite is that you have Node.js and npm installed on your computer—most people probably have that, right? After installation, go to the MacroFactor settings page to generate an API key (Personal Access Token), then create a .env file in the project folder and write:
MACROFACTOR_API_KEY=your_api_key_here
Now you're ready to play!
Three Ways to Use It
- MCP Server: Once started, any AI assistant that supports MCP (like some chatbot platforms) can connect to it. You can say to the AI, "Show me my carbohydrate intake trend for the last week," and the AI will automatically fetch the data and provide analysis.
- CLI Tool: Run commands directly in your terminal, for example:
macrofactor-mcp get-daily-summary --date 2025-01-01. This returns the nutrition summary for that day. Great for geeks who love the command line. - Web Application: Built with SvelteKit, after starting it opens a beautiful web page that presents data graphically. It's like a lighter-weight web version of MacroFactor.
My Hands-On Experience
I mainly used the MCP server mode because, when coding, I'm used to having an AI as an assistant. After setting it up, I asked the AI to organize my protein intake for the past week. The AI directly invoked the get_nutrition_summary tool, returned a table of data, and even drew a trend chart (using other skills). Honestly, at that moment, I felt like a cyborg human. However, note that this skill requires internet access to the MacroFactor API, and data updates might have a few minutes of delay. Also, since the repository is archived, the author might not update it, but the basic functionality should be sufficient.
For developers, this skill is also a great MCP example to learn how to wrap third-party APIs. What tools does it expose? I guess there are get_daily_data, get_workout_plan, log_food, etc. (for specifics, check the SKILL.md file—the page mentions this file but didn't expand on it). If you're interested, you can download the ZIP source code to see the implementation.
A Few Minor Gripes
After all, it's an archived project, so the documentation might not be perfect. For example, exactly which environment variables are needed, or the CLI command list—you'll have to dig through the source code yourself. Also, MacroFactor's API itself might have rate limits, so don't query too much data at once. Additionally, if you don't have a MacroFactor membership account, you might not even be able to use the API. But for frequent MacroFactor users, this is definitely a productivity booster.
In summary, this skill has made my vision of AI + fitness a reality. Although I can't yet interact with the app directly through voice, at least I can gracefully ask the AI from my computer: "I ate three bowls of rice today; can you calculate if I exceeded my carb limit?" Can you imagine that? Hopefully, there will be more MCP skills like this in the future!