nemlig-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nemlig-mcp find oat milk"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
nemlig-mcp
Unofficial local MCP for nemlig.com, danish delivery service
Built as a thin layer over nemlig_cli,
which already solves the hard parts: the three-step XSRF/bearer/login flow, the
cookie-backed session, the two different API hosts, and the GetAsJson
endpoints. This package adds a token-refresh loop, a privacy filter, and a
curated tool surface.
Tools
Tool | Writes? | Description |
| no | Search the catalogue |
| no | Nutrition, allergens, attributes |
| no | Current basket contents |
| yes | Set units of a product in the basket (0 removes it) |
| yes | Same, for a list of products, applied one by one with retries |
| no | Previous orders |
| no | Line items of one past order |
Related MCP server: oda-mcp
What this server deliberately cannot do
It cannot place an order or read your payment cards. Nemlig's API exposes
POST /webapi/Order/PlaceOrderLoggedIn (which charges a saved card) and
GET /webapi/Checkout/GetCreditCards. nemlig_cli implements neither, and this
server does not add them.
The tool surface is an allowlist, not a filtered view of the whole API, so an
endpoint cannot become reachable by accident. A test asserts this
(tests/test_server.py). The two set_basket_quantit*
tools are the only ones that change state, and every change they make is
reversible on the website.
Both are annotated destructive_hint=True, because their quantity is absolute
rather than a delta: lowering it discards units already in the basket, and 0
removes the line. Clients use that hint to decide whether to confirm with the
user, so understating it would be the dangerous direction to be wrong in.
Batching
set_basket_quantities takes a list of {product_id, quantity} and applies it
sequentially, so filling a basket from a recipe or a past order is one tool call
rather than fifteen. A failing item is retried up to three times with a growing
backoff, but only for failures another attempt could actually fix — a timeout, a
429 or a 5xx. A request nemlig rejected outright is not retried, because it
would be rejected again and only delay the rest of the batch.
A failing item is recorded and skipped rather than aborting the run: the basket
has already been half-changed by that point, so the useful thing to return is
what happened to every item plus the resulting basket. The tool reports both,
and reports the basket as null with a basket_error if even the final read
fails, rather than throwing away the per-item results.
Because quantities are absolute, a product may appear only once in the list; two lines for one product would silently mean "last one wins" rather than the sum a caller likely intended, so that is rejected up front.
Privacy
Basket and order responses embed the account holder's name, street address and
phone number. Everything a tool returns lands in the model's context and in the
conversation transcript, so those fields are replaced with a marker before they
leave the server. See privacy.py.
Setup
1. Install
git clone https://github.com/kraenhansen/nemlig-mcp.git
cd nemlig-mcp
uv syncRequires uv and Python 3.11+. nemlig_cli is
pulled from git automatically — no separate checkout needed.
2. Provide credentials
Two options. Prefer the config file — an MCP config with a password in it is easy to commit by accident.
mkdir -p ~/.config/nemlig
cat > ~/.config/nemlig/login.json <<'EOF'
{"username": "you@example.com", "password": "your-password"}
EOF
chmod 600 ~/.config/nemlig/login.jsonThis is the same file the CLI uses, so both share one login. Alternatively set
NEMLIG_USER / NEMLIG_PASS in the environment, which takes precedence.
3. Register the server
claude mcp add nemlig -- uv --directory ~/code/nemlig-mcp run nemlig-mcpOr add it to .mcp.json (project-local) or ~/.claude.json (global). Use an
absolute path — ~ is not expanded inside args:
{
"mcpServers": {
"nemlig": {
"command": "uv",
"args": ["--directory", "/Users/you/code/nemlig-mcp", "run", "nemlig-mcp"]
}
}
}If you would rather not use the config file, add credentials here instead — and make sure the file is gitignored:
"env": { "NEMLIG_USER": "you@example.com", "NEMLIG_PASS": "..." }4. Verify
uv run pytest # 20 tests, no network, no credentials
uv run python tests/smoke_stdio.py # spawns the server, lists its toolsThen ask Claude something like "search nemlig for kaffebønner". The first call logs in, which takes a second or two; tokens are cached for 240s after that.
Troubleshooting:
Symptom | Cause |
| Step 2 not done, or the config file is not valid JSON |
|
|
Tool calls fail with | Wrong username/password — nemlig returns 401 from the login endpoint |
Relationship to the upstream CLI
Building this surfaced two problems in nemlig_cli, both fixed upstream in
eisbaw/nemlig_cli#3:
login()could hang forever. The progress spinner was started before the request sequence but only stopped on the success path, on a non-daemon thread — so a wrong password left the process spinning instead of raising.Progress was written to stdout, which on a stdio MCP server is the JSON-RPC transport. It now renders to stderr, and only when stderr is a tty.
Because of that fix, nemlig-cli is pinned to a commit that includes it. The
quiet() wrapper in _compat.py is kept anyway:
a single stray print() anywhere in a dependency would corrupt the protocol
stream, and that is cheap insurance against a failure mode this severe.
Development
uv run pytest # 20 tests, no network, no credentials
uv run python tests/smoke_stdio.py # end-to-end over stdioTo work against a local checkout of the CLI, uncomment the [tool.uv.sources]
block in pyproject.toml and clone nemlig_cli as a sibling directory.
Disclaimer
Not affiliated with nemlig.com. Uses a private API that may change or break, and automated access may conflict with their terms of service.
License
MIT
Available Tools
6 toolsget_basketARead-only
Show the current shopping basket with line items and prices.
Delivery and invoice addresses are redacted.
Inputs: no named parameters. Returns: object
get_order_detailsARead-only
Fetch the line items of one past order.
Args: order_id: Numeric order Id from get_order_history (not OrderNumber).
Inputs: order_id (required). Returns: object
get_order_historyARead-only
List previous orders, most recent first.
Args: skip: Number of orders to skip, for pagination. take: Number of orders to return (1-50).
Returns: Orders with Id, OrderNumber, Total and delivery window. Use Id with get_order_details. Addresses are redacted.
Inputs: skip, take. Returns: object
get_product_detailsARead-only
Fetch full details for one product, including nutrition and allergens.
Args: product_id: Product Id from search_products, e.g. "5070417".
Inputs: product_id (required). Returns: object
search_productsARead-only
Search the nemlig.com catalogue.
Args: query: Search term. Danish terms match best, e.g. "kaffebønner", "mælk". limit: Maximum number of products to return (1-50).
Returns: Matching products with Id, Name, Brand, Price and availability. Use the Id with get_product_details or set_basket_quantity.
Inputs: query (required), limit. Returns: result
set_basket_quantityADestructive
Set how many units of a product the basket should contain.
The quantity is absolute, not a delta. It is the number of units to end up with, so setting 2 on a line that currently holds 5 removes 3 of them, and setting 0 removes the product entirely. To add to a line that may already exist, read its current Quantity with get_basket and pass the new total.
This changes the user's real basket on nemlig.com. It does not place an order or charge anything -- the user completes checkout themselves.
Args: product_id: Product Id from search_products, e.g. "5070417". quantity: Units the basket should end up with. 0 removes the product.
Returns: The updated basket, with addresses redacted.
Inputs: product_id (required), quantity. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct resource and action: search vs. details, basket vs. order, and list vs. detail vs. modify. No two tools overlap in purpose.
All tools follow the consistent verb_noun pattern in snake_case: search_products, get_product_details, get_basket, get_order_details, set_basket_quantity, get_order_history.
Six tools is well-scoped for a grocery shopping assistant, covering product discovery, basket management, and order history without unnecessary bloat.
The domain is fully covered: product search/detail, basket read/update (including removal via quantity 0), and order list/detail. Checkout is intentionally omitted as the user completes it manually.
Maintenance
Related MCP Connectors
Plan the next grocery basket from past Nemlig.com orders, compare Danish shop prices, fill the cart.
Danish grocery catalog as MCP tools: live offers across all major chains, stores, EAN lookup, stock.
Order from local Danish shops: products, pickup times, card payment and AltID age verification.
Product search, store prices and price history from Norwegian web shops. Read-only, no login.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI assistants to interact with Mathem.se, a Swedish online grocery store, allowing users to search for ingredients, add items to their shopping basket, and manage recipes through natural language.42-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables agentic grocery shopping on Oda (Norway) and Mathem (Sweden) platforms through an MCP-compatible interface. Users can search for products, manage their shopping cart, and access order history using natural language commands.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables grocery shopping at Nemlig.com via MCP, including product searches, basket management, and session-based authentication.MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to search grocery products, manage shopping carts, access account and order information, and find deals and delivery details across several European online grocery platforms.-