Leclerc Drive

io.github.skunkobi由 GitHub 账号 skunkobi 发布v0.3.0更新于 Oct 25, 2026

MCP server for E.Leclerc Drive — search products, manage cart, and order groceries from Claude

已验证STDIO仅桌面效率与工作流商业与电商

概览

AI 生成的概览

非官方 MCP 服务器,让助手通过真实 Chrome 会话搜索 E.Leclerc Drive 商品、选择门店并管理购物车。

可以做什么
按邮编或城市查找附近的 Leclerc Drive 门店,并选择、记住当前门店及其后端主机。搜索商品目录,返回价格、每公斤价格、Nutri-Score、库存情况和商品 id。向购物车添加商品、删除条目、设置条目数量。读取完整购物车及总价。
适用场景
适合在 MCP 客户端中自动化自己在 E.Leclerc Drive 上的个人日常采购,替代在网站上缓慢手动点击。当你固定在一家门店购物,并希望助手在对话中搜索商品、组建购物车时最有用。
运行要求
通过 npm 包 mcp-leclerc-drive 以 stdio 在本地运行。需要 Node.js 22 或更高版本,以及同一台机器上安装的 Google Chrome;会打开 Chrome 窗口,需登录一次 Leclerc Drive。可选变量包括 LECLERC_STORE_ID、LECLERC_HOST、LECLERC_CHROME_PATH、LECLERC_CHROME_PROFILE_DIR、LECLERC_CHROME_PORT、LECLERC_HEADLESS 及限流设置;LECLERC_COOKIE 为可选的原始 Cookie 覆盖。
安装前请注意
非官方项目,与 E.Leclerc 无关联;请使用自己的账户、自担风险并遵守网站条款。它会驱动真实 Chrome 窗口,依赖绕过 DataDome 机器人防护,可能失效或违反网站条款。购物车工具会修改你的购物车。可选的 LECLERC_COOKIE 密钥可提供会话访问权限。结账和配送时段预约尚未实现。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Leclerc Drive,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-leclerc-drive

The first open-source MCP server for E.Leclerc Drive — let Claude search products, manage a cart, and prepare grocery orders natively, instead of clicking through the website.

🟢 v0.3 — working & DataDome-proof. All eight tools are validated end-to-end against the live site. Requests run inside a real Chrome driven over CDP, so they pass DataDome's bot protection (which blocks headless clients and cookie-replay). You log into Leclerc Drive once in the window that opens; the session persists. See docs/api-capture.md for the reverse-engineered API.

Why

E.Leclerc Drive has no public API. Today the only way to automate it is browser automation — slow (~3–5 s per item) and fragile (blind clicks). This project exposes the underlying operations as proper MCP tools so any MCP client (Claude Desktop, Claude Code) can drive it directly.

Tools

ToolDescription
find_stores(query)Find drives near a postal code or city → name, id, service type, distance, host.
set_store(store_id)Select & remember the active store (resolves the right host automatically).
get_store()Show the currently selected store.
search_product(query)Search the catalogue → products with price, price/kg, Nutri-Score, availability, and an id.
add_to_cart(product_id, quantity?)Add a product to the cart.
remove_from_cart(product_id)Remove a line from the cart.
update_quantity(product_id, quantity)Set a line's quantity (0 removes it).
get_cart()Read the full cart with total.

Status

  • Reverse-engineer Leclerc Drive endpoints (search / cart / store locator — see docs/api-capture.md)
  • All 8 tools validated end-to-end against the live store
  • Runtime store selection with persistence (find_stores / set_store)
  • v0.3: DataDome-proof via real-Chrome CDP driving (beats active bot-challenge that killed cookie-replay) ✅
  • Published to npm + MCP registry
  • Checkout / delivery-slot booking

Requirements

  • Node.js ≥ 22 (uses the built-in WebSocket)
  • Google Chrome installed (the server drives it via CDP)

Install (development)

bash
git clone https://github.com/skunkobi/mcp-leclerc-drive.gitcd mcp-leclerc-drivenpm installnpm run build

How auth works (real Chrome via CDP)

Leclerc Drive is protected by DataDome, which blocks non-browser traffic (headless clients, cookie-replay) with HTTP 403 once it escalates to active challenge mode. The only thing that reliably passes is a real browser that executes the challenge. So that's what the server uses:

  1. On first request it launches your installed Google Chrome with a dedicated, persistent profile (~/.mcp-leclerc-drive/chrome) and a debug port — no automation flags, so navigator.webdriver stays false.
  2. A Chrome window opens. Log into Leclerc Drive once in it. The persistent profile keeps you logged in across restarts.
  3. Every request runs inside that page via CDP, so it carries the browser's cookies, TLS fingerprint, and solved DataDome challenge — and passes.

No cookies are read or stored; there's no Keychain prompt. The server must run on the same machine as Chrome, and a window does open (headless is detectable by DataDome — don't enable it unless you know the risk).

Env varDefaultDescription
LECLERC_STORE_ID053701Default store id (overridden at runtime by set_store).
LECLERC_HOSTfd9-courses.leclercdrive.frDefault backend host (the fdN prefix varies by store).
LECLERC_CHROME_PATHautoPath to the Chrome binary, if not in the default location.
LECLERC_CHROME_PROFILE_DIR~/.mcp-leclerc-drive/chromePersistent Chrome profile dir.
LECLERC_CHROME_PORT9222CDP remote-debugging port.
LECLERC_HEADLESSfalseRun Chrome headless (⚠️ DataDome-detectable — not recommended).
LECLERC_MIN_INTERVAL_MS1000Minimum delay between two requests (hygiene).
LECLERC_JITTER_MS400Extra random jitter added between requests.
LECLERC_MAX_RETRIES3Retries on a transient 403/429 before giving up.
LECLERC_BACKOFF_BASE_MS1500Base retry backoff (doubles each attempt).

The server still serializes and spaces out requests (single queue, ~1 s + jitter, retry with backoff) to stay polite — good hygiene even though the browser now handles DataDome.

Choosing your store (no env needed)

The easiest way: just ask, in the conversation. No env vars required.

> "trouve mon drive vers 44000"     → find_stores lists nearby drives> "prends Rezé Atout Sud"           → set_store remembers it (correct host resolved)> "cherche du lait"                  → runs on that store

set_store persists your choice to ~/.mcp-leclerc-drive/config.json, so it sticks across sessions, and it resolves the correct backend host for you (the fdN prefix genuinely varies per store — fd8, fd9, fd14…).

⚠️ One drive at a time. Leclerc binds your session to a single drive. The store you set_store to must be the one your Chrome session is logged into — which is the normal case (your own drive). Switching to an arbitrary other drive your browser isn't on will return a "session expired" error.

You can still hard-set the store via LECLERC_STORE_ID / LECLERC_HOST env vars if you prefer (e.g. for headless deploys). To find them manually: your Drive URL looks like https://fd9-courses.leclercdrive.fr/magasin-053701-053701-Your-Town/ — the 6-digit number is the store id, the fdN-courses.leclercdrive.fr part is the host.

Claude Desktop / Claude Code (mcp config)

Install straight from npm — no clone needed:

bash
# Claude Codeclaude mcp add leclerc-drive -- npx -y mcp-leclerc-drive

Or in a Claude Desktop config:

json
{  "mcpServers": {    "leclerc-drive": {      "command": "npx",      "args": ["-y", "mcp-leclerc-drive"]    }  }}

No env needed — pick your store in-conversation with find_stores / set_store. On first use a Chrome window opens: log into Leclerc Drive once and you're set.

Development

bash
npm run dev        # tsc --watchnpm run typecheck  # type-check without emittingnpm run inspect    # run under the MCP Inspector

Architecture

src/  index.ts          # MCP server: registers the 8 tools over stdio  config.ts         # env-based config (store, host, Chrome/CDP, throttle)  types.ts          # Product / CartItem / Cart  store.ts          # active store selection + persistence (~/.mcp-leclerc-drive)  browser.ts        # ChromeSession: drives real Chrome via CDP → beats DataDome  leclerc/    client.ts       # Leclerc Drive backend client (search + cart)    locator.ts      # store finder: postal code / city → nearby drives    throttle.ts     # request serialization + spacing + retry (hygiene)docs/  api-capture.md    # the reverse-engineered Leclerc Drive API

Contributing

This is a community tool — contributions are very welcome, whether it's a bug fix, support for your store, or a whole new capability (checkout, delivery slots, saved lists…).

See CONTRIBUTING.md for dev setup, how to smoke-test against your own account (npm run smoke), and — most useful for this project — a short guide on how to reverse-engineer a new Leclerc Drive endpoint and wire it in. Good first issues are listed in the status checklist above.

Feedback & contact

Feedback, bug reports, and ideas are very welcome.

Disclaimer

Unofficial. Not affiliated with or endorsed by E.Leclerc. Use with your own account, at your own risk, in line with the site's terms of service. Intended for personal automation of your own grocery shopping.

License

MIT

来源:README.md,提交 ac341d7

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.3.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分