Skip to content
MyFitnessPal logo
MCP server
Registry

MyFitnessPal MCP Server

Log MyFitnessPal by talking to your AI: search foods with macros, log meals, weight, water and more.

MyFitnessPal scores 71 (Good), licensed MIT and written in Python. It installs as a local process. It declares 19 tools. Filed under Search. GitHub shows 37 stars. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.

by mason-levyyMITPython37 stars
Trust score
71Good
Trust score 71 of 100, Good

Good trust

71 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: mit.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 71 comes from

22 + 20 + 5 + 10 + 4 + 10 = 71. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity5 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 5 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs10 / 10

A real summary, a README with depth, listed tools.

Docs: 10 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "mason-levyy-myfitnesspal-mcp": {      "command": "uvx",      "args": [        "mfp-mcp"      ],      "env": {        "MFP_COOKIE": "YOUR_MFP_COOKIE",        "MFP_USERNAME": ""      }    }  }}

Environment variables

NameRequiredNotes
MFP_COOKIESecretOptionalMyFitnessPal session cookie (optional; 'mfp-mcp auth' is the guided alternative)
MFP_USERNAMEOptionalMyFitnessPal username; only needed if MFP's profile lookup fails for your account

Tools19Tool docs quality grade C

All capabilities

About

Log MyFitnessPal by talking to your AI.

Mason-Levyy/myfitnesspal-mcp MCP server PyPI GitHub stars CI Python License: MIT

Install in Cursor Install in VS Code Install in VS Code Insiders

Quickstart · Tools · Authentication · Changelog

▶ Watch the launch video

MyFitnessPal MCP is a free, open-source MCP server that connects MyFitnessPal to Claude, Cursor, VS Code, or any MCP client. Log meals by talking, search the food database with macros, track trends, and export your nutrition history, all against your real MyFitnessPal diary.

Published on PyPI as mfp-mcp and in the official MCP Registry as io.github.Mason-Levyy/mfp-mcp.

Unofficial. MyFitnessPal has no public API; this reverse-engineers the web app's own endpoints. It can break whenever MFP changes their site. Use at your own risk, with your own account.

Why this one?

MyFitnessPal moved behind Cloudflare + NextAuth, which broke the username/password login that most existing integrations rely on. This server:

  • Authenticates with your browser session cookie over a real Chrome TLS fingerprint (curl_cffi), which passes Cloudflare
  • Auto-refreshes the session (optional): a headless browser profile rotates the token when it expires, and failed calls retry automatically
  • Writes, not just reads: log, modify, and delete real diary entries
  • Search-then-log: get candidates with macros, then log the exact item

Quickstart

  1. Connect your account (one-time; prompts you to paste a cookie — see Authentication):

    uvx mfp-mcp auth
    
  2. Add the server to your client. The install buttons at the top do this in one click for Cursor and VS Code.

    Claude Code

    claude mcp add myfitnesspal -- uvx mfp-mcp
    

    Or install it as a plugin:

    /plugin install myfitnesspal-mcp --marketplace Mason-Levyy/myfitnesspal-mcp
    

    Claude Desktop (claude_desktop_config.json), Cursor (~/.cursor/mcp.json), Windsurf (~/.codeium/windsurf/mcp_config.json), and Cline (cline_mcp_settings.json) all take the same entry:

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

    VS Code (or use the button above):

    code --add-mcp '{"name":"myfitnesspal","command":"uvx","args":["mfp-mcp"]}'
    

    Codex CLI:

    codex mcp add myfitnesspal -- uvx mfp-mcp
    

    Gemini CLI:

    gemini mcp add myfitnesspal uvx mfp-mcp
    
  3. Talk to it: "log a banana as a snack", "what did I eat yesterday?", "chart my weight this month".

Requires uv. Any MCP client that speaks stdio or streamable HTTP works, not just Claude.

Finding this useful? A ⭐ on GitHub helps other MyFitnessPal users find it.

Authentication

This server signs in with your browser's MyFitnessPal session cookie:

  1. Log in at myfitnesspal.com
  2. Open DevTools (F12) → Application (Chrome) or Storage (Firefox) → Cookies → https://www.myfitnesspal.com
  3. Copy the value of __Secure-next-auth.session-token
  4. Paste it into the mfp-mcp auth prompt, or on macOS run mfp-mcp auth --clipboard and copy the cookie: it connects as soon as the token reaches the clipboard

Sessions last 30 days from their last renewal. The server renews the session whenever it builds a client and saves the cookies MyFitnessPal re-issues, so the saved session stays current as long as it's used at least once a month. mfp-mcp auth --check reports whether the saved session still works and whether auto-refresh is set up; it renews and saves the session as it checks and exits 1 when the session needs attention, so running it on a schedule (cron, launchd) keeps an idle session alive and warns before it lapses.

Auto-refresh (recommended)

With the autorefresh extra, auth also seeds a persistent headless browser profile. When MyFitnessPal rejects the session mid-call, the server tells your client it is retrying, boots the profile headlessly, lets MyFitnessPal rotate the session token, saves the fresh cookie, and retries the call.

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

Then use the same --from 'mfp-mcp[autorefresh]' form in your client config (e.g. uvx --from 'mfp-mcp[autorefresh]' mfp-mcp).

Tools

ToolWhat it does
fitness_get_dayNutrition totals, goals and remaining macros, diary entries, the MFP daily note, and feel note for a day
fitness_search_foodCandidate matches with brand, calories, macros, serving, and ids
fitness_draft_foodNumbered options with every serving size, filtered/ranked by optional calorie and macro targets
fitness_log_foodLog a draft option (and serving), a remembered food, or exact ids to the real diary
fitness_list_food_pinsRemembered query → food/serving choices (local)
fitness_clear_food_pinForget one remembered choice, or all of them
fitness_delete_foodRemove a diary entry by name match
fitness_modify_foodReplace an entry (or change its quantity), choosing the replacement like fitness_log_food
fitness_complete_dayReport whether a diary day is complete, mark it complete ("Complete This Entry"), or reopen it
fitness_log_weightLog a weight measurement (updates the same day on re-log)
fitness_log_waterAdd water (cups, fl oz, mL, L) or set the day's total with replace
fitness_get_exerciseRead the exercise diary (cardio + strength)
fitness_get_exercise_entriesList cardio and strength entries with each section's columns
fitness_delete_exerciseRemove an exercise entry by name match (all_matches for multi-row sync cleanup)
fitness_get_noteRead the MyFitnessPal daily diary note (the "Notes" box) for a day
fitness_log_noteWrite that daily note to MFP (replace, or append a new line)
fitness_log_feelSave a subjective "how I feel" note (stored locally, never sent to MFP)
fitness_get_trendsOne metric over a date range: weight, calories_in, protein, carbs, fat
fitness_bulk_exportWhole date range in one call, including goals and remaining macros

Logging flow

Food logging is draft-then-confirm, so what lands in your diary never depends on MyFitnessPal's search order:

  1. fitness_draft_food("greek yogurt", min_protein=15, max_calories=150) returns numbered options. Each lists every serving size with calories and macros for the whole entry (serving × quantity) plus a suggested serving; options that meet the targets come first, near misses follow. Call it again with different targets to refine.
  2. fitness_log_food(draft_id=..., option=2, serving=1) logs exactly that food and serving, and remembers the choice for that query.
  3. Next time, fitness_log_food(query="greek yogurt") logs the remembered food and serving without searching.

A bare fitness_log_food(query=...) with nothing remembered logs only when exactly one result matches the name exactly; otherwise it logs nothing and returns a draft to choose from. Remembered choices live in the local cache (fitness_list_food_pins, fitness_clear_food_pin). Drafts expire after 24 hours.

fitness_modify_food picks the replacement the same way, before deleting anything: a remembered food or a single exact-name match is used directly; otherwise the entry is left alone and a draft comes back — call fitness_modify_food again with the same query plus draft_id and option.

fitness_log_food, fitness_delete_food, and fitness_modify_food all take a meal argument the same way: breakfast/lunch/dinner/snacks, or the literal name of any meal section currently on your diary — including a renamed default meal or one of the up to two extra meals MyFitnessPal lets you add in Diary Settings. Matching is case-insensitive against your account's current meal labels. If you renamed a default meal, the keywords still work: breakfast/lunch/dinner/snacks fall back to your first through fourth meal, unless that slot now carries a different default name (e.g. lunch won't land in a second meal you renamed to "Dinner"). Any other unrecognized meal raises an error instead of silently logging into the wrong section.

Day summaries and trends read from a local SQLite cache that gap-fills from MyFitnessPal (first call on a fresh install fetches up to 30 days, one request per day).

Water logging reads the day's current total from /food/water, adds the requested quantity, and posts the new total back to the same endpoint. Pass replace=True to set the day's total outright (e.g. to fix a mislogged amount); every call returns previous_ml, so a mistake can be reverted by passing it back as amount with unit="ml" and replace=True. The separate /stats request with a water_logged event is analytics telemetry; it does not persist the water total.

Remote / HTTP mode

The default transport is stdio. For network clients:

mfp-mcp --http --host 127.0.0.1 --port 8484

This serves streamable HTTP at /mcp. A session idle for 30 minutes is closed, and the client has to reconnect; clients that keep the event stream open aren't affected. There is no built-in authentication — never expose it to the internet. Bind to localhost and front it with something that authenticates for you: a VPN/tailnet (e.g. tailscale serve), an authenticating reverse proxy, or an OAuth-aware MCP gateway.

Configuration

VariablePurposeDefault
MFP_COOKIESession cookie (full header or bare token); overrides the saved file–
MFP_USERNAMEYour MFP username (not email); only needed if profile lookup failsauto-detected
MFP_IMPERSONATEcurl_cffi browser fingerprint (try chrome124 on 403s)chrome
MFP_SYNC_DAYSGap-fill lookback window in days30
MFP_MCP_DATA_DIRWhere the SQLite cache + browser profile liveplatform data dir

Troubleshooting

  • 403 / Cloudflare blocked: try MFP_IMPERSONATE=chrome124 (or another curl_cffi target). Datacenter IPs get challenged far more than residential ones.
  • "Session expired": confirm with mfp-mcp auth --check, then re-run mfp-mcp auth, or set up auto-refresh.
  • "couldn't read your MyFitnessPal profile": MFP's profile endpoint 500s for some accounts. Set MFP_USERNAME to your username (not your email).
  • curl_cffi install issues: prebuilt wheels cover Linux/macOS/Windows; musl (Alpine) builds from source.

FAQ

How do I connect MyFitnessPal to Claude? Run uvx mfp-mcp auth once to save your MyFitnessPal session, then add the server: claude mcp add myfitnesspal -- uvx mfp-mcp in Claude Code, or the JSON entry from the Quickstart in Claude Desktop. Then ask Claude to log a meal or show yesterday's diary.

Is it free? Yes. It's open source under the MIT license, and it doesn't sell or collect anything.

Is there an official MyFitnessPal API? Not one you can use. MyFitnessPal's API is limited to approved partners and isn't open to new applications, so there's no API key to get. This server signs in with your own browser session cookie and makes the same requests the MyFitnessPal website makes (see How it works).

Which MCP clients does it work with? Any client that runs a stdio or streamable HTTP server, including Claude Desktop, Claude Code, Cursor, Windsurf, Cline, and VS Code. Use the uvx mfp-mcp command from the Quickstart. AI coding agents can follow llms-install.md.

Can it log meals as well as read them? Yes. It logs, replaces, and deletes diary entries, logs weight and water, and writes the daily note. See Tools.

Where does my data go? The server talks only to MyFitnessPal. The session cookie stays in your local config directory, and day summaries, feel notes, and remembered foods stay in a local SQLite file. Tool results go to whichever MCP client and model you connect it to.

How it works

  • Every request runs over a curl_cffi session that impersonates Chrome's TLS fingerprint, so Cloudflare lets it through with just the NextAuth session cookie. The diary, exercise, and measurements pages are parsed with lxml.
  • Writes replicate the web app's own XHR calls: the legacy food-search page supplies the food_id/weight_id that /food/add accepts, deletes go through /food/remove, water reads/writes via /food/water, and the daily note reads/writes via /food/note — each with the page CSRF token.
  • Day summaries, trends, and exports read a local SQLite cache that gap-fills missing days. The MyFitnessPal daily note syncs both ways; feel notes are local-only.

Development

git clone https://github.com/Mason-Levyy/myfitnesspal-mcp
cd myfitnesspal-mcp
uv sync --extra autorefresh
uv run pytest

Tests run against synthetic MyFitnessPal HTML/JSON fixtures — no account needed. Lint and formatting are enforced with ruff (uv run ruff check ., uv run ruff format .).

Contributing

Issues and pull requests are welcome, especially endpoint captures when MyFitnessPal changes something. See CONTRIBUTING.md for setup, style, and the PR checklist, and SECURITY.md for how to report vulnerabilities privately. Release history is in CHANGELOG.md.

Support the project

If this server saves you time, please star the repo. Stars are how other MyFitnessPal users find it in GitHub search and MCP directories. Bug reports and endpoint captures are just as welcome in issues.

Credits

The sign-in and the diary, exercise, weight, and food-detail parsing started as python-myfitnesspal by Adam Coddington, which this project used as a dependency through 0.4.x. That code now lives in this repo, trimmed to what the server uses and adapted to its curl_cffi session, under python-myfitnesspal's MIT license (see NOTICE). Thanks to Adam and its contributors for years of keeping up with MyFitnessPal's site.

License

MIT. Code adapted from python-myfitnesspal keeps its own MIT license notice in NOTICE.

Frequently asked questions

What is MyFitnessPal MCP Server?

Log MyFitnessPal by talking to your AI: search foods with macros, log meals, weight, water and more.

How do I install MyFitnessPal MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. MyFitnessPal MCP Server runs locally from the PyPI package mfp-mcp with the command uvx mfp-mcp.

Is MyFitnessPal MCP Server free and open source?

Yes. MyFitnessPal MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does MyFitnessPal MCP Server support remote (HTTP) connections?

No remote endpoint is listed for MyFitnessPal MCP Server. It runs locally on your machine over stdio, started by your MCP client.

What tools does MyFitnessPal MCP Server provide?

MyFitnessPal MCP Server provides 19 tools, including fitness_bulk_export, fitness_clear_food_pin, fitness_complete_day, and fitness_delete_exercise. See the full tool list for descriptions and parameters.

How is MyFitnessPal MCP Server's trust score calculated?

MyFitnessPal MCP Server scores 71 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

—Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server