Shopify管理员MCP服务器
一个MCP(模型上下文协议)服务器,提供对Shopify管理GraphQL API的只读访问。
特性
- 只读访问 到Shopify管理员数据
- 35个核心工具 用于产品、订单、客户、营销、折扣、收藏、库存和店铺信息
- 12个ShopifyQL分析工具 (可选,需要2级访问权限)用于销售、转化、活动等
快速开始
1.创建Shopify自定义应用程序
- 在您的Shopify管理员中,转到 设置→ 应用程序和销售渠道→ 开发应用程序
- 点击 允许自定义应用程序开发 (如果尚未启用)
- 点击 创建应用程序 并为其命名(例如,“Claude MCP”)
- 点击 配置管理员API作用域 并启用:
- read_products - read_orders - read_customers - read_marketing_events - read_discounts - read_inventory - read_locations - read_locales - read_analytics - read_reports
- 点击 保存,然后单击 安装应用程序
- 在 API证书 选项卡,复制 API密钥 和 API密钥
ShopifyQL和分析要求
基于ShopifyQL的分析工具(run_shopifyql, get_sales_over_time, get_top_customers等)需要超出API范围的额外访问:
read_reports范围 -已包含在上述范围内- 2级受保护的客户数据访问 -所有ShopifyQL查询都需要,即使是那些不访问客户数据的查询
要启用2级访问:
- 去 Shopify合作伙伴仪表板
- 引导到 Apps → 您的应用程序→ API访问
- 在...之下 受保护的客户数据,请求2级访问权限
- 完成所需的安全认证
- 等待Shopify批准(可能需要几天时间)
默认情况下,ShopifyQL工具处于禁用状态 以防止没有2级访问权限的用户出错。批准后,通过添加环境变量启用它们:
{
"mcpServers": {
"shopify-admin": {
"command": "npx",
"args": ["-y", "shopify-admin-mcp"],
"env": {
"SHOPIFY_CREDENTIALS_PATH": "/path/to/credentials.json",
"SHOPIFY_SHOPIFYQL_ENABLED": "true"
}
}
}
}注: 非ShopifyQL工具(产品、订单、客户等)在没有2级访问权限的情况下工作。
2.创建凭据文件
使用您的Shopify凭据创建JSON文件(例如。, ~/.shopify-credentials.json):
{
"shop": "your-store.myshopify.com",
"clientId": "your-api-key",
"clientSecret": "your-api-secret-key"
}3.配置您的MCP客户端
克劳德代码
添加到 ~/.claude/settings.json:
{
"mcpServers": {
"shopify-admin": {
"command": "npx",
"args": ["-y", "shopify-admin-mcp"],
"env": {
"SHOPIFY_CREDENTIALS_PATH": "/path/to/your/shopify-credentials.json"
}
}
}
}克劳德桌面版
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"shopify-admin": {
"command": "npx",
"args": ["-y", "shopify-admin-mcp"],
"env": {
"SHOPIFY_CREDENTIALS_PATH": "/path/to/your/shopify-credentials.json"
}
}
}
}4.重新启动和测试
重新启动克劳德代码/桌面,然后尝试询问:
- “获取我的店铺信息”
- “显示过去7天的销售额”
- “列出我的十大产品”
可用工具
产品工具
| 工具 | 说明 |
|---|---|
get_products | 列出具有过滤/分页功能的产品 |
get_product | 按ID获取单个产品 |
get_product_variants | 列出产品变体 |
get_product_tags | 获取所有产品标签 |
get_product_types | 获取所有产品类型 |
get_product_vendors | 获取所有产品供应商 |
get_products_count | 清点产品 |
订购工具
| 工具 | 说明 |
|---|---|
get_orders | 列出带有过滤/分页功能的订单 |
get_order | 按ID获取单笔订单 |
get_orders_count | 清点订单 |
get_abandoned_checkouts | 列出放弃的结账 |
get_abandoned_checkouts_count | 统计放弃的结账 |
客户和细分工具
| 工具 | 说明 |
|---|---|
get_customers | 列出具有筛选功能的客户 |
get_customer | 通过ID获取单个客户 |
get_customers_count | 统计客户数量 |
get_segments | 列出客户细分 |
get_segment | 按ID获取单个分段 |
get_segment_members | 在细分市场中吸引客户 |
营销工具
| 工具 | 说明 |
|---|---|
get_marketing_activities | 列出营销活动 |
get_marketing_activity | 获得单一营销活动 |
get_marketing_events | 列出营销活动 |
get_marketing_event | 获取单一营销活动 |
折扣工具
| 工具 | 说明 |
|---|---|
get_discounts | 列出所有折扣 |
get_discount | 按ID获得单次折扣 |
get_code_discounts | 列出基于代码的折扣 |
get_automatic_discounts | 列出自动折扣 |
收藏工具
| 工具 | 说明 |
|---|---|
get_collections | 列出收藏 |
get_collection | 按ID获取单个集合 |
get_collections_count | 清点藏品 |
库存和位置工具
| 工具 | 说明 |
|---|---|
get_inventory_items | 列出库存项目 |
get_inventory_item | 获取单个库存项目 |
get_locations | 列出地点 |
get_location | 获取单一位置 |
车间工具
| 工具 | 说明 |
|---|---|
get_shop | 获取店铺信息 |
get_shop_locales | 获取店铺所在地 |
run_shopifyql | 运行自定义ShopifyQL查询 |
分析工具
| 工具 | 说明 |
|---|---|
get_sales_over_time | 按天/周/月划分的销售趋势 |
get_sales_by_product | 畅销产品 |
get_sales_by_region | 按国家分列的销售额 |
get_sales_by_traffic_source | 按推荐人/来源列出的销售额 |
get_sessions_over_time | 流量/会话趋势 |
get_conversion_rate | 会话到订单的转换率 |
get_average_order_value | AOV随时间的变化趋势 |
get_top_customers | 消费最高的客户 |
get_conversions_by_channel | 按渠道划分的转换率 |
get_campaign_performance | 活动绩效指标 |
get_campaign_performance_over_time | 随时间推移的活动趋势 |
示例用法
了解销售趋势
"Show me daily sales for the last 30 days"分析顶级产品
"What are my top 10 best-selling products this month?"检查活动绩效
"How are my marketing campaigns performing?"运行自定义分析
"Run this ShopifyQL query: FROM sales SHOW total_sales, orders GROUP BY product_title SINCE -7d ORDER BY total_sales DESC LIMIT 5"发展
本地设置
git clone https://github.com/MAYUNO-International-LLC/shopify-admin-mcp.git
cd shopify-admin-mcp
npm install
npm run build本地MCP配置
对于本地开发,请指向构建的文件:
{
"mcpServers": {
"shopify-admin": {
"command": "node",
"args": ["/path/to/shopify-admin-mcp/dist/index.js"],
"env": {
"SHOPIFY_CREDENTIALS_PATH": "/path/to/credentials.json"
}
}
}
}许可证
麻省理工学院
