Skip to main content
Glama
mercadona-mcp
by Syuf1514

mercadona-mcp

Unofficial. Not made, endorsed or supported by Mercadona. It uses the web shop's undocumented API, which can change or stop working at any time. Use it with your own account, at your own pace.

An MCP server that lets Claude (or any MCP-capable agent) use tienda.mercadona.es: search the catalog, read your orders and purchase history, and fill your cart. It never checks out or pays. You place the order yourself on the website.

How it works (and why not "browser automation")

People often build these marketplace servers by driving a headless browser: click, read the DOM, click again. That approach is slow, breaks whenever the UI changes, and burns tokens. It's mostly unnecessary, because nearly every modern shop is a single-page app talking to its own JSON API. This server takes that route:

Layer

What it does

Site's internal JSON API (tienda.mercadona.es/api/...)

All data and cart operations. Endpoints were found by reading the site's public JS bundle. Fast, structured, and stable for longer than the HTML.

Real browser, for login only

Mercadona's login needs reCAPTCHA, so login opens a normal Chrome window and you sign in. The server then copies the session token from the page's localStorage["MO-user"]. Your password never passes through this code. Tokens refresh automatically.

Local catalog index

The site's search backend blocks non-browser clients, so the server crawls the ~150 public category pages (≈4,400 products) and searches them locally with accent-insensitive matching. The first search takes about 20 s; results are cached for 12 h in ~/.mercadona-mcp/.

This is unofficial and uses undocumented endpoints, so Mercadona can change them at any time. Request volume is small and paced (≥120 ms between calls).

Related MCP server: wegmans-mcp-cloudflare-workers

Tools

Setup: mercadona_status, mercadona_login, mercadona_import_session, mercadona_logout, set_postal_code

Catalog (no login): search_products, list_categories, browse_category, get_product (ingredients, allergens, origin, similar products), refresh_catalog

Cart: get_cart, update_cart (add or set quantities, many items in one call), remove_from_cart, clear_cart (needs confirm: true), add_order_to_cart (re-order), add_shopping_list_to_cart, add_regulars_to_cart

History: list_orders, get_order (every line: ordered vs. prepared quantity, price paid), purchase_history (what you buy, how often, typical quantities), my_regulars (Mercadona's "Mis habituales"), list_store_tickets (in-store digital receipts, if enabled)

Lists and delivery: list_shopping_lists, get_shopping_list, create_shopping_list, update_shopping_list, delete_shopping_list (needs confirm: true), list_addresses, delivery_slots

Prompt: weekly_basket rebuilds your usual shop from history, asks for your OK, then fills the cart.

Product cards: chat apps don't show outside images in the agent's replies, so the server attaches a small display-only view to product, cart and order results (MCP Apps, rendered inline by Claude and ChatGPT). It shows:

  • Search results, categories, regulars and history: photo cards with price, size and price per kilo.

  • The cart and orders: a two-column list grouped by shop section, with a highlight on what the last request changed and the total.

  • A product page: photos, price, allergens and similar products.

The view has no buttons that change anything: you still ask the agent, and the agent still does the talking. Its text results carry the same data without image links, which keeps them short. In clients without MCP Apps you get the text only. test/cards-harness.mjs previews the cards locally.

Apps download the view once and may keep that copy for a long time. In remote mode the view therefore loads its current styles and code from the server (/cards/live.js) every time it's shown, so design changes reach every app right away; if that fails, it uses the copy built into the view. Locally (stdio) the built-in copy is always used.

Tested

All 29 tools were run against a live account (December 2026): reading orders, history, regulars, lists, addresses and slots; adding, setting, removing and clearing cart items; re-ordering a 38-item order; creating, editing and deleting a list. test/smoke.mjs and test/lists.mjs are the scripts used. lists.mjs changes your real cart and lists, then cleans up.

Setup

npm install
node src/cli.js postal-code 28001     # your delivery postal code (sets the warehouse and prices)
node src/cli.js login                 # opens Chrome; sign in, and the window closes by itself
node src/cli.js status

Register with Claude Code:

claude mcp add --scope user mercadona -- node /ABSOLUTE/PATH/mercadona-mcp/src/cli.js

Claude Desktop or other clients (claude_desktop_config.json and similar):

{ "mcpServers": { "mercadona": { "command": "node", "args": ["/ABSOLUTE/PATH/mercadona-mcp/src/cli.js"] } } }

You can also log in from chat: ask the agent to call mercadona_login.

Fallback login: if the automated Chrome window gives you trouble (Google sign-in sometimes refuses automated browsers), log in to tienda.mercadona.es in your normal browser. Then run localStorage.getItem('MO-user') in the DevTools console and pass the result to node src/cli.js import-session '<json>' (or the mercadona_import_session tool).

Remote mode (Claude on iPad/web, ChatGPT)

The Claude apps and ChatGPT can't start a program on your computer. They connect to MCP servers by URL instead, so http mode serves the same tools over Streamable HTTP at /mcp, with a built-in single-owner OAuth server in front:

  • Discovery and registration are automatic. The apps find the OAuth endpoints and register themselves (dynamic client registration). Only redirect URIs on claude.ai, claude.com, chatgpt.com, chat.openai.com and localhost are accepted; override with MCP_ALLOWED_REDIRECT_HOSTS.

  • The owner approves each app once by typing the passphrase on the sign-in page. Five wrong tries lock the page for 15 minutes.

  • Tokens: access tokens last 24 h, refresh tokens 90 days and rotate on use. Both are stored only as SHA-256 hashes in oauth.json.

  • Not available remotely: mercadona_login (it needs a desktop). Log in on the server with import-session.

node src/cli.js set-passphrase            # generates one and prints it; or pass your own (12+ chars)
MCP_PUBLIC_URL=https://mcp.example.com PORT=8787 node src/cli.js http   # listens on 127.0.0.1 only
node src/cli.js revoke-tokens             # sign every connected app out

deploy/remote.sh sets this up on a Debian server that already runs Caddy: a sandboxed systemd service, a dedicated system user, and the Caddy site. It reads MCP_HOST and SSH_HOST from deploy/remote.env (gitignored); run it without --apply first to see what it would change.

Put a TLS reverse proxy in front (Caddy: mcp.example.com { reverse_proxy 127.0.0.1:8787 }). Then add https://mcp.example.com/mcp as a custom connector in Claude (Settings → Connectors) or ChatGPT (custom MCP server). test/http-flow.mjs checks the whole OAuth and MCP flow against a running instance.

Using it yourself (or sharing with a friend)

Each running server belongs to one Mercadona account: it holds that account's session, and everyone who connects to it shares the same cart and orders. So don't hand out access to yours. Instead, each person runs their own copy:

Setup

Works with

Effort

Notes

On your computer (npm install, login, add to the app)

Claude Desktop, Claude Code, other local MCP clients

Low

No server, no domain. Only while that computer is on.

Your computer + a tunnel (e.g. Cloudflare Tunnel or ngrok) to http mode

ChatGPT, Claude on the web or phone

Medium

Set a passphrase and MCP_PUBLIC_URL to the tunnel's https URL. Only while that computer is awake.

Your own small server (http mode behind Caddy, see deploy/remote.sh)

Everything, from any device

Higher

Needs a Linux box and a domain. Always on. Log in on your computer, then copy the session over (--with-session).

ChatGPT only connects to servers at a public https URL, so it needs one of the last two.

Files

~/.mercadona-mcp/ holds:

  • config.json: postal code and warehouse.

  • session.json: the Mercadona token (mode 600).

  • catalog-*.json: the search index.

  • chrome-profile/: the login browser profile.

  • owner.json and oauth.json: remote mode only (passphrase hash, app registrations, token hashes).

Override the location with MERCADONA_MCP_HOME.

Ideas for more

  • Price tracking: diff the catalog index daily and alert when a usual product drops in price.

  • Meal planning: recipe → ingredients → search_products → update_cart.

  • Nutrition and allergen filters over get_product.

  • "Running low" predictions from purchase_history intervals.

  • The same pattern (read the SPA bundle, call its JSON API, log in through a real browser) works for most shops, e.g. Carrefour, DIA, Alcampo or Amazon. Only the endpoint map changes.

License

MIT, see LICENSE. Mercadona is a trademark of Mercadona S.A.; this project is not affiliated with it.

Available Tools

29 tools
add_order_to_cartRe-order into cartA

Add every product from a past order to the cart (with the same quantities). Use list_orders to find the id.

Inputs: order_id (required), exclude_product_ids.

add_regulars_to_cartMy regulars → cartA

Add products from 'my regulars' to the cart with Mercadona's recommended quantity (or all of them if product_ids is omitted — ask first, the list can be long).

Inputs: product_ids.

add_shopping_list_to_cartShopping list → cartB

Add all products of a shopping list to the cart (quantity from the list, default 1).

Inputs: list_id (required).

browse_categoryBrowse categoryA
Read-only

List all products in a sub-category (use ids from list_categories, e.g. 112 = 'Aceite, vinagre y sal'), grouped by shelf.

Inputs: category_id (required).

clear_cartEmpty cartA
Destructive

Remove everything from the cart. Requires confirm=true; ask the user first.

Inputs: confirm (required).

create_shopping_listCreate shopping listC

Create a named shopping list, optionally with products.

Inputs: name (required), product_ids.

delete_shopping_listDelete shopping listA
Destructive

Permanently delete a shopping list. Requires confirm=true; ask the user first.

Inputs: confirm (required), list_id (required).

delivery_slotsDelivery slotsA
Read-only

Available delivery time slots and their prices for a saved address (default address if omitted).

Inputs: address_id.

get_cartGet cartA
Read-only

Show the current online cart with quantities and an estimated total.

Inputs: no named parameters.

get_orderOrder detailsA
Read-only

Details of one online order including every product line (ordered vs. prepared quantity, price paid).

Inputs: order_id (required).

get_productProduct detailsB
Read-only

Full details for a product: price, size, ingredients, allergens, origin, storage. Optionally similar products.

Inputs: product_id (required), include_similar.

get_shopping_listShopping listC
Read-only

Products in one shopping list.

Inputs: list_id (required).

list_addressesDelivery addressesA
Read-only

Saved delivery addresses (ids are needed for delivery_slots).

Inputs: no named parameters.

list_categoriesList categoriesA
Read-only

List the full category tree (top-level sections and their sub-categories with ids).

Inputs: no named parameters.

list_ordersList online ordersA
Read-only

List past and upcoming online orders (newest first), 1 page ≈ 10–20 orders.

Inputs: page.

list_shopping_listsShopping listsC
Read-only

The customer's saved shopping lists.

Inputs: no named parameters.

list_store_ticketsIn-store ticketsB
Read-only

Digital tickets (receipts) from purchases in physical Mercadona stores, if the user enabled digital tickets.

Inputs: page.

mercadona_import_sessionImport sessionA

Fallback login: store a session copied from the user's own browser. In DevTools console on tienda.mercadona.es run localStorage.getItem('MO-user') and pass the resulting JSON string here.

Inputs: session_json (required).

mercadona_loginLog in (opens browser)A

Open a Chrome window on tienda.mercadona.es so the USER can sign in themselves (email/password + captcha). Waits up to 5 minutes, then stores the session token locally (~/.mercadona-mcp/session.json). Tell the user a browser window is opening before calling this.

Inputs: no named parameters.

mercadona_logoutLog outA

Forget the locally stored Mercadona session token.

Inputs: no named parameters.

mercadona_statusStatusA
Read-only

Show login state, the customer's name/email, and the current postal code / warehouse used for prices and availability.

Inputs: no named parameters.

my_regularsMy regularsA
Read-only

Mercadona's own 'Mis habituales' list: products this customer buys regularly, with the shop's recommended quantity.

Inputs: no named parameters.

purchase_historyPurchase history analysisA
Read-only

Aggregate the last N online orders into per-product stats: how many orders included it, total quantity, typical quantity, last bought date, and spend per order. Great for 'what do I usually buy?' and for rebuilding a usual basket.

Inputs: top, max_orders.

refresh_catalogRefresh catalog indexA
Read-only

Rebuild the local product index now (prices/stock change daily).

Inputs: no named parameters.

remove_from_cartRemove from cartB
Destructive

Remove the given products from the cart entirely.

Inputs: product_ids (required).

search_productsSearch productsA
Read-only

Search the catalog by keywords (Spanish works best: 'leche semidesnatada', 'tomate frito', 'yogur griego'). First call may take ~30s while the catalog index is built; it is then cached for 12h.

Inputs: query (required), limit, category, max_price.

set_postal_codeSet delivery postal codeA

Set the Spanish postal code used for catalog, prices and availability. Returns the warehouse that serves it.

Inputs: postal_code (required).

update_cartAdd / change cart itemsA

Add products to the cart or change quantities, in one call. mode 'add' (default) adds to any existing quantity; 'set' sets the exact quantity (0 removes). Quantities are units/pieces (fruit too, e.g. 6 bananas); only products flagged sold_by_weight take kg (e.g. 0.5). Does NOT check out.

Inputs: items (required).

update_shopping_listEdit shopping listC

Add products to a shopping list and/or remove products from it.

Inputs: list_id (required), add_product_ids, remove_product_ids.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 29 tools

    Disambiguation4/5

    Most tools target clearly distinct resources (catalog browsing vs. cart vs. orders vs. shopping lists), and the three 'add X to cart' variants are differentiated by their source (past order, 'my regulars', saved list). Minor overlap exists between update_cart with mode 'set'/0, remove_from_cart, and clear_cart, which could cause misselection for removal tasks.

    Naming Consistency3/5

    The dominant convention is snake_case verb_noun (list_categories, get_product, update_cart), which is readable, but four auth tools carry a mercadona_ prefix while the rest do not, and several tools are bare nouns (delivery_slots, purchase_history, my_regulars, list_store_tickets). The mix is workable but not predictable.

    Tool Count3/5

    29 tools is heavy, but the surface spans genuinely separate sub-domains (auth, catalog, cart, orders, physical tickets, regulars, shopping lists, addresses/delivery), so most tools earn their place. Still, marginal value tools like refresh_catalog and the four separate auth tools push it past a comfortable size.

    Completeness3/5

    Coverage is broad across browsing, cart building, history and list management, but the lifecycle dead-ends at checkout: update_cart explicitly 'does NOT check out' and there is no place_order or delivery-slot booking tool, so an agent can assemble a basket but never complete a purchase. Address management is read-only and there is no order tracking beyond past orders.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers