MCP Shopify管理服务器
MCP(模型上下文协议)服务器,向Claude等LLM公开Shopify Admin API功能。
特性
- 产品:列出、获取、创建和更新产品
- 订单:列出、获取、履行和取消订单
- 客户:列出并获取客户详细信息
- 库存:获取库存水平并调整数量
先决条件
- Node.js 18+
- 具有管理员API访问权限的Shopify商店
- 具有所需作用域的管理员API访问令牌
要求的API范围
您的Shopify Admin API访问令牌需要以下范围:
read_products,write_productsread_orders,write_ordersread_customers,write_customersread_inventory,write_inventoryread_locations
安装
- 克隆此存储库:
git clone https://github.com/your-org/mcp-shopify-admin.git
cd mcp-shopify-admin- 安装依赖项:
npm install- 创建一个
.env使用您的Shopify凭据文件:
cp .env.example .env- 编辑
.env使用您的商店域和访问令牌:
SHOPIFY_STORE_DOMAIN=your-store.myshopify.com
SHOPIFY_ACCESS_TOKEN=shpat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx用法
使用克劳德桌面
添加到您的Claude Desktop配置(claude_desktop_config.json):
{
"mcpServers": {
"shopify": {
"command": "node",
"args": ["path/to/mcp-shopify-admin/src/index.js"],
"env": {
"SHOPIFY_STORE_DOMAIN": "your-store.myshopify.com",
"SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}与MCP检查员一起
使用MCP检查器测试服务器:
npx @modelcontextprotocol/inspector node src/index.js独立
直接运行服务器(用于调试):
npm start可用工具
产品
| 工具 | 描述 | 类型 |
|---|---|---|
shopify_list_products | 列出具有过滤和分页功能的产品 | 阅读 |
shopify_get_product | 按ID获取详细的产品信息 | 阅读 |
shopify_create_product | 创建新产品 | 编写 |
shopify_update_product | 更新现有产品 | 写入 |
订单
| 工具 | 描述 | 类型 |
|---|---|---|
shopify_list_orders | 列出带有状态筛选的订单 | 读取 |
shopify_get_order | 按ID获取详细订单信息 | 阅读 |
shopify_fulfill_order | 创建订单履行 | 写入 |
shopify_cancel_order | 取消订单 | 写入 |
客户
| 工具 | 描述 | 类型 |
|---|---|---|
shopify_list_customers | 通过搜索列出客户 | 阅读 |
shopify_get_customer | 按ID获取详细的客户信息 | 阅读 |
库存
| 工具 | 描述 | 类型 |
|---|---|---|
shopify_get_inventory_levels | 获取各个地点的库存 | 阅读 |
shopify_update_inventory | 调整库存数量 | 写入 |
响应格式
所有工具都支持两种响应格式 response_format 参数:
json(默认):用于编程的结构化JSONmarkdown:人类可读的格式化输出
例子
产品列表
Use shopify_list_products to show me the first 10 products获取订单详细信息
Use shopify_get_order with id "5123456789" and response_format "markdown"更新库存
Use shopify_update_inventory to add 50 units to inventory item "12345" at location "67890"错误处理
服务器为常见问题提供明确的错误消息:
- 401未经授权:检查您的访问令牌
- 403禁止:您的令牌可能缺少所需的作用域
- 429价格有限:在发出更多请求之前等待
- 404未找到:请求的资源不存在
许可证
麻省理工学院
