Skip to main content
Layers exposes two Model Context Protocol (MCP) servers that let AI assistants interact directly with your stores. Use them to manage merchandising, search tuning, catalog operations, and storefront queries through any MCP-compatible client.

Layers MCP server

The main MCP server exposes tools for managing your Layers stores. It uses OAuth authentication and requires the mcp:use scope.

Connecting

The official Layers connector is available in the Claude directory. Add it from Settings > Connectors in Claude, then authorize Layers when prompted. If you are using a different MCP client, configure it with the following endpoint:
When you connect for the first time, you’re redirected to the Layers dashboard to authorize the connection. After authorization, your MCP client stores the OAuth tokens and reconnects automatically. MCP connections are scoped to specific stores and specific permissions. On the authorization screen, you choose which stores the connection can access and which of your own permissions it may use. A connection can never exceed your own access - and if your access is later reduced, the connection’s access is reduced immediately to match. Because connections are store-scoped, store-list returns only the stores granted to the connection. If a tool is called for a store that wasn’t granted the permission it needs, the tool returns a permission error.

Available tools

Most write tools are consolidated into a single *-manage tool per resource. Pass an action (for example list, create, update, delete) to control what the tool does, so listing and mutation share one tool per resource.

Submitting feedback about MCP tooling

Admin MCP connections can call mcp-feedback to report friction with the MCP itself. Use it when an assistant hits a rough edge you want the platform to fix. Examples include a missing capability, a schema field that isn’t exposed, an action that takes too many calls, or a tool description that led an agent astray. The tool accepts a short set of fields: Example call:
The response confirms the submission:
delivered is false when feedback routing isn’t configured for the environment. The submission is still recorded.

Usage pattern

1

List your stores

Call store-list to see all stores you have access to. Note the store slug for each store you want to work with.
2

Pass the store slug

Include the store slug in all subsequent tool calls. For example, if your store is my-store.myshopify.com, the slug is my-store.
3

Use manage tools to make changes

Tools ending in -manage accept an action parameter - commonly list, create, update, or delete, plus tool-specific actions such as toggle_status or the bulk variants below. Read-only actions like list are safe to call freely.

Example: create a merchandising rule

Ask your AI assistant:
“Pin the product ‘Classic White Tee’ to position 1 in the Summer Sale collection, and boost all products where brand is ‘Nike’ using a soft boost expression.”
The assistant calls merchandise-rules-manage with action: "create" and the appropriate parameters - handling pin positions, collection targeting, and expression configuration automatically.

Bulk actions

Several -manage tools accept bulk variants so an assistant can apply the same change to many records in one call:
  • blocks-manage - bulk_publish, bulk_unpublish, bulk_duplicate, bulk_delete (pass block_ids)
  • merchandise-rules-manage - bulk_enable, bulk_disable, bulk_delete (pass rule_ids)
Use bulk actions to act on many records at once - for example, unpublishing all draft blocks after a seasonal campaign, or disabling a batch of merchandising rules outside their window.
The response includes an affected_count so the assistant can confirm how many records changed.

Collaborative editor

Assistants edit merchandising rules, sort orders, and facet values through a collaborative editing flow instead of direct writes. An assistant announces presence on a resource, reads the current shared document and its revision, then applies small RFC 6902 JSON Patch operations. This lets multiple humans and agents work on the same resource without overwriting each other. It also powers the same real-time collaboration experience that shows other editors in the dashboard. When an agent calls set_presence or apply_patch, humans on the same page see the agent live in the dashboard. The agent gets its own presence avatar with a distinct color, and its focused field or selected rows are tinted and locked like any other collaborator’s. On the facet-values editor, a compact agent activity popover also surfaces the intent and message your agent supplies. Provide a short, human-readable activity.intent and activity.message on set_presence, and a concise metadata.intent on apply_patch. This lets a human co-editor tell at a glance what your agent is doing. Use the collaborative editor tools when your assistant needs to change:
  • Merchandising rule fields, pins, or banners
  • Sort order fields (referenced by id or handle)
  • Facet value sorting, grouping, and hidden values (referenced by attribute id or code)
For read-only inspection or listing, keep using merchandise-rules-manage, sort-orders-manage, and facet-values-manage with action: "list".
Direct write actions on merchandise-rules-manage and sort-orders-manage (create, update, delete, bulk_*, toggle_status, and so on) now return a compatibility error that points to the collaborative editor tools. Update your prompts and agents to use set_presence + apply_patch for writes.

Editing flow

1

Announce presence and read the document

Call set_presence with the store, resource_type, and resource_id. The first call for an agent run creates a new presence_id. The response includes the presence_id, current document, revision, active_editors, and an expires_at timestamp.
2

Plan and (optionally) validate patches

Build small RFC 6902 patches against the public roots /fields, /pins, and /banners. Prefer granular list operations like add /pins/-, replace /pins/5, remove /pins/3, and move over replacing the entire /pins or /banners collection. Call validate_document first when it would reduce risk - for example, before a large or unusual patch.
3

Apply the patch

Call apply_patch with the same presence_id, the observed revision, and the RFC 6902 patch list. Patches are applied atomically: if any operation fails, no changes are committed and the revision is unchanged. On success, the response returns the new revision and document.
4

Refresh presence and retry on conflict

Presence expires at expires_at unless refreshed. Calling set_presence again with the same presence_id refreshes it, and successful apply_patch calls also refresh presence for that run. If a patch fails with a stale revision or a failed test operation, refresh presence to re-read the document and re-plan.

set_presence

Declares an agent’s activity state and returns the shared document. Supported activity_state values are viewing, editing, thinking, and validating.
Example response:
Pass a sort order handle or id as resource_id when resource_type is sort_order. Concurrent runs from the same OAuth client each receive their own presence_id so they can expire independently.

validate_document

Validates the current document or a proposed set of patches without applying changes. Whole-collection replacements return warnings so agents prefer granular list operations.

apply_patch

Applies an atomic RFC 6902 patch. Requires an active presence_id from set_presence and the latest observed revision. Supported operations are add, remove, replace, move, copy, and test. Patch paths must be under /fields, /pins, or /banners.
Use test before replace to catch concurrent edits:
Explaining edits with metadata.notes
metadata accepts an optional notes object that maps an exact patch path in the same call to a one-line reason for the change. Notes appear in the dashboard’s agent activity feed as the caption for that step, so a human co-editor can see why the agent made each change.
Rules for notes:
  • Each key must match a path present in the same patches list. Notes for unknown paths are dropped.
  • Values must be non-empty strings. Non-strings and empties are dropped.
  • Notes are trimmed and capped at 240 characters.
  • Write a short reason (why this helps the shopper), not a restatement of the operation.
Agents that omit notes behave exactly as before.

Error handling

apply_patch returns deterministic errors so agents can recover automatically:

Requesting publish approval

apply_patch only updates the shared draft. To publish a merchandising rule, an agent asks a human reviewer to approve the change. The reviewer approves or rejects the request from the dashboard, and Layers records the agent’s identity in the config audit log when it publishes. Use request_publish when the user asks you to save or publish, then poll check_publish_request until the request settles. Do not call apply_patch again on the same rule while a request is pending unless the reviewer rejects it or the user explicitly asks for more edits. Publish requests are supported for resource_type: "merchandising_rule". Facet values and sort orders publish through their own flows (see Editing facet values).
1

Request approval

Call request_publish with the same presence_id and the latest observed revision. Include an optional message describing what changed so the reviewer has context. The response includes a publish_request_id, a same-origin review_url, and an expires_at timestamp.
2

Share the review URL and wait

Send the review_url to the user so they (or another grant owner) can open the review modal in the dashboard. While a request is pending, the shared draft is protected from reconciliation, so unrelated dashboard events will not overwrite it.
3

Poll for the outcome

Call check_publish_request with the publish_request_id until settled is true. The final status is published, rejected, superseded, or expired. Publish requests expire after 72 hours.
4

Handle the result

On published, the changes are live and config_version_id points at the resulting config version. On rejected or expired, you can edit the rule again and call request_publish again. On superseded, a newer request has replaced this one - switch to the newer publish_request_id.
request_publish
Creates a pending publish request for the shared document the agent is currently editing. Requires an active presence_id from set_presence and the revision you last observed. The revision must still match the current room revision, or the tool returns a RevisionMismatch error - refresh presence and try again.
Example response:
Requesting publish while another request is still pending for the same rule marks the older request as superseded and returns the new publish_request_id.
check_publish_request
Returns the current state of a publish request. Safe to call as often as needed.
Example response after approval:
status values:

collaborative-merchandising-editor prompt

The Layers MCP server exposes a collaborative-merchandising-editor prompt that describes the full safe-edit workflow, including the request_publish handshake. MCP clients that surface prompts (for example, Claude Desktop) can select it to prime an assistant with the correct presence-then-patch-then-request sequence before making changes.

Editing facet values

Facet value sorting, grouping, and hidden values live inside a filterable attribute’s configuration. Assistants co-edit them through the same collaborative editor tools by passing resource_type: "facet_values" and the attribute id or code as resource_id. The shared document exposes two keys under /fields:
  • facet_value_group_sorts - an ordered list of { facet_value, position, facet_value_group_filter } entries. position controls the manual storefront order, and facet_value_group_filter is { name } when the value belongs to a named group (all values sharing one facet_value_group_filter.name render as one group), or null when ungrouped.
  • hidden_values - a list of facet value strings that are hidden on the storefront.
Rows in facet_value_group_sorts carry no ids. The server keys sorts by facet_value and groups by name (both distinct per attribute) and owns the underlying UUIDs. Never send an id on a sort entry or on facet_value_group_filter - it will be rejected. Facet value sorting, grouping, and hidden values can only be written through this shared editor plus facet-values-manage publish. attributes-manage create and update reject facet_value_group_sorts and hidden_values with a 422 that points back to the shared editor - don’t try to set them alongside other attribute fields. Facets don’t have /pins or /banners, so patches must target /fields/facet_value_group_sorts or /fields/hidden_values. The attributes.view permission is required to read a facet’s document and attributes.edit is required to apply patches or publish. Reorder a value:
Group two values under a shared display name by giving both entries the same facet_value_group_filter.name:
Hide a value from the storefront:
Publishing the draft
apply_patch only updates the shared draft. In the dashboard, a human presses Save to commit that draft. When an agent is running on its own with no human editing the room, call facet-values-manage with action: "publish" and the target attribute to commit the draft to the store.
  • Publish is refused while a human is co-editing the room. In that case the response is { "published": false, "reason": "human_editing" } - keep co-editing with apply_patch and let the human press Save, or retry publish after they leave.
  • Publish is refused if you have not seeded or edited the draft in this session, to prevent an empty draft from wiping existing config.
  • Successful publishes write to the store via the same code path as the dashboard Save action and appear in the MCP audit log.

collaborative-facet-editor prompt

The Layers MCP server also exposes a collaborative-facet-editor prompt covering the presence-patch-publish flow, /fields patch boundaries, and the human-in-the-loop rule for publishing. Select it before asking an assistant to reorder, group, or hide facet values.

Working with grouped attributes

Some attributes are containers that hold other attributes rather than a single filterable value - for example, a “dimensions” attribute that wraps length, width, and height. MCP tools treat these differently:
  • Groups are listed but not selectable. attributes-manage with action: "list" returns grouped attributes as read-only entries with their child attributes nested under children. Only the scalar children are marked selectable.
  • Search, browse, facets, and sort orders reject group codes. Passing a group, object, or otherwise non-selectable attribute code to filter_group, facets, or a sort order returns a validation error. When the parent has scalar children, the error lists them so your assistant can retry with a valid code.
Use attributes-manage with action: "list" to discover which attributes are selectable before building filters or sort orders.

Fetching attribute values

Call attributes-manage with action: "values" to enumerate the values available for a single scalar attribute. Use it before building filter_group conditions when your assistant needs to know what values a facet actually contains. For example, list every vendor or size before choosing one to filter on. The response depends on the attribute’s type:
  • Categorical attributes return a cursor-paginated values array. Pass the returned next_cursor back in a follow-up call to fetch the next page.
  • Numeric attributes return a range object with the minimum and maximum values in the catalog.
Both responses can be scoped to a collection with collection_handle so the values reflect only products in that collection.

Classifying attributes for query understanding

attributes-manage create and update accept a data.classes array that controls how the query-understanding pipeline uses an attribute. Set it separately from is_searchable, keyword_search_weight, and enable_as_storefront_facet - each switch controls a different behavior. Pass one or more classes; values are lowercased and deduped server-side. To leave the existing classes unchanged on update, omit the classes key. Passing null or any non-array value returns a validation error rather than clearing the field.
Toggling is_searchable triggers a catalog reindex, so batch those changes. The attribute-setup prompt walks an assistant through the full workflow - discovering the attribute, sampling values with query_catalog, picking classes, and verifying with product-search-diagnostics. Select it from an MCP client that surfaces prompts (for example, Claude Desktop) before asking an agent to classify attributes.

Diagnosing search coverage

Use product-search-diagnostics when a product is missing from search-semantic results, to verify what content reached its search document, or to confirm an attribute change flowed through. Resolve a product by numeric id, Shopify gid (gid://shopify/Product/...), or handle. Pass include_variant_documents: true on per-variant-indexed products to include the rendered document text for each variant. The response has three sections:
On dev stores that skip LLM content selection, the payload’s content_selection field is "skipped" - the store indexes the full unfiltered catalog instead.

Diagnosing missing facets

product-search-diagnostics also explains facet availability. Pass facet_codes (and optionally a collection handle) to check why a facet you requested from the Facets API is missing from the response:
The response’s facet_diagnostics section lists the requested codes, which were included, and which were dropped with a reason: attribute_not_found, not_enabled_as_facet, attribute_not_filterable, facet_still_building, or facet_build_failed. These are the same readiness checks the Facets API applies when serving requests, so a dropped code here explains a missing facet in storefront responses. See When a facet goes live for how facet builds work. For a store-wide rollup, call store-operational-status and read search_documents. It returns aggregate ready, pending, and needs_attention counts across the catalog. The same response includes a facets section with each facet’s build phase and last refresh time under states, plus a withheld list naming any enabled facets the API is currently holding back and why.

Example: run an analytics query

Analytics is exposed through LayersQL. Ask your assistant to inspect the schema first, then run a query:
Call layersql-schema to discover available datasets, metrics, and dimensions. Omit dataset to get a compact syntax cheat-sheet with clause order, operators, and two example queries. Pass include_reference: true for the full syntax reference. Call layersql-validate-query to check a query before you run it.

MCP audit log

Every write action your assistant performs through the Layers MCP server is recorded alongside dashboard configuration changes in the store’s Activity Log. Each MCP entry captures the tool, action, user, store, and timestamp. Review activity in the dashboard under Configure → Access & Security → Activity Log. MCP actions appear in the same feed as configuration edits, so you can see everything that changed in a store in one place. Filter by event, action, or free-text search, and open any entry to inspect its details. The operational context attached to an MCP call is only visible to users with API key management permissions. Lower-privilege users still see that an MCP action happened, but not its raw context.

Storefront MCP server

The Storefront MCP server exposes read-only storefront operations as MCP tools. It uses the same access token as the Storefront REST API, so you can integrate AI assistants into customer-facing experiences.

Connecting

Configure your MCP client with the storefront endpoint and your API token:
Authentication uses the same storefront access token you use for the REST API. Pass it as a bearer token in the authorization header.

Available tools

Common parameters

Most search and browse tools accept these optional parameters:
By default, search-text and browse strip the _meta payload from responses to keep results compact. Pass debug: true when you need scoring diagnostics - for example, when debugging why a product ranked where it did.
filter_group, facets, and sort orders only accept scalar attribute codes. Group or container attribute codes are rejected with a validation error that lists the selectable child attributes when they’re available.

Example: text search with debug

When to use each server

  • Use the Layers MCP server when you want an AI assistant to help manage your store - creating merchandising rules, tuning search behavior, building sort orders, or exploring analytics.
  • Use the Storefront MCP server when you want to integrate AI-powered product discovery into a customer-facing experience. It’s also useful when building AI agents that need to search and browse your catalog.

Next steps