MCP ExplorerExplorer

Mcp Shopify Server

@linyingwei2003on 12 days ago
1 MIT
FreeCommunity
AI Systems
MCP Server for Shopify Admin API with GraphQL query tools

Overview

What is Mcp Shopify Server

mcp-shopify-server is a Model Context Protocol (MCP) server that facilitates access to the Shopify Admin API through GraphQL queries, allowing developers to interact with their Shopify store data efficiently.

Use cases

Use cases for mcp-shopify-server include querying store information such as product details, customer data, and order management, as well as integrating Shopify with other applications for enhanced functionality.

How to use

To use mcp-shopify-server, clone the repository, install the dependencies, configure your environment variables with your Shopify credentials, and start the server. You can then execute GraphQL queries against your Shopify store.

Key features

Key features of mcp-shopify-server include Shopify Admin API integration for executing GraphQL queries, access to the complete GraphQL schema, real-time connections using Server-Sent Events, comprehensive error handling, and a complete testing suite.

Where to use

mcp-shopify-server is primarily used in e-commerce development, particularly for Shopify store management and data manipulation through the Shopify Admin API.

Content

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

Variable Description Example
SHOPIFY_STORE_URL Your Shopify store’s GraphQL endpoint https://mystore.myshopify.com/admin/api/2025-04/graphql.json
SHOPIFY_ACCESS_TOKEN Admin API access token shpat_xxxxxxxxxxxx
PORT Server 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 LICENSE file for details.

Support

For issues and questions:

Tools

No tools

Comments