Skip to main content

GraphQL Query

The GraphQL Query tool executes queries and mutations against Magento's GraphQL API.

The tool automatically discovers the full GraphQL schema, including types, queries, and mutations registered by third-party modules. Any module that extends the GraphQL schema will have its operations available through this tool — no additional configuration is needed.

Access control

Access to this tool is controlled by the MCP Tools -> Built in -> System -> GraphQL Query ACL resource. Enable or disable it in System -> Permissions -> User Roles -> [Role] -> Role Resources.

note

Magento's GraphQL API does not use ACL-based endpoint permissions the way REST API does. Once the tool is enabled for a role, the AI client can execute any GraphQL query or mutation that Magento's schema supports.

Mutation limitations

Some GraphQL mutations require an authenticated customer session (e.g., updateCustomerEmail, addProductsToCart for a customer cart, placeOrder). These mutations are not available through MCP by design — executing actions on behalf of a customer without their active session would constitute customer impersonation, which violates data protection principles under regulations such as GDPR and CCPA.


Parameters

ParameterDescriptionTypeRequired
queryGraphQL query or mutationstringYes
variablesVariables for the queryobjectNo
store_codeStore code to execute the query against (e.g., default, de, fr). Uses the default store if not specified.stringNo

When to use

GraphQL is best for:

  • Catalog data — products, categories, attributes
  • Storefront operations — cart, checkout, customer data
  • Combining related data in a single request (e.g., product with its categories, images, and prices)
  • Store-specific data — prices, translations, and content for a specific store view

Store context

Use the store_code parameter to query data as it appears in a specific store view. This affects:

  • Product prices and currencies
  • Translated content (product names, descriptions, CMS pages)
  • Store-specific configurations

Schema introspection

To explore the available GraphQL schema, use an introspection query:

{
__schema {
types {
name
}
}
}

Or get details about a specific type:

{
__type(name: "ProductInterface") {
name
fields {
name
type {
name
}
}
}
}

Examples

Search products:

{
products(search: "bag", pageSize: 5, sort: {name: ASC}) {
items {
sku
name
price_range {
minimum_price {
final_price {
value
currency
}
}
}
}
total_count
}
}

Get category tree:

{
categories(filters: {ids: {eq: "2"}}) {
items {
id
name
children {
id
name
product_count
}
}
}
}

Get CMS page:

{
cmsPage(identifier: "home") {
title
content
meta_title
meta_description
}
}

Store-specific query:

Query with store_code: "de" to get German translations and EUR prices:

{
products(filter: {sku: {eq: "24-MB01"}}) {
items {
name
price_range {
minimum_price {
final_price {
value
currency
}
}
}
}
}
}