Package Exports
- store-chat-mcp-server
Readme
Store Chat MCP Server
An MCP (Model Context Protocol) server that enables Claude Desktop to interact with Shopify stores using the public Storefront API.
Features
- Store Code Based Access: Use store codes instead of domains for enhanced security
- Subscription Validation: Automatic checking of store subscription status
- Analytics Tracking: All tool executions are tracked for usage insights
- No Authentication Required: Uses Shopify's public Storefront API
- Rich Store Interactions: Search products, check inventory, browse collections
- Real-time Data: Direct connection to live Shopify stores
- TypeScript Support: Fully typed for better development experience
- Backward Compatibility: Still supports legacy domain-based access
Available Tools
1. search_products
Search for products in a Shopify store.
Parameters:
storeCode(recommended): The store code (e.g.,ABCD-1234)domain(deprecated): The Shopify store domain (for backward compatibility)query(required): Search query to find productslimit(optional): Maximum number of products to return (default: 10, max: 250)
2. get_product
Get detailed information about a specific product.
Parameters:
storeCode(recommended): The store code (e.g.,ABCD-1234)domain(deprecated): The Shopify store domain (for backward compatibility)productId(required): The product ID (Shopify GID) or handle (URL slug)
3. check_inventory
Check inventory levels for a specific product variant.
Parameters:
storeCode(recommended): The store code (e.g.,ABCD-1234)domain(deprecated): The Shopify store domain (for backward compatibility)variantId(required): The variant ID to check inventory for
4. get_store_info
Get general information about the Shopify store.
Parameters:
storeCode(recommended): The store code (e.g.,ABCD-1234)domain(deprecated): The Shopify store domain (for backward compatibility)
5. list_collections
List product collections in the store.
Parameters:
storeCode(recommended): The store code (e.g.,ABCD-1234)domain(deprecated): The Shopify store domain (for backward compatibility)limit(optional): Maximum number of collections to return (default: 10, max: 250)
Installation
npm install @store-chat/mcp-serverUsage with Claude Desktop
- Add the server to your Claude Desktop configuration:
{
"mcpServers": {
"store-chat": {
"command": "npx",
"args": ["@store-chat/mcp-server"]
}
}
}Restart Claude Desktop
Start chatting with any Shopify store:
Using store codes (recommended):
"Search for t-shirts using store code ABCD-1234"
"Show me the collections for store WXYZ-5678"
"Check if variant gid://shopify/ProductVariant/123 is in stock for store ABCD-1234"Using domains (legacy):
"Search for t-shirts in the quickstart-6f5d3a6e.myshopify.com store"
"Show me the collections available"
"Check if variant gid://shopify/ProductVariant/123 is in stock"Configuration
Set the following environment variables for the MCP server:
# API endpoint configuration (required for store code validation)
STORE_CHAT_API_URL=https://your-app.myshopify.com
# API secret for authentication (required)
ANALYTICS_API_SECRET=your-secret-key
# Optional: Custom analytics API key
ANALYTICS_API_KEY=your-api-keyDevelopment
Setup
# Clone the repository
git clone <repository-url>
# Navigate to the MCP server package
cd packages/mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run devTesting
# Run tests
npm test
# Run linting
npm run lint
# Type checking
npm run typecheckProject Structure
src/
├── index.ts # Main server entry point
├── config.ts # Configuration management
├── api/
│ └── client.ts # API client for validation & analytics
├── middleware/
│ └── store-validation.ts # Store validation middleware
├── shopify/
│ └── client.ts # Shopify Storefront API client
├── tools/
│ ├── index.ts # Tool exports
│ ├── search-products.ts
│ ├── get-product.ts
│ ├── check-inventory.ts
│ ├── get-store-info.ts
│ └── list-collections.ts
└── utils/
└── logger.ts # Winston logger configurationExample Store for Testing
You can test the MCP server with this example Shopify store:
- Domain:
quickstart-6f5d3a6e.myshopify.com
This is a public demo store that's perfect for testing all the available tools.
How It Works
- Store Validation: When a tool is called with a store code, the server validates it with the main app API
- Subscription Check: The server verifies the store has an active subscription (ACTIVE or TRIAL status)
- Tool Execution: If validation passes, the requested operation is performed using the store's domain
- Analytics Tracking: After execution, usage analytics are sent back to the main app
Error Handling
The server includes comprehensive error handling:
- Invalid store codes are validated and reported
- Expired subscriptions block access with clear messages
- Invalid store domains are caught and reported
- Network errors are logged and returned as user-friendly messages
- GraphQL errors are parsed and displayed clearly
- All errors include context for debugging
Logging
The server uses Winston for structured logging:
- Set
LOG_LEVELenvironment variable to control verbosity - Logs include timestamps, error stacks, and request context
- Console output is colorized for better readability
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT
Support
For issues, questions, or contributions, please visit the GitHub repository.