SH

Shopify Storefront MCP Server for AI Agents

Discover Shopify storefronts with this MCP server, enabling AI agents to fetch products, collections, and store data via the Storefront API.

Quick Install
npx -y @QuentinCody/shopify-storefront-mcp-server

Overview

This MCP (Model Context Protocol) server exposes Shopify Storefront data as machine-readable tools that AI agents can discover and call. It sits between an agent and the Shopify Storefront API, translating standard tool calls into Storefront API queries so agents can fetch products, collections, and store metadata without embedding Shopify credentials.

The server is useful when you want agents (chatbots, RAG agents, automated assistants) to interact with a Shopify storefront in a safe, discoverable way. By implementing the MCP discovery endpoints and a small set of resource endpoints, the project makes it straightforward to let models query storefront content, search products, and retrieve collection information programmatically.

Repository: https://github.com/QuentinCody/shopify-storefront-mcp-server

Features

  • MCP-compliant discovery endpoint for AI agents to find available tools
  • Proxy endpoints for common Storefront API operations: product search, product by handle, collection listing, and store metadata
  • Configurable via environment variables (Shopify domain + Storefront API token)
  • Lightweight and framework-agnostic (easy to run locally or in containers)
  • Example requests and integration patterns for agent tool use

Installation / Configuration

Prerequisites: Node.js (14+), a Shopify store with a Storefront API access token.

Clone and install:

git clone https://github.com/QuentinCody/shopify-storefront-mcp-server.git
cd shopify-storefront-mcp-server
npm install

Create a .env file in the project root with your Storefront credentials:

SHOPIFY_STORE_DOMAIN=your-store.myshopify.com
SHOPIFY_STOREFRONT_TOKEN=your-storefront-access-token
PORT=3000
HOST=0.0.0.0

Start the server (development):

npm run dev
# or
npm start

Docker (optional):

docker build -t shopify-mcp .
docker run -e SHOPIFY_STORE_DOMAIN=your-store.myshopify.com \
           -e SHOPIFY_STOREFRONT_TOKEN=token \
           -p 3000:3000 shopify-mcp

Common environment variables

VariableDescription
SHOPIFY_STORE_DOMAINYour shop domain (e.g., my-shop.myshopify.com)
SHOPIFY_STOREFRONT_TOKENStorefront API access token (public token)
PORTPort the MCP server listens on (default 3000)
HOSTHost binding (default 0.0.0.0)

Available Tools / Resources

The server exposes an MCP discovery endpoint (e.g., /mcp) that lists the available tools. Typical tools provided include:

  • search_products
    • Search the store by query text, returning product snippets (id, title, handle, price, image).
  • get_product_by_handle
    • Retrieve full product details given a product handle (variants, description, images).
  • list_collections
    • Return collections with basic metadata and top products.
  • get_collection_by_handle
    • Fetch a collection and its products by handle.
  • get_store_info
    • Retrieve store-wide metadata (name, currency, locale).

Example discovery response (JSON) will include the tool name, description, and the endpoint URL agents should call.

Example: call the search tool

curl "http://localhost:3000/tools/search_products?q=running+shoes"

Example: fetch a product by handle

curl "http://localhost:3000/tools/get_product_by_handle?handle=classic-tshirt"

Responses are JSON-formatted and simplified for agent consumption (e.g., product summaries and relevant pagination cursors).

Use Cases

  1. Dynamic product answering

    • An assistant can use search_products to respond to user queries like “Show me eco-friendly water bottles under $30” and return matched products with prices and buy links.
  2. Content generation for marketing

    • Fetch product descriptions and images with get_product_by_handle, then automatically generate marketing copy or social posts using an LLM.
  3. Inventory-aware chatbots

    • Agents can use get_product_by_handle to confirm variant availability or price before suggesting items in chat conversations.
  4. Automated merchandising insights

    • Periodically call list_collections to build dashboards showing top collections and curated product lists, or to re-rank recommendations.
  5. Guided shopping flows

    • Use collection endpoints to populate multi-step shopping assistants that present categories, refine by filters, and create cart links.

Example client snippet (Node.js)

import fetch from 'node-fetch';

async function searchProducts(q) {
  const res = await fetch(`http://localhost:3000/tools/search_products?q=${encodeURIComponent(q)}`);
  return res.json();
}

(async () => {
  const results = await searchProducts('leather wallet');
  console.log(results);
})();

Notes and Best Practices

  • Keep your Storefront API token secure; the MCP server centralizes access so you do not need to embed secrets into agent clients.
  • The server intentionally simplifies responses for agent consumption—if you need additional fields, extend the server to include them.
  • Consider rate limits: Shopify Storefront API has usage limits and your MCP server should handle retries, caching, and error surfaces gracefully for production deployments.

For full code, examples, and the exact discovery schema, see the project on GitHub: https://github.com/QuentinCody/shopify-storefront-mcp-server