Shopify MCP Server

Shopify MCP Server

Enables management of Shopify orders through the Admin REST API, allowing users to create new orders and retrieve order status details. It supports both local and remote access via SSE and STDIO transports for integration with MCP clients like Claude Desktop.

Category
访问服务器

README

Shopify MCP Server

A Model Context Protocol (MCP) server for Shopify order management using the official MCP Python SDK.

Features

  • ✅ MCP-Compliant: Follows official MCP specification
  • 🛠️ Two Tools: Create orders and check order status via Shopify Admin REST API
  • 🌐 Remote Access: SSE transport for cloud deployment
  • 🔒 Secure: Environment-based credential management

Available Tools

1. create_order

Create new Shopify orders with line items and customer information.

Parameters:

  • line_items (array, required): Product items to order
  • customer_email (string, optional): Customer email
  • financial_status (string, optional): Payment status (default: "pending")
  • test (boolean, optional): Create as test order (default: true)

2. get_order_status

Retrieve complete order details by order ID.

Parameters:

  • order_id (integer, required): Shopify order ID

Quick Start

Prerequisites

  • Python 3.10 or higher
  • Shopify Admin API access token
  • Shopify store URL

Local Setup

# Clone the repository
cd mcp-server

# Create and activate virtual environment (recommended)
python -m venv mcpserver
mcpserver\Scripts\activate  # Windows
# source mcpserver/bin/activate  # macOS/Linux

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
# Create .env file with:
SHOPIFY_ADMIN_API_BASE_URL=https://your-store.myshopify.com/admin/api/2025-07
SHOPIFY_ACCESS_TOKEN=your_access_token_here
USE_DUMMY_RESPONSES=true  # Optional: returns mock data when API fails (for testing)

# Run the server
python shopify_mcp_server.py

Testing Mode (Dummy Responses)

For development and testing without valid Shopify credentials, enable dummy response mode:

# In .env file
USE_DUMMY_RESPONSES=true

When enabled:

  • ✅ API errors return realistic mock data instead of error messages
  • ✅ Test tools without valid Shopify store credentials
  • ✅ See what successful responses look like
  • ✅ All responses include "dummy_mode": true flag

Demo:

python demo_dummy_responses.py

Example dummy response:

{
  "success": true,
  "dummy_mode": true,
  "order_id": 9999999999,
  "order_number": 1001,
  "financial_status": "paid",
  "total_price": "79.97",
  "note": "This is a dummy response for testing purposes"
}

Disable for production:

USE_DUMMY_RESPONSES=false  # or remove the variable entirely

Usage with MCP Clients

Claude Desktop Integration

Add to your Claude Desktop configuration file:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "shopify": {
      "command": "python",
      "args": ["C:\\path\\to\\mcp-server\\shopify_mcp_server.py"],
      "env": {
        "SHOPIFY_ADMIN_API_BASE_URL": "https://your-store.myshopify.com/admin/api/2025-07",
        "SHOPIFY_ACCESS_TOKEN": "your_access_token_here"
      }
    }
  }
}

Restart Claude Desktop, and you'll see the Shopify tools available.

MCP Inspector (Testing)

Test your server with the official MCP Inspector:

npx @modelcontextprotocol/inspector python shopify_mcp_server.py

This opens a web interface to test tool discovery and execution.

Remote Deployment

The server uses SSE (Server-Sent Events) transport for remote access, making it compatible with cloud platforms.

Railway Deployment

  1. Fork/Clone this repository

  2. Connect to Railway:

    • Go to Railway.app
    • Click "New Project" → "Deploy from GitHub repo"
    • Select this repository
  3. Set Environment Variables in Railway dashboard:

    SHOPIFY_ADMIN_API_BASE_URL=https://your-store.myshopify.com/admin/api/2025-07
    SHOPIFY_ACCESS_TOKEN=your_access_token_here
    
  4. Deploy: Railway auto-deploys from Procfile

Your MCP server will be available at: https://your-app.up.railway.app

Render Deployment

  1. Connect GitHub repo to Render
  2. Create new Web Service
  3. Set environment variables
  4. Set start command: python shopify_mcp_server.py

Other Platforms (Fly.io, Heroku, etc.)

The server works on any platform supporting Python web services. Use the start command:

python shopify_mcp_server.py

Transport Options

The server supports two transport modes (configured in code):

# SSE Transport (remote access, default)
mcp.run(transport="sse")

# STDIO Transport (local only, for Claude Desktop)
mcp.run(transport="stdio")

Current configuration: SSE (remote deployment)

Environment Variables

Variable Description Example
SHOPIFY_ADMIN_API_BASE_URL Shopify Admin API endpoint https://store.myshopify.com/admin/api/2025-07
SHOPIFY_ACCESS_TOKEN Admin API access token shpat_xxxxx
USE_DUMMY_RESPONSES Enable mock responses for testing (optional) true or false (default: false)

Security Best Practices

⚠️ Important Security Notes:

  • Never commit .env files to version control (already in .gitignore)
  • Use environment variables on hosting platforms
  • Rotate access tokens regularly
  • Enable HTTPS in production (automatic on Railway/Render)
  • Restrict API scopes to minimum required permissions

Troubleshooting

"SHOPIFY_ACCESS_TOKEN not set"

  • Verify .env file exists and contains the token
  • Check environment variables in your deployment platform

"Order not found" (404)

  • Verify the order ID is correct (use numeric ID, not order number)
  • Check API access token has permission to read orders

Tools not appearing in Claude Desktop

  • Verify configuration file path is correct
  • Check Python path in the command field
  • Restart Claude Desktop after config changes
  • Check Claude Desktop logs for errors

Development

Project Structure

mcp-server/
├── shopify_mcp_server.py   # Main MCP server
├── requirements.txt         # Python dependencies
├── .env                     # Local environment variables (gitignored)
├── Procfile                # Railway/Heroku deployment
└── README.md               # This file

Testing

Use MCP Inspector for development testing:

npx @modelcontextprotocol/inspector python shopify_mcp_server.py

Resources

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选