MyFitnessPal MCP
# MyFitnessPal MCP
English documentation. For the French version, see [README.fr.md](README.fr.md).
Local TypeScript MCP server that extracts a public MyFitnessPal food diary from the printable page and returns it as readable Markdown, with one block per day.
## Before you start
For this MCP to work, your MyFitnessPal food diary must be visible to other users, and you need to know your exact MyFitnessPal `username`.
### Make your diary public
MyFitnessPal states that the food diary is `private by default`. You need to set it to `public` so the public printable URL can be used by this MCP.
#### From the mobile app
1. Open the MyFitnessPal app.
2. Tap your profile photo at the top.
3. Tap the gear icon in the top-right corner to open `Settings`.
4. Open `Diary Settings`.
5. Set `Diary Sharing` to `Public`.
#### From the web app
1. Sign in to [www.myfitnesspal.com](https://www.myfitnesspal.com).
2. Click `Settings`.
3. Open `Diary Settings` under `Account Settings`.
4. Set `Diary Sharing` to `Public`.
### Find your MyFitnessPal username
#### From the mobile app
MyFitnessPal indicates that the `username` can be viewed through the profile edit flow:
1. Open the MyFitnessPal app.
2. Tap your profile photo at the top.
3. Your username appears at the top.
#### Simple method from the web app
1. Sign in to [www.myfitnesspal.com](https://www.myfitnesspal.com).
2. At the top, you should see `Hi, {username}`.
## Exposed tool
`get_food_diary_markdown`
Parameters:
- `startDate`: ISO date in `YYYY-MM-DD`
- `endDate`: ISO date in `YYYY-MM-DD`
Constraints:
- the range must cover exactly `1` day or `7` consecutive days
- all visible table columns are preserved
- the output includes Markdown text and a `structuredContent` payload with daily blocks
- the `username` is defined when the server starts via `args`, not in the tool call
- in `7-day` mode, the server only returns days that are actually present in the diary
## Installation in Perplexity App
This procedure targets the Perplexity macOS app. According to the Perplexity Help Center, local MCP support is currently available in the macOS app and relies on the `PerplexityXPC` helper.
### 1. Prepare the server
From this repository:
```bash
npm install
npm run install:browser
npm run build
which node
```
Note the output of `which node`. It will be used to launch the server with an absolute path. Example:
```bash
/opt/homebrew/bin/node
```
### 2. Add the MCP in Perplexity
1. Open Perplexity.
2. Go to `Account Settings`, then `Connectors`.
3. If prompted, install the `PerplexityXPC` helper.
4. Go back to `Connectors`, then click `Add Connector`.
5. In the `Simple` tab, create a connector.
6. Give it a name, for example `MyFitnessPal Diary`.
7. In the command field, use an absolute command like this:
```bash
/opt/homebrew/bin/node /Users/fabio/Documents/Projects/mfp-mcp/dist/src/index.js --username=your_mfp_username
```
8. Save it, then verify the status changes to `Running`.
9. On the main Perplexity screen, enable this MCP in `Sources`.
### 3. Test
For example, ask:
```text
Use get_food_diary_markdown to retrieve the diary from 2024-08-29 to 2024-08-29.
```
If Perplexity cannot find `node`, replace the command with the exact absolute path returned by `which node`.
## Installation in Claude App
This procedure targets Claude Desktop on macOS.
### 1. Prepare the server
From this repository:
```bash
npm install
npm run install:browser
npm run build
which node
```
### 2. Open the Claude Desktop MCP config
In Claude Desktop:
1. Open `Settings`.
2. Go to `Developer`.
3. Click `Edit Config`.
On macOS, the file is usually:
```text
~/Library/Application Support/Claude/claude_desktop_config.json
```
### 3. Add this server
Add or merge this JSON block:
```json
{
"mcpServers": {
"myfitnesspal-food-diary": {
"command": "/opt/homebrew/bin/node",
"args": [
"/Users/fabio/Documents/Projects/mfp-mcp/dist/src/index.js",
"--username=your_mfp_username"
]
}
}
}
```
If you already have other MCP servers, just add the `myfitnesspal-food-diary` entry inside `mcpServers` without overwriting the rest.
### 4. Restart Claude
1. Save `claude_desktop_config.json`.
2. Fully quit Claude Desktop.
3. Reopen Claude Desktop.
The server should then appear in the available MCP tools.
### 5. Test
For example, ask:
```text
Analyze my meals from yesterday on MyFitnessPal.
```
### Quick troubleshooting
- Always use absolute paths, not relative paths.
- Check that `npm run build` generated `dist/src/index.js`.
- Check that Playwright Chromium is installed with `npm run install:browser`.
- If Claude does not see the server, inspect the logs in `~/Library/Logs/Claude`.
- If `node` is not found, replace `command` with the exact value returned by `which node`.
## Output format
The returned text is Markdown, for example:
```md
## Aug 29, 2024
### Breakfast
| Foods | Calories | Carbs | Fat | Protein | Cholest | Sodium | Sugar | Fiber |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Orange juice, 1 cup | 119 | 28g | 0g | 2g | 0mg | 5mg | 21g | 1g |
```
In weekly mode, the server also returns a `markdownBlocks` structure with a distinct Markdown block for each day.
## Known limitations
- parsing depends on the current HTML structure of the MyFitnessPal printable page
- loading depends on Playwright/Chromium so the page can execute its JavaScript
- if MyFitnessPal returns an anti-bot page, the server returns an explicit error
- this server is meant for local use with a public diary and no authentication
## Development
```bash
npm install
npm run install:browser
npm run build
npm test
```
Development in `stdio` mode:
```bash
npm run dev
```
Production build:
```bash
npm run build
npm start
```
The server needs a real browser rendering step so MyFitnessPal can execute its JavaScript. Install Chromium once:
```bash
npm run install:browser
```
## References
- Diary visibility and privacy: [Can other members see my weight, or my food diary?](https://support.myfitnesspal.com/hc/en-us/articles/360032274392-Can-other-members-see-my-weight-or-my-food-diary)
- Web/mobile privacy steps: [How do I report inappropriate users?](https://support.myfitnesspal.com/hc/en-us/articles/360032272932-How-do-I-report-inappropriate-users)
- Changing and viewing the username: [Comment modifier mon nom d'utilisateur ?](https://support.myfitnesspal.com/hc/fr/articles/360032623531-Comment-modifier-mon-nom-d-utilisateur)
- Recovering a forgotten username: [I have forgotten my password or my username. How can I retrieve them?](https://support.myfitnesspal.com/hc/en-us/articles/360032273512-I-have-forgotten-my-password-or-my-username-How-can-I-retrieve-them-)
- Claude Desktop MCP configuration: [Model Context Protocol quickstart](https://modelcontextprotocol.io/quickstart/user)
- Claude Desktop server setup and absolute-path guidance: [Model Context Protocol build-server guide](https://modelcontextprotocol.io/docs/develop/build-server)
- Perplexity local MCP setup on macOS: [Perplexity Help Center](https://www.perplexity.ai/help-center/en/articles/11502712-local-and-remote-mcps-for-perplexity)
TDQS
Scored across 1 tool
Only one tool exists, so there is no possibility of confusion with another tool. Its purpose—fetching a diary as Markdown—is clearly stated.
The single name follows a clear verb_noun+format pattern (get_food_diary_markdown) and is descriptive. Consistency cannot be fully demonstrated with only one tool, so it falls short of a perfect score.
A single tool is thin even for a narrow read-only server; basic related operations (e.g. nutrition totals, date lookup) are absent. The count is defensible for a minimal integration but feels under-scoped.
The surface covers only a fixed one-day or seven-day diary fetch for a preconfigured user, with no nutrition summary, no flexible date ranges, and no other diary reads. Common agent needs will hit dead ends quickly.