io.github.thehesiod/costco
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@io.github.thehesiod/costco show my warehouse receipts from last week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: trundler
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
claude mcp add --transport stdio costco -- \
uvx --from "costco-mcp-server @ git+https://github.com/thehesiod/costco-mcp" costco-mcp-serverOnce published to PyPI, the above simplifies to:
claude mcp add --transport stdio costco -- uvx costco-mcp-serverAuthentication
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):
uvx --from "costco-mcp-server @ git+https://github.com/thehesiod/costco-mcp" costco-auth-browserChrome 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):
claude mcp add costco-browser -- npx -y chrome-devtools-mcp --browserUrl http://127.0.0.1:9223Log 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:
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 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.exeLinux / 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
Available Tools
7 toolscheck_auth_statusA
Check if authenticated with Costco. Shows token status and expiry.
Args: account: Account name (optional, uses default if empty). Use list_accounts to see all.
Inputs: account. Returns: result
get_all_receipt_detailsA
Get full itemized details for ALL warehouse receipts in a date range.
Fetches the receipt list then retrieves full details for each one.
Args: start_date: Start date as M/DD/YYYY. Defaults to 90 days ago. end_date: End date as M/DD/YYYY. Defaults to today. account: Account name (optional, uses default).
Inputs: start_date, end_date, account. Returns: result
get_receipt_detailA
Get full itemized receipt detail for a warehouse purchase.
Returns all line items with descriptions, prices, quantities, tax flags, plus payment tender details and tax breakdown.
Args: barcode: Transaction barcode from list_warehouse_receipts account: Account name (optional, uses default).
Inputs: barcode (required), account. Returns: result
list_online_ordersA
List online Costco.com orders for a date range.
Returns order summaries with order number, date, total, status, and line items with descriptions and shipping info.
Args: start_date: Start date as YYYY-M-DD (e.g. "2026-1-01"). Defaults to 90 days ago. end_date: End date as YYYY-M-DD (e.g. "2026-3-31"). Defaults to today. warehouse_number: Warehouse number (default "847"). page_number: Page number for pagination (default 1). page_size: Results per page (default 25). account: Account name (optional, uses default).
Inputs: start_date, end_date, warehouse_number, page_number, +2 more. Returns: result
list_warehouse_receiptsA
List in-warehouse purchase receipts for a date range.
Returns receipt summaries with date, warehouse name, total, item count, and transaction barcode (use barcode with get_receipt_detail for full items).
Args: start_date: Start date as M/DD/YYYY (e.g. "1/01/2026"). Defaults to 90 days ago. end_date: End date as M/DD/YYYY (e.g. "3/31/2026"). Defaults to today. document_type: Filter: "all", "warehouse", "gas", "carwash". Defaults to "all". account: Account name (optional, uses default).
Inputs: start_date, end_date, document_type, account. Returns: result
lookup_productsA
Look up full Costco product names by item numbers.
Uses a shared local cache — only calls the API for uncached items.
Args: item_numbers: Comma-separated item numbers (e.g. "70476,5887,1532925") warehouse_number: Warehouse number (default "847") account: Account name (optional, uses default).
Inputs: item_numbers (required), warehouse_number, account. Returns: result
save_refresh_tokenA
Save a refresh token obtained from a browser login session.
Use this to add a new account or update an existing one. The refresh token is valid for 90 days.
Args: refresh_token: The OAuth2 refresh token from Costco's Azure AD B2C account: Account name (e.g. "personal", "spouse"). Creates the account if new. If empty, uses default account.
Inputs: refresh_token (required), account. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: auth status, receipt bulk/single detail, online orders, warehouse receipts, product lookup, and token management. There is no overlap or ambiguity between them.
All tools use a consistent verb_noun pattern with snake_case, such as check_auth_status, list_warehouse_receipts, and save_refresh_token. The naming is predictable and easy to understand.
Seven tools is an appropriate number for a Costco data retrieval server. It covers authentication, receipts, online orders, product lookup, and token management without being too few or excessive.
The tool set covers the main data retrieval needs, but there is a notable gap: check_auth_status references a nonexistent list_accounts tool. Adding that would improve completeness, though core operations are present.
Maintenance
Related MCP Connectors
MCP server for SkuVault — products, inventory, sales, purchase orders and stock adjustments.
MCP server for MarketTime — wholesale orders, customers, catalog and shipment tracking.
MCP server for Codat — companies, connections, invoices, bills and financial statements.
MCP server for the GovContractScout US government contracts API: search, NAICS, match scoring.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server for USDA nutrition data lookup, meal logging, and daily macro tracking.3MIT
- AlicenseAqualityBmaintenanceA local MCP server for grocery shopping, enabling product search, specials, and browsing across NZ supermarkets, with cart and order history for Countdown/Woolworths via browser-assisted login.141MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that relays Walmart order history collected by the Walmart Invoice Exporter browser extension, enabling Claude and other AI clients to query orders and spending.18 npm1MIT
- FlicenseNot gradedqualityDmaintenanceRead-only MCP server for querying group expense splits and balances from a self-hosted receipt splitting app.-