Shopify MCP Server

Shopify MCP Server

MCP server that connects Claude to Shopify stores, enabling natural language queries and actions on products, orders, customers, inventory, and sales analytics. Includes a demo mode with bundled fixtures for trying tools without credentials.

Category
访问服务器

README

Shopify MCP Server

Connect Claude to your Shopify store. This Model Context Protocol server gives Claude Code and Claude Desktop safe, structured access to products, orders, customers, inventory and sales analytics — so you can ask things like:

"Which orders from last week are still unfulfilled?" "Summarize June sales and tell me my top 5 products." "Set the M-size Summit Leggings stock to 40."

It ships with a complete demo store (Aurora Athletics — 30 products, 60 orders, 25 customers), so you can try every tool in under a minute with zero credentials, then point it at a real store when you're ready.

Tools

Tool Type What it does
search_products read Keyword search across titles, handles, types, vendors, tags and SKUs
get_product read Full product detail by id or handle: variants, SKUs, prices, live inventory
list_orders read Recent orders with status filter (any/open/closed/cancelled) and date range
get_order read One order in full: line items, totals breakdown, payment/fulfillment status, tracking numbers
get_customer read Customer profile by email or id, with lifetime stats and recent order history
update_inventory write Set a variant's available quantity (absolute); reports previous value so changes are reversible
sales_summary read Revenue, refunds, order count, AOV, best day and top products for any date range
top_customers read Customers ranked by net spend for any date range, with order counts and last-order dates

Architecture

flowchart LR
    Claude["Claude Code /<br/>Claude Desktop"] <-- "MCP over stdio" --> Server["shopify-mcp-server<br/>(8 tools, zod-validated)"]
    Server --> Iface{{"StoreBackend<br/>interface"}}
    Iface --> Demo["DemoBackend<br/>bundled fixtures,<br/>in-memory writes"]
    Iface --> Live["ShopifyBackend<br/>rate-limit aware<br/>REST client"]
    Live -- "Admin REST API<br/>(HTTPS + access token)" --> Shopify["Shopify"]

Both backends implement one StoreBackend interface, so every tool — including the sales_summary aggregation pipeline — behaves identically against fixtures and against a live store. The live client retries HTTP 429s (honoring Retry-After) and transient 5xx/network errors with exponential backoff, and follows Shopify's cursor pagination for analytics windows.

Quickstart (demo mode, no credentials)

Requires Node.js 20+.

git clone https://github.com/sahididrishi/shopify-mcp-server.git && cd shopify-mcp-server
npm install
npm run build

Add it to Claude Code:

claude mcp add shopify -- node /absolute/path/to/shopify-mcp-server/dist/index.js

Or to Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "shopify": {
      "command": "node",
      "args": ["/absolute/path/to/shopify-mcp-server/dist/index.js"]
    }
  }
}

Then just ask Claude: "Search the store for leggings" or "Give me a sales summary for the last 30 days."

With no Shopify credentials configured, the server automatically serves the fictional Aurora Athletics activewear store. Every tool is fully functional: analytics are computed from 60 realistic orders whose dates are rebased at startup, so the demo store always looks like it traded over the last 90 days. Inventory writes are held in memory and reset on restart — nothing touches the network.

Try it without Claude

npm run try-it

Spawns the built server as a real subprocess, connects an MCP client over stdio, and exercises search_products, get_order, get_customer and sales_summary with pretty-printed output. Exits non-zero on any failure, so it doubles as an integration test.

Connecting a real Shopify store

  1. In your Shopify admin, go to Settings → Apps and sales channels → Develop apps and click Create an app (enable custom app development if prompted).
  2. Under Configuration → Admin API integration, grant scopes:
    • read_products, read_orders, read_customers, read_inventory
    • write_inventory — only if you want the update_inventory tool to work; omit it for a read-only server
  3. Under API credentials, click Install app, then reveal and copy the Admin API access token (starts with shpat_). Shopify shows it once — store it safely.
  4. Configure the server via environment variables (see .env.example):
claude mcp add shopify \
  --env SHOPIFY_STORE_DOMAIN=your-store.myshopify.com \
  --env SHOPIFY_ACCESS_TOKEN=shpat_xxxxxxxxxxxxxxxx \
  -- node /absolute/path/to/shopify-mcp-server/dist/index.js
Variable Required Description
SHOPIFY_STORE_DOMAIN for live mode The *.myshopify.com domain (not your custom storefront domain)
SHOPIFY_ACCESS_TOKEN for live mode Custom app Admin API access token (shpat_...)
SHOPIFY_API_VERSION no Admin API version, defaults to 2026-04

If neither of the first two is set, the server runs in demo mode. If only one is set, it exits with a clear error rather than silently serving demo data.

Security notes

  • Your token never leaves your machine. The server runs locally, speaks to Claude over stdio (no listening ports), and sends the token only to https://<your-store>.myshopify.com.
  • Scope to what you need. Grant read-only scopes and the server is physically incapable of modifying your store — update_inventory will return a clear 403 explanation instead.
  • One deliberate write path. update_inventory is the only mutating tool, it is labelled WRITE OPERATION in its description so Claude treats it accordingly, and it echoes the previous quantity so any change can be reversed.
  • Keep .env files out of version control (.gitignore here already does).

Development

npm test                    # vitest: 44 unit + end-to-end tool tests, no network
npm run build               # tsc + fixture copy
npm run try-it              # integration smoke test against the built server
npm run generate-fixtures   # regenerate the demo store (seeded, deterministic)

The test suite drives the real MCP server through an in-memory client/server transport pair and pins the demo backend's reference date, so aggregation math in sales_summary is asserted against exact known-good figures.

Project layout

src/
  index.ts           entry point: backend selection + stdio transport
  server.ts          MCP server: tool registration, schemas, error mapping
  backend.ts         StoreBackend interface shared by both backends
  backends/
    shopify.ts       live Admin REST API client (retry, pagination, mapping)
    demo.ts          fixture-backed store with date rebasing
  analytics.ts       pure sales aggregation (unit tested)
  format.ts          markdown rendering for tool output
  fixtures/          Aurora Athletics demo data (JSON)
scripts/
  try-it.ts          stdio integration demo
  generate-fixtures.ts  deterministic fixture generator
tests/               vitest suites

License

MIT © 2026 Sahid Idrishi

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选