@anton.andrusenko/shopify-mcp-admin 0.7.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +416 -6
  2. package/dist/index.js +1867 -183
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @anton.andrusenko/shopify-mcp-admin
2
2
 
3
- > 🛍️ **MCP Server for Shopify Admin API** — Enable AI agents to manage Shopify stores with 71 powerful tools
3
+ > 🛍️ **MCP Server for Shopify Admin API** — Enable AI agents to manage Shopify stores with 81 powerful tools
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/@anton.andrusenko%2Fshopify-mcp-admin.svg)](https://www.npmjs.com/package/@anton.andrusenko/shopify-mcp-admin)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -11,7 +11,8 @@
11
11
 
12
12
  ## ✨ Features
13
13
 
14
- - 🛠️ **71 MCP Tools** — Complete store management: products, inventory, collections, pages, blogs, redirects, metafields, markets, locales & translations
14
+ - 🛠️ **81 MCP Tools** — Complete store management: products, inventory, collections, pages, blogs, redirects, metafields, markets, locales & translations
15
+ - 📦 **Modular Architecture** — 7 modules with lazy loading for optimal AI performance (see [Tool Modules](#-tool-modules))
15
16
  - 🤖 **AI-Optimized** — Tool descriptions and error messages designed for LLM comprehension
16
17
  - 🔌 **Dual Transport** — STDIO for Claude Desktop, HTTP for ChatGPT/OpenAI
17
18
  - ⚡ **Rate Limiting** — Automatic retry with exponential backoff for Shopify API limits
@@ -107,6 +108,8 @@ Tokens are automatically refreshed every 24 hours.
107
108
  | `PORT` | No | `3000` | HTTP server port (when `TRANSPORT=http`) |
108
109
  | `DEBUG` | No | — | Enable debug logging (`1` or `true`) |
109
110
  | `LOG_LEVEL` | No | `info` | Log level: `debug`, `info`, `warn`, `error` |
111
+ | `SHOPIFY_MCP_LAZY_LOADING` | No | `true` | Enable modular lazy loading (set to `false` for all tools at startup) |
112
+ | `SHOPIFY_MCP_ROLE` | No | — | Role preset for automatic module loading (see [Role Presets](#-role-presets)) |
110
113
 
111
114
  **⚡ Authentication:** Provide EITHER `SHOPIFY_ACCESS_TOKEN` (legacy) OR both `SHOPIFY_CLIENT_ID` and `SHOPIFY_CLIENT_SECRET` (Dev Dashboard).
112
115
 
@@ -248,16 +251,114 @@ Each tool can be converted to OpenAI function format:
248
251
 
249
252
  ---
250
253
 
254
+ ## 🎭 Role Presets
255
+
256
+ Role presets automatically load appropriate tool modules at startup, optimizing the tool set for specific workflows and reducing AI context overhead.
257
+
258
+ ### Available Presets
259
+
260
+ | Preset | Modules | Tools | Use Case |
261
+ |--------|---------|-------|----------|
262
+ | `inventory-manager` | core | 15 | Stock management and inventory operations |
263
+ | `product-manager` | core, store-context, collections, product-extensions | 41 | Full product catalog management |
264
+ | `content-manager` | core, content | 37 | Pages, blogs, and content marketing |
265
+ | `seo-specialist` | core, collections, product-extensions, advanced-redirects | 38 | SEO optimization and URL management |
266
+ | `international-manager` | core, store-context, international, collections | 46 | Multi-market and translation management |
267
+ | `full-access` | All 7 modules | 81 | Full store administration |
268
+
269
+ ### Using Role Presets
270
+
271
+ Set the `SHOPIFY_MCP_ROLE` environment variable:
272
+
273
+ ```bash
274
+ export SHOPIFY_MCP_ROLE=product-manager
275
+ npx @anton.andrusenko/shopify-mcp-admin
276
+ ```
277
+
278
+ Or in Claude Desktop config:
279
+
280
+ ```json
281
+ {
282
+ "mcpServers": {
283
+ "shopify": {
284
+ "command": "npx",
285
+ "args": ["-y", "@anton.andrusenko/shopify-mcp-admin"],
286
+ "env": {
287
+ "SHOPIFY_STORE_URL": "your-store.myshopify.com",
288
+ "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxx",
289
+ "SHOPIFY_MCP_ROLE": "product-manager"
290
+ }
291
+ }
292
+ }
293
+ }
294
+ ```
295
+
296
+ ### Module Discovery
297
+
298
+ If no role is set, the server starts with core tools only (15 tools). AI agents can discover and load additional modules dynamically:
299
+
300
+ 1. **Discover modules**: Use `list-modules` to see available modules
301
+ 2. **Load modules**: Use `load-module` with the module name to enable tools
302
+ 3. **Suggestions**: Tool responses include suggestions for relevant modules to load
303
+
304
+ ---
305
+
251
306
  ## 🛠️ Available Tools
252
307
 
253
- @anton.andrusenko/shopify-mcp-admin provides **71 tools** organized into 16 categories:
308
+ @anton.andrusenko/shopify-mcp-admin provides **81 tools** (79 domain tools + 2 meta-tools) organized into 16 categories:
254
309
 
255
310
  <details>
256
- <summary><strong>🏪 Store Info (1 tool)</strong></summary>
311
+ <summary><strong>🏪 Store Info (9 tools)</strong></summary>
257
312
 
258
313
  | Tool | Description |
259
314
  |------|-------------|
260
315
  | `get-store-info` | Get basic store information (name, domain, plan, currency, timezone, email) |
316
+ | `get-store-limits` | Get store resource limits (max variants, max options, location limit) |
317
+ | `get-store-features` | Get feature flags (gift cards, reports, storefront, bundles, subscriptions) |
318
+ | `get-store-currencies` | Get multi-currency configuration (base currency, presentment currencies, formats) |
319
+ | `get-store-shipping` | Get shipping configuration (ships-to countries, countries in shipping zones) |
320
+ | `get-store-domain` | Get primary domain configuration (hostname, URL, SSL status) |
321
+ | `get-store-taxes` | Get tax configuration (taxes included in prices, tax shipping) |
322
+ | `get-store-policies` | Get legal policies (privacy, terms of service, refund policy) |
323
+ | `get-store-alerts` | Get admin alerts and setup requirements |
324
+
325
+ #### Example: Get Store Limits
326
+
327
+ ```json
328
+ {
329
+ "maxProductVariants": 2000,
330
+ "maxProductOptions": 3,
331
+ "locationLimit": 1000,
332
+ "redirectLimitReached": false
333
+ }
334
+ ```
335
+
336
+ #### Example: Get Store Features
337
+
338
+ ```json
339
+ {
340
+ "giftCards": true,
341
+ "reports": true,
342
+ "storefront": true,
343
+ "bundles": {
344
+ "eligibleForBundles": true
345
+ },
346
+ "sellsSubscriptions": false
347
+ }
348
+ ```
349
+
350
+ #### Example: Get Store Currencies
351
+
352
+ ```json
353
+ {
354
+ "currencyCode": "USD",
355
+ "enabledPresentmentCurrencies": ["USD", "EUR", "GBP", "CAD"],
356
+ "currencyFormats": {
357
+ "moneyFormat": "${{amount}}",
358
+ "moneyWithCurrencyFormat": "${{amount}} USD"
359
+ }
360
+ }
361
+ ```
261
362
 
262
363
  </details>
263
364
 
@@ -453,6 +554,289 @@ Each tool can be converted to OpenAI function format:
453
554
 
454
555
  ---
455
556
 
557
+ ## 📦 Tool Modules
558
+
559
+ shopify-mcp-admin uses a modular architecture to optimize AI agent performance. Instead of loading all 81 tools at startup (which can degrade AI performance by up to 85%), tools are organized into 7 modules that can be loaded on demand.
560
+
561
+ ### How Module Loading Works
562
+
563
+ 1. **At startup:** Only the **Core Module** (15 tools) is loaded by default
564
+ 2. **Discovery:** AI agents use `list-modules` to see available modules
565
+ 3. **Loading:** AI agents use `load-module` to enable additional tools
566
+ 4. **Suggestions:** Tool responses include hints about which modules to load next
567
+
568
+ ### Module Dependency Diagram
569
+
570
+ ```
571
+ ┌─────────────────────────────────────────────────────────────────┐
572
+ │ CORE MODULE │
573
+ │ (Always Loaded - 15 tools) │
574
+ │ Products (7) • Inventory (4) • Store Info (2) • Meta (2) │
575
+ └─────────────────────────────────────────────────────────────────┘
576
+
577
+ ├──────────────────────────────────────────────────────────┐
578
+ │ │
579
+ ▼ ▼
580
+ ┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐
581
+ │ STORE CONTEXT │ │ COLLECTIONS │ │ CONTENT │
582
+ │ (7 tools) │ │ (10 tools) │ │ (22 tools) │
583
+ │ No deps │ │ No deps │ │ No deps │
584
+ └───────────────────┘ └───────────────────┘ └───────────────────┘
585
+
586
+ ├──────────────────────┼──────────────────────────────────┐
587
+ │ │ │
588
+ ▼ ▼ ▼
589
+ ┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐
590
+ │ INTERNATIONAL │ │ PRODUCT EXTENSIONS│ │ ADVANCED REDIRECTS│
591
+ │ (14 tools) │ │ (9 tools) │ │ (4 tools) │
592
+ │ No deps │ │ No deps │ │ Deps: product-ext │
593
+ └───────────────────┘ └───────────────────┘ └───────────────────┘
594
+ ```
595
+
596
+ ### Module: Core (15 tools) — Always Loaded
597
+
598
+ **Description:** Essential product and inventory management tools that form the foundation for most Shopify operations. Always loaded at startup.
599
+
600
+ **Dependencies:** None
601
+
602
+ **Tools:**
603
+
604
+ | Category | Tools |
605
+ |----------|-------|
606
+ | Products (7) | `create-product`, `get-product`, `update-product`, `delete-product`, `list-products`, `update-product-variant`, `add-product-image` |
607
+ | Inventory (4) | `get-inventory`, `update-inventory`, `list-low-inventory`, `get-bulk-inventory` |
608
+ | Store Info (2) | `get-store-info`, `get-store-limits` |
609
+ | Meta Tools (2) | `list-modules`, `load-module` |
610
+
611
+ **Use Case:** Basic product catalog management, inventory tracking, and store information queries.
612
+
613
+ ---
614
+
615
+ ### Module: Store Context (7 tools)
616
+
617
+ **Description:** Extended store configuration and context tools from Epic 11. Provides deep insights into store configuration including features, currencies, shipping, and more.
618
+
619
+ **Dependencies:** None
620
+
621
+ **Tools:**
622
+ - `get-store-features` — Feature flags (gift cards, reports, storefront, bundles)
623
+ - `get-store-currencies` — Multi-currency configuration
624
+ - `get-store-shipping` — Shipping countries and zones
625
+ - `get-store-domain` — Primary domain configuration
626
+ - `get-store-taxes` — Tax configuration
627
+ - `get-store-policies` — Legal policies (privacy, terms, refund)
628
+ - `get-store-alerts` — Admin alerts and setup requirements
629
+
630
+ **Use Case:** Understanding store capabilities before operations, multi-currency setup, tax configuration.
631
+
632
+ **Load Command:** `load-module(module: "store-context")`
633
+
634
+ ---
635
+
636
+ ### Module: Collections (10 tools)
637
+
638
+ **Description:** Product collection management for organizing products and navigation. Includes CRUD operations and metafields.
639
+
640
+ **Dependencies:** None
641
+
642
+ **Tools:**
643
+
644
+ | Category | Tools |
645
+ |----------|-------|
646
+ | CRUD (7) | `list-collections`, `get-collection`, `create-collection`, `update-collection`, `delete-collection`, `add-products-to-collection`, `remove-products-from-collection` |
647
+ | Metafields (3) | `get-collection-metafields`, `set-collection-metafields`, `delete-collection-metafields` |
648
+
649
+ **Use Case:** Organizing products into collections, SEO optimization, storefront navigation.
650
+
651
+ **Load Command:** `load-module(module: "collections")`
652
+
653
+ ---
654
+
655
+ ### Module: Product Extensions (9 tools)
656
+
657
+ **Description:** Extended product management including metafields, advanced image operations, and URL redirects for SEO.
658
+
659
+ **Dependencies:** None
660
+
661
+ **Tools:**
662
+
663
+ | Category | Tools |
664
+ |----------|-------|
665
+ | Metafields (3) | `get-product-metafields`, `set-product-metafields`, `delete-product-metafields` |
666
+ | Images (3) | `update-product-image`, `delete-product-image`, `reorder-product-images` |
667
+ | Redirects (3) | `create-redirect`, `list-redirects`, `delete-redirect` |
668
+
669
+ **Use Case:** Adding custom metadata to products, SEO image alt text, URL redirects when changing product handles.
670
+
671
+ **Load Command:** `load-module(module: "product-extensions")`
672
+
673
+ ---
674
+
675
+ ### Module: Content (22 tools)
676
+
677
+ **Description:** Content management for pages, blogs, and articles. Complete CRUD operations plus metafields for content marketing and SEO.
678
+
679
+ **Dependencies:** None
680
+
681
+ **Tools:**
682
+
683
+ | Category | Tools |
684
+ |----------|-------|
685
+ | Pages (8) | `list-pages`, `get-page`, `create-page`, `update-page`, `delete-page`, `get-page-metafields`, `set-page-metafields`, `delete-page-metafields` |
686
+ | Blogs (7) | `list-blogs`, `create-blog`, `update-blog`, `delete-blog`, `get-blog-metafields`, `set-blog-metafields`, `delete-blog-metafields` |
687
+ | Articles (7) | `list-articles`, `create-article`, `update-article`, `delete-article`, `get-article-metafields`, `set-article-metafields`, `delete-article-metafields` |
688
+
689
+ **Use Case:** Content marketing, blog management, static pages (About, Contact, FAQ).
690
+
691
+ **Load Command:** `load-module(module: "content")`
692
+
693
+ ---
694
+
695
+ ### Module: International (14 tools)
696
+
697
+ **Description:** International commerce and localization tools. Markets, web presence, and shop locale translations for multi-region stores.
698
+
699
+ **Dependencies:** None
700
+
701
+ **Tools:**
702
+
703
+ | Category | Tools |
704
+ |----------|-------|
705
+ | Markets (5) | `list-markets`, `get-market`, `create-market`, `update-market`, `delete-market` |
706
+ | Web Presence (4) | `list-web-presences`, `create-web-presence`, `update-web-presence`, `delete-web-presence` |
707
+ | Translations (5) | `list-shop-locales`, `enable-shop-locale`, `disable-shop-locale`, `register-translations`, `remove-translations` |
708
+
709
+ **Use Case:** Multi-region selling, localized storefronts, translation management.
710
+
711
+ **Load Command:** `load-module(module: "international")`
712
+
713
+ ---
714
+
715
+ ### Module: Advanced Redirects (4 tools)
716
+
717
+ **Description:** Bulk URL redirect operations for large-scale SEO management. Import and mass-delete capabilities.
718
+
719
+ **Dependencies:** `product-extensions` (auto-loaded when you load this module)
720
+
721
+ **Tools:**
722
+ - `bulk-delete-redirects` — Delete multiple redirects by ID
723
+ - `bulk-delete-redirects-by-search` — Delete redirects matching a search query
724
+ - `import-redirects` — Import redirects from CSV URL
725
+ - `submit-redirect-import` — Submit a redirect import job for processing
726
+
727
+ **Use Case:** Site migrations, bulk URL updates, SEO cleanup operations.
728
+
729
+ **Load Command:** `load-module(module: "advanced-redirects")`
730
+
731
+ > **Note:** Loading this module automatically loads `product-extensions` (9 tools) as a dependency.
732
+
733
+ ---
734
+
735
+ ### Choosing the Right Module
736
+
737
+ | If you need to... | Load these modules |
738
+ |-------------------|-------------------|
739
+ | Manage basic products and inventory | Core only (default) |
740
+ | Work with collections and organize products | `collections` |
741
+ | Add product metafields or manage images | `product-extensions` |
742
+ | Manage blog posts and pages | `content` |
743
+ | Set up international markets | `international` |
744
+ | Bulk manage URL redirects | `advanced-redirects` |
745
+ | Full store administration | Use `full-access` role preset |
746
+
747
+ ---
748
+
749
+ ## 🔄 Upgrading from Previous Versions
750
+
751
+ ### What's New in v0.8.0+: Modular Tool Loading
752
+
753
+ Starting with v0.8.0, shopify-mcp-admin uses **lazy loading** to optimize AI agent performance. Research shows that presenting more than 30 tools to an AI agent can degrade performance by up to 85%.
754
+
755
+ **Default Behavior (Lazy Loading Enabled):**
756
+ - Only 15 core tools are loaded at startup
757
+ - Additional tools are loaded on-demand via `load-module`
758
+ - AI agents discover available modules using `list-modules`
759
+ - Token usage reduced by up to 81% compared to loading all tools
760
+
761
+ ### Breaking Changes
762
+
763
+ | Previous Behavior | New Behavior (v0.8.0+) |
764
+ |-------------------|------------------------|
765
+ | All 79+ tools loaded at startup | 15 core tools loaded at startup |
766
+ | No module concept | 7 modules with lazy loading |
767
+ | N/A | `list-modules` and `load-module` meta-tools added |
768
+
769
+ ### Legacy Mode: Restore Previous Behavior
770
+
771
+ If you prefer all tools loaded at startup (not recommended for optimal AI performance):
772
+
773
+ ```bash
774
+ # Option 1: Environment variable
775
+ export SHOPIFY_MCP_LAZY_LOADING=false
776
+
777
+ # Option 2: In Claude Desktop config
778
+ {
779
+ "mcpServers": {
780
+ "shopify": {
781
+ "command": "npx",
782
+ "args": ["-y", "@anton.andrusenko/shopify-mcp-admin"],
783
+ "env": {
784
+ "SHOPIFY_STORE_URL": "your-store.myshopify.com",
785
+ "SHOPIFY_ACCESS_TOKEN": "shpat_xxxxx",
786
+ "SHOPIFY_MCP_LAZY_LOADING": "false"
787
+ }
788
+ }
789
+ }
790
+ }
791
+ ```
792
+
793
+ ### Migration Steps
794
+
795
+ 1. **Review your use case** — Do you need all 81 tools? Most workflows only need a subset.
796
+
797
+ 2. **Choose a role preset** (recommended) — Set `SHOPIFY_MCP_ROLE` for pre-configured modules:
798
+ ```bash
799
+ export SHOPIFY_MCP_ROLE=product-manager
800
+ ```
801
+
802
+ 3. **Or use on-demand loading** — Let AI agents discover and load modules as needed:
803
+ - AI uses `list-modules` to see available modules
804
+ - AI uses `load-module` with module name to enable tools
805
+ - Tool responses suggest relevant modules automatically
806
+
807
+ 4. **Or disable lazy loading** — Set `SHOPIFY_MCP_LAZY_LOADING=false` for legacy behavior
808
+
809
+ ### When to Use Each Mode
810
+
811
+ | Mode | Tools | Best For |
812
+ |------|-------|----------|
813
+ | **Lazy Loading (default)** | 15 at startup | New projects, optimal AI performance |
814
+ | **Role Preset** | 15-81 based on role | Specific workflows (e.g., content manager) |
815
+ | **Legacy Mode** | All 81 | Backward compatibility, full store admin |
816
+
817
+ ### Performance Comparison
818
+
819
+ | Mode | Tools at Startup | Est. Token Usage | AI Performance |
820
+ |------|------------------|------------------|----------------|
821
+ | Lazy Loading (default) | 15 | ~4,500 | ⭐⭐⭐ Optimal |
822
+ | inventory-manager | 15 | ~4,500 | ⭐⭐⭐ Optimal |
823
+ | content-manager | 37 | ~11,100 | ⭐⭐ Good |
824
+ | product-manager | 41 | ~12,300 | ⭐⭐ Good |
825
+ | international-manager | 46 | ~13,800 | ⭐⭐ Good |
826
+ | full-access | 81 | ~24,000 | ⭐ May degrade |
827
+ | Legacy Mode | 81 | ~24,000 | ⭐ May degrade |
828
+
829
+ ### Troubleshooting Module Loading
830
+
831
+ | Issue | Solution |
832
+ |-------|----------|
833
+ | Tool not found after upgrade | Load the appropriate module: `load-module(module: "collections")` |
834
+ | "Module not found" error | Use `list-modules` to see valid module names |
835
+ | Want all tools at startup | Set `SHOPIFY_MCP_LAZY_LOADING=false` |
836
+ | AI agent loading too many modules | Use a role preset instead of on-demand loading |
837
+
838
+ ---
839
+
456
840
  ## 🔧 Troubleshooting
457
841
 
458
842
  ### Common Errors
@@ -497,12 +881,38 @@ npm run inspect:config
497
881
 
498
882
  MCP Inspector opens a web UI at `http://localhost:6274` where you can:
499
883
 
500
- - 📋 Browse all 71 registered tools with schemas
884
+ - 📋 Browse registered tools with schemas (15 core tools by default, up to 81 with modules)
885
+ - 📦 Test module loading via `list-modules` and `load-module`
886
+ - 📊 Access 9 MCP resources for store context
501
887
  - ▶️ Execute tools interactively and view results
502
888
  - 🔍 Inspect JSON-RPC protocol messages
503
889
  - 📊 Monitor server events in real-time
504
890
 
505
- > **Tip:** Use `npm run inspect:dev` during development for instant feedback without rebuilding.
891
+ > **Tip:** Copy `mcp-inspector.example.json` to `mcp-inspector.json` for pre-configured role presets like `product-manager` or `full-access`.
892
+
893
+ ---
894
+
895
+ ## 📊 MCP Resources
896
+
897
+ The MCP server exposes comprehensive store context information via MCP resources. These are read-only data sources that AI agents can query for context.
898
+
899
+ ### Extended Store Resources
900
+
901
+ | Resource URI | Description |
902
+ |--------------|-------------|
903
+ | `shopify://store/info` | Basic store info (name, domain, plan, currency, timezone) |
904
+ | `shopify://store/limits` | Resource limits (max variants, max options, location limit) |
905
+ | `shopify://store/features` | Feature flags (gift cards, reports, storefront, bundles) |
906
+ | `shopify://store/currencies` | Multi-currency configuration (base currency, presentment currencies) |
907
+ | `shopify://store/shipping` | Shipping configuration (ships-to countries, shipping zones) |
908
+ | `shopify://store/domain` | Primary domain configuration (hostname, URL, SSL status) |
909
+ | `shopify://store/taxes` | Tax configuration (taxes included, tax shipping) |
910
+ | `shopify://store/policies` | Legal policies (privacy, terms of service, refund) |
911
+ | `shopify://store/alerts` | Admin alerts and setup requirements |
912
+
913
+ > **Note:** For MCP clients that don't support resources (e.g., Claude Desktop), equivalent tools are available. See **Store Info Tools** below.
914
+
915
+ ---
506
916
 
507
917
  ### FAQ
508
918