Layers MCP server
The main MCP server exposes tools for managing your Layers stores. It uses OAuth authentication and requires themcp:use scope.
Connecting
Configure your MCP client with the following endpoint: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.
Store
Store
Catalog
Catalog
Search
Search
Attributes
Attributes
Search tuning
Search tuning
Merchandising
Merchandising
Sort orders
Sort orders
Collaborative editor
Collaborative editor
Products
Products
Analytics (LayersQL)
Analytics (LayersQL)
Knowledge
Knowledge
Documentation
Documentation
Feedback
Feedback
Submitting feedback about MCP tooling
Admin MCP connections can callmcp-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:
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(passblock_ids)merchandise-rules-manage—bulk_enable,bulk_disable,bulk_delete(passrule_ids)
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 callsset_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)
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.
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.
test before replace to catch concurrent edits:
Error handling
apply_patch returns deterministic errors so agents can recover automatically:
collaborative-merchandising-editor prompt
The Layers MCP server exposes a collaborative-merchandising-editor prompt that describes the full safe-edit workflow. MCP clients that surface prompts (for example, Claude Desktop) can select it to prime an assistant with the correct presence-then-patch 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 passingresource_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.positioncontrols the manual storefront order, andfacet_value_group_filteris{ name }when the value belongs to a named group (all values sharing onefacet_value_group_filter.namerender as one group), ornullwhen ungrouped.hidden_values— a list of facet value strings that are hidden on the storefront.
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:
facet_value_group_filter.name:
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 withapply_patchand 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 wrapslength, width, and height. MCP tools treat these differently:
- Groups are listed but not selectable.
attributes-managewithaction: "list"returns grouped attributes as read-only entries with their child attributes nested underchildren. Only the scalar children are markedselectable. - 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.
attributes-manage with action: "list" to discover which attributes are selectable before building filters or sort orders.
Fetching attribute values
Callattributes-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
valuesarray. Pass the returnednext_cursorback in a follow-up call to fetch the next page. - Numeric attributes return a
rangeobject with the minimum and maximum values in the catalog.
collection_handle so the values reflect only products in that collection.
Example: run an analytics query
Analytics is exposed through LayersQL. Ask your assistant to inspect the schema first, then run a query:layersql-schema to discover available datasets, metrics, and dimensions, and 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 underConfigure → 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: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
- Manage API access to create storefront tokens
- Learn about request transforms and merchandising to understand what you can configure through MCP
- Explore the API reference for the underlying REST endpoints