Shopify管理API工具集

为Shopify管理API提供的多功能工具集,涵盖产品、订单、客户、库存、履行、集合、分析、营销、内容和Webhooks等36种工具。

  • by ExpertVagabond
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 ExpertVagabond/shopify-mcp

使用说明

shopify mcp

Shopify Admin API的MCP服务器-用于产品、订单、客户、库存、完成量、收藏、分析、营销、内容和网络挂钩的36个工具。

发布于npm @purplesquirrel/shopify-mcp.未放映的 shopify-mcp npm上的包是一个无关的第三方项目——始终安装作用域名称。


工具

产品(5)

工具 说明
list_products 按标题、供应商、类型、集合、状态列出/过滤产品
get_product 详细的产品信息,包括变体、图像、图元字段
search_products 在标题、供应商、标签、SKU之间进行全文搜索
product_count 统计符合筛选条件的产品
list_collections 列出智能和自定义集合

订单(5)

工具 说明
list_orders 按状态、日期、履行情况列出/筛选订单
get_order 详细的订单,包括行项目、装运、履行
recent_orders 最近N个订单
unfulfilled_orders 等待完成的订单
order_count 计数与筛选器匹配的订单

客户(3)

工具 说明
search_customers 按姓名、电子邮件、电话搜索
get_customer 客户详细信息,包括地址和订单历史记录
top_customers 按总支出或订单数排名

库存(4)

工具 说明
check_inventory 产品在不同地点的库存水平
list_locations 所有仓库/商店位置
low_stock_products 低于库存阈值的产品
adjust_inventory 调整某一地点的库存

收藏(3)

工具 说明
get_collection 收集详细信息,包括产品数量和规则
collection_products 特定系列中的产品
create_smart_collection 使用规则创建自动化集合

履行(3)

工具 说明
list_fulfillments 具有跟踪功能的订单履行情况
create_fulfillment 使用跟踪信息创建订单履行
fulfillment_status_summary 按履行状态统计订单数

分析(2)

工具 说明
store_summary 今天的订单、收入、履行明细
sales_by_product 日期范围内按产品划分的收入和单位

市场营销(4)

工具 说明
list_price_rules 列出所有价格规则
get_price_rule 带条件的价格规则详细信息
create_discount_code 为价格规则创建折扣代码
list_discount_codes 列出价格规则的代码

内容(4)

工具 说明
list_blogs 列出博客条目
list_pages 列出商店页面
get_metafields 获取任何资源的图元字段
set_metafield 创建或更新图元字段

Webhooks(3)

工具 说明
list_webhooks 列出已注册的webhooks
create_webhook 注册新的webhook
delete_webhook 删除webhook

设置

安装

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

获取Shopify访问令牌

  1. 在Shopify管理员界面: 设置>应用程序和销售渠道>开发应用程序
  2. 创建应用程序,配置管理员API作用域:
    • read_products, write_products, read_orders, write_orders
    • read_customers, read_inventory, write_inventory, read_locations
    • read_fulfillments, write_fulfillments
  3. 安装并复制管理员API访问令牌

克劳德桌面/Claude代码配置

{
  "mcpServers": {
    "shopify": {
      "command": "node",
      "args": ["/path/to/shopify-mcp/dist/index.js"],
      "env": {
        "SHOPIFY_STORE_DOMAIN": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

速率限制

内置Shopify限速:

  • 监视器 X-Shopify-Shop-Api-Call-Limit 头球
  • 接近极限时主动节流
  • 尊重 Retry-After 429回应
  • 5xx错误的指数回退
  • 瞬态故障最多可重试3次

建筑

src/
  index.ts              MCP server setup, 36 tool registrations
  api.ts                Shopify REST client (rate limiting, pagination, retries)
  tools/
    products.ts         Product listing, search, count
    orders.ts           Order listing, details, counts
    customers.ts        Customer search, details, ranking
    inventory.ts        Stock levels, locations, adjustments
    collections.ts      Collection management
    fulfillments.ts     Fulfillment creation, tracking
    analytics.ts        Store summary, sales reports
    marketing.ts        Price rules, discount codes
    content.ts          Blogs, pages, metafields
    webhooks.ts         Webhook management

采用TypeScript严格模式构建, @modelcontextprotocol/sdk (stdio传输),Shopify管理REST API 2024-10,基于游标的分页,零外部HTTP依赖。

许可证

麻省理工学院

作者

由...建造 紫松鼠传媒