Skip to main content

Shopify Store MCP 伺服器

官方 Shopify Dev MCP 提供開發者文件和結構內省,而 store MCP 伺服器直接連接到您 Shopify 商店的 Admin API。 它們讓 AI 工具執行真實操作 -- 建立商品、擷取訂單、管理庫存、更新客戶——全部透過自然語言。

多個社群建構的 MCP 伺服器提供商店連接。本指南涵蓋最成熟和最廣泛使用的選項。

使用開發商店進行學習

Store MCP 伺服器會在您的 Shopify 商店上執行真實操作。像「刪除所有草稿商品」這樣的命令會真正刪除它們。學習和測試時請始終使用開發商店。在您完全理解正在執行哪些操作之前,永遠不要連接生產商店。

驗證:存取權杖 vs OAuth

在設定任何 store MCP 伺服器之前,您需要了解 Shopify 的驗證模型,該模型在 2025 年 1 月發生了重大變更。

自訂應用程式存取權杖(舊有和現有應用程式)

對於 2025 年 1 月之前建立的應用程式,或透過 Shopify 管理後台建立的自訂應用程式:

  1. 前往 Shopify 管理後台 > 設定 > 應用程式和銷售管道
  2. 點擊開發應用程式 > 建立應用程式
  3. 設定 Admin API 範圍(選擇您需要的權限)
  4. 安裝應用程式並複製 Admin API 存取權杖
Access token format
shpat_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

OAuth 憑證(2025 年 1 月以來的新應用程式)

Shopify 從 2025 年 1 月起棄用了新的公開和自訂應用程式的直接存取權杖建立方式。新應用程式使用 OAuth 客戶端憑證:

  1. 在 Shopify Partner Dashboard 中建立您的應用程式
  2. 記下您的 Client IDClient Secret
  3. 使用 OAuth 流程取得存取權杖
  4. MCP 伺服器會自動處理權杖更新
您需要哪種方法?
  • 使用自訂應用程式的開發商店:使用存取權杖(設定更簡單)
  • 透過 Partner Dashboard 建立的新應用程式:使用 OAuth 憑證
  • 已有儲存權杖的現有應用程式:使用現有存取權杖

大多數 MCP 伺服器支援兩種方法。請查閱特定伺服器的文件以了解設定選項。

shopify-mcp by GeLi2001

最全面的社群 MCP 伺服器,擁有 70 多個工具,涵蓋幾乎所有 Admin API 操作。這是進行完整商店管理的推薦選擇。

Repository: github.com/GeLi2001/shopify-mcp

為 Claude Code 安裝

Install with access token
claude mcp add shopify-store -- npx -- -y shopify-mcp --accessToken shpat_your_token_here --domain your-store.myshopify.com
Install with OAuth credentials
claude mcp add shopify-store -- npx -- -y shopify-mcp --clientId your_client_id --clientSecret your_client_secret --domain your-store.myshopify.com

Cursor 設定

.cursor/mcp.json
{
"mcpServers": {
"shopify-store": {
"command": "npx",
"args": [
"-y",
"shopify-mcp",
"--accessToken", "shpat_your_token_here",
"--domain", "your-store.myshopify.com"
]
}
}
}

可用操作

該伺服器提供按資源類型組織的工具:

Products (15+ tools)

ToolDescription
get_productsList products with filtering and pagination
get_productGet a single product by ID
create_productCreate a new product with variants
update_productUpdate product fields
delete_productDelete a product
get_product_variantsList variants for a product
create_product_variantAdd a variant to a product
update_product_variantModify variant details
get_product_imagesList product images
upload_product_imageAdd an image to a product
Example: Create a product
> Create a new product called "Organic Cotton T-Shirt" with sizes
S, M, L, XL. Price the small at $29.99 and add $2 for each
size up. Set inventory to 50 units per variant at our main location.

Orders (10+ tools)

ToolDescription
get_ordersList orders with status filters
get_orderGet a single order with line items
create_fulfillmentFulfill an order
cancel_orderCancel an order
create_draft_orderCreate a draft order
get_order_risksCheck order fraud risk
Example: Find unfulfilled orders
> Show me all unfulfilled orders from the last 48 hours with
their customer email and total value.

Customers (8+ tools)

ToolDescription
get_customersList customers with search
get_customerGet customer details
create_customerCreate a new customer
update_customerUpdate customer info
get_customer_ordersList a customer's orders
search_customersSearch by email, name, etc.

Collections (6+ tools)

ToolDescription
get_collectionsList all collections
get_smart_collectionsList smart (automated) collections
create_collectionCreate a custom collection
add_product_to_collectionAdd products to a collection
get_collection_productsList products in a collection

Inventory (5+ tools)

ToolDescription
get_inventory_levelsCheck inventory at locations
adjust_inventoryAdjust inventory quantities
get_locationsList store locations
set_inventory_levelSet absolute inventory level

Discounts (6+ tools)

ToolDescription
get_price_rulesList price rules
create_price_ruleCreate a discount rule
create_discount_codeGenerate a discount code
get_discount_codesList codes for a price rule

分頁模式

Shopify 的 API 使用基於游標的分頁。MCP 伺服器會處理此問題,但了解此模式有助於您發出有效的請求:

Paginated request
> List all products (I have about 500). Fetch them in batches
of 50 and compile the complete list.

MCP 伺服器會在後台進行多次分頁 API 呼叫,跟隨 pageInfo.hasNextPage 並使用 endCursor 進行後續請求。

避免擷取所有資料

雖然 MCP 伺服器會處理分頁,但擷取數千個項目會消耗時間和 token。請具體說明:當您不需要完整目錄時,「列出最近更新的 20 個產品」比「列出所有產品」更好。

@ajackus/shopify-mcp-server

一個替代的社群伺服器,專注於簡潔性和核心操作。

安裝

Install @ajackus server
claude mcp add shopify-ajackus -- npx -- -y @ajackus/shopify-mcp-server --token shpat_your_token --shop your-store.myshopify.com

此伺服器提供較小的精選工具集,專注於最常見的操作。如果您想要較少的工具和較低的複雜度,這是一個不錯的選擇。

Python 實作

對於偏好 Python 的團隊,有一個基於 Python 的 Shopify MCP 伺服器:

Install Python MCP server
pip install shopify-mcp-server
Claude Desktop configuration (Python server)
{
"mcpServers": {
"shopify-store": {
"command": "python",
"args": ["-m", "shopify_mcp_server"],
"env": {
"SHOPIFY_ACCESS_TOKEN": "shpat_your_token_here",
"SHOPIFY_STORE_DOMAIN": "your-store.myshopify.com"
}
}
}
}
Python 與 Node.js MCP 伺服器

兩者提供類似的功能。根據您團隊的語言偏好來選擇。Node.js 伺服器(shopify-mcp、@ajackus)往往更新頻率更高,因為 Shopify 自身的工具以 Node.js 為中心。如果您要與基於 Python 的資料管線整合,Python 伺服器是更好的選擇。

SSE 傳輸設定

部分 MCP 伺服器支援使用 Server-Sent Events (SSE) 作為持久 HTTP 服務運行,這對於團隊共享存取非常有用:

Start server with SSE transport
npx shopify-mcp --accessToken shpat_xxx --domain store.myshopify.com --transport sse --port 3100

然後設定 Claude Code 透過 SSE 連線:

Claude Code SSE configuration
{
"mcpServers": {
"shopify-store": {
"url": "http://localhost:3100/sse"
}
}
}

SSE 傳輸的優勢

  • 多個開發人員可以共享一個 MCP 伺服器實例
  • 伺服器保持運行(每次工作階段無啟動延遲)
  • 集中化的權杖管理(開發人員不需要個別的權杖)
  • 可以部署在團隊伺服器的驗證層之後

實務工作流程

工作流程 1:產品目錄稽核

Audit workflow
> Analyze our product catalog:
1. List all products with no images
2. Find products with variants that have $0 price
3. Identify products with no inventory at any location
4. List products without descriptions

Compile this into a report with product titles and IDs.

工作流程 2:訂單調查

Order investigation
> A customer (email: customer@example.com) says they haven't
received their order. Look up their recent orders, check
fulfillment status, and summarize what I should tell them.

工作流程 3:批次操作

Bulk update
> Add the tag "summer-2026" to all products in the "Summer
Collection" collection. Also set a metafield
custom.seasonal = "summer" on each one.

工作流程 4:庫存對帳

Inventory check
> Compare inventory levels between our "Main Warehouse" and
"Retail Store" locations. List any products where the total
across both locations is under 10 units.

安全最佳實務

範圍最小化

建立您的存取權杖時,僅包含工作流程所需的範圍:

WorkflowMinimum Scopes
Product managementread_products, write_products
Order viewingread_orders
Full store managementread_products, write_products, read_orders, write_orders, read_customers, read_inventory, write_inventory
永遠不要為 MCP 使用完整的管理員存取權限

抵制「以防萬一」就授予所有範圍的誘惑。如果您的 MCP 工作流程只讀取訂單,就只授予 read_orders。如果 MCP 伺服器被入侵或濫用,有限的範圍可以限制損害。在使用社群建構的伺服器時,這一點尤為重要。

權杖輪換

定期輪換您的存取權杖:

  1. 建立具有相同範圍的新自訂應用程式
  2. 使用新權杖更新 MCP 伺服器設定
  3. 解除安裝舊的自訂應用程式

環境變數

永遠不要在會提交到版本控制的設定檔中硬編碼權杖:

Use environment variables
# In your shell profile
export SHOPIFY_MCP_TOKEN=shpat_your_token_here
export SHOPIFY_MCP_DOMAIN=your-store.myshopify.com

# In Claude Code MCP configuration
claude mcp add shopify-store -- npx -- -y shopify-mcp --accessToken $SHOPIFY_MCP_TOKEN --domain $SHOPIFY_MCP_DOMAIN

疑難排解

「未授權」錯誤

  • 驗證您的存取權杖是否正確且未被撤銷
  • 檢查權杖是否具有操作所需的範圍
  • 確認商店網域正確(使用 .myshopify.com 網域)

速率限制

如果在批次操作期間看到速率限制錯誤:

Rate-limited request
> Retry the operation with a 500ms delay between API calls.
My store is rate-limited right now.

大多數 MCP 伺服器會自動處理速率限制,但非常大量的批次操作仍可能達到限制。

缺失資料

如果查詢回傳意外的空結果:

  • 檢查產品/訂單是否處於預期的狀態(使用中,非草稿/已封存)
  • 驗證日期範圍過濾器的格式是否正確
  • 確認存取權杖具有該資源類型的 read_ 範圍

下一步

設定好商店資料存取後,您可以透過分析進一步增強您的工作流程。 前往 Analytics MCP 了解如何透過 MCP 連接 Shopify 分析和報告工具。