# shopify-ai-mcp

MCP (Model Context Protocol) server for Shopify store management. Connect any AI assistant (Claude, etc.) to your Shopify store for product management, SEO optimization, collection management, and order monitoring.

## Features

- **Product Management** - List, search, get details, and update products
- **SEO Optimization** - Update meta titles and descriptions, bulk SEO updates across products
- **Collection Management** - List, create collections, and add products to them
- **Order Monitoring** - List and filter orders by status, date, and fulfillment
- **Store Info** - Get store metadata, plan info, and configuration

## Prerequisites

You need a Shopify store with a **Custom App** that has Admin API access.

### Creating a Shopify Access Token

1. Go to your Shopify Admin panel
2. Navigate to **Settings > Apps and sales channels > Develop apps**
3. Click **Create an app** and give it a name (e.g. "AI MCP Server")
4. Click **Configure Admin API scopes** and enable:
   - `read_products`, `write_products`
   - `read_orders`
   - `read_product_listings`
   - `read_inventory`
5. Click **Install app** and copy the **Admin API access token**

The token starts with `shpat_`.

## Installation

### Use with Claude Desktop

Add this to your Claude Desktop config file:

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

```json
{
  "mcpServers": {
    "shopify": {
      "command": "npx",
      "args": ["-y", "shopify-ai-mcp"],
      "env": {
        "SHOPIFY_STORE_URL": "mystore.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

### Use with Claude Code

```bash
claude mcp add shopify -- npx -y shopify-ai-mcp

# Then set the environment variables in your shell:
export SHOPIFY_STORE_URL="mystore.myshopify.com"
export SHOPIFY_ACCESS_TOKEN="shpat_xxxxxxxxxxxxxxxxxxxxx"
```

### Global Install

```bash
npm install -g shopify-ai-mcp

# Set environment variables
export SHOPIFY_STORE_URL="mystore.myshopify.com"
export SHOPIFY_ACCESS_TOKEN="shpat_xxxxxxxxxxxxxxxxxxxxx"

# Run
shopify-ai-mcp
```

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `SHOPIFY_STORE_URL` | Yes | Your Shopify store URL (e.g. `mystore.myshopify.com`) |
| `SHOPIFY_ACCESS_TOKEN` | Yes | Admin API access token (starts with `shpat_`) |

## Tools

### list_products

List products with optional filtering.

| Parameter | Type | Description |
|-----------|------|-------------|
| `limit` | number | Products to return (1-250, default 50) |
| `status` | string | Filter: `active`, `draft`, or `archived` |
| `vendor` | string | Filter by vendor name |
| `product_type` | string | Filter by product type |
| `collection_id` | number | Filter by collection |

### get_product

Get full product details including variants, images, options, and SEO metadata.

| Parameter | Type | Description |
|-----------|------|-------------|
| `product_id` | number | Shopify product ID |

### update_product

Update product fields. Only provided fields are changed.

| Parameter | Type | Description |
|-----------|------|-------------|
| `product_id` | number | Product ID to update |
| `title` | string | New product title |
| `body_html` | string | New description (HTML) |
| `tags` | string | Comma-separated tags |
| `status` | string | `active`, `draft`, or `archived` |
| `vendor` | string | Product vendor |
| `product_type` | string | Product type |
| `seo_title` | string | SEO meta title |
| `seo_description` | string | SEO meta description |

### bulk_update_seo

Batch update SEO fields across multiple products.

| Parameter | Type | Description |
|-----------|------|-------------|
| `updates` | array | Array of `{ product_id, seo_title?, seo_description? }` (max 100) |

### list_collections

List all custom and smart collections.

| Parameter | Type | Description |
|-----------|------|-------------|
| `limit` | number | Max per type (1-250, default 50) |

### create_collection

Create a new custom collection.

| Parameter | Type | Description |
|-----------|------|-------------|
| `title` | string | Collection title |
| `body_html` | string | Description (HTML) |
| `published` | boolean | Whether published (default true) |
| `sort_order` | string | Sort order for products |

### add_to_collection

Add products to an existing custom collection.

| Parameter | Type | Description |
|-----------|------|-------------|
| `collection_id` | number | Target collection ID |
| `product_ids` | number[] | Product IDs to add (max 100) |

### search_products

Search products by title keyword.

| Parameter | Type | Description |
|-----------|------|-------------|
| `query` | string | Search keyword |

### get_store_info

Get store metadata (no parameters). Returns name, domain, plan, currency, timezone, and more.

### list_orders

List orders with filtering.

| Parameter | Type | Description |
|-----------|------|-------------|
| `limit` | number | Orders to return (1-250, default 50) |
| `status` | string | `open`, `closed`, `cancelled`, or `any` |
| `financial_status` | string | `paid`, `pending`, `refunded`, etc. |
| `fulfillment_status` | string | `shipped`, `unshipped`, `partial`, etc. |
| `created_at_min` | string | ISO 8601 date filter (after) |
| `created_at_max` | string | ISO 8601 date filter (before) |

## Example Usage

Once connected, you can ask your AI assistant things like:

- "List all active products"
- "Search for products with 'shirt' in the title"
- "Update the SEO title and description for product 123456"
- "Show me all orders from last week"
- "Create a new collection called 'Summer Sale'"
- "Add products 111, 222, 333 to the Summer Sale collection"
- "Update the SEO for all products in the store with better descriptions"

## Done-For-You Service

Don't want to set this up yourself? I'll optimize your entire Shopify store for you.

**[Hire me on Fiverr](https://www.fiverr.com/therealjlc)** - I use this exact tool to optimize your products, SEO, and collections. Starting at $50.

**[ShopForge AI](https://shopify-ai-agency.vercel.app)** - Learn more about the full service.

## API Version

This server uses the Shopify Admin REST API version **2025-01**.

## License

MIT
