UNPKG

@mayurgodhani/ecomtools-cli

Version:

E-commerce tools MCP server for Shopify development

197 lines (139 loc) 4.42 kB
# ecomTools A comprehensive Shopify e-commerce toolkit for AI assistants that provides helpful utilities and code generation for e-commerce development. [![npm version](https://img.shields.io/npm/v/@mayurgodhani/ecomtools-cli.svg)](https://www.npmjs.com/package/@mayurgodhani/ecomtools-cli) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) ## Features - Generate product schema markup for SEO - Calculate discounts and pricing - Generate common Shopify components like cart drawers - Access code snippets and references for e-commerce development ## Quick Start You can run ecomTools using npx without installing: ```bash npx -y @mayurgodhani/ecomtools-cli@latest start ``` This will start the ecomTools MCP server that can be used with compatible AI assistants. ## MCP Configuration If you're using an IDE or environment that supports Model Context Protocol (MCP), you can add the following configuration to your `mcp.json` file: ```json { "mcpServers": { "ecomtools-cli": { "command": "npx", "args": [ "-y", "@mayurgodhani/ecomtools-cli@latest start" ] } } } ``` This configuration allows your IDE to automatically start the ecomTools MCP server when needed. ## Installation If you prefer to install globally: ```bash npm install -g @mayurgodhani/ecomtools-cli ``` Then run it with: ```bash ecomtools start ``` ## Usage with AI Assistants ecomTools is designed to work with AI assistants that support the Model Context Protocol (MCP). Once the server is running, your AI assistant can leverage it for e-commerce development tasks. ## Available Tools and Examples ### 1. Calculate Discount Calculate discounted prices with detailed breakdown. **Example:** ``` Calculate the discount for a product with price $99.99 and a 25% discount using ecomTools. ``` **Result:** ``` Original price: $99.99 Discount: 25% ($25.00) Final price: $74.99 ``` ### 2. Generate Product Schema Create JSON-LD product schema for SEO. **Example:** ``` My product name is Premium Coffee Maker, description is High-quality automatic coffee maker with timer, price is $149.99. Currency I am selling in is USD. The product image is at https://example.com/images/coffee-maker.jpg. Generate product schema using ecomTools. ``` **Result:** ```html <script type="application/ld+json"> { "@context": "https://schema.org/", "@type": "Product", "name": "Premium Coffee Maker", "description": "High-quality automatic coffee maker with timer", "image": "https://example.com/images/coffee-maker.jpg", "offers": { "@type": "Offer", "price": 149.99, "priceCurrency": "USD" } } </script> ``` ### 3. Find Code Snippets Find code snippets by keywords. **Example:** ``` Find code snippets related to "product card" using ecomTools. ``` **Result:** ``` # Shopify Product Card A responsive product card component for displaying products in collections with image, title, price, and add to cart button. ``` ### 4. Generate Code Generate common e-commerce components. **Example:** ``` Generate a cart drawer component for mobile view using ecomTools. ``` **Result:** ``` # Generated Shopify cart-drawer Code Based on your requirements: cart drawer component for mobile view <!-- Cart Drawer HTML --> <div id="cart-drawer" class="cart-drawer"> ... </div> ``` ## Extending ecomTools is designed to be extensible. You can add your own code snippets to the `data` directory. ### Adding Code Snippets Create a new text file in the `data` directory with the following format: ``` Title: Your Code Snippet Title Description: A brief description of what this code does Code: // Your actual code here ``` The file name should reflect the type of snippet (e.g., `cart-drawer.txt`). ## Development To set up the development environment: ```bash git clone https://github.com/mayur2010/ecomtools-cli.git cd ecomtools-cli npm install ``` Run locally: ```bash npm start ``` ## Publishing To publish to npm: 1. Update the version in `package.json` 2. Run `npm login` to log in to your npm account 3. Run `npm publish --access public` ## License MIT ## Credits This project was built with: - [Model Context Protocol](https://modelcontextprotocol.github.io/) - [Commander.js](https://github.com/tj/commander.js/) - [Chalk](https://github.com/chalk/chalk) - [Ora](https://github.com/sindresorhus/ora)