KosmoKrator

productivity

Magento CLI for AI Agents

Use the Magento CLI from KosmoKrator to call Magento tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Magento CLI Setup

Magento can be configured headlessly with `kosmokrator integrations:configure magento`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure magento --set access_token="$MAGENTO_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor magento --json
kosmokrator integrations:status --json

Credentials

Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
access_token MAGENTO_ACCESS_TOKEN Secret secret yes Access Token
url MAGENTO_URL URL url no API Base URL

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call magento.magento_list_products '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json
Provider shortcut
kosmo integrations:magento magento_list_products '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs magento --json
kosmo integrations:docs magento.magento_list_products --json
kosmo integrations:schema magento.magento_list_products --json
kosmo integrations:search "Magento" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

magento.magento_list_products

List products from the Magento catalog. Returns a list of products with support for search criteria filtering and pagination.

Read read
Parameters
search_criteria, page_size, current_page
Generic call
kosmo integrations:call magento.magento_list_products '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json
Shortcut
kosmo integrations:magento magento_list_products '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json

magento.magento_get_product

Get details of a specific Magento product by its SKU. Returns the full product object including attributes, pricing, and stock information.

Read read
Parameters
sku
Generic call
kosmo integrations:call magento.magento_get_product '{"sku":"example_sku"}' --json
Shortcut
kosmo integrations:magento magento_get_product '{"sku":"example_sku"}' --json

magento.magento_create_product

Create a new product in the Magento catalog. Requires SKU, name, price, and attribute set ID. Returns the created product object.

Write write
Parameters
sku, name, price, attribute_set_id, type_id, weight, description, short_description, visibility, status
Generic call
kosmo integrations:call magento.magento_create_product '{"sku":"example_sku","name":"example_name","price":1,"attribute_set_id":1,"type_id":"example_type_id","weight":1,"description":"example_description","short_description":"example_short_description"}' --json
Shortcut
kosmo integrations:magento magento_create_product '{"sku":"example_sku","name":"example_name","price":1,"attribute_set_id":1,"type_id":"example_type_id","weight":1,"description":"example_description","short_description":"example_short_description"}' --json

magento.magento_list_orders

List orders from the Magento store. Returns a list of orders with support for search criteria filtering and pagination.

Read read
Parameters
search_criteria, page_size, current_page
Generic call
kosmo integrations:call magento.magento_list_orders '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json
Shortcut
kosmo integrations:magento magento_list_orders '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json

magento.magento_get_order

Get details of a specific Magento order by its ID. Returns the full order object including items, addresses, payment, and totals.

Read read
Parameters
order_id
Generic call
kosmo integrations:call magento.magento_get_order '{"order_id":"example_order_id"}' --json
Shortcut
kosmo integrations:magento magento_get_order '{"order_id":"example_order_id"}' --json

magento.magento_list_customers

List customers from the Magento store. Returns a list of customers with support for search criteria filtering and pagination.

Read read
Parameters
search_criteria, page_size, current_page
Generic call
kosmo integrations:call magento.magento_list_customers '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json
Shortcut
kosmo integrations:magento magento_list_customers '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json

magento.magento_get_current_user

Verify Magento API connectivity and retrieve current user information. Useful as a health check to confirm the integration is properly configured.

Read read
Parameters
none
Generic call
kosmo integrations:call magento.magento_get_current_user '{}' --json
Shortcut
kosmo integrations:magento magento_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

magento.magento_list_products 3 parameters
Schema command
kosmo integrations:schema magento.magento_list_products --json
ParameterTypeRequiredDescription
search_criteria string no Search criteria filter expression (e.g., "name:like:%shirt%").
page_size integer no Number of products per page (default: 20).
current_page integer no Current page number for pagination (starts at 1).
magento.magento_get_product 1 parameters
Schema command
kosmo integrations:schema magento.magento_get_product --json
ParameterTypeRequiredDescription
sku string yes The product SKU (Stock Keeping Unit) to retrieve.
magento.magento_create_product 10 parameters
Schema command
kosmo integrations:schema magento.magento_create_product --json
ParameterTypeRequiredDescription
sku string yes Unique product SKU.
name string yes Product name.
price number yes Product price (e.g., 29.99).
attribute_set_id integer no Attribute set ID (default: 4 for Default).
type_id string no Product type (simple, configurable, virtual, etc.). Default: "simple".
weight number no Product weight.
description string no Full product description.
short_description string no Short product description.
visibility integer no Visibility (1=Not Visible, 2=Catalog, 3=Search, 4=Catalog & Search). Default: 4.
status integer no Product status (1=Enabled, 2=Disabled). Default: 1.
magento.magento_list_orders 3 parameters
Schema command
kosmo integrations:schema magento.magento_list_orders --json
ParameterTypeRequiredDescription
search_criteria string no Search criteria filter expression (e.g., "status:pending").
page_size integer no Number of orders per page (default: 20).
current_page integer no Current page number for pagination (starts at 1).
magento.magento_get_order 1 parameters
Schema command
kosmo integrations:schema magento.magento_get_order --json
ParameterTypeRequiredDescription
order_id string yes The order increment ID or entity ID.
magento.magento_list_customers 3 parameters
Schema command
kosmo integrations:schema magento.magento_list_customers --json
ParameterTypeRequiredDescription
search_criteria string no Search criteria filter expression.
page_size integer no Number of customers per page (default: 20).
current_page integer no Current page number for pagination (starts at 1).
magento.magento_get_current_user 0 parameters
Schema command
kosmo integrations:schema magento.magento_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.