
Costco
io.github.thehesiod由 GitHub 帳號 thehesiod 發布v0.1.2更新於 Oct 24, 2026
MCP server for Costco warehouse receipts and online orders
概覽
本機 MCP 伺服器,透過從瀏覽器工作階段取得的權杖,讓助理讀取 Costco 賣場收據、線上訂單與商品資訊。
- 可以做什麼
- 依日期範圍列出賣場購物收據,並取得單張收據明細,或批次取得整個日期範圍內所有收據的明細,包含商品、數量、價格、折價券與部門代碼。依日期範圍列出 Costco.com 線上訂單,含訂單編號、狀態、商品與總額。將商品編號解析為商品名稱與部門,結果快取在本機 SQLite 資料庫中。檢查權杖效期與已設定的帳戶,並註冊或更新帳戶的更新權杖。所有工具都接受選用的帳戶名稱,以便區分多個 Costco 帳戶。
- 適用情境
- 適合讓助理查詢自己的 Costco 購買紀錄、逐項檢視收據,或核對線上訂單與店內消費,而不必手動匯出資料。它是個人帳戶工具,並非通用的購物或比價服務。
- 執行需求
- 以 Python 套件(costco-mcp-server)透過 uvx 在本機執行;未宣告環境變數或請求標頭。需要 Costco.com 帳戶,以及從瀏覽器 Costco 登入工作階段取得的更新權杖,可手動取得,也可透過另一個 Chrome DevTools MCP 實例完成。半自動流程需要安裝 Chrome 或 Chromium,並能連線至 Costco 的內部 API。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Costco,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Costco MCP Server
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 accountssave_refresh_token— Register or update an account's refresh token
Setup
Install in Claude Code
Once published to PyPI, the above simplifies to:
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."
-
Launch the auth browser (cross-platform console script):
Chrome starts on port 9223 with a persistent profile at
~/.costco-mcp/chrome-profile/. -
Register a chrome-devtools-mcp instance pointed at that port (one time):
-
Log into costco.com in the launched browser window (first time only — the profile persists).
-
Ask Claude to refresh:
Extract my Costco refresh token and save it for account "personal".
Claude reads the
msal.*.refreshtokenentry from localStorage viachrome-devtools-mcpand callssave_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:
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 ordersecom-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%underGoogle\Chrome\Application\chrome.exe - Linux / fallback:
google-chrome,google-chrome-stable,chromium,chromium-browseronPATH
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.pyare 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版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分