MyFitnessPal — Claude Code MCP server: setup
Connects an AI coding client to your MyFitnessPal diary for food logging, product lookup, and nutrition analysis.
claude mcp add --env MFP_COOKIE=<MFP_COOKIE> --env MFP_USERNAME=<MFP_USERNAME> --transport stdio myfitnesspal -- uvx mfp-mcpWhat MyFitnessPal does
This MCP server lets Claude Code work with a MyFitnessPal diary through chat. It can add, edit, and remove diary entries, find foods with macro data, inspect daily meals, follow weight trends, and export nutrition history.
The process runs with uvx mfp-mcp and authenticates through a browser session cookie. You need uv and MFP_COOKIE before connecting it; the client configuration also uses MFP_USERNAME. Optional session renewal relies on a headless browser profile and Playwright. MyFitnessPal has no public API, so the server depends on private web endpoints and can stop working when the site changes.
What it helps with
- log meals into a MyFitnessPal diary
- find foods together with macro values
- review what was eaten on a given day
- track weight and nutrition trends
- export diary history for analysis
Example prompts for the agent
- Log a banana as a snack in MyFitnessPal.
- Show what I ate yesterday and group the entries by meal.
- Chart my weight for this month.
How to install MyFitnessPal
Platform CLI
claude mcp add --env MFP_COOKIE=<MFP_COOKIE> --env MFP_USERNAME=<MFP_USERNAME> --transport stdio myfitnesspal -- uvx mfp-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mfp-mcp <command>
Platform CLI
codex mcp add myfitnesspal --env MFP_COOKIE=<MFP_COOKIE> --env MFP_USERNAME=<MFP_USERNAME> -- uvx mfp-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mfp-mcp <command>
Config file
{
"mcpServers": {
"myfitnesspal": {
"command": "uvx",
"args": [
"mfp-mcp"
],
"env": {
"MFP_COOKIE": "<MFP_COOKIE>",
"MFP_USERNAME": "<MFP_USERNAME>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mfp-mcp <command>
Config file
{
"servers": {
"myfitnesspal": {
"type": "stdio",
"command": "uvx",
"args": [
"mfp-mcp"
],
"env": {
"MFP_COOKIE": "<MFP_COOKIE>",
"MFP_USERNAME": "<MFP_USERNAME>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mfp-mcp <command>
Platform CLI
gemini mcp add -e MFP_COOKIE=<MFP_COOKIE> -e MFP_USERNAME=<MFP_USERNAME> myfitnesspal uvx mfp-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mfp-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about MyFitnessPal
How do I install MyFitnessPal in Claude Code?
Run claude mcp add mfp-mcp -e MFP_COOKIE=<MFP_COOKIE> -- uvx mfp-mcp. The MyFitnessPal session cookie is passed through MFP_COOKIE.
What does MyFitnessPal do?
It gives an AI client access to a MyFitnessPal diary for food search, diary edits, meal review, and nutrition history analysis.
What is required to authenticate MyFitnessPal?
The server signs in with a cookie from an active MyFitnessPal browser session. When that session expires, refresh the cookie; automatic renewal uses the Playwright setup.