# MyFitnessPal [Health: Active]

**Category:** 🏃 Sports  
**Repository:** https://github.com/Mason-Levyy/myfitnesspal-mcp  
**GitHub Stars:** 37  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/myfitnesspal

## Description
MCP server for MyFitnessPal: log, search, and analyze your food diary.

## Tools
Capabilities this server exposes over MCP:

- **fitness_get_day** — Nutrition summary, diary entries, the MyFitnessPal daily note, and the
    local feel note for a day.

    date: YYYY-MM-DD (default: today).
    
- **fitness_search_food** — Search MyFitnessPal's food database and return candidate matches.

    Each candidate has name, brand, calories, macros, serving, and the
    food_id + weight_id to pass to fitness_log_food to log exactly that item.
    
- **fitness_draft_food** — Draft a food entry: numbered options to choose from before logging.

    Each option lists every serving size with its calories/protein/carbs/fat
    for the whole entry (serving × quantity) and a suggested_serving. The
    min_/max_ targets (grams; calories in kcal) also apply to the whole
    entry: options that fit come first, near misses follow, flagged
    fits_targets=false. A food you've confirmed before for this query is
    pinned to the top. The order is fixed once drafted.

    Log a choice with fitness_log_food(draft_id=..., option=N, serving=M);
    call this again with different targets to refine. Drafts last 24 hours.
    date: YYYY-MM-DD (default: today).
    
- **fitness_log_food** — Log a food to the real MyFitnessPal diary.

    Preferred: pick from a fitness_draft_food draft with draft_id + option
    (+ serving, default the option's suggested_serving). meal, quantity, and
    date default to the draft's. pin=True remembers the choice so logging
    the same query later reuses this food and serving.

    With only `query`: logs a pinned food, or the single exact-name match;
    otherwise nothing is logged and a draft is returned (needs_choice=true)
    to pick from. With food_id + weight_id (from fitness_search_food): logs
    exactly that item, `query` being its display name.

    meal: breakfast|lunch|dinner|snacks (default breakfast) or any meal name
    on the account. quantity: number of servings (default 1).
    date: YYYY-MM-DD (default today).
    
- **fitness_list_food_pins** — List remembered food choices (query → food and serving) that
    fitness_log_food reuses. Stored locally only.
- **fitness_clear_food_pin** — Forget a remembered food choice for `query`, or every choice with
    clear_all=True, so the next log of that query drafts options again.
- **fitness_delete_food** — Remove a food from the MyFitnessPal diary by name match.

    query: text matched against logged entry names (e.g. "banana"). If this
    matches nothing, the error lists what's actually logged that day/meal — use
    that to retry with a better query. If it matches more than one entry (and
    none is an exact name match), the error lists the candidates; narrow `query`
    to pick one. Identical duplicates (same name, including its quantity, in
    the same meal) are interchangeable, so one of them is removed; call again
    to remove another.
    meal: optional breakfast|lunch|dinner|snacks or any meal name on the
    account, to disambiguate duplicates. date: YYYY-MM-DD (default: today).
    
- **fitness_modify_food** — Replace a MyFitnessPal diary entry: deletes the match, then adds a food.

    query: the existing entry to replace (name match) within `meal`. If this
    matches nothing, the error lists what's actually logged that day/meal — use
    that to retry with a better query. If it matches more than one entry (and
    none is an exact name match), the error lists the candidates; narrow `query`
    to pick one. Of several identical duplicates, one is replaced.
    new_query: the food to add instead; omit to re-add `query` (e.g. to change
    quantity). The replacement is chosen like fitness_log_food's: a pinned
    food or a single exact-name match is used directly; otherwise nothing is
    changed and a draft comes back (needs_choice=true) — call again with the
    same query plus draft_id + option (and optionally serving).
    meal: breakfast|lunch|dinner|snacks or any meal name on the account,
    used for both the delete and the add. quantity: servings (default 1, or
    the draft's). date: YYYY-MM-DD (default: today).
    
- **fitness_log_weight** — Log a weight measurement to MyFitnessPal.

    weight: in your MyFitnessPal account's display unit (kg or lbs).
    Logging twice for the same date updates that day's measurement.
    date: YYYY-MM-DD (default: today).
    
- **fitness_log_water** — Log water to the real MyFitnessPal water tracker.

    amount: quantity to add to the day's total. unit: cup | fl_oz | ml | l
    (common spellings like "cups", "oz", "fl oz", "milliliters", "litres" are
    accepted). replace: set the day's total to `amount` instead of adding —
    use it to correct a mislogged total (amount=0 clears the day).
    Returns previous_ml; to undo a mistake, call again with
    amount=previous_ml, unit="ml", replace=True.
    date: YYYY-MM-DD (default: today).
    
- **fitness_get_exercise** — Read the MyFitnessPal exercise diary (cardio + strength) for a day.

    date: YYYY-MM-DD (default: today).
    
- **fitness_get_exercise_entries** — List a day's cardio and strength exercise-diary entries.

    Each entry has its section, name, and that section's columns (cardio:
    minutes, calories_burned; strength: sets, reps_set, weight_set). entry_id
    is informational only — fitness_delete_exercise deletes by name match.
    date: YYYY-MM-DD (default: today).
    
- **fitness_delete_exercise** — Remove exercise-diary entries by name match (case-insensitive).

    query: text matched against logged exercise names. By default deletes
    exactly one entry, like fitness_delete_food: an exact name match wins;
    otherwise several matches raise an error listing the candidates, and no
    match raises an error listing what's actually logged. Of several identical
    rows (same name and columns), one is removed.
    all_matches: delete every entry whose name contains `query` — for
    cleaning up syncs that log one workout as several same-named rows
    (e.g. Garmin's "Aerobics, general"). Check fitness_get_exercise_entries
    first; a short query can match many entries.
    date: YYYY-MM-DD (default: today).
    
- **fitness_get_note** — Read the MyFitnessPal daily diary note (the free-text 'Notes' box at the
    bottom of the day) straight from your account.

    date: YYYY-MM-DD (default: today).
    
- **fitness_log_note** — Write the MyFitnessPal daily diary note (the free-text 'Notes' box at the
    bottom of the day). This is your real MFP note, synced to your account —
    distinct from the local-only fitness_log_feel.

    text: the note body. append: add to the existing note on a new line instead
    of replacing it. date: YYYY-MM-DD (default: today).
    
- **fitness_log_feel** — Save a 'how I feel today' note. Stored locally only — never sent to
    MyFitnessPal.

    rating: optional 1-5. date: YYYY-MM-DD (default: today).
    
- **fitness_get_trends** — A single metric over a date range, for charts/analysis.

    metric: weight | calories_in | protein | carbs | fat.
    start/end: YYYY-MM-DD (default: last 30 days).
    Returns {metric, points: [{day, value}, ...]} with nulls omitted.
    
- **fitness_bulk_export** — Export a whole date range at once for analysis: per-day nutrition
    totals, food entries with macros, the MyFitnessPal daily note, and local
    feel notes. Read-only.

    start/end: YYYY-MM-DD (default: last 30 days ending today).
    sync_first: gap-fill from MyFitnessPal before exporting. Off by default so
    large historical exports stay fast on cached data.
    

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "myfitnesspal": {
    "command": "uvx",
    "args": ["mfp-mcp"]
  }
}
```

## Documentation

## What MyFitnessPal does

MyFitnessPal exposes diary management and nutrition-analysis operations through MCP. Agents can read a day's nutrition totals, diary entries, MyFitnessPal note, and local feel note; search the food database; and write food entries to the real diary. The server also handles weight measurements, water totals, exercise entries, daily notes, and trend data.

Food logging can begin with a database search or a draft. Search results include the food name, brand, calories, macros, serving information, and identifiers needed to select an exact item. Drafts present numbered choices with serving sizes and whole-entry nutrition values, optionally ranked against calorie or macro targets.

Analysis tools cover individual metrics such as weight, calories, protein, carbohydrates, and fat over a date range. A bulk export returns per-day nutrition totals, food entries, MyFitnessPal notes, and locally stored feel notes for a larger period.

## How it works

The server uses MyFitnessPal's web application endpoints rather than a public API. Authentication is based on the `__Secure-next-auth.session-token` browser cookie from a signed-in MyFitnessPal account. Saved sessions can be renewed when the server builds a client, and an optional headless-browser setup can refresh a rejected session and retry the request.

The normal food workflow is search or draft, choose an option, then call `fitness_log_food`. A draft remains available for 24 hours and can be refined with different targets. Confirmed food choices can be pinned locally so later logs for the same query reuse the selected food and serving. Delete and modify operations use name matching, with errors listing candidates or the day's actual entries when a query needs narrowing.

## Setup and configuration

Install `uv`, authenticate once, and add the server as a stdio MCP server:

```bash
uvx mfp-mcp auth
```

The authentication command prompts for the session cookie. It can also read the cookie from the clipboard on macOS. Add `uvx mfp-mcp` to an MCP client configuration, or use the client-specific commands for Claude Code, Codex CLI, and Gemini CLI. Cursor, VS Code, Windsurf, Cline, and Claude Desktop use the same command-and-arguments pattern.

For automatic session renewal through a persistent headless browser profile, install the optional `autorefresh` extra and Chromium:

```bash
uvx --from 'mfp-mcp[autorefresh]' playwright install chromium
uvx --from 'mfp-mcp[autorefresh]' mfp-mcp auth
```

The same `--from` form is used in the client configuration. `mfp-mcp auth --check` checks and renews the saved session; it exits with status 1 when the session needs attention.

## Tools and capabilities

- Read daily nutrition, diary entries, notes, and local feel ratings.
- Search foods and create serving-aware drafts with calorie and macro targets.
- Log, delete, replace, and locally pin food choices.
- Record weight and water, including replacing a day's water total.
- Read and remove cardio or strength exercise entries.
- Read or write the MyFitnessPal daily note and save a local feel note.
- Generate metric trends or export a date range for analysis.

## Limitations and notes

MyFitnessPal MCP is unofficial and depends on reverse-engineered web endpoints. Changes to the MyFitnessPal website can interrupt compatibility. It operates against the authenticated account's real diary, so write operations change account data. Local food pins and feel notes are stored locally, while `fitness_log_note` writes to the MyFitnessPal diary. The server supports stdio and streamable HTTP MCP clients, and requires an active authenticated session.

_Full upstream README: https://allmcps.com/mcp/myfitnesspal/readme_

