Costco

io.github.thehesiod由 GitHub 账号 thehesiod 发布v0.1.2更新于 Oct 24, 2026

MCP server for Costco warehouse receipts and online orders

已验证STDIO仅桌面金融商业与电商

概览

AI 生成的概览

本地 MCP 服务器,借助从浏览器会话中取得的令牌,让助手读取 Costco 仓储店收据、线上订单和商品信息。

可以做什么
按日期范围列出仓储店购物收据,并获取单张收据的明细,或批量获取整个日期范围内所有收据的明细,包括商品、数量、价格、优惠券和部门代码。按日期范围列出 Costco.com 线上订单,含订单号、状态、商品和总额。将商品编号解析为商品名称和部门,结果缓存在本地 SQLite 数据库中。检查令牌有效期和已配置账户,并注册或更新账户的刷新令牌。所有工具都接受可选的账户名,以便区分多个 Costco 账户。
适用场景
适合让助手查询自己的 Costco 购买记录、逐项查看收据,或核对线上订单与店内消费,而无需手动导出数据。它是个人账户工具,不是通用的购物或比价服务。
运行要求
以 Python 包(costco-mcp-server)通过 uvx 在本机运行;未声明环境变量或请求头。需要 Costco.com 账户,以及从浏览器 Costco 登录会话中提取的刷新令牌,可手动提取,也可通过另一个 Chrome DevTools MCP 实例完成。半自动流程需要安装 Chrome 或 Chromium,并能访问 Costco 的内部 API。
安装前请注意
刷新令牌以明文形式存放在用户主目录下,仅靠操作系统文件权限保护,有效期约 90 天。服务器调用 Costco 未公开的内部 API,这些接口可能变更或被封禁,此类使用可能违反 Costco 服务条款,存在账户被停用或触发限流的风险。收据和订单数据从你的账户读取;该项目与 Costco 无关联,且不提供任何担保。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Costco MCP Server

[MCP Registry] [PyPI]

An MCP (Model Context Protocol) server that gives Claude access to Costco warehouse receipts and online orders. Talks directly to Costco's internal GraphQL API using OAuth2 refresh tokens extracted from a browser session — no scraping, no runtime headless browser. Multi-account (e.g. personal, spouse) with per-account token storage.

Available on the MCP Registry as io.github.thehesiod/costco.

Disclaimer

This project is not affiliated with, endorsed by, or sponsored by Costco Wholesale Corporation. "Costco" and all related names, logos, and trademarks are the property of their respective owners.

This server communicates with Costco's undocumented internal APIs — endpoints that are not published, not guaranteed to be stable, and may change or be blocked at any time without notice. Use of those APIs may violate Costco's Terms of Service; you are responsible for reviewing the ToS and deciding whether your use is acceptable.

Use at your own risk. The authors and contributors accept no responsibility for any consequences of using this software, including but not limited to: account suspension or termination, data loss or corruption, incorrect receipt/order information, failed purchases, financial discrepancies, API rate-limit strikes, IP blocks, or any other direct or indirect damages. No warranty is provided — see LICENSE for the full MIT no-warranty clause.

If Costco publishes an official API, this project should be considered deprecated in favor of that.

Features

Warehouse

  • list_warehouse_receipts — In-store receipts for a date range (barcode, warehouse, total)
  • get_receipt_detail — Full itemized receipt by barcode (products, quantities, prices, coupons, department codes)
  • get_all_receipt_details — Bulk fetch every receipt's full detail for a date range

Online Orders

  • list_online_orders — Costco.com orders for a date range (order number, status, items, totals)

Products

  • lookup_products — Resolve item numbers to full product names + departments. Uses a local SQLite cache (~/.costco-mcp/products.db) so repeated lookups are free.

Authentication

  • check_auth_status — Report token freshness and list configured accounts
  • save_refresh_token — Register or update an account's refresh token

Setup

Install in Claude Code

bash
claude mcp add --transport stdio costco -- \    uvx --from "costco-mcp-server @ git+https://github.com/thehesiod/costco-mcp" costco-mcp-server

Once published to PyPI, the above simplifies to:

bash
claude mcp add --transport stdio costco -- uvx costco-mcp-server

Authentication

Costco doesn't expose a public OAuth app, so refresh tokens are extracted from your browser's Azure AD B2C session storage. Refresh tokens are valid for ~90 days; bearer tokens are minted transparently on each API call.

Semi-automated flow (recommended). Uses a dedicated Chrome profile + chrome-devtools-mcp so Claude extracts and registers the token for you. After first setup, each re-auth is "launch the browser, ask Claude to refresh."

  1. Launch the auth browser (cross-platform console script):

    bash
    uvx --from "costco-mcp-server @ git+https://github.com/thehesiod/costco-mcp" costco-auth-browser

    Chrome starts on port 9223 with a persistent profile at ~/.costco-mcp/chrome-profile/.

  2. Register a chrome-devtools-mcp instance pointed at that port (one time):

    bash
    claude mcp add costco-browser -- npx -y chrome-devtools-mcp --browserUrl http://127.0.0.1:9223
  3. Log into costco.com in the launched browser window (first time only — the profile persists).

  4. Ask Claude to refresh:

    Extract my Costco refresh token and save it for account "personal".

    Claude reads the msal.*.refreshtoken entry from localStorage via chrome-devtools-mcp and calls save_refresh_token.

Manual fallback. If you'd rather not wire up a second MCP: log into costco.com, open DevTools → Application → Local Storage → https://www.costco.com, find the key containing refreshtoken, copy the secret field from its JSON value, then:

bash
uvx --from "costco-mcp-server @ git+https://github.com/thehesiod/costco-mcp" \    costco-mcp-server --save-token personal <REFRESH_TOKEN>

Multi-Account

Every tool takes an optional account argument (e.g. "personal", "spouse"). Omitting it uses the default account (first registered, or most recently set). Account data is isolated per name under ~/.costco-mcp/accounts/<name>/.

How It Works

The server uses httpx[http2] to hit Costco's internal GraphQL endpoints directly:

  • ecom-api.costco.com/ebusiness/order/v1/orders/graphql — warehouse receipts + online orders
  • ecom-api.costco.com/ebusiness/product/v1/products/graphql — product lookups

Authentication uses Azure AD B2C (signin.costco.com). The public client IDs baked into auth.py (tenant, policy, MSAL/WCS client IDs) ship in Costco's own browser bundle — they are not secrets. No credentials (username/password) are handled by this server.

See CLAUDE.md for architecture details and development notes.

Platform Notes

Fully cross-platform (macOS, Linux, Windows). No shell scripts — all entry points are Python console scripts.

The semi-automated auth flow requires Chrome or Chromium installed at a standard location. costco-auth-browser searches:

  • macOS: /Applications/Google Chrome.app/...
  • Windows: %ProgramFiles%, %ProgramFiles(x86)%, %LocalAppData% under Google\Chrome\Application\chrome.exe
  • Linux / fallback: google-chrome, google-chrome-stable, chromium, chromium-browser on PATH

Override the debugger port with COSTCO_AUTH_PORT.

Security Notes

  • Refresh tokens are stored plaintext in ~/.costco-mcp/. Rely on OS-level home directory permissions.
  • No credentials handled by this server. Authentication happens entirely in your browser's Costco login flow.
  • The Azure AD B2C client IDs in auth.py are public SPA identifiers that ship in Costco's browser bundle — not secrets.

License

MIT — see LICENSE.

mcp-name: io.github.thehesiod/costco

来源:README.md,提交 9671e2c

工具

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

版本历史

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

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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