官方 Shopify Dev MCP Server
Shopify Dev MCP Server(@anthropic-ai/shopify-dev-mcp)是由 Shopify 和 Anthropic 合作建構的官方 Model Context Protocol Server。它讓 AI 助手能夠深入存取 Shopify 的開發者文件、API Schema、Liquid 模板和 Functions 腳手架——全部透過自然語言。
這是你可以加入 Shopify 開發工作流程的最具影響力的單一工具。它消除了手動搜尋文件、交叉參考 API 版本或猜測 Liquid 語法的需要。你的 AI 助手獲得資深 Shopify 開發者所擁有的知識,始終與最新 API 版本保持同步。
概覽
| Detail | Value |
|---|---|
| Package | @anthropic-ai/shopify-dev-mcp |
| npm | npmjs.com/package/@anthropic-ai/shopify-dev-mcp |
| GitHub | github.com/anthropics/shopify-dev-mcp |
| Maintained by | Anthropic + Shopify Developer Relations |
| Transport | stdio (local) |
| Auth Required | No |
| Node.js | 18+ |
核心功能
1. 文件搜尋
搜尋整個 Shopify 開發者文件庫,包含:
- Admin API reference (GraphQL / REST)
- Storefront API reference
- App development guides
- Theme development docs
- Hydrogen / Oxygen docs
- Shopify Functions docs
- Checkout extensibility guides
- Partner documentation
Example prompt:
"Search the Shopify docs for how to implement a delivery customization function"
2. API Schema 探索
探索任何 Shopify API 版本的完整 GraphQL Schema:
- 瀏覽類型、查詢、Mutation 和訂閱
- 查看欄位層級的文件和棄用通知
- 比較不同 API 版本之間的 Schema
- 了解輸入類型和必填欄位
Example prompt:
"Show me the ProductInput type for the 2026-01 API version.
What fields are required vs optional?"
3. Liquid 驗證和參考
存取完整的 Liquid 模板語言文件:
- 物件屬性和過濾器
- 標籤語法和行為
- Section 和 block schema
- 佈景主題架構模式
Example prompt:
"What Liquid filters are available for formatting money in Shopify?
Show me examples with multi-currency support."
4. Functions 腳手架
獲取 Shopify Functions 開發指南:
- 可用的 Function API 及其輸入/輸出 Schema
- Rust 和 JavaScript 實作模式
- Functions 的測試策略
- 部署工作流程
Example prompt:
"Help me scaffold a delivery customization function that blocks
shipping to PO boxes for oversized items."
設定說明
Claude Code(推薦)
Claude Code 具有一流的 MCP 支援。設定只需一個命令:
# Add the server to your project
claude mcp add shopify-dev -- npx -y @anthropic-ai/shopify-dev-mcp@latest
驗證連線:
# Start Claude Code
claude
# Then ask:
> What Shopify MCP tools do you have available?
全域安裝(在所有專案中可用):
claude mcp add --scope user shopify-dev -- npx -y @anthropic-ai/shopify-dev-mcp@latest
--scope project(預設):僅在目前專案中可用。設定儲存在.claude/中。--scope user:全域可用。設定儲存在~/.claude/中。
Cursor
{
"mcpServers": {
"shopify-dev": {
"command": "npx",
"args": ["-y", "@anthropic-ai/shopify-dev-mcp@latest"]
}
}
}
Claude Desktop
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"shopify-dev": {
"command": "npx",
"args": ["-y", "@anthropic-ai/shopify-dev-mcp@latest"]
}
}
}
Codex (OpenAI)
codex mcp add shopify-dev -- npx -y @anthropic-ai/shopify-dev-mcp@latest
Windsurf
{
"mcpServers": {
"shopify-dev": {
"command": "npx",
"args": ["-y", "@anthropic-ai/shopify-dev-mcp@latest"]
}
}
}
工具參考
Shopify Dev MCP Server 公開以下工具:
search_docs
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query text |
topic | string | No | Filter: admin-api, storefront-api, hydrogen, functions, themes, apps, checkout |
version | string | No | API version (e.g., 2026-01) |
explore_api_schema
| Parameter | Type | Required | Description |
|---|---|---|---|
type_name | string | No | GraphQL type (e.g., Product, OrderInput) |
query | string | No | Search pattern |
api | string | No | admin (default), storefront |
version | string | No | API version |
get_liquid_reference
| Parameter | Type | Required | Description |
|---|---|---|---|
object | string | No | Liquid object (e.g., product, cart) |
filter | string | No | Liquid filter (e.g., money, img_url) |
tag | string | No | Liquid tag (e.g., for, if, section) |
get_function_reference
| Parameter | Type | Required | Description |
|---|---|---|---|
function_type | string | No | Function API type |
language | string | No | rust, javascript |
validate_graphql
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | GraphQL query/mutation to validate |
api | string | No | admin or storefront |
version | string | No | API version |
實際使用範例
Example 1
I'm building a Shopify app that syncs inventory across multiple locations.
Search the docs for:
1. The inventory management APIs
2. Webhook topics related to inventory changes
3. Best practices for real-time inventory sync
Then show me the GraphQL mutations I'll need.
Example 2
My product page isn't showing variant-specific metafields.
Get the Liquid reference for:
1. The product.variants object
2. How to access metafields on variants
3. The metafield Liquid filter
Show me a working code example.
Example 3
I need to migrate my app from API version 2025-07 to 2026-01.
1. What breaking changes affect the Product type?
2. Show me the deprecated fields I need to update
3. What new fields are available?
有效使用的技巧
- 查詢要具體 —— 「product creation mutation with media」比「products」更好
- 指定 API 版本 —— 總是提及您的目標版本
- 組合使用工具 —— 先搜尋文件,再探索 schema,然後驗證
- 使用主題篩選 —— 將結果縮小到相關領域
- 反覆迭代結果 —— 如果結果太廣泛,用額外的上下文來精煉
Prompt Patterns
# Pattern: Research then build
"Search Shopify docs for [topic]. Based on what you find,
write a [component/function/mutation] that [requirement]."
# Pattern: Schema-first development
"Explore the [TypeName] in the admin API schema.
Show me all required fields, then write a mutation using them."
# Pattern: Validation loop
"Here's my GraphQL mutation: [code]. Validate it against the
2026-01 schema and fix any issues."
疑難排解
Server 無法啟動
node --version # Should be 18+
npx -y @anthropic-ai/shopify-dev-mcp@latest --help
工具未出現在 Claude Code 中
claude mcp list
claude mcp remove shopify-dev
claude mcp add shopify-dev -- npx -y @anthropic-ai/shopify-dev-mcp@latest
過時的文件結果
claude mcp remove shopify-dev
claude mcp add shopify-dev -- npx -y @anthropic-ai/shopify-dev-mcp@latest
回應緩慢
- 檢查您的網路連線
- 嘗試更具體的查詢
- 確保您正在執行最新的 Server 版本
這個 Server 不做什麼
Shopify Dev MCP Server 提供對文件和 API Schema 的存取。它不會:
- 連接到您的實際 Shopify 商店
- 建立、讀取、更新或刪除商店資料(產品、訂單等)
- 存取您商店的分析或報告
- 管理您的 Partner 帳戶或應用程式
如需商店管理功能,請參閱我們的社群 MCP 伺服器指南,其中涵蓋連接到 Shopify Admin API 的伺服器。
更新和變更日誌
伺服器持續維護中。主要更新通常與 Shopify 的季度 API 發布同步:
- API 2026-01 —— 新增完整 Schema 支援
- Functions 腳手架 —— JavaScript 和 Rust 範本
- Checkout 可擴展性 —— Extension target 文件
- Liquid 2026 —— 更新的物件和過濾器參考
請查看 npm 頁面 或 GitHub 版本發布 以了解最新變更。