通过GraphQL API启用与Shopify商店数据的交互,支持产品、客户和订单管理,并具有全面的错误处理功能。
523 查看 · 2026-07-07 更新
简介
通过GraphQL API启用与Shopify商店数据的交互,支持产品、客户和订单管理,并具有全面的错误处理功能。
简介
通过GraphQL API启用与Shopify商店数据的交互,支持产品、客户和订单管理,并具有全面的错误处理功能。
Shopify MCP 服务器
用于 Shopify API 的 MCP 服务器,通过 GraphQL API 实现与商店数据的交互。此服务器提供了管理产品、客户、订单等功能的工具。
功能
- 产品管理:搜索和检索产品信息
- 客户管理:加载客户数据并管理客户标签
- 订单管理:高级订单查询和过滤
- GraphQL 集成:直接与 Shopify 的 GraphQL Admin API 集成
- 全面的错误处理:对 API 和认证问题提供清晰的错误消息
工具
# Shopify MCP 服务器 用于 Shopify API 的 MCP 服务器,通过 GraphQL API 实现与商店数据的交互。此服务器提供了管理产品、客户、订单等功能的工具。 <a href="https://glama.ai/mcp/servers/bemvhpy885"><img width="380" height="200" src="https://glama.ai/mcp/servers/bemvhpy885/badge" alt="Shopify Server MCP server" /></a> ## 功能 * **产品管理**:搜索和检索产品信息 * **客户管理**:加载客户数据并管理客户标签 * **订单管理**:高级订单查询和过滤 * **GraphQL 集成**:直接与 Shopify 的 GraphQL Admin API 集成 * **全面的错误处理**:对 API 和认证问题提供清晰的错误消息 ## 工具
-
get-products- Get all products or search by title
- Inputs:
searchTitle(optional string): Filter products by titlelimit(number): Maximum number of products to return
- Returns: Formatted product details including title, description, handle, and variants
-
get-products-by-collection- Get products from a specific collection
- Inputs:
collectionId(string): ID of the collection to get products fromlimit(optional number, default: 10): Maximum number of products to return
- Returns: Formatted product details from the specified collection
-
get-products-by-ids- Get products by their IDs
- Inputs:
productIds(array of strings): Array of product IDs to retrieve
- Returns: Formatted product details for the specified products
-
get-variants-by-ids- Get product variants by their IDs
- Inputs:
variantIds(array of strings): Array of variant IDs to retrieve
- Returns: Detailed variant information including product details
-
get-customers- Get shopify customers with pagination support
- Inputs:
limit(optional number): Maximum number of customers to returnnext(optional string): Next page cursor
- Returns: Customer data in JSON format
-
tag-customer- Add tags to a customer
- Inputs:
customerId(string): Customer ID to tagtags(array of strings): Tags to add to the customer
- Returns: Success or failure message
-
get-orders- Get orders with advanced filtering and sorting
- Inputs:
first(optional number): Limit of orders to returnafter(optional string): Next page cursorquery(optional string): Filter orders using query syntaxsortKey(optional enum): Field to sort by ('PROCESSED_AT', 'TOTAL_PRICE', 'ID', 'CREATED_AT', 'UPDATED_AT', 'ORDER_NUMBER')reverse(optional boolean): Reverse sort order
- Returns: Formatted order details
-
get-order- Get a single order by ID
- Inputs:
orderId(string): ID of the order to retrieve
- Returns: Detailed order information
-
create-discount- Create a basic discount code
- Inputs:
title(string): Title of the discountcode(string): Discount code that customers will entervalueType(enum): Type of discount ('percentage' or 'fixed_amount')value(number): Discount value (percentage as decimal or fixed amount)startsAt(string): Start date in ISO formatendsAt(optional string): Optional end date in ISO formatappliesOncePerCustomer(boolean): Whether discount can be used only once per customer
- Returns: Created discount details
-
create-draft-order- Create a draft order
- Inputs:
lineItems(array): Array of items with variantId and quantityemail(string): Customer emailshippingAddress(object): Shipping address detailsnote(optional string): Optional note for the order
- Returns: Created draft order details
-
complete-draft-order- Complete a draft order
- Inputs:
draftOrderId(string): ID of the draft order to completevariantId(string): ID of the variant in the draft order
- Returns: Completed order details
-
get-collections- Get all collections
- Inputs:
limit(optional number, default: 10): Maximum number of collections to returnname(optional string): Filter collections by name
- Returns: Collection details
-
get-shop- Get shop details
- Inputs: None
- Returns: Basic shop information
-
get-shop-details- Get extended shop details including shipping countries
- Inputs: None
- Returns: Extended shop information including shipping countries
-
manage-webhook- Subscribe, find, or unsubscribe webhooks
- Inputs:
action(enum): Action to perform ('subscribe', 'find', 'unsubscribe')callbackUrl(string): Webhook callback URLtopic(enum): Webhook topic to subscribe towebhookId(optional string): Webhook ID (required for unsubscribe)
- Returns: Webhook details or success message
设置
Shopify 访问令牌
要使用此 MCP 服务器,您需要在您的 Shopify 商店中创建一个自定义应用:
- 从您的 Shopify 管理后台进入 设置 > 应用程序和销售渠道
- 点击 开发应用(您可能需要先启用开发者预览)
- 点击 创建一个应用
- 为您的应用设置一个名称(例如:“Shopify MCP 服务器”)
- 点击 配置 Admin API 权限范围
- 选择以下权限范围:
read_products,write_productsread_customers,write_customersread_orders,write_orders
- 点击 保存
- 点击 安装应用
- 点击 安装 以授予该应用访问您的商店数据的权限
- 安装后,您将看到您的 Admin API 访问令牌
- 复制此令牌 - 您将在配置时需要用到它
注意:请安全地存储您的访问令牌。它提供了对您商店数据的访问权限,不应被分享或提交到版本控制中。 有关如何创建 Shopify 应用的更多详细信息,请参阅这里。
与 Claude Desktop 结合使用
在您的 claude_desktop_config.json 中添加:
{ "mcpServers": { "shopify": { "command": "npx", "args": ["-y", "shopify-mcp-server"], "env": { "SHOPIFY_ACCESS_TOKEN": "<YOUR_ACCESS_TOKEN>", "MYSHOPIFY_DOMAIN": "<YOUR_SHOP>.myshopify.com" } } } }
开发
- 克隆仓库
- 安装依赖项:
npm install
- 创建
.env文件:
SHOPIFY_ACCESS_TOKEN=your_access_token MYSHOPIFY_DOMAIN=your-store.myshopify.com
- 构建项目:
npm run build
- 运行测试:
npm test
依赖项
- @modelcontextprotocol/sdk - MCP 协议实现
- graphql-request - 用于 Shopify API 的 GraphQL 客户端
- zod - 运行时类型验证
贡献
欢迎贡献!请首先阅读我们的贡献指南。
许可证
MIT
社区
使用 ❤️ 和 模型上下文协议 构建
工具列表
-
get-products: Get all products or search by title
-
get-products-by-collection: Get products from a specific collection
-
get-products-by-ids: Get products by their IDs
-
get-variants-by-ids: Get product variants by their IDs
-
get-customers: Get shopify customers with pagination support
-
tag-customer: Add tags to a customer
-
get-orders: Get shopify orders with advanced filtering and sorting
-
get-order: Get a single order by ID
-
create-discount: Create a basic discount code
-
create-draft-order: Create a draft order
-
complete-draft-order: Complete a draft order
-
get-collections: Get all collections
-
get-shop: Get shop details
-
get-shop-details: Get extended shop details including shipping countries
-
manage-webhook: Subscribe, find, or unsubscribe webhooks
服务配置
[{'mcpServers': {'shopify': {'args': ['-y', 'shopify-mcp-server'], 'command': 'npx', 'env': {'MYSHOPIFY_DOMAIN': '<YOUR_SHOP>.myshopify.com', 'SHOPIFY_ACCESS_TOKEN': '<YOUR_ACCESS_TOKEN>'}}}}]
来源
- 来源:github
- 链接:https://github.com/amir-bengherbi/shopify-mcp-server