Skip to content

Add platform handlers for Shopify and Wix with domain/config detection#69

Merged
prasjaiswal merged 7 commits intomainfrom
feature/platform-handlers-shopify
Feb 16, 2026
Merged

Add platform handlers for Shopify and Wix with domain/config detection#69
prasjaiswal merged 7 commits intomainfrom
feature/platform-handlers-shopify

Conversation

@prasjaiswal
Copy link
Collaborator

@prasjaiswal prasjaiswal commented Feb 16, 2026

Summary

  • Adds a new platform-handlers provider package with ShopifyMCPHandler and WixMCPHandler for keyword-based retrieval via MCP endpoints
  • KeywordRetrievalHandler base class extends DefaultAskHandler — overrides only _run_query_body(), inheriting the full pipeline (decontextualization, ranking, summarization)
  • LLM-powered query rewriting converts natural language to 1-5 keyword search queries
  • Adds domain pattern matching (*.myshopify.com, *.wixsite.com) and platform config field (platform: shopify/wix) detection to SiteSelectingHandler in handler.py
  • Adds ProductSchema, GenericResultSchema, and isSummary() type guard to frontend parseSchema.ts
  • Fixes result deduplication in useNlWeb.ts to use @id || url

Detection cascade (handler.py)

  1. Domain pattern: myshopify.com → ShopifyMCPHandler, wixsite.com → WixMCPHandler
  2. Platform config: platform: shopify or platform: wix in site_config handler section
  3. Explicit handler class: existing ask_handler_class + ask_handler_import_path
  4. Default: DefaultAskHandler (vector DB retrieval)

New files

  • ask_api/packages/providers/platform_handlers/ — full package with base, shopify, wix, query_rewrite
  • 43 tests across 4 test files (base, query_rewrite, shopify, wix)

Test plan

  • make check passes in ask_api (295 tests, 0 pyright errors)
  • make check passes in frontend
  • Live tested: domain auto-detection selects correct handler for .myshopify.com and .wixsite.com domains
  • Live tested: platform: shopify and platform: wix config entries route to correct handler
  • Live tested: query rewriting produces good keyword queries
  • End-to-end test with a Shopify/Wix store that has MCP enabled (current test stores return 404 from MCP endpoints)

🤖 Generated with Claude Code

Introduces a new nlweb-platform-handlers package that enables querying
platform search APIs directly (e.g., Shopify MCP) instead of relying on
a pre-indexed vector database. This is useful for sites that have their
own search endpoints.

Architecture:
- KeywordRetrievalHandler extends DefaultAskHandler, overriding only
  _run_query_body() — inherits the full pipeline (decontextualization,
  elicitation, ranking, summarization) for free
- LLM-based query rewriting converts natural language to keyword queries
  suited for platform search APIs
- ShopifyMCPHandler queries stores via https://{site}/api/mcp using the
  search_shop_catalog tool and converts products to schema.org format
- Zero changes to handler.py — uses existing SiteSelectingHandler
  config-driven routing via ask_handler_class + ask_handler_import_path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns:
List of RetrievedItem objects with schema.org formatted data.
"""
...
Prashant Jaiswal and others added 4 commits February 16, 2026 13:05
Adds WixMCPHandler alongside ShopifyMCPHandler in the platform-handlers
package. Queries Wix sites via https://{site}/_api/mcp using
SearchSiteApiDocs (products/services) with fallback to SearchInSite
(general content). Auto-detects content type (Product, Article, WebPage)
and converts to schema.org format. Handles Wix media ID to CDN URL
conversion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Frontend changes to support Shopify/Wix platform handler results:
- Add ProductSchema with offers, brand, ratings, and tags
- Add OfferSchema (Offer + AggregateOffer) for product pricing
- Add GenericResultSchema as fallback for any schema.org type
- Add isSummary(), isProductResult(), isGenericResult() type guards
- Reorder parseSchema() to try Summary first, add Product + Generic
- Fix result deduplication in useNlWeb to use @id || url instead of
  just @id (platform results may not have @id)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds two automatic detection steps before explicit handler config:

1. Domain pattern matching (no HTTP, just string matching):
   *.myshopify.com → ShopifyMCPHandler
   *.wixsite.com → WixMCPHandler

2. Site config 'platform' field for custom domains:
   sites:
     www.mycustomshop.com:
       platform: shopify

Both use lazy dynamic imports — if nlweb-platform-handlers isn't
installed, detection gracefully falls back to DefaultAskHandler.
Refactors handler import logic into shared _import_handler() method.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prasjaiswal prasjaiswal changed the title Add platform handlers package with Shopify MCP support Add platform handlers for Shopify and Wix with domain/config detection Feb 16, 2026
Prashant Jaiswal and others added 2 commits February 16, 2026 13:49
Add 8 Shopify stores (gymshark, allbirds, kyliecosmetics, stevemadden,
brooklinen, bombas, rothys, colourpop) and 7 Wix sites as platform
config entries for testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prasjaiswal prasjaiswal merged commit 28e25ad into main Feb 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant