linyingwei2003/mcp-shopify-server
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.
run_shopify_admin_query
Executes GraphQL queries against the Shopify Admin API.
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
- Clone this repository:
git clone https://github.com/yourusername/mcp-shopify-server.git
cd mcp-shopify-server
- Install dependencies:
npm install
- 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
- 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 protocolPOST /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:
- Test MCP connection
- Initialize connection
- List available tools
- Execute Shopify queries
- 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
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
License
MIT License - see file for details.
Support
For issues and questions:
- Check the Issues page
- Review Shopify's Admin API documentation
- Check MCP protocol specification