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 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.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
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.
kosmo integrations:call magento.magento_list_products '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json 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.
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 - Parameters
- search_criteria, page_size, current_page
kosmo integrations:call magento.magento_list_products '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json 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 - Parameters
- sku
kosmo integrations:call magento.magento_get_product '{"sku":"example_sku"}' --json 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 - Parameters
- sku, name, price, attribute_set_id, type_id, weight, description, short_description, visibility, status
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 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 - Parameters
- search_criteria, page_size, current_page
kosmo integrations:call magento.magento_list_orders '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json 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 - Parameters
- order_id
kosmo integrations:call magento.magento_get_order '{"order_id":"example_order_id"}' --json 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 - Parameters
- search_criteria, page_size, current_page
kosmo integrations:call magento.magento_list_customers '{"search_criteria":"example_search_criteria","page_size":1,"current_page":1}' --json 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 - Parameters
- none
kosmo integrations:call magento.magento_get_current_user '{}' --json 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
kosmo integrations:schema magento.magento_list_products --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema magento.magento_get_product --json | Parameter | Type | Required | Description |
|---|---|---|---|
sku | string | yes | The product SKU (Stock Keeping Unit) to retrieve. |
magento.magento_create_product 10 parameters
kosmo integrations:schema magento.magento_create_product --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema magento.magento_list_orders --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema magento.magento_get_order --json | Parameter | Type | Required | Description |
|---|---|---|---|
order_id | string | yes | The order increment ID or entity ID. |
magento.magento_list_customers 3 parameters
kosmo integrations:schema magento.magento_list_customers --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema magento.magento_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| 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.