Yandex Lavka Mcp

io.github.Dudude-bit由 GitHub 账号 Dudude-bit 发布v0.1.6更新于 Oct 25, 2026

Unofficial MCP server for ordering Yandex Lavka groceries: search, cart, checkout.

已验证STDIO仅桌面位置与生活商业与电商

概览

AI 生成的概览

非官方本地 MCP 服务器,让助手在你自己账户上搜索 Yandex Lavka 杂货、管理购物车并下真实订单。

可以做什么
检查会话与配送位置,列出已保存地址,并按名称、文本地址或经纬度切换配送点。浏览商品目录:搜索商品、查看商品详情与营养信息、列出分类组和分类商品。查看、添加、修改数量和清空购物车。预览结账总额,列出并选择已保存的支付卡,确认或取消订单,并查看进行中订单、历史订单和单个订单详情。
适用场景
适合让助手处理俄罗斯 Yandex Lavka 的日常买菜:查找商品、组建购物车,并在扣款前经过预览与确认步骤完成下单。
运行要求
以 Python 3.12+ 包(yandex-lavka-mcp)在本地通过 stdio 运行。需要你自己的 Yandex Lavka 会话 Cookie,放在配置文件中或通过 YANDEX_LAVKA_MCP_CONFIG_JSON 传入,并需先设置配送位置才能使用目录。Cookie 会过期,需要重新获取。远程使用可选 HTTP 传输和 OAuth 设置。
安装前请注意
非官方项目,依赖私有 Web API,可能随时失效或违反 Yandex 条款。confirm_order 会从真实银行卡扣款,要求先运行预览并回传完全一致的确认总额,3-D Secure 可能需要你打开跳转链接完成支付。会话 Cookie 属敏感凭据。同一账户的购物车是共享的,同一时间只应使用一个客户端。对外暴露的 HTTP 实例会花真钱,应使用 OAuth 保护。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

yandex-lavka-mcp

[PyPI] [Python] [License: MIT] [MCP]

An MCP server that lets an AI assistant order groceries from Yandex Lavka — search products, build a cart, and place a real order — with an explicit human confirmation before any money is charged.

[!WARNING] Unofficial. Yandex Lavka has no public API. This project talks to the same private web API that lavka.yandex.ru uses, authenticated with your own Yandex session cookies. It automates your own account, for your own shopping.

  • Not affiliated with or endorsed by Yandex. Using it may violate Yandex's Terms of Service, and the private API can change or be blocked at any time.
  • confirm_order spends real money on your card. Use at your own risk.
  • Provided as is, without warranty (see LICENSE).

What it does

ToolCharges?What it does
lavka_status—Is the session + location set up?
list_addresses—Your saved Lavka addresses, by name.
use_address—Switch delivery to a saved address by name.
set_delivery_address—Set delivery to any address by text (any city).
set_location—Set delivery point by raw lat/lon.
search_products—Search the catalog at the current location.
get_product—Product detail by id, slug or Lavka link, incl. nutrition (КБЖУ per 100 g / per portion, as the card shows it).
list_categories—Catalog menu: category groups with their categories (per storefront).
get_category_group—Categories inside one catalog group, by group id.
get_category_products—Products in a category + its subcategory shelf counts; optional subcategory filter.
view_cart—Show cart + total.
add_to_cart—Add an item.
update_cart_item—Set exact quantity (0 removes).
clear_cart—Empty the cart.
checkout_previewnoFull summary: items, subtotal, discount, delivery, ETA, payment, total.
list_payment_methods—Your saved cards and which is the default.
set_payment_method—Choose which card orders charge.
confirm_orderYESPlaces the order and charges the default card (or the one set above).
cancel_order—Cancel an order by id.
active_orders—Currently tracked orders with status/ETA.
order_history—Past orders (total, items count, date), paged.
get_order—One order in full: items, totals, address, status.

Money safety. Placing an order is a deliberate two-step flow: checkout_preview returns the full summary and charges nothing; confirm_order(confirmed_total) refuses unless a preview was just run and you pass back the exact total it showed. Change the cart and the preview is invalidated — you must preview again.

3-D Secure. confirm_order submits the order and charges the on-file card, then polls payment status. If your bank requires 3-D Secure, payment_status comes back wait_user_action and a redirect_url is returned — open it to finish paying (a headless charge cannot complete 3DS). cancel_order(order_id) cancels.

Multiple locations / cities. Catalog, prices and cart are location-scoped. use_address("Дача") switches to a saved address; set_delivery_address("Казань, улица Баумана, 1", flat="12") works for any address in any city (it geocodes via Lavka's own address search).

How it's built

  • Python 3.12+ · FastMCP · httpx.
  • client.py — the async API client (session auth, CSRF, request building, trims huge payloads).
  • endpoints.py — every API path in one place (overridable from config, no code change).
  • server.py — the MCP tools the assistant sees.

The API sits under https://lavka.yandex.ru/api/v1/providers/* (plus /api/v1/orders/submit for placing orders). Requests need the CSRF token from the homepage HTML plus X-Lavka-Web-* headers — the client handles this.

Setup

1. Install

bash
uv venv && uv pip install -e .

2. Provide your Yandex session (one time)

Log into Lavka in your browser first, then get the session cookies into ~/.config/yandex-lavka-mcp/config.json.

macOS — pull cookies straight from Chrome (one Keychain prompt → Allow):

bash
uv pip install -e '.[browser]'python scripts/extract_chrome_cookies.py          # auto-detects your profile

Any OS — paste the Cookie header from DevTools (Network → any lavka.yandex.ru request → Request Headers → Cookie):

bash
python scripts/import_cookies.py --header "Session_id=...; yandexuid=...; L=..."

Session cookies expire — re-run when calls start failing with "Lavka session is not authorized".

3. Set a delivery location

Copy config.example.json to ~/.config/yandex-lavka-mcp/config.json and edit, or set it from the assistant with use_address / set_delivery_address. The catalog only works once a location is set. Smoke-test:

bash
python scripts/smoke.py "молоко"

4. Register with your assistant

Claude Code:

bash
claude mcp add yandex-lavka -- uv run --directory /path/to/yandex-lavka-mcp yandex-lavka-mcp

Claude Desktop (mcpServers):

json
{  "yandex-lavka": {    "command": "uv",    "args": ["run", "--directory", "/path/to/yandex-lavka-mcp", "yandex-lavka-mcp"]  }}

Remote deploy (order from your phone)

By default the server speaks stdio (local clients). Set YANDEX_LAVKA_MCP_TRANSPORT=streamable-http to expose it over HTTP so a hosted instance can back a claude.ai custom connector (phone / web).

A prebuilt Dockerfile is included. Secrets are injected at runtime — never baked into the image:

bash
docker build -t yandex-lavka-mcp .docker run -p 8000:8000 \  -e YANDEX_LAVKA_MCP_TRANSPORT=streamable-http \  -e YANDEX_LAVKA_MCP_CONFIG_JSON="$(cat ~/.config/yandex-lavka-mcp/config.json)" \  yandex-lavka-mcp

(The image defaults to stdio; the TRANSPORT env above switches it to HTTP.)

Environment variables

VarPurpose
YANDEX_LAVKA_MCP_TRANSPORTstdio (default) or streamable-http.
YANDEX_LAVKA_MCP_HOST / _PORTBind address for HTTP (default 0.0.0.0:8000 in Docker).
YANDEX_LAVKA_MCP_CONFIG_JSONThe whole config.json as one secret (instead of a file).
YANDEX_LAVKA_MCP_SPRAVKACaptcha pass for the server's IP, if Yandex demands one (see Captcha).

Authentication (any OIDC provider)

A public endpoint spends real money, so protect it. claude.ai's custom connector UI only supports OAuth (no static bearer / custom header — that works only in Claude Code/Desktop). This server is a provider-agnostic OAuth 2.1 resource server: point it at any OpenID-Connect provider (Zitadel, Keycloak, Auth0, Google, …) and it validates JWT access tokens against that provider's JWKS and advertises it via OAuth protected-resource metadata.

Enable it by installing the server extra (pip install '.[server]', already in the Docker image) and setting:

VarPurpose
YANDEX_LAVKA_MCP_OAUTH_ISSUERYour provider's issuer URL (enables OAuth).
YANDEX_LAVKA_MCP_SERVER_URLPublic URL of this MCP server (the resource).
YANDEX_LAVKA_MCP_OAUTH_AUDIENCEExpected token audience (optional but recommended).
YANDEX_LAVKA_MCP_OAUTH_SCOPESSpace-separated required scopes (optional).
YANDEX_LAVKA_MCP_OAUTH_SUBJECTSAllow-list of token subs that may call the server (optional; strongest lock — every request spends your Lavka session).
YANDEX_LAVKA_MCP_OAUTH_JWKS_URLOverride JWKS URL (optional; else discovered).

A network-exposed HTTP transport refuses to start unless OAuth is configured (it spends real money). Set YANDEX_LAVKA_MCP_ALLOW_INSECURE=1 only if you front it with your own auth. Leaving OAuth unset is allowed for loopback/local use.

Session cookies expire; when calls start failing, re-capture them and update the YANDEX_LAVKA_MCP_CONFIG_JSON secret. There is no headless Yandex login. The captcha pass (below) is a separate secret, so it survives this.

Captcha from a server

Yandex may start answering a hosted instance with a captcha — decided by the server's IP, not the session (the same cookies keep working from home). Tools then fail with "Yandex anti-bot returned a captcha". Solve it once through that IP:

bash
ssh -f -N -D 1080 <your-server>     # SOCKS proxy out of the server's IPuv run --with playwright python scripts/solve_captcha.py --proxy socks5://127.0.0.1:1080

A throwaway Chrome window opens on the captcha; solve it. The script prints the spravka cookie to stdout — set it as the YANDEX_LAVKA_MCP_SPRAVKA secret (pipe it straight in) and restart. It lasts about 30 days; repeat when the captcha error comes back.

Develop

bash
uv pip install -e ".[dev]"pytest

One account = one cart

Lavka keeps a single server-side cart per account, guarded by an optimistic cartVersion. This server serializes its own cart writes and retries on version conflicts, so parallel tool calls in one session are safe. But don't drive the same Yandex account from two places at once (e.g. this server and a second MCP session, and the Lavka app): they all write the one shared cart, and you'll see items from the other writer appear in yours. Use a single client at a time.

Security & privacy

  • Cookies and address live only in ~/.config/yandex-lavka-mcp/config.json (chmod 600), git-ignored. Never commit them.
  • The server never adds payment methods or changes account settings.
  • Ordering always requires an explicit confirmed total.

License

MIT. Unofficial project, not affiliated with Yandex.

来源:README.md,提交 8ff40f5

工具

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

版本历史

4
  1. v0.1.6最新Oct 5, 2026
  2. v0.1.5Oct 4, 2026
  3. v0.1.4Oct 4, 2026
  4. v0.1.1Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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