AM

adamwalt/myfitnesspal-mcp-python

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

70 stars 56 forks 质量 86 趋势 28MIT

adamwalt/myfitnesspal-mcp-python 是从 https://github.com/adamwalt/myfitnesspal-mcp-python. 导入的 MCP 服务器候选

概览

adamwalt/myfitnesspal-mcp-python 是从 https://github.com/adamwalt/myfitnesspal-mcp-python. 导入的 MCP 服务器候选

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,使像Claude这样的AI助手能够与你的MyFitnessPal数据互动,包括饮食日记、锻炼、身体测量、营养目标和饮水量。

特色

工具 类型 描述
mfp_get_diary 阅读 获取任何日期的食物日记条目
mfp_search_food 阅读 搜索MyFitnessPal食品数据库
mfp_get_food_details 阅读 获取食品的详细营养信息
mfp_add_food_to_diary 写 在日记中添加一份特定餐食和日期的食物
mfp_remove_food_from_diary 写 删除你日记中的记录条目
mfp_create_custom_food 写 创建带有完整营养面板的私人定制食物
mfp_list_own_foods 阅读 列出你自己的自定义食物(私密食物不会出现在搜索中)
mfp_delete_custom_food 写 删除你自定义的食物
mfp_get_measurements 阅读 获取体重/身体测量历史
mfp_set_measurement 写入 记录新的体重或身体测量
mfp_get_exercises 阅读 获取记录的锻炼(有氧和力量)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MyFitnessPal MCP Server

A Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with your MyFitnessPal data, including food diary, exercises, body measurements, nutrition goals, and water intake.

Features

Tool Type Description
mfp_get_diary Read Get food diary entries for any date
mfp_search_food Read Search the MyFitnessPal food database
mfp_get_food_details Read Get detailed nutrition info for a food item
mfp_add_food_to_diary Write Add a food item to your diary for a specific meal and date
mfp_remove_food_from_diary Write Remove a logged entry from your diary
mfp_create_custom_food Write Create a private custom food with a full nutrition panel
mfp_list_own_foods Read List your own custom foods (private ones do not appear in search)
mfp_delete_custom_food Write Delete one of your custom foods
mfp_get_measurements Read Get weight/body measurement history
mfp_set_measurement Write Log a new weight or body measurement
mfp_get_exercises Read Get logged exercises (cardio & strength)
mfp_get_goals Read Get daily nutrition goals
mfp_set_goals Write Update daily nutrition goals
mfp_get_water Read Get water intake for a date
mfp_set_water Write Log water intake for a date
mfp_get_steps Read Get daily step counts synced from Apple Health / devices
mfp_log_fast Write Log a completed intermittent fasting window (start + end)
mfp_update_fast Write Update the start/end times of an existing fasting entry
mfp_delete_fast Write Delete a fasting entry by id
mfp_get_report Read Get nutrition reports over a date range
refresh_browser_cookies Utility Extract and save session cookies from browser

How diary writes work

MyFitnessPal has no public API. Reads here are scraped from the website via python-myfitnesspal, and diary writes go through MFP’s internal v2 JSON API — the same one their web client uses, authenticated with your existing session token.

Custom-food writes (mfp_create_custom_food, mfp_list_own_foods, mfp_delete_custom_food) use a different endpoint family: MFP’s v2 API exposes no custom-food create, so these call the same cookie-authenticated web endpoints their website uses (/api/auth/csrf, /api/services/users/foods/mine, /api/services/foods). No browser needs to be running — the stored session cookies are sufficient.

That interface is undocumented and was determined by observing the web client. It works today, but MyFitnessPal can change it without notice. They have already done so once: this server originally posted to /food/diary/{user}/add, which now returns 404, leaving food logging

在 GitHub 查看完整 README

安装

docker run -it --rm \
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "myfitnesspal": { "command": "/Users/yourname/myfitnesspal-mcp-python/venv/bin/python", "args": ["-m", "mfp_mcp.server"], "env": { "MFP_USERNAME": "gAAAAAB...<encrypted_email>", "MFP_PASSWORD": "gAAAAAB...<encrypted_password>" } } } }