sainsburys-mcp
An MCP server that enables adding groceries to a Sainsbury's basket from a plain-text shopping list via natural language, using existing browser session for authentication.
README
sainsburys-cli
Build a Sainsbury's Groceries basket from a plain-text shopping list, from the command line.
It talks directly to Sainsbury's internal Groceries API and authenticates by borrowing the session from a browser you're already logged in to — so there's no password to store and no browser being driven around. It never places an order; it only fills the basket, ready for you to review and check out yourself.
⚠️ This uses an undocumented, unofficial API. It can break if Sainsbury's changes their site, and it's for personal use with your own account only.
Install
cd ~/code/sainsburys_cli
python3 -m venv .venv
.venv/bin/pip install -e .
This gives you a sainsburys command (at .venv/bin/sainsburys).
First-time setup: log in
-
Open your normal browser and log in at https://www.sainsburys.co.uk.
-
Leave that session logged in.
-
Check it works:
.venv/bin/sainsburys whoamiYou should see your name/email. The CLI reads the Sainsbury's cookies from your browser automatically. If you have several browsers, point it at one:
.venv/bin/sainsburys --browser firefox whoami
When your session later expires, just reload sainsburys.co.uk in the browser and
run any command with --refresh.
Build a basket from a list
Write a shopping list, one item per line:
# weekly shop
2 x semi skimmed milk
free range eggs x2
wholemeal bread
600g chicken breast
bananas
Quantities can go at the start (2 x milk, 3 bananas) or end (milk x2).
Blank lines and # comments are ignored.
Preview first (nothing is added):
.venv/bin/sainsburys add-list shopping.txt
You'll get a per-line report: ✓ confident matches, ? low-confidence or
out-of-stock (with alternatives shown), and ✗ no-match. When it looks right,
commit:
.venv/bin/sainsburys add-list shopping.txt --commit
Only confident, in-stock matches are added; anything flagged for review is left
for you to add manually (e.g. with search + add). Then open the basket on
the website to review and check out.
Other commands
.venv/bin/sainsburys search "oat milk" # find products + their ids
.venv/bin/sainsburys add 7977681 --qty 2 # add one product by id
.venv/bin/sainsburys basket # show the current basket (with item ids)
.venv/bin/sainsburys remove "oat milk" # remove an item by name (or [item ...] id)
remove matches on the product name; if more than one basket item matches
equally (e.g. remove "milk" with two milks) it lists them and does nothing, so
you can re-run with the specific [item ...] id or --all.
Add --json to any command for machine-readable output (handy when Claude is
driving it).
Using it with Claude Desktop
Claude Desktop drives this through a bundled MCP server (sainsburys-mcp) so
your partner can just chat — "add milk, eggs and bread to my Sainsbury's basket"
— with no terminal. See docs/CLAUDE_DESKTOP.md for
the one-time setup. (In Claude Code, use the CLI directly as below.)
Using it with Claude (CLI)
You don't have to pre-format anything. Paste a messy list into Claude — prose,
a copied spreadsheet, mixed units ("6 pints semi-skimmed, a dozen eggs, loaf of
wholemeal") — and ask it to build the basket. Claude interprets the list itself,
then uses search --json to find each product and add to put it in the
basket, stopping to ask you whenever an item is ambiguous (which size? which
brand? the usual one's out of stock — swap it?). It confirms the basket at the
end; you review and check out on the website. See CLAUDE.md for the exact
protocol Claude follows.
If reading browser cookies doesn't work
Some locked-down work machines (or Chrome on recent Windows) block reading the
cookie store. Fallback: copy the request cookies from your browser's dev tools
(Network tab → any groceries-api request → Cookie header, and the
wcauthtoken request header) and set them as env vars:
set -x SAINSBURYS_COOKIE "WC_AUTHENTICATION_123=...; JSESSIONID=..."
set -x SAINSBURYS_WCAUTHTOKEN "..."
Running the tests
.venv/bin/pip install pytest
.venv/bin/python -m pytest
The tests cover the list-parsing and product-matching logic (which run offline); the API calls themselves need a live logged-in session to exercise.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。