Skip to content

MCP Extension Reference

Some extensions publish reference documentation for the Badger Commerce MCP server: what each field means, its valid values and defaults, and worked examples. A client lists an extension's sections with extensions getSchema and reads one with extensions getReference (extensionName, sectionCode). This page is that same text, word for word, so it can be read without connecting to a shop.

Generated page

This page is generated from the code. ExtensionReferenceDocTest (commerce-core) fails when it differs from what the MCP server returns; regenerate it by running that test with -Dupdate.reference=true.

See MCP & OAuth2 for the server itself and JSON Components for the jsonComponent block.

eventDetails

Shows an event's date and time, venue, doors open, ticket status and an add-to-calendar link on its product page.

Section code Title Contents
placement Where it goes Which stereotype and slot carry it, and how to hide parts

Where it goes (eventDetails / placement)

Event Ticket products get the eventProduct stereotype when they have no stereotype of their own (manageProducts and the admin both do this), and that stereotype carries eventDetails in the variantDisplay slot with priority 500, above the ticket-type picker. Settings for every event live on the eventProduct stereotype's block (changed with manageExtensionConfig). Settings for one event come from an eventDetails block on that product in the same slot: an item's own placement replaces the stereotype's. Fields: showVenue, showDoorsOpen, showStatus, showCalendarLink (all true by default). Doors open shows only when checkInOpensMinutesBefore is above 0. On a product that isn't an event, or an event without a start, it renders nothing. The add-to-calendar link serves /events/{skuId}/calendar.ics.

jsonComponent

Create custom UI components using a JSON design language with semantic styling and data binding. Components are theme-agnostic and can be generated with AI assistance.

Section code Title Contents
components Component Types Available component types and their props
data-binding Data Binding Context paths for user, order, site, and item data
media Media Library Images How media library images are referenced
data-sources Data Sources Server-side data providers and syntax
semantic-tokens Semantic Style Tokens All available style tokens (typography, colors, spacing, etc.)
layout-rules Layout & Rules Layout modes and document rules
examples Examples Working JSON component examples

Component Types (jsonComponent / components)

Available Components:

- container: A layout container for grouping components with spacing, background options, and optional background images. Has children.
  Props: style [spacing, padding, background, backgroundImage, backgroundOverlay, backgroundPosition, backgroundSize, radius, shadow, maxWidth, border, animation], children

- row: A horizontal flex container for arranging components side by side. Has children.
  Props: stackOnMobile, style [gap, align, justify, animation], children

- column: A vertical flex container for stacking components with optional width control. Has children.
  Props: width [1/4, 1/3, 1/2, 2/3, 3/4, full, auto], mobileWidth [1/2, full, auto], style [gap, align, maxWidth, animation], children

- heading: A text heading (h1-h6) for titles and section headers.
  Props: level, text (bindable), style [variant, color, align, transform, tracking, textStyle]

- text: A paragraph or inline text element.
  Props: text (bindable), style [variant, color, align, transform, tracking, textStyle]

- image: An image element with optional styling.
  Props: src (bindable), alt (bindable), style [radius, shadow, width, height]

- link: A navigation link to another page or URL.
  Props: text (bindable), href (bindable), action, style [variant]

- button: A clickable button for navigation with optional icon.
  Props: text (bindable), icon ["" (none), arrow-right, arrow-left, chevron-right, chevron-left, shopping-cart, shopping-bag, heart, star, check, plus, minus, search, download, upload, external-link, mail, phone, user, log-in, log-out], iconPosition [left, right], action, style [variant, color]

- spacer: An empty space element for adding vertical or horizontal gaps.
  Props: size [xs, sm, md, lg, xl]

- divider: A horizontal line separator for visual breaks between content sections.
  Props: thickness [thin, md, thick], lineStyle [solid, dashed, dotted], style [color, spacing]

- blockquote: A styled quote block with optional author attribution for testimonials.
  Props: quote (bindable), author (bindable), role (bindable), avatar (bindable), style [variant, color, background]

- icon: A Lucide icon with customizable size and color.
  Props: name [arrow-right, arrow-left, arrow-up, arrow-down, chevron-right, chevron-left, chevron-up, chevron-down, menu, x, check, plus, minus, search, settings, edit, trash, copy, download, upload, external-link, shopping-cart, shopping-bag, credit-card, tag, gift, percent, truck, package, mail, phone, message-circle, share, heart, star, thumbs-up, info, alert-circle, check-circle, x-circle, help-circle, user, users, log-in, log-out, home, calendar, clock, map-pin, eye, lock, shield, award, zap, sparkles, rocket], size [xs, sm, md, lg, xl], style [color]

- carousel: A simple image carousel with auto-advance.
  Props: images, autoPlay, interval, showIndicators, showControls, style [radius, shadow]

- tabs: A tabbed content container for organizing content into panels. Has children.
  Props: style [variant], children

- tab: An individual tab panel with label and content. Has children.
  Props: label (bindable), active, children

- accordion: A collapsible content container for expandable sections. Has children.
  Props: allowMultiple, style [variant], children

- accordionItem: An individual accordion section with title and collapsible content. Has children.
  Props: title (bindable), expanded, children

- productGrid: A responsive grid of product cards populated from a data source.
  Props: dataSource, columns, mobileColumns, showPrice, showDescription, cardVariant [standard, compact, featured], style [gap, padding, background, radius]

- productCarousel: A horizontally scrollable strip of product cards from a data source. bleed: "both" runs the strip to both edges of the screen (first card still lines up with the content), "end" to the trailing edge only; ignored inside a row or column.
  Props: dataSource, autoScroll, scrollInterval, showPrice, cardVariant [standard, compact, featured], bleed [none, end, both], style [gap, padding, background, radius]

- productCard: A single product card from a data source at a given index.
  Props: dataSource, index, showImage, showPrice, showDescription, variant [standard, compact, featured], style [padding, background, radius, shadow]

Data Binding (jsonComponent / data-binding)

## Data Binding

A dynamic value is written {"$ref": "/context/path", "fallback": "default value"}.
The "fallback" is shown when the path has no value. Optional "format" property:
capitalize, uppercase, lowercase, trim

### User Context (/user/*)
- /user/loginName - User's email/login
- /user/personalDetails/firstName - First name
- /user/personalDetails/lastName - Last name
- /user/personalDetails/title - Title (Mr, Mrs, etc.)
- /user/personalDetails/emailAddress - Email address
- /user/personalDetails/mobilePhoneNumber - Phone number
- /user/attributes/{key} - Custom user attributes

### Order/Basket Context (/order/*)
- /order/number - Order number
- /order/state - Order status
- /order/price/total - Total price (in cents)
- /order/price/currencyCode - Currency (GBP, USD, etc.)
- /order/price/tax - Tax amount
- /order/price/discount - Discount amount
- /order/lineItems - Array of order items
- /order/personalDetails/firstName - Billing first name
- /order/personalDetails/lastName - Billing last name

### Site Context (/siteContext/*)
- /siteContext/siteName - Site display name
- /siteContext/logoURL - Site logo URL
- /siteContext/productImagePath - Base path for media/images
- /siteContext/socialAccounts/{platform} - Social media links

### Item Context (/item/* - depends on page type)

For Products:
- /item/productName - Product title
- /item/price - Price (in cents)
- /item/comparePrice - Original/compare price
- /item/description - Full description
- /item/miniDescription - Short description
- /item/manufacturer - Brand name
- /item/seoName - URL-friendly name
- /item/images/0/url - Primary image URL
- /item/images/0/altText - Primary image alt text
- /item/quantityInStock - Stock level
- /item/attributes/{key} - Custom product attributes

For Collections:
- /item/name - Collection name
- /item/description - Collection description
- /item/seoName - URL-friendly name

For Pages:
- /item/name - Page name
- /item/attributes/{key} - Custom page attributes

### Last Order Context (/lastOrder/*)
Same structure as /order/* but for the customer's most recent completed order.
Useful for order confirmation pages.

Media Library Images (jsonComponent / media)

## Media Library Images

A media library image's URL is made of:
- Site's media path: /siteContext/productImagePath
- Media file path: The relative path stored in media library

Example for a product image:
{
  "type": "image",
  "props": {
    "src": {"$ref": "/item/images/0/url"},
    "alt": {"$ref": "/item/images/0/altText", "fallback": "Product image"}
  }
}

Example for a static media library image (the full URL: productImagePath followed
by the media's url):
{
  "type": "image",
  "props": {
    "src": "https://images.example.com/my-site/media/hero-banner.jpg",
    "alt": "Welcome banner"
  }
}

A static src is used exactly as written: nothing is prepended to it. Only product
image bindings (/item/images/...) are prefixed with productImagePath automatically, so
a static image's src is its full URL.

Data Sources (jsonComponent / data-sources)

Available Data Source Types:

- collection-products: Returns products from a collection. Params: collection (seoName, required), limit (int, default 12), offset (int, default 0), inStockOnly (boolean, default false).
- merchandising-node-products: Returns products bound to a merchandising-tree node. Params: nodeId (string, optional) OR path (string, optional, e.g. "/c/womens/coats"); treeId (string, optional, defaults to primary tree); limit (int, default 12); offset (int, default 0).
- recently-viewed: Returns the current user's recently viewed products. Params: limit (int, default 10). Requires logged-in user.
- trending-products: Returns trending products. Params: limit (int, default 8), hoursToCheck (int, default 24).


### Data Source Syntax

Data sources are declared at the top level of the JSON definition and fetch product data server-side. They are resolved before rendering and injected into the component tree.

They go in a "dataSources" object at the root level (sibling of "component"):

{
  "version": "1.0",
  "dataSources": {
    "mySourceName": {
      "type": "source-type",
      "params": { ... }
    }
  },
  "component": { ... }
}

### Using Data Sources in Components

A component names a declared data source in its dataSource prop:

{
  "type": "productGrid",
  "props": { "dataSource": "mySourceName", "columns": 4 }
}

### Data Binding with Data Sources

Resolved data is also accessible via $ref paths under /data/:
- /data/{sourceName}/0/productName - First product's name
- /data/{sourceName}/0/price - First product's price

Semantic Style Tokens (jsonComponent / semantic-tokens)

## Semantic Style Tokens

These are the values the "style" prop accepts. Each token becomes a theme class, so a
raw CSS value (such as "16px" or "#333") has no effect.

### Typography Variants (variant)
- display-xl: Marketing hero headline (very large, responsive, tight tracking)
- display-lg: Section hero headline (large, responsive)
- display-md: Sub-section headline (medium, responsive)
- heading-xl: Extra large heading (display size)
- heading-lg: Large heading (h1 equivalent)
- heading-md: Medium heading (h2 equivalent)
- heading-sm: Small heading (h3 equivalent)
- body-lg: Large body text (lead paragraphs)
- body-md: Standard body text
- body-sm: Small body text (captions, fine print)
- subheadline: Marketing subheadline (larger body, muted, max-width for readability)
- overline: Uppercase label text (small, semibold, primary color, wide tracking)
- overline-pill: Pill-shaped overline with primary background tint
- button-primary: Primary button styling
- button-secondary: Secondary button styling
- link: Link text styling
- link-arrow: Link with animated arrow icon on hover

### Colors (color)
Base colors:
- primary: Brand primary color (typically indigo/blue)
- secondary: Secondary/subdued color
- muted: De-emphasized text (gray)
- success: Success/positive (green)
- error: Error/negative (red)
- warning: Warning/caution (amber)

Light/dark variants:
- primary-light, primary-dark: Lighter/darker primary shades
- secondary-light, secondary-dark: Lighter/darker secondary shades
- success-light, success-dark: Lighter/darker success shades
- error-light, error-dark: Lighter/darker error shades
- warning-light, warning-dark: Lighter/darker warning shades

Gray scale:
- gray-light: Light gray text
- gray: Medium gray text
- gray-dark: Dark gray text

Utility:
- white: White text
- black: Black text

### Text Style (textStyle)
- gradient: Gradient text effect (primary to secondary color gradient on text)

### Spacing & Gap (spacing, gap)
- none: 0
- xs: 4px
- sm: 8px
- md: 16px
- lg: 24px
- xl: 32px
- 2xl: 48px
- 3xl: 64px

### Padding (padding)
- none, xs, sm, md, lg, xl (same scale as spacing)
- 2xl: Extra large padding (64px)
- 3xl: Maximum padding (96px)
- section: Vertical section padding with horizontal container padding (64px / 24px)
- section-lg: Large vertical section padding (96px / 24px)

### Background (background)
Base:
- surface: Light gray surface
- primary: Brand primary color background (white text)
- transparent: No background
- white: Pure white

Surface variants:
- surface-light: Very light surface
- surface-dark: Slightly darker surface
- primary-subtle: Subtle gradient from primary tint to white (great for section intros)

Gradient & pattern backgrounds (for marketing/landing pages):
- gradient: Multi-color gradient (primary-50 to white to secondary-50)
- gradient-dark: Dark gradient (deep indigo to near-black to dark blue) with white text
- mesh: Organic mesh gradient with subtle primary/secondary/accent radials on white
- mesh-dark: Dark mesh gradient with colored radials on near-black, with white text
- dark: Solid dark background (near-black) with white text
- dots: Subtle dot grid pattern background

Primary variants:
- primary-light: Light primary tint (great for subtle highlights)
- primary-dark: Dark primary shade (white text)

Status backgrounds (for alerts, badges, notifications):
- success, success-light: Success backgrounds (green tints)
- error, error-light: Error backgrounds (red tints)
- warning, warning-light: Warning backgrounds (amber tints)

Gray scale:
- gray-light: Very light gray background
- gray: Light gray background
- gray-dark: Medium gray background

### Alignment (align)
- left: Left-align text
- center: Center text
- right: Right-align text
- start: Flex align-items start
- end: Flex align-items end

### Justify (justify) - for row/column
- start: Items at start
- center: Items centered
- end: Items at end
- between: Space between items
- around: Space around items

### Border Radius (radius)
- none: Square corners
- sm: Slightly rounded
- md: Medium rounded
- lg: Large rounded
- full: Fully rounded (pill/circle)

### Shadow (shadow)
- none: No shadow
- sm: Subtle shadow
- md: Medium shadow
- lg: Prominent shadow
- xl: Extra prominent shadow

### Width/Height (width, height)
- full: 100%
- auto: Auto-size

### Max Width (maxWidth) - for readable text lines
- prose: Optimal reading width (65 characters)
- sm: Small max-width (640px)
- md: Medium max-width (768px)
- lg: Large max-width (1024px)
- xl: Extra large max-width (1280px)
- full: 100% max-width
- none: No max-width constraint

### Column Width (width prop on column component)
- 1/4: 25% width
- 1/3: 33.333% width
- 1/2: 50% width
- 2/3: 66.666% width
- 3/4: 75% width
- full: 100% width
- auto: Equal distribution (default)

### Text Transform (transform)
- uppercase: UPPERCASE text
- lowercase: lowercase text
- capitalize: Capitalize Each Word
- none: No transformation

### Letter Spacing / Tracking (tracking)
- tight: Tighter letter spacing (-0.025em)
- normal: Default letter spacing
- wide: Wider letter spacing (0.025em)
- wider: Even wider spacing (0.05em)
- widest: Maximum spacing (0.1em)

### Background Image (backgroundImage, backgroundPosition, backgroundSize, backgroundOverlay)
- backgroundImage: URL string for background images (e.g., "media/hero.jpg" or external URL)
- backgroundPosition: center, top, bottom, left, right
- backgroundSize: cover (fills container), contain (fits inside), auto
- backgroundOverlay: none, light (30%), medium (50%), dark (70%), heavy (85%) - for text readability

### Border (border) - on containers
- default: Standard gray border
- light: Light gray border
- dark: Darker gray border
- none: No border
- accent-top: Primary-colored 3px top border
- gradient-top: Gradient (primary to secondary) 3px top border

### Animation (animation) - on containers, rows, columns
- reveal: Fade-in and slide-up when element scrolls into view (uses IntersectionObserver)
- stagger: Each direct child animates in sequence with 100ms delay between them

Layout & Rules (jsonComponent / layout-rules)

## Layout Modes

The top-level "layout" field controls how the component fills the page:

- **"layout": "fluid"** (default) - Full-width, edge-to-edge. Suits hero sections with background images.
- **"layout": "contained"** - Constrained to page container width. Suits standard content sections.

Example full-width hero:
{"version": "1.0", "layout": "fluid", "component": {...}}

Example contained content:
{"version": "1.0", "layout": "contained", "component": {...}}

Full-width backgrounds with constrained content: "layout": "fluid" with a container inside that has "maxWidth": "prose" or similar.

## Full-bleed product carousels

A productCarousel normally stops at the edges of the page's content column. "bleed": "both" runs its strip to both edges of the screen: at rest the first card still lines up with the heading above it, and scrolling runs edge to edge. "bleed": "end" breaks out on the trailing (right) side only. Default "none". Bleed is ignored when the carousel is inside a row or column, because a half-width column stays inside its box; a bleeding carousel belongs at the top level or in a plain container. Bleed also assumes the block sits in a centred column, so it does not suit a sidebar slot.

Example: {"type": "productCarousel", "props": {"dataSource": "shop", "bleed": "both"}}

## Document rules

1. The document is {"version": "1.0", "component": {...}}, plus the optional top-level "layout" and "dataSources"
2. Every component has a "type" and optionally "key", "props", "children"
3. Styling is semantic tokens only; raw CSS values such as "16px" or "#333" have no effect
4. Data bindings are {"$ref": "/context/path", "fallback": "default"}
5. Navigation buttons and links take action: {"type": "navigate", "href": "/path"}
6. The document is strict JSON: no comments, no trailing commas
7. Prices are stored in minor units (cents/pence): 1299 is 12.99
8. A binding's fallback is what shows when the data is missing (for example a visitor who isn't signed in has no first name)

Examples (jsonComponent / examples)

## Example: Welcome Banner with User Personalization

{
  "version": "1.0",
  "component": {
    "type": "container",
    "props": {
      "style": { "padding": "lg", "background": "surface", "radius": "md" }
    },
    "children": [
      {
        "type": "heading",
        "props": {
          "level": 2,
          "text": { "$ref": "/user/personalDetails/firstName", "fallback": "Welcome", "format": "capitalize" },
          "style": { "variant": "heading-lg", "color": "primary" }
        }
      },
      {
        "type": "text",
        "props": {
          "text": "Thanks for visiting our store!",
          "style": { "variant": "body-md", "color": "muted" }
        }
      },
      {
        "type": "spacer",
        "props": { "size": "md" }
      },
      {
        "type": "button",
        "props": {
          "text": "Browse Products",
          "action": { "type": "navigate", "href": "/collections" },
          "style": { "variant": "button-primary" }
        }
      }
    ]
  }
}

## Example: Trending Products Grid with Data Source

{
  "version": "1.0",
  "dataSources": {
    "trending": {
      "type": "trending-products",
      "params": { "limit": 8 }
    }
  },
  "component": {
    "type": "container",
    "props": { "style": { "padding": "lg" } },
    "children": [
      {
        "type": "heading",
        "props": { "level": 2, "text": "Trending Now", "style": { "variant": "heading-md" } }
      },
      {
        "type": "spacer",
        "props": { "size": "md" }
      },
      {
        "type": "productGrid",
        "props": { "dataSource": "trending", "columns": 4, "showPrice": true }
      }
    ]
  }
}

## Example: Two-Column Layout

{
  "version": "1.0",
  "component": {
    "type": "row",
    "props": {
      "style": { "gap": "lg", "align": "start" }
    },
    "children": [
      {
        "type": "column",
        "props": {
          "style": { "gap": "md" }
        },
        "children": [
          {
            "type": "heading",
            "props": {
              "level": 2,
              "text": "About Us",
              "style": { "variant": "heading-md" }
            }
          },
          {
            "type": "text",
            "props": {
              "text": "We are passionate about quality.",
              "style": { "variant": "body-md" }
            }
          }
        ]
      },
      {
        "type": "column",
        "props": {
          "style": { "gap": "md" }
        },
        "children": [
          {
            "type": "heading",
            "props": {
              "level": 2,
              "text": "Contact",
              "style": { "variant": "heading-md" }
            }
          },
          {
            "type": "link",
            "props": {
              "text": "Get in touch",
              "href": "/contact",
              "style": { "variant": "link", "color": "primary" }
            }
          }
        ]
      }
    ]
  }
}