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.
npx -y @QuentinCody/shopify-storefront-mcp-serverOverview
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:
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):
# or
Docker (optional):
Common environment variables
| Variable | Description |
|---|---|
| SHOPIFY_STORE_DOMAIN | Your shop domain (e.g., my-shop.myshopify.com) |
| SHOPIFY_STOREFRONT_TOKEN | Storefront API access token (public token) |
| PORT | Port the MCP server listens on (default 3000) |
| HOST | Host 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
Example: fetch a product by handle
Responses are JSON-formatted and simplified for agent consumption (e.g., product summaries and relevant pagination cursors).
Use Cases
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.
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.
Inventory-aware chatbots
- Agents can use get_product_by_handle to confirm variant availability or price before suggesting items in chat conversations.
Automated merchandising insights
- Periodically call list_collections to build dashboards showing top collections and curated product lists, or to re-rank recommendations.
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)
;
;
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