mcp-shopify-server

linyingwei2003/mcp-shopify-server

3.2

If you are the rightful owner of mcp-shopify-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Shopify Server is a Model Context Protocol server that facilitates access to the Shopify Admin API through GraphQL queries, providing real-time connectivity and comprehensive error handling.

Tools
  1. run_shopify_admin_query

    Executes GraphQL queries against the Shopify Admin API.

  2. get_shopify_schema

    Returns the Shopify Admin API GraphQL schema in SDL format from a local file.

MCP Shopify Server

A Model Context Protocol (MCP) server that provides access to the Shopify Admin API via GraphQL queries.

Features

  • ๐Ÿ›๏ธ Shopify Admin API Integration: Execute GraphQL queries against your Shopify store
  • ๐Ÿ“‹ Schema Access: Get the complete Shopify Admin API GraphQL schema
  • ๐Ÿ”„ Server-Sent Events: Real-time connection using MCP protocol
  • โšก Error Handling: Comprehensive error handling with detailed feedback
  • ๐Ÿงช Testing Suite: Complete HTTP test suite included

Tools Available

run_shopify_admin_query

Executes GraphQL queries against the Shopify Admin API.

Arguments:

  • query (string): The GraphQL query string to execute

Example:

query {
  shop {
    name
    email
    domain
  }
}

get_shopify_schema

Returns the Shopify Admin API GraphQL schema in SDL format from a local file.

Arguments: None

Setup

Prerequisites

  • Node.js (v14 or higher)
  • Shopify store with Admin API access
  • Private app with Admin API access token

Installation

  1. Clone this repository:
git clone https://github.com/yourusername/mcp-shopify-server.git
cd mcp-shopify-server
  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .env.example .env

Edit .env file with your Shopify credentials:

SHOPIFY_STORE_URL=https://your-store.myshopify.com/admin/api/2025-04/graphql.json
SHOPIFY_ACCESS_TOKEN=your_admin_api_access_token
  1. Start the server:
npm start

The server will be available at http://localhost:3000/mcp

Configuration

Environment Variables

VariableDescriptionExample
SHOPIFY_STORE_URLYour Shopify store's GraphQL endpointhttps://mystore.myshopify.com/admin/api/2025-04/graphql.json
SHOPIFY_ACCESS_TOKENAdmin API access tokenshpat_xxxxxxxxxxxx
PORTServer port (optional)3000

MCP Client Configuration

Add this to your MCP client configuration:

{
  "mcp": {
    "servers": {
      "shopify-server": {
        "url": "http://localhost:3000/mcp"
      }
    }
  }
}

API Endpoints

MCP Protocol Endpoints

  • GET /mcp - Server-Sent Events connection for MCP protocol
  • POST /mcp - JSON-RPC method calls (initialize, tools/list, tools/call)

Health Check

  • GET / - Server health check and endpoint information

Testing

Use the included test.http file to test all endpoints:

  1. Test MCP connection
  2. Initialize connection
  3. List available tools
  4. Execute Shopify queries
  5. Test error handling

Error Handling

The server provides comprehensive error handling:

  • GraphQL Errors: Returns detailed Shopify API errors
  • Invalid Queries: Validates query syntax and parameters
  • Connection Issues: Handles network and authentication errors
  • File Errors: Manages schema file reading errors

Development

Project Structure

โ”œโ”€โ”€ index.js              # Main server file
โ”œโ”€โ”€ test.http            # HTTP test cases
โ”œโ”€โ”€ 2023-10.graphql      # Shopify GraphQL schema
โ”œโ”€โ”€ .env                 # Environment variables
โ”œโ”€โ”€ .gitignore           # Git ignore rules
โ””โ”€โ”€ package.json         # Node.js dependencies

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

MIT License - see file for details.

Support

For issues and questions: