Shopify商店模型上下文协议服务器

一个通过Shopify Admin和Storefront API连接实时Shopify商店的模型上下文协议(MCP)服务器,支持AI代理对商店执行真实操作。

  • by Brahim-Benzarti
  • TypeScript
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 brahim-benzarti/shopify_store-mcp

使用说明

Shopify商店MCP服务器

连接到的模型上下文协议(MCP)服务器 Shopify商店直播 通过管理和店面API。与仅记录MCP不同,此服务器使AI代理能够执行 实际操作 在你的商店。

为什么选择MCP?

功能 Shopify商店MCP Shopify开发MCP
执行GraphQL查询 ✅ 真正的API调用 ❌ 仅文档
修改店铺数据 ✅ 完整CRUD ❌ 没有
上传文件 ✅ 是 ❌ 没有
批量操作 ✅ 是 ❌ 没有
API文件 ❌ 否 ✅ 是的
模式自省 ❌ 否 ✅ 是的

重要提示: 为了获得最佳体验,请使用 两者 这个MCP和官方 Shopify开发MCP 一起。Dev MCP帮助您的AI代理了解Shopify的API架构和文档,同时此MCP执行您商店的实际操作。

特性

  • 通用GraphQL访问 -通过执行任何管理API查询或突变 run_graphql_query
  • 智能多步工具 --文件上传、批量操作、元对象异常以及自动轮询
  • 速率限制 --尊重Shopify基于计划的费率限制(标准/高级/高级/企业)
  • 操作日志 --SQLite数据库跟踪调试和历史记录的所有操作
  • 架构发现 --探索您商店的图元字段定义和图元对象类型

先决条件

  1. Node.js 18+
  2. Shopify商店 带着一个 自定义应用程序
  3. 管理员API访问令牌 --在Shopify Admin中创建自定义应用程序→ 设置→ 应用程序和开发渠道→ 开发应用程序

安装

Cursor

快速安装

安装后,编辑配置以添加实际的存储凭据。

手动配置

添加到光标MCP设置(~/.cursor/mcp.json):

{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "npx",
      "args": ["-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Windows Configuration
{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "cmd",
      "args": ["/k", "npx", "-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Claude Desktop

添加到您的Claude Desktop配置中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 窗户: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "npx",
      "args": ["-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Windows Configuration
{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "cmd",
      "args": ["/k", "npx", "-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Claude Code (CLI)

添加到您的克劳德代码设置(~/.claude/settings.json):

{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "npx",
      "args": ["-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
VS Code (Copilot)

添加到您的VS代码设置(settings.json):

{
  "mcp.servers": {
    "shopify-store-mcp": {
      "command": "npx",
      "args": ["-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Windsurf

添加到您的Windsurf MCP配置(~/.windsurf/mcp.json):

{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "npx",
      "args": ["-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Other MCP Clients

对于任何兼容MCP的客户端,请使用:

npx -y shopify-store-mcp

对于环境变量:

  • SHOPIFY_STORE_URL --您店铺的myshopify.com域名
  • SHOPIFY_ACCESS_TOKEN -管理员API访问令牌

推荐:添加Shopify开发MCP

为了获得最佳的AI代理体验,还添加了官方 **Shopify开发MCP**它提供:

  • API文档搜索
  • GraphQL模式自检
  • 查询验证
  • 最新的Shopify API知识

这有助于您的AI代理了解 写什么查询 在使用此MCP执行它们之前。

{
  "mcpServers": {
    "shopify-store-mcp": {
      "command": "npx",
      "args": ["-y", "shopify-store-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "your-store.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    },
    "shopify-dev-mcp": {
      "command": "npx",
      "args": ["-y", "@shopify/dev-mcp@latest"]
    }
  }
}

环境变量

变量 必填 默认 描述
SHOPIFY_STORE_URL 是 -- 商店的myshopify.com域名
SHOPIFY_ACCESS_TOKEN 是 - 管理员API访问令牌
SHOPIFY_STOREFRONT_ACCESS_TOKEN 否 - 店面API令牌
SHOPIFY_API_VERSION 没有 2026-01 API版本(或 unstable 用于出血边缘)
SHOPIFY_TIER 没有 STANDARD 费率限制层
MCP_LOG_OPERATIONS 没有 true 启用操作日志记录

可用工具

核心工具

工具 说明
get_shop_info 检索商店配置、计划信息和设置
run_graphql_query 万能工具 --执行任何GraphQL查询或变异

智能工具

自动处理复杂性的多步骤工作流:

工具 说明
upload_file 上传文件(URL、本地路径或base64)→ 轮询直到准备就绪→ 返回CDN URL
bulk_export 开始批量查询→ 投票完成→ 返回JSONL下载URL
bulk_import 分阶段上传→ 大量突变→ 投票完成
upsert_metaobject 按句柄创建或更新元对象(幂等)
delete_metaobject 按ID或类型+句柄删除元对象
schema_discover 发现元字段定义和元对象类型

基础设施工具

工具 说明
configure 设置速率限制级别(从车间计划中手动或自动检测)
get_history 查询过去的操作以进行调试
get_stats 聚合使用统计数据(调用、错误、响应时间)

速率限制

服务器会根据您的店铺计划自动遵守Shopify的费率限制:

层 请求/秒 计划
STANDARD 1 基础、开发、精简版
ADVANCED 2 高级
PLUS 5 Shopify Plus
ENTERPRISE 10 商业组件

使用 configure 该工具用于设置您的等级或从您的店铺计划中自动检测。

可用提示

提示 描述
analyze-product 产品分析模板
summarize-orders 按时间段列出的订单摘要
inventory-health 库存健康检查
customer-insights 客户细分分析
custom-query 帮助构建自定义GraphQL查询

可用资源

资源 描述
shopify://config 当前店铺连接信息
shopify://docs/query-syntax 查询语法参考
shopify://docs/gid-format GID格式参考
shopify://docs/scopes API范围参考

发展

# Clone the repo
git clone https://github.com/Brahim-Benzarti/Shopify_store-MCP.git
cd Shopify_store-MCP

# Install dependencies
npm install

# Build
npm run build

# Run with MCP Inspector
npm run inspect

# Watch mode
npm run dev

# View database
npm run db:studio

数据库

服务器使用SQLite进行操作日志记录和配置。数据库在以下位置自动创建 ~/.shopify-mcp/mcp.db.

安全

  • 永不承诺 你的 .env 文件或访问令牌
  • 使用 环境变量 或MCP配置以获取凭据
  • 访问令牌应具有 所需最小范围
  • 操作在本地记录以进行调试(禁用 MCP_LOG_OPERATIONS=false)

许可证

国际学生委员会

相关