Skip to main content
Glama
mijneetmeter-mcp

mijneetmeter-mcp

by jhofstede
README.md
# mijneetmeter-mcp

An **unofficial** [Model Context Protocol](https://modelcontextprotocol.io) server for
[Mijn Eetmeter](https://mijn.voedingscentrum.nl), the food diary of the Dutch Voedingscentrum.
It lets an MCP client such as Claude search products, read your diary, and add or remove entries.

> [!IMPORTANT]
> **This is not an official MCP server.** It is not made, endorsed or supported by the
> Voedingscentrum, and "Mijn Eetmeter" is their product. Mijn Eetmeter has no public API: this
> server drives the same web pages your browser does, using endpoints that were reverse-engineered
> from the site. It can break whenever the site changes. Use it with your own account only, keep
> the request volume modest, and check that your use fits the site's terms.

## Tools

| Tool | What it does | Changes the diary |
|---|---|---|
| `search_food` | Search products by name; optional filter on generic / recipe / branded | no |
| `get_diary` | Entries for one date and meal moment | no |
| `get_diary_day` | Entries for a whole day, grouped per meal moment | no |
| `add_food` | Add a product from `search_food` with an amount and unit | **yes** |
| `delete_food` | Delete an entry by its `consumption_id` | **yes** |
| `get_favorites` | Your favourite products | no |
| `today` | Today's date in the format the other tools use | no |

Dates are `DD-MM-YYYY`. Meal moments are `ontbijt`, `lunch`, `avondeten` and `tussendoor`
(`breakfast`, `dinner` and `snack` work too). Diary entries carry the product name, amount, unit
and kcal.

## Setup

You need Python 3.10+ and a Mijn Eetmeter account. The examples use [uv](https://docs.astral.sh/uv/)
to run the server straight from this repository; a `pip install git+https://github.com/jhofstede/mijneetmeter-mcp`
followed by `mijneetmeter-mcp` works just as well.

The server reads your login from two environment variables:

```sh
export EETMETER_EMAIL="you@example.com"
export EETMETER_PASSWORD="your-password"
```

Your credentials are only ever sent to `mijn.voedingscentrum.nl`. They are not logged and not
written to disk.

### Claude Code

```sh
claude mcp add eetmeter \
  --env EETMETER_EMAIL=you@example.com \
  --env EETMETER_PASSWORD=your-password \
  -- uvx --from git+https://github.com/jhofstede/mijneetmeter-mcp mijneetmeter-mcp
```

### Claude Desktop and other stdio clients

```json
{
  "mcpServers": {
    "eetmeter": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/jhofstede/mijneetmeter-mcp", "mijneetmeter-mcp"],
      "env": {
        "EETMETER_EMAIL": "you@example.com",
        "EETMETER_PASSWORD": "your-password"
      }
    }
  }
}
```

### As a local HTTP service

With `--http` the server runs as a long-lived service that speaks Streamable HTTP. It logs in once
and keeps the session, so calls are faster than starting a fresh stdio process each time.

```sh
uvx --from git+https://github.com/jhofstede/mijneetmeter-mcp mijneetmeter-mcp --http
# listening on http://127.0.0.1:8765/mcp
```

Point a client at it:

```json
{ "mcpServers": { "eetmeter": { "type": "http", "url": "http://127.0.0.1:8765/mcp" } } }
```

`GET /health` answers `{"status": "ok"}` without touching Mijn Eetmeter.

The HTTP service gives whoever can reach it full access to your diary, so:

- it listens on `127.0.0.1` by default and rejects requests whose `Origin` is not a local page;
- set `MCP_AUTH_TOKEN` to require `Authorization: Bearer <token>`;
- it refuses to start on a non-loopback `--host` unless `MCP_AUTH_TOKEN` is set. It serves plain
  HTTP, so put TLS in front of it before exposing it beyond your machine.

## Configuration

| Variable | Default | Meaning |
|---|---|---|
| `EETMETER_EMAIL` | – | Mijn Eetmeter login (required) |
| `EETMETER_PASSWORD` | – | Mijn Eetmeter password (required) |
| `EETMETER_SEARCH_MAX_RESULTS` | `20` | Cap on the number of `search_food` results |
| `MCP_HOST` / `--host` | `127.0.0.1` | Bind address for `--http` |
| `MCP_PORT` / `--port` | `8765` | Port for `--http` |
| `MCP_AUTH_TOKEN` | – | Bearer token required on `--http` requests |

## How it works

- Login is an ASP.NET cookie session. The server logs in on the first tool call and again
  when the session has expired.
- The diary is an ASP.NET WebForms page: reading, adding and deleting are form postbacks, and the
  results are parsed out of the returned HTML. Adding one product takes four to five requests.
- Product search and favourites are small JSON endpoints.

[`docs/API_REFERENCE.md`](docs/API_REFERENCE.md) documents the endpoints. The client in
[`src/mijneetmeter_mcp/client.py`](src/mijneetmeter_mcp/client.py) can also be used on its own:

```python
from mijneetmeter_mcp.client import EetmeterClient

client = EetmeterClient()
client.login(email, password)
client.get_diary_day("30-03-2026")
```

### Limitations

- Entries report kcal only; macro- and micronutrients are not read.
- `add_food` picks a unit by position (`unit_index`) and always uses the first preparation
  variant of a product. The result lists the units that were available.
- Amounts of existing entries cannot be edited; delete and add again.
- HTML parsing is tied to the current markup of the site.

## Development

```sh
uv sync
uv run pytest
uv run ruff check .
```

The tests run against fakes and recorded-shape HTML; they never contact Mijn Eetmeter and need no
account.

## License

[Apache 2.0](LICENSE)

TDQS

A3.6/5.0

Scored across 7 tools

Disambiguation4/5

Most tools have clearly distinct resource+action targets (search_food, add_food, delete_food, get_favorites), and the search→add dependency is explicitly documented. The only real overlap is get_diary (single date + meal moment) versus get_diary_day (full day), which the descriptions do clarify but which could still be misselected by a hurried agent.

Naming Consistency4/5

Six of seven tools follow a clean verb_noun snake_case pattern (search_food, get_diary, get_diary_day, add_food, delete_food, get_favorites). The outlier is 'today', which has no verb and breaks the pattern, a minor but noticeable deviation.

Tool Count5/5

Seven tools is well-scoped for a food-diary server: discovery, day/meal reading, write, delete, favorites, and a date helper. Each tool earns its place with no redundancy or filler.

Completeness3/5

The surface covers search, read, create, and delete, but there is no update operation to change an entry's amount or unit, forcing agents to delete and re-add for edits. There is also no way to retrieve daily nutrition totals or meal-level aggregates, which limits the stated diary-management domain.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues