SH

Shopify API MCP Server: Orders, Products, Customers

Manage Shopify orders, products, and customers with an MCP server that connects, syncs, and automates API interactions for seamless e-commerce workflows.

Quick Install
npx -y @GeLi2001/shopify-mcp

Overview

This MCP (Model Context Protocol) server provides a connector between Shopify stores and model-driven workflows. It exposes structured tools and endpoints that let automated agents, scripts, or human operators read and write Shopify Orders, Products, and Customers via a consistent interface. The server handles authentication, pagination, rate-limit retrying, and webhook syncing so that higher-level automations can focus on business logic instead of low-level API details.

The project is useful when you need to integrate LLMs or other automation layers with Shopify without embedding Shopify credentials into each agent. Typical scenarios include syncing orders to an ERP, generating product descriptions with a language model and pushing them back to Shopify, or building conversational agent tooling that queries a shop’s customers and orders in natural language. The codebase and API design aim to reduce friction for developers by exposing targeted routes and tools specifically for orders, products, and customer workflows.

Features

  • Connect to Shopify Admin API (REST/GraphQL) with support for API token configuration
  • CRUD operations for Orders, Products, and Customers
  • Webhook registration and handling for real-time sync (orders created/updated, product changes)
  • Pagination and bulk fetch utilities
  • Rate-limit handling and automatic retry/backoff
  • Idempotent update operations to avoid duplicate writes
  • Simple HTTP endpoints for integrations and MCP-compatible tool definitions
  • Docker and local development support for quick setup

Installation / Configuration

Prerequisites: Node.js (>=14) and Docker (optional).

Clone the repo and install dependencies:

git clone https://github.com/GeLi2001/shopify-mcp.git
cd shopify-mcp
npm install

Create a .env file (example):

SHOPIFY_STORE=your-shop-name.myshopify.com
SHOPIFY_API_KEY=your_api_key
SHOPIFY_API_SECRET=your_api_secret
SHOPIFY_ADMIN_TOKEN=shpat_xxx_or_custom_token
PORT=3000
WEBHOOK_SECRET=your_webhook_secret
NODE_ENV=development

Start the server in development:

npm run dev
# or
node dist/index.js

Docker (optional):

# docker-compose.yml
version: "3.8"
services:
  shopify-mcp:
    build: .
    ports:
      - "3000:3000"
    environment:
      - SHOPIFY_STORE=${SHOPIFY_STORE}
      - SHOPIFY_ADMIN_TOKEN=${SHOPIFY_ADMIN_TOKEN}
      - PORT=3000

Run with:

docker-compose up --build

Available Tools / Resources

The server exposes a set of HTTP endpoints and “tools” intended for programmatic use by model-driven agents. Typical endpoints include:

  • GET /health — health check
  • POST /mcp/execute — MCP tool execution entrypoint (run a named tool with params)
  • GET /sync/orders — fetch and paginate orders
  • GET /sync/products — fetch products (supports since_id or cursor pagination)
  • GET /sync/customers — fetch customers
  • POST /webhooks/shopify — Shopify webhook receiver for updates
  • POST /orders/:id/fulfill — helper to create fulfillments
  • PATCH /products/:id — partial update for product metadata or description

Example: fetch recent orders with curl

curl -X GET "http://localhost:3000/sync/orders?limit=50" \
  -H "Authorization: Bearer ${MCP_API_KEY}"

Developer resources:

  • Postman collection (if provided in repo) or OpenAPI spec for endpoint definitions
  • Example scripts in /examples for common flows (sync, bulk-update, webhook test)
  • Logging and trace output (configurable via NODE_ENV or a LOG_LEVEL env var)

Use Cases

  • Sync orders to an ERP: Fetch new orders via /sync/orders, map fields to your ERP schema, and mark them as exported. The server handles repeated fetches, pagination, and will avoid duplication via idempotent flags.
  • Auto-generate product content: Use an LLM to create product descriptions or SEO titles and call PATCH /products/:id to update the Shopify product. The MCP server manages API auth and rate-limit retries, letting your prompt logic stay focused on text generation.
  • Customer segmentation and outreach: Pull customer lists with /sync/customers, filter or augment records (e.g., add tags), and update customers programmatically. Combine with webhook events to keep segments up-to-date in near real time.
  • Fulfillment automation: On order creation webhook, a workflow can call POST /orders/:id/fulfill to create fulfillments and trigger shipping label creation via third-party services.
  • Human-in-the-loop tasks: Present a UI or chat interface that calls POST /mcp/execute to run a named tool (for example, “update_product_price”) and let an operator confirm before the MCP server applies changes to Shopify.

Tips and Best Practices

  • Use a dedicated Shopify Admin API token with minimal required scopes (read_orders, write_products, read_customers, etc.).
  • Register and validate webhooks using the WEBHOOK_SECRET to ensure authenticity.
  • Implement monitoring for rate-limit responses — the server retries but you should surface metrics for backoff events.
  • Use idempotency keys for bulk write operations to avoid duplicate updates from retries.

For full reference and example scripts, see the project repository: https://github.com/GeLi2001/shopify-mcp.