Logo Shopify MCP

Shopify MCP

Cộng đồng
Cesarjoquin

shopify mcp server for Claude Desktop, Claude Code, or any MCP-compatible client to manage products, customers, orders, inventory, and metafields through a typed tool interface of shopify mcp

Nhà phát hànhCesarjoquin
Kho mãshopify-mcp
Ngôn ngữTypeScript
Bản fork
400
Sao
143
Công cụ có sẵn
0
Phương thức truyền tảistdio
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Shopify MCP cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    143 sao và 400 bản fork từ kho mã được liên kết.

Shopify MCP Server

A production-oriented Model Context Protocol server that exposes the Shopify Admin GraphQL API to AI assistants. Connect Claude Desktop, Claude Code, or any MCP-compatible client to manage products, customers, orders, inventory, and metafields through a typed tool interface.


Table of Contents


Overview

This server translates MCP tool calls into Shopify Admin GraphQL operations. It supports static access tokens and OAuth client-credentials (Dev Dashboard apps), optional Redis-backed token persistence, structured JSON logging, and graceful shutdown.


Architecture

Runtime layers

LayerResponsibility
src/index.tsProcess entry, error boundary
src/server/Bootstrap, MCP wiring, shutdown hooks
src/config/Environment and CLI configuration
src/lib/Auth, logging, Redis, shared utilities
src/tools/40 MCP tools (products, orders, customers, …)

Request workflow

Authentication flow


Features

CategoryCapabilities
ProductsCRUD, variants, options, collections
CustomersCRUD, merge, address management
OrdersQuery, cancel, fulfill, refund, draft orders
MetafieldsRead, write, delete on any resource
InventorySet quantities, read levels and items
DiscoveryShop info, locations, markets, price lists
PlatformRedis token cache, structured logging, graceful shutdown, strict TypeScript

All list tools support cursor pagination, sorting, and Shopify search syntax filtering.


Requirements

  • Node.js 18 or later
  • Shopify store with a custom app and Admin API scopes
  • Redis (optional) for OAuth token persistence across restarts

Required Admin API scopes

read_products, write_products, read_customers, write_customers, read_orders, write_orders (plus scopes for inventory/metafields as needed).


Installation

Run with npx (recommended)

bash
npx shopify-mcp \
  --clientId YOUR_CLIENT_ID \
  --clientSecret YOUR_CLIENT_SECRET \
  --domain your-store.myshopify.com

Install from source

bash
git clone https://github.com/GeLi2001/shopify-mcp.git
cd shopify-mcp
npm install
npm run build
npm start

Claude Desktop

Add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "shopify": {
      "command": "npx",
      "args": [
        "shopify-mcp",
        "--clientId", "<CLIENT_ID>",
        "--clientSecret", "<CLIENT_SECRET>",
        "--domain", "<store>.myshopify.com"
      ]
    }
  }
}

Config locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

Configuration

Copy .env.example to .env and fill in values:

bash
cp .env.example .env

Environment variables

VariableRequiredDescription
MYSHOPIFY_DOMAINYesStore domain, e.g. store.myshopify.com
SHOPIFY_ACCESS_TOKENOption AStatic shpat_ token (legacy apps)
SHOPIFY_CLIENT_IDOption BDev Dashboard client ID
SHOPIFY_CLIENT_SECRETOption BDev Dashboard client secret
SHOPIFY_API_VERSIONNoAPI version (default: 2026-01)
LOG_LEVELNodebug, info, warn, error
REDIS_ENABLEDNoEnable Redis persistence (true/false)
REDIS_URLIf RedisConnection URL, e.g. redis://127.0.0.1:6379
REDIS_KEY_PREFIXNoKey namespace prefix (default: shopify-mcp:)
REDIS_MAX_RETRIESNoMax command retries (default: 10)
REDIS_CONNECT_TIMEOUT_MSNoConnect timeout in ms (default: 10000)

CLI flags (--accessToken, --clientId, --clientSecret, --domain, --apiVersion) override environment variables.


Development

bash
# Install dependencies
npm install

# Run in development (TypeScript directly)
npm run dev

# Full validation pipeline
npm run validate

# GraphQL schema validation
npm run validate:graphql

Scripts

ScriptPurpose
npm run buildCompile TypeScript to dist/
npm run typecheckType-check source and tests
npm run lintESLint
npm testJest unit tests
npm run validatetypecheck + lint + test + build

Testing

Tests live in tests/ and cover configuration parsing, logging, error utilities, and Redis token caching.

bash
npm test

Tests use mocked Redis clients — no running Redis instance required for the test suite.


Project Structure

shopify-mcp/
├── docs/
│   └── AUDIT.md           # Internal architecture audit
├── src/
│   ├── config/            # Environment loading (Zod-validated)
│   ├── lib/               # Auth, logging, Redis, tool factory
│   │   └── redis/         # Connection manager + token cache
│   ├── server/            # Bootstrap, MCP server, shutdown
│   ├── tools/             # MCP tool implementations
│   └── index.ts           # Entry point
├── tests/                 # Unit tests
├── .env.example           # Configuration template
├── .github/workflows/     # CI (build, lint, test, typecheck)
└── package.json

Design decisions:

  • Tools use a createTool() factory to eliminate duplicated GraphQL client wiring.
  • Configuration is centralized in src/config/env.ts with Zod validation.
  • OAuth tokens optionally persist in Redis so restarts do not force re-authentication.
  • Logs are structured JSON on stderr (safe for stdio MCP transport).

Troubleshooting

Authentication errors

Authentication credentials are required

Provide either SHOPIFY_ACCESS_TOKEN or both SHOPIFY_CLIENT_ID and SHOPIFY_CLIENT_SECRET.

Wrong package installed

If you see errors referencing a different package name, verify you are running shopify-mcp (this package), not a similarly named alternative.

MCP connection issues

Check Claude Desktop MCP logs:

bash
# macOS
tail -f ~/Library/Logs/Claude/mcp*.log

Ensure the server starts without errors:

bash
SHOPIFY_ACCESS_TOKEN=shpat_xxx MYSHOPIFY_DOMAIN=store.myshopify.com npm start

Redis connection failures

If REDIS_ENABLED=true but Redis is unreachable, the server exits at startup. Either start Redis locally or set REDIS_ENABLED=false.

bash
docker run -d -p 6379:6379 redis:7-alpine

GraphQL userErrors

Shopify returns field-level errors in mutation responses. The server surfaces these as Failed to <operation>: field: message.


Contributing

  1. Fork the repository and create a feature branch.
  2. Run npm run validate before opening a pull request.
  3. Keep commits focused and write clear commit messages.
  4. Add tests for new library or configuration behavior.
  5. Do not commit secrets, .env, or package-lock.json.

FAQ

Does this replace the Shopify Admin UI?
No. It provides programmatic access for AI assistants via MCP.

Can I use a static access token?
Yes. Set SHOPIFY_ACCESS_TOKEN for legacy custom apps with shpat_ tokens.

Is Redis required?
No. Redis is optional and only caches OAuth tokens for client-credentials auth.

How many tools are available?
40 tools covering products, customers, orders, metafields, inventory, and store discovery.

Which API version is used?
Default 2026-01. Override with SHOPIFY_API_VERSION or --apiVersion.

Why JSON logs on stderr?
MCP uses stdout for the protocol. Logs must go to stderr to avoid corrupting the transport.


License

MIT — see LICENSE.

Dùng MCP Shopify MCP với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Shopify MCP, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Shopify MCP làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Shopify MCP.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "shopify-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Shopify MCP, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Shopify MCP.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Shopify MCP giúp tôi làm việc này không?
Shopify MCP
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Shopify MCP.

Câu hỏi thường gặp

Máy chủ MCP Shopify MCP dùng để làm gì?

Shopify MCP là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Shopify MCP với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Shopify MCP với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Shopify MCP với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Shopify MCP, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Shopify MCP với TypingMind?

Shopify MCP hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Shopify MCP cung cấp những công cụ nào trong TypingMind?

Shopify MCP cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Shopify MCP không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Shopify MCP yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇