官方 Shopify Dev MCP 服务器
Shopify Dev MCP 服务器(@anthropic-ai/shopify-dev-mcp)是由 Shopify 和 Anthropic 合作构建的官方 Model Context Protocol 服务器。它让 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
Claude Code 范围选项
--scope project(default): Available only in the current project. Config stored in.claude/.--scope user: Available globally. Config stored in~/.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 服务器 公开以下工具:
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?
有效使用的技巧
最佳实践
- Be specific with queries -- "product creation mutation with media" > "products"
- Specify API versions -- Always mention your target version
- Combine tools -- Search docs first, then explore the schema, then validate
- Use topic filters -- Narrow results to the relevant area
- Iterate on results -- Refine with additional context if too broad
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."
疑难排解
服务器 无法启动
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
响应缓慢
- 检查你的网络连接
- 尝试更具体的查询
- 确保你正在运行最新的 服务器 版本
这个服务器不做什么
warning
Shopify Dev MCP 服务器提供对文档和 API Schema 的访问。它不会:
- 连接到你的实际 Shopify 商店
- 创建、读取、更新或删除商店数据(产品、订单等)
- 访问你商店的分析或报告
- 管理你的 Partner 账户或应用
如需商店管理功能,请参阅我们的 社区 MCP 服务器 指南,其中涵盖连接到 Shopify Admin API 的服务器。
更新和变更日志
服务器持续维护中。主要更新通常与 Shopify 的季度 API 发布同步:
- API 2026-01 —— 新增完整 Schema 支持
- Functions 脚手架 —— JavaScript 和 Rust 模板
- Checkout 可扩展性 —— Extension target 文档
- Liquid 2026 —— 更新的对象和过滤器参考
请查看 npm 页面 或 GitHub releases 以了解最新变更。