MCP HubMCP Hub
amir-bengherbi

shopify-mcp-server

by: amir-bengherbi

MCP Server for Shopify API

6created 26/01/2025
Visit
Shopify
API

📌Overview

Purpose: The Shopify MCP Server is designed to facilitate interaction with Shopify store data through a robust GraphQL API, enabling effective management of products, customers, orders, and more.

Overview: This server acts as an integration tool that allows developers to seamlessly connect with Shopify's GraphQL Admin API, providing a comprehensive suite for the management of various store elements including products, customers, and orders, while ensuring strong error handling and intuitive querying capabilities.

Key Features:

  • Product Management: Enables searching and retrieving product information, helping users manage inventory effectively.

  • Customer Management: Allows loading customer data and managing tags, which aids in maintaining customer relationships and segmentation.

  • Order Management: Supports advanced querying and filtering of orders, providing detailed insights into sales and customer transactions.

  • GraphQL Integration: Directly integrates with Shopify's GraphQL Admin API, streamlining the data retrieval process.

  • Comprehensive Error Handling: Offers clear error messages for API and authentication issues, enhancing the user experience and troubleshooting process.


Shopify MCP Server

MCP Server for Shopify API, enabling interaction with store data through GraphQL API. This server provides tools for managing products, customers, orders, and more.

Features

  • Product Management: Search and retrieve product information
  • Customer Management: Load customer data and manage customer tags
  • Order Management: Advanced order querying and filtering
  • GraphQL Integration: Direct integration with Shopify's GraphQL Admin API
  • Comprehensive Error Handling: Clear error messages for API and authentication issues

Tools

  1. get-products
    Retrieve all products or search by title.
    Inputs:

    • searchTitle (optional string): Filter products by title
    • limit (number): Maximum number of products to return
      Returns: Formatted product details including title, description, handle, and variants
  2. get-products-by-collection
    Retrieve products from a specific collection.
    Inputs:

    • collectionId (string): ID of the collection
    • limit (optional number, default: 10): Maximum number of products
      Returns: Formatted product details from the specified collection
  3. get-products-by-ids
    Retrieve products by their IDs.
    Inputs:

    • productIds (array of strings): Product IDs to retrieve
      Returns: Formatted product details for specified products
  4. get-variants-by-ids
    Retrieve product variants by their IDs.
    Inputs:

    • variantIds (array of strings): Variant IDs to retrieve
      Returns: Detailed variant information including product details
  5. get-customers
    Retrieve Shopify customers with pagination support.
    Inputs:

    • limit (optional number): Maximum customers to return
    • next (optional string): Next page cursor
      Returns: Customer data in JSON format
  6. tag-customer
    Add tags to a customer.
    Inputs:

    • customerId (string): Customer ID
    • tags (array of strings): Tags to add
      Returns: Success or failure message
  7. get-orders
    Retrieve orders with advanced filtering and sorting.
    Inputs:

    • first (optional number): Limit on orders
    • after (optional string): Next page cursor
    • query (optional string): Filter query
    • sortKey (optional enum): Sort field ('PROCESSED_AT', 'TOTAL_PRICE', 'ID', 'CREATED_AT', 'UPDATED_AT', 'ORDER_NUMBER')
    • reverse (optional boolean): Reverse order
      Returns: Formatted order details
  8. get-order
    Retrieve a single order by ID.
    Inputs:

    • orderId (string): Order ID
      Returns: Detailed order information
  9. create-discount
    Create a discount code.
    Inputs:

    • title (string): Discount title
    • code (string): Discount code
    • valueType (enum): Discount type ('percentage' or 'fixed_amount')
    • value (number): Discount value
    • startsAt (string): Start date ISO
    • endsAt (optional string): End date ISO
    • appliesOncePerCustomer (boolean): Single-use flag
      Returns: Created discount details
  10. create-draft-order
    Create a draft order.
    Inputs:

    • lineItems (array): Items with variantId and quantity
    • email (string): Customer email
    • shippingAddress (object): Shipping address
    • note (optional string): Optional note
      Returns: Created draft order details
  11. complete-draft-order
    Complete a draft order.
    Inputs:

    • draftOrderId (string): Draft order ID
    • variantId (string): Variant ID
      Returns: Completed order details
  12. get-collections
    Retrieve all collections.
    Inputs:

    • limit (optional number, default: 10): Maximum collections
    • name (optional string): Filter by name
      Returns: Collection details
  13. get-shop
    Retrieve shop details.
    Inputs: None
    Returns: Basic shop information

  14. get-shop-details
    Retrieve extended shop details including shipping countries.
    Inputs: None
    Returns: Extended shop information

  15. manage-webhook
    Manage webhooks (subscribe, find, unsubscribe).
    Inputs:

    • action (enum): 'subscribe', 'find', or 'unsubscribe'
    • callbackUrl (string): Webhook URL
    • topic (enum): Webhook topic
    • webhookId (optional string): Webhook ID (for unsubscribe)
      Returns: Webhook details or success message

Setup

Shopify Access Token

To use this MCP server, create a custom app in your Shopify store:

  1. From Shopify admin, go to Settings > Apps and sales channels
  2. Click Develop apps (enable developer preview if needed)
  3. Click Create an app
  4. Name your app (e.g., "Shopify MCP Server")
  5. Click Configure Admin API scopes
  6. Select scopes:
    • read_products, write_products
    • read_customers, write_customers
    • read_orders, write_orders
  7. Save and click Install app
  8. Confirm installation
  9. Copy the Admin API access token

Store the token securely; do not share or commit it to version control.

More details on creating Shopify apps can be found here.

Usage with Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "shopify": {
      "command": "npx",
      "args": ["-y", "shopify-mcp-server"],
      "env": {
        "SHOPIFY_ACCESS_TOKEN": "<YOUR_ACCESS_TOKEN>",
        "MYSHOPIFY_DOMAIN": "<YOUR_SHOP>.myshopify.com"
      }
    }
  }
}

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Create a .env file:
    SHOPIFY_ACCESS_TOKEN=your_access_token
    MYSHOPIFY_DOMAIN=your-store.myshopify.com
    
  4. Build the project:
    npm run build
    
  5. Run tests:
    npm test
    

Dependencies

  • @modelcontextprotocol/sdk - MCP protocol implementation
  • graphql-request - GraphQL client for Shopify API
  • zod - Runtime type validation

Contributing

Contributions are welcome! Please read our Contributing Guidelines first.

License

MIT

Community


Built with ❤️ using the Model Context Protocol