Ask Claude what is in Swedish food, straight from Livsmedelsverket's database.

An unofficial MCP server for Livsmedelsdatabasen, the Swedish Food Agency's open nutrition database. It covers about 2,600 foods and dishes with 50+ nutrients each. Claude, or any other MCP client, can search foods in English or Swedish, read nutrient values, compare foods side by side and work out the nutrition of a recipe per serving. It is published on npm as @rickardlind/livsmedel-mcp and installs with one npx command.
Problem
Livsmedelsverket publishes the data through an open API under CC BY 4.0, but the API can't search by name. It only pages through the full list with offset and limit, and the details for one food are spread over five separate endpoints. Mapping those one to one would give the model six tools, and it would still need several calls to answer a normal question like how much vitamin D there is in oat drink.
Approach
I shaped the tools around the questions people ask instead of the endpoints: search_foods, get_food, get_nutrients, compare_foods and calculate_recipe_nutrition, plus a nutrition_label prompt that chains them into an EU-style nutrition declaration. On the first search the server walks the whole catalogue in pages of 500, caches it per language and searches in memory after that. Results page with an opaque cursor tied to the query, so a cursor from another search gets a clear error instead of the wrong page. The HTTP client retries 408, 425, 429 and 5xx responses with jittered exponential backoff and respects Retry-After. Failures come back as tool results with a short error code such as not_found or rate_limited, so the model can recover by searching again. The public API needs no key, but an optional one can be set through the environment for a gateway, and it never appears in logs or tool output.
Outcomes
43 unit tests run against responses recorded from the real API. They cover retries, Retry-After, error mapping, auth headers, log redaction, pagination, caching, cursors and every tool through an in-memory MCP client. I also recorded a full session against the live API that calls every tool plus two error cases, and published the transcript with only long arrays trimmed.
Selected features
- Five read-only tools: search_foods, get_food, get_nutrients, compare_foods, calculate_recipe_nutrition
- nutrition_label prompt that turns a plain-text recipe into an EU-style nutrition declaration
- Search in English or Swedish with cursor-based paging
- Retries with backoff and Retry-After support; errors mapped to codes the model can act on
- Optional API key from the environment, never logged
- Recorded live session covering every tool and two error cases
- Installs with npx from npm as @rickardlind/livsmedel-mcp
Tech
Open source, MIT licensed. Unofficial: not made by, affiliated with or endorsed by Livsmedelsverket. Data from Livsmedelsdatabasen under CC BY 4.0. stdio transport only.