@hiberus-magento/magento-rest 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -17
- package/THIRD-PARTY-NOTICES.txt +1 -0
- package/dist/cli.js +277 -36
- package/dist/mcp.js +1754 -157
- package/package.json +6 -3
- package/server.json +56 -0
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ verification.
|
|
|
29
29
|
|
|
30
30
|
| Binary | What it is |
|
|
31
31
|
| --- | --- |
|
|
32
|
-
| `hiberus-magento-rest-mcp` | The **
|
|
32
|
+
| `hiberus-magento-rest-mcp` | The **MCP server**. By default it speaks JSON-RPC over stdio: this is what you put in an MCP client's configuration. With `MAGENTO_REST_HTTP_PORT` set it serves HTTP instead (see [Running over HTTP](#running-over-http)). |
|
|
33
33
|
| `hiberus-magento-rest` | The **operator CLI**, for a human at a terminal. It stores the token (`auth token set`, from stdin) and checks it (`auth status`). It has no command that reads or writes catalog data. |
|
|
34
34
|
|
|
35
35
|
With two binaries declared, `npx` has to be told which one to run
|
|
@@ -46,6 +46,8 @@ executable to run`.
|
|
|
46
46
|
- `magentorest_advanced_product_search` (read-only) — Use this to filter products on one field with a chosen comparison (eq, like, gt, gteq, lt, lteq, in, ...) and sort the result. Returns a bounded page of summaries and the total count.
|
|
47
47
|
- `magentorest_create_product` — Use this to create a new product. Adds a catalog record; the SKU must be unique. Does not touch stock or categories. Without website_ids it goes to the default website only: the website of store_code's store view, or the store's only website; with several websites and no store_code it refuses and asks for website_ids (magentorest_get_websites lists them).
|
|
48
48
|
- `magentorest_update_product` — Use this to change fields of an existing product. Only the fields you pass are sent; at least one is required. Overwrites the current values.
|
|
49
|
+
- `magentorest_get_product_content` (read-only) — Use this to read a product's content as one store view shows it: name, description, short description, meta title and meta description, and each image's id, file and label. Each value is the store view's own or the one it inherits, null when there is none. An unknown SKU returns found: false. **Not verified against a live service** — this tool has not been run against a real Magento instance; its request shape and response projection are covered by unit tests against a test double and by the conformance suite.
|
|
50
|
+
- `magentorest_update_product_content` — Use this to change a product's content in ONE store view: any of name, description, short description, meta title and meta description, and image labels by id. Only the values that differ from the current ones are sent; the result is the content read back. A store view is required (all and admin are refused). Requires Magento 2.4.7 or later. Side effect: Magento then writes a store-view value for every image of the product, so those images stop inheriting later changes made to the default values in this store view. **Not verified against a live service** — this tool has not been run against a real Magento instance; its request shape and response projection are covered by unit tests against a test double and by the conformance suite.
|
|
49
51
|
- `magentorest_update_product_attribute` — Use this to set ONE attribute of a product by code (name, price, status, description, a custom attribute, ...). Overwrites the current value. The identity attributes sku, id, entity_id and type_id are refused.
|
|
50
52
|
- `magentorest_delete_product` — Use this to permanently delete a product by SKU. Irreversible: the product, its images and its URL rewrites are removed.
|
|
51
53
|
- `magentorest_assign_product_to_category` — Use this to add a product to a category at a position. Adds a link; it does not move the product out of other categories.
|
|
@@ -64,14 +66,14 @@ executable to run`.
|
|
|
64
66
|
- `magentorest_update_category` — Use this to change fields of an existing category. Only the fields you pass are sent; at least one is required. Overwrites the current values.
|
|
65
67
|
- `magentorest_delete_category` — Use this to permanently delete a category and its subcategories by ID. Irreversible; the products stay in the catalog but lose the assignment.
|
|
66
68
|
- `magentorest_move_category` — Use this to move a category under a different parent, optionally right after a sibling. Changes the category tree and the URL paths below it.
|
|
67
|
-
- `magentorest_get_customer_by_id` (read-only) — Use this to read one customer by numeric ID:
|
|
69
|
+
- `magentorest_get_customer_by_id` (read-only) — Use this to read one customer by numeric ID: group, website, store and the default address IDs, plus name and email only when the server runs with MAGENTO_REST_CUSTOMER_DATA=true. Date of birth, tax number and the address book are not returned.
|
|
68
70
|
- `magentorest_search_customers` (read-only) — Use this to find customers by part of the email or name, by group or website, or by creation date range (YYYY-MM-DD). Filters are combined with AND. Returns a bounded page of summaries and the total count.
|
|
69
71
|
- `magentorest_get_customer_groups` (read-only) — Use this to list the customer groups with their code and tax class.
|
|
70
|
-
- `magentorest_get_customer_addresses` (read-only) — Use this to list a customer's addresses by location: country, region
|
|
72
|
+
- `magentorest_get_customer_addresses` (read-only) — Use this to list a customer's addresses by location: country, region and which is the default billing or shipping address, plus city and postcode only when the server runs with MAGENTO_REST_CUSTOMER_DATA=true. Street, telephone and the addressee are not returned.
|
|
71
73
|
- `magentorest_create_customer` — Use this to create a customer account from an email and a name. It takes no password: Magento's own password-reset flow is how the customer sets one. Adds a record; the email must not already exist on the website.
|
|
72
74
|
- `magentorest_update_customer` — Use this to change a customer's email, name or group. Only the fields you pass change; at least one is required. Overwrites the current values.
|
|
73
75
|
- `magentorest_delete_customer` — Use this to permanently delete a customer account by ID. Irreversible: the account and its address book are removed; past orders keep their own copy of the details.
|
|
74
|
-
- `magentorest_get_order_by_id` (read-only) — Use this to read one order by entity ID: status, state, totals, currency
|
|
76
|
+
- `magentorest_get_order_by_id` (read-only) — Use this to read one order by entity ID: status, state, totals, currency and the order lines; who placed it (customer ID, name, email) only when the server runs with MAGENTO_REST_CUSTOMER_DATA=true. Billing and shipping addresses and payment details are not returned.
|
|
75
77
|
- `magentorest_get_order_by_increment_id` (read-only) — Use this to read one order by its order number (increment ID), the one a customer quotes. Same fields as reading by entity ID. A number with no order is reported as not-found.
|
|
76
78
|
- `magentorest_search_orders` (read-only) — Use this to find orders by status, customer email or ID, creation date range (YYYY-MM-DD, whole days) and grand-total range. Filters are combined with AND. Newest first unless you sort otherwise. Returns a bounded page of summaries and the total count.
|
|
77
79
|
- `magentorest_get_order_items` (read-only) — Use this to list the lines of one order: SKU, name, quantities ordered, shipped, invoiced and refunded, price and row total, tax and discount.
|
|
@@ -96,10 +98,10 @@ executable to run`.
|
|
|
96
98
|
- `magentorest_get_inventory_stocks` (read-only) — Use this to list the inventory stocks of multi-source inventory with the sales channels (websites) each one serves.
|
|
97
99
|
- `magentorest_get_source_items` (read-only) — Use this to read a product's quantity and status in each inventory source, by SKU.
|
|
98
100
|
- `magentorest_update_product_stock` — Use this to set a product's stock quantity on the default stock. The in-stock flag follows the quantity (in stock when above zero) unless you set it. Overwrites the current quantity. With multi-source inventory enabled this changes the quantity of the default source (observed on a live store) and no other source; magentorest_get_source_items reads every source, and nothing here writes the others.
|
|
99
|
-
- `magentorest_get_cart_by_id` (read-only) — Use this to read one cart by ID: activity, item count and quantity, currency
|
|
101
|
+
- `magentorest_get_cart_by_id` (read-only) — Use this to read one cart by ID: activity, item count and quantity, currency and the cart lines; the customer's identity (id, name, email, group) only when the server runs with MAGENTO_REST_CUSTOMER_DATA=true. Addresses are not returned.
|
|
100
102
|
- `magentorest_search_carts` (read-only) — Use this to find carts by customer email or ID, active status and creation date range (YYYY-MM-DD, whole days). Filters are combined with AND. Returns a bounded page of summaries and the total count.
|
|
101
103
|
- `magentorest_get_cart_items` (read-only) — Use this to list the lines of one cart: SKU, name, quantity, price and product type.
|
|
102
|
-
- `magentorest_get_abandoned_carts` (read-only) — Use this to find abandoned carts: active, non-empty carts not updated for at least a number of days, most recently updated first. Each entry names the owner (or Guest)
|
|
104
|
+
- `magentorest_get_abandoned_carts` (read-only) — Use this to find abandoned carts: active, non-empty carts not updated for at least a number of days, most recently updated first. Each entry gives the item count and the dates, and names the owner (or Guest) only when the server runs with MAGENTO_REST_CUSTOMER_DATA=true. Returns a bounded page, the total count and the cutoff used.
|
|
103
105
|
- `magentorest_get_cms_block_by_id` (read-only) — Use this to read one CMS block by ID, including its content (HTML), title, identifier, dates and whether it is active.
|
|
104
106
|
- `magentorest_search_cms_blocks` (read-only) — Use this to find CMS blocks by identifier (exact), part of the title, or active status. Filters are combined with AND. Returns a bounded page of summaries WITHOUT the content, and the total count; read one by ID for its content.
|
|
105
107
|
- `magentorest_update_cms_block` — Use this to change a CMS block's identifier, title, content or active flag. Only the fields you pass change; at least one is required. Overwrites the current values on the live storefront. The block ends up assigned to all store views: Magento resets a block's store assignment on every REST update.
|
|
@@ -133,7 +135,7 @@ executable to run`.
|
|
|
133
135
|
- `magentorest_get_order_count` (read-only) — Use this to count the orders of a period, optionally by status. The count is Magento's own total, so it is exact and is never partial.
|
|
134
136
|
- `magentorest_get_product_sales` (read-only) — Use this to see what sold in a period: orders, items, units, revenue, and the ten best-selling products by quantity with their revenue. Optionally for one country (billing or shipping). Computed from the orders; it returns no order details. Reads at most max_pages pages of 100 orders and says when the result is partial. With no status it leaves out canceled and closed orders. Amounts in different currencies are never added together: when the orders span several, the revenue figures are null and by_currency gives each currency's own revenue and order count.
|
|
135
137
|
- `magentorest_get_revenue_by_country` (read-only) — Use this to total the revenue of a period for one country (orders billed or shipped there): revenue, currency, order count, average order value and tax. Computed from the orders; it returns no order details. Reads at most max_pages pages of 100 orders and says when the result is partial. With no status it leaves out canceled and closed orders. Amounts in different currencies are never added together: when the orders span several, the totals are null and by_currency gives each currency's own totals.
|
|
136
|
-
- `magentorest_get_customer_ordered_products_by_email` (read-only) — Use this to list every order of one customer, found by exact email, with each order's lines (SKU, name, price, quantity). Returns the customer's id, name and email, never their addresses. For a product's own detail use magentorest_get_product_by_sku. Reads at most max_pages pages of 100 orders and says when the result is partial.
|
|
138
|
+
- `magentorest_get_customer_ordered_products_by_email` (read-only) — Use this to list every order of one customer, found by exact email, with each order's lines (SKU, name, price, quantity). Returns the customer's id, name and email only when the server runs with MAGENTO_REST_CUSTOMER_DATA=true, never their addresses. For a product's own detail use magentorest_get_product_by_sku. Reads at most max_pages pages of 100 orders and says when the result is partial.
|
|
137
139
|
- `magentorest_db_status` (read-only) — Use this to check that the database connection works: returns the server version, the database name, that the session is read-only, and whether database writes are enabled. Run it first when a database tool fails. **Not verified against a live service** — this tool has not been run against a real Magento instance; its request shape and response projection are covered by unit tests against a test double and by the conformance suite.
|
|
138
140
|
- `magentorest_db_list_tables` (read-only) — Use this to list the tables of the Magento database, optionally only those whose name contains a fragment (e.g. `sales_order`). Returns each table's name, engine and approximate row count (an estimate, not a count: use magentorest_db_stats or a COUNT(*) for exact figures). **Not verified against a live service** — this tool has not been run against a real Magento instance; its request shape and response projection are covered by unit tests against a test double and by the conformance suite.
|
|
139
141
|
- `magentorest_db_describe_table` (read-only) — Use this to see the columns of one table: name, type, whether it can be NULL, key, default and extra. Refuses the tables that hold credentials (administrators, OAuth tokens, integrations). **Not verified against a live service** — this tool has not been run against a real Magento instance; its request shape and response projection are covered by unit tests against a test double and by the conformance suite.
|
|
@@ -149,11 +151,18 @@ executable to run`.
|
|
|
149
151
|
- `MAGENTO_REST_BASE_URL` (required) — The Magento REST root every magentorest_* tool addresses, e.g. https://<host>/rest/V1 (or /rest/<store-code>/V1 for one store view). Resolved on the first tool call and refused without it; tools/list still works. Must be https — plain http is accepted only for localhost.
|
|
150
152
|
- `MAGENTO_REST_TOKEN` (optional) — A Magento integration access token or admin token, sent as a Bearer. Every tool call needs one, but it may come from this variable OR from the credential file written by `hiberus-magento-rest auth token set`, so neither source is required on its own.
|
|
151
153
|
- `MAGENTO_REST_FIELDS_FILE` (optional) — Path to a JSON file that adjusts the fields a resource exposes, e.g. {"product":{"add":["cost"],"remove":["weight"]}}. A resource may carry only `add` and `remove`, so a file can widen or narrow the shipped list but never replace it — and credential and payment fields (passwords, hashes, tokens, secrets, card and payment data) can never be added. Read once at startup; a file that cannot be read or does not validate stops the server with exit code 1 rather than starting with a half-applied configuration.
|
|
152
|
-
- `
|
|
153
|
-
- `
|
|
154
|
+
- `MCP_WRITES_ENABLED` (optional) — The write switch an MCP host sets itself. Exactly `true` registers the write tools (create, update, delete, cancel, invoice, refund, ...); any other value, `false` included, registers read tools only, and then MAGENTO_REST_ALLOW_WRITES is ignored. Unset, MAGENTO_REST_ALLOW_WRITES decides. Read once at startup.
|
|
155
|
+
- `MAGENTO_REST_ALLOW_WRITES` (optional) — The write switch for standalone use, read only when MCP_WRITES_ENABLED is unset. Set to exactly `true` to register the write tools (create, update, delete, cancel, invoice, refund, ...). Unset, or any other value, and the server registers read tools only — a write tool is then absent from tools/list, not merely refused. Read once at startup.
|
|
156
|
+
- `MAGENTO_REST_CUSTOMER_DATA` (optional) — Set to exactly `true` to include customer personal data in REST tool results: an order's customer ID, name and email, a cart's customer, a customer's name and email, and the city and postcode of their addresses. Unset, or any other value, and every REST tool result leaves them out, and a MAGENTO_REST_FIELDS_FILE cannot add them back. Off by default so a host that must keep personal data out of a model's context (GDPR) gets that without setting anything. The database tools (MAGENTO_REST_DATABASE_CONNECTION) are not filtered: they return what the SQL selects.
|
|
157
|
+
- `MAGENTO_REST_GROUPS` (optional) — Comma-separated tool groups to load, e.g. `products,customers`, so a project registers only the tools it needs instead of every one. Groups: `products`, `store`, `categories`, `customers`, `orders`, `sales-documents`, `stock`, `carts`, `cms`, `attributes`, `media`, `promotions`, `tax`, `analytics`, `database` (only with MAGENTO_REST_DATABASE_CONNECTION; naming it without one stops the server). Case-insensitive; blanks and repeats are ignored. Unset or empty loads every group (`database` too, when a connection is configured). A name that is not a group stops the server with exit code 1, listing the valid ones. The write switch (MCP_WRITES_ENABLED, or MAGENTO_REST_ALLOW_WRITES when it is unset) still decides whether the write tools of a loaded group are registered. Read once at startup.
|
|
154
158
|
- `MAGENTO_REST_DATABASE_CONNECTION` (optional) — Adds the `database` tool group (magentorest_db_*): direct, read-only access to the Magento database. A URL with NO password, e.g. `mysql://reader@127.0.0.1:3306/magento`; a password in it stops the server. A host that is not this machine uses verified TLS unless you write `?ssl=false`. Unset, there are no database tools. Use a database user with the narrowest grants you can: SELECT only unless you also enable writes. The URL is validated at startup (exit code 1 if it is invalid); the password is only needed when a tool is called.
|
|
155
159
|
- `MAGENTO_REST_DATABASE_PASSWORD` (optional) — The password of the database user, used by the database tools. It may come from this variable OR from the credential file written by `hiberus-magento-rest auth db-password set` (read from stdin, mode 0600), so neither source is required on its own. Resolved on every connection, so a stored password applies without a restart.
|
|
156
160
|
- `MAGENTO_REST_DATABASE_ALLOW_WRITES` (optional) — Set to exactly `true` to register magentorest_db_execute (one INSERT, UPDATE or DELETE per call, in a transaction, with a dry run and a cap on rows changed). A switch of its own: MAGENTO_REST_ALLOW_WRITES does not enable it. Unset, or any other value, and the tool is absent from tools/list. Without MAGENTO_REST_DATABASE_CONNECTION it stops the server with exit code 1. Read once at startup.
|
|
161
|
+
- `MAGENTO_REST_HTTP_PORT` (optional) — Set to serve MCP over HTTP instead of stdio, for callers that cannot own a child process (for example a PHP middleware or a queue consumer). Opt-in: unset or blank and the server speaks stdio exactly as before. `0` picks a free port, which is logged to stderr as `magento-rest: listening on http://<host>:<port>/mcp`. Stateless: one POST per call, no session, JSON replies. Requires MAGENTO_REST_HTTP_TOKEN. Read once at startup. Headers, examples and status codes: docs/http-mode.md.
|
|
162
|
+
- `MAGENTO_REST_HTTP_TOKEN` (optional) — Bearer token the HTTP caller must send as `Authorization: Bearer <token>`. Required when MAGENTO_REST_HTTP_PORT is set; at least 32 characters (generate one with `openssl rand -hex 32`), otherwise the server stops with exit code 1. Read from the environment only, never from argv, and never logged or echoed. Rotating it means restarting the server.
|
|
163
|
+
- `MAGENTO_REST_HTTP_HOST` (optional) — Interface the HTTP endpoint binds to. Default `127.0.0.1` (loopback only). Set it to `0.0.0.0` or a container address only when the server must be reached from another host, and then list the names callers use in MAGENTO_REST_HTTP_ALLOWED_HOSTS.
|
|
164
|
+
- `MAGENTO_REST_HTTP_ALLOWED_HOSTS` (optional) — Comma-separated extra `Host` header values the HTTP endpoint accepts, for example `magento-rest:3000`, beyond loopback with the bound port. A request with any other Host is refused with 403 (DNS rebinding protection).
|
|
165
|
+
- `MAGENTO_REST_HTTP_ALLOWED_ORIGINS` (optional) — Comma-separated `Origin` values the HTTP endpoint accepts. Unset, any request that carries an Origin header is refused with 403: this server is for backends, not browsers.
|
|
157
166
|
|
|
158
167
|
## Configure in an MCP client
|
|
159
168
|
|
|
@@ -167,7 +176,7 @@ Pin the exact version; pass secrets as environment variable references, never li
|
|
|
167
176
|
"args": [
|
|
168
177
|
"-y",
|
|
169
178
|
"--package",
|
|
170
|
-
"@hiberus-magento/magento-rest@0.
|
|
179
|
+
"@hiberus-magento/magento-rest@0.3.0",
|
|
171
180
|
"hiberus-magento-rest-mcp"
|
|
172
181
|
],
|
|
173
182
|
"env": {
|
|
@@ -180,6 +189,32 @@ Pin the exact version; pass secrets as environment variable references, never li
|
|
|
180
189
|
|
|
181
190
|
<!-- package:end -->
|
|
182
191
|
|
|
192
|
+
## Running over HTTP
|
|
193
|
+
|
|
194
|
+
For a caller that cannot launch a child process (a PHP middleware, a queue consumer), set a port and a
|
|
195
|
+
token and the server listens on `http://127.0.0.1:<port>/mcp` instead of stdio:
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
export MAGENTO_REST_BASE_URL=https://demo-host.example-domain/rest/V1
|
|
199
|
+
export MAGENTO_REST_HTTP_PORT=3200
|
|
200
|
+
export MAGENTO_REST_HTTP_TOKEN="$(openssl rand -hex 32)"
|
|
201
|
+
npx -y --package @hiberus-magento/magento-rest hiberus-magento-rest-mcp
|
|
202
|
+
|
|
203
|
+
curl -s http://127.0.0.1:3200/mcp \
|
|
204
|
+
-H "Authorization: Bearer $MAGENTO_REST_HTTP_TOKEN" \
|
|
205
|
+
-H "Content-Type: application/json" \
|
|
206
|
+
-H "Accept: application/json, text/event-stream" \
|
|
207
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"magentorest_get_store_configs","arguments":{}}}'
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`MAGENTO_REST_HTTP_TOKEN` is the secret HTTP callers send; it is not the Magento token, which still comes
|
|
211
|
+
from `MAGENTO_REST_TOKEN` or the stored file (see [Credentials](#credentials)). Each call is one `POST` with
|
|
212
|
+
a JSON-RPC body: no `initialize`, no session. All three headers are required; without that `Accept` value
|
|
213
|
+
the reply is `406`. A tool that fails answers HTTP `200` with `"isError": true`. The
|
|
214
|
+
[HTTP mode guide](https://github.com/hiberus-magento/mcp-servers/blob/main/docs/http-mode.md) has the
|
|
215
|
+
status codes, the setup for reaching it from another container, and its limits (one store per process, the
|
|
216
|
+
integration's identity on every call).
|
|
217
|
+
|
|
183
218
|
## Credentials
|
|
184
219
|
|
|
185
220
|
A Magento **integration Access Token** (or an admin token), sent as a Bearer. It
|
|
@@ -200,8 +235,10 @@ effect without a restart.
|
|
|
200
235
|
|
|
201
236
|
## Read-only by default
|
|
202
237
|
|
|
203
|
-
With `MAGENTO_REST_ALLOW_WRITES` unset, or set to anything
|
|
204
|
-
`true`, the server registers **read tools only
|
|
238
|
+
With `MCP_WRITES_ENABLED` and `MAGENTO_REST_ALLOW_WRITES` unset, or set to anything
|
|
239
|
+
but the exact string `true`, the server registers **read tools only**. An MCP host
|
|
240
|
+
sets `MCP_WRITES_ENABLED` itself; when it is present it decides alone, and
|
|
241
|
+
`MAGENTO_REST_ALLOW_WRITES` (the switch for standalone use) is ignored. A write tool is then absent from
|
|
205
242
|
`tools/list`, not merely refused when called. The choice is made once at
|
|
206
243
|
startup. Reads that hit a `429` or `5xx` are retried with backoff; a write is
|
|
207
244
|
sent exactly once, because replaying an invoice or a refund after an ambiguous
|
|
@@ -252,6 +289,86 @@ the product works: `magentorest_advanced_product_search` with `field: sku`
|
|
|
252
289
|
returns its summary, because the SKU then travels in the query string. Not
|
|
253
290
|
checked against a live Apache.
|
|
254
291
|
|
|
292
|
+
## What a read returns
|
|
293
|
+
|
|
294
|
+
Every read tool declares an `outputSchema` and answers with `structuredContent`,
|
|
295
|
+
mirrored exactly as JSON text:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"result": { "increment_id": "000000042", "status": "processing", "grand_total": 59.9 },
|
|
300
|
+
"provenance": {
|
|
301
|
+
"endpoint": "GET /rest/V1/orders/42",
|
|
302
|
+
"api_version": "V1",
|
|
303
|
+
"read_at": "2026-11-23T10:00:00.000Z",
|
|
304
|
+
"store_view": "default"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
`result` is the projected answer (its fields are the tool's allowlist, so the
|
|
310
|
+
schema is derived from it). `provenance` says where and when the data was read:
|
|
311
|
+
`endpoint` is the method and path from `/rest` on, with no host, query string or
|
|
312
|
+
token; `endpoints` lists each distinct one when a tool used several; `read_at` is
|
|
313
|
+
when Magento answered; `store_view` appears when the URL named one. `all` is the
|
|
314
|
+
global scope, not a store view, so a base URL of `https://<host>/rest/all/V1`
|
|
315
|
+
(useful where only `/rest/all/V*` bypasses a CDN) gives no `store_view`. A result whose
|
|
316
|
+
JSON is over 100,000 bytes is refused with an error: ask for fewer records. Write
|
|
317
|
+
tools answer with text, as before.
|
|
318
|
+
|
|
319
|
+
## Customer data is off by default
|
|
320
|
+
|
|
321
|
+
Results carry **no customer personal data** unless the server runs with
|
|
322
|
+
`MAGENTO_REST_CUSTOMER_DATA=true`: no names, email, phone, street, date of birth,
|
|
323
|
+
tax number, gender or IP, no `customer_*` identity on an order, no `customer` on a
|
|
324
|
+
cart, and no city or postcode on a customer's addresses. An order still has its
|
|
325
|
+
number, status, totals and lines. A `MAGENTO_REST_FIELDS_FILE` cannot add these
|
|
326
|
+
fields back while the switch is off. The database tools are not filtered: they
|
|
327
|
+
return what their SQL selects.
|
|
328
|
+
|
|
329
|
+
## Product content per store view
|
|
330
|
+
|
|
331
|
+
`magentorest_get_product_content` reads a product's name, description, short
|
|
332
|
+
description, meta title and meta description, and each image's `id` (a decimal
|
|
333
|
+
string), `file` and `label`, as one store view shows them: its own value, or the
|
|
334
|
+
one it inherits, or `null` when there is none. An unknown SKU returns
|
|
335
|
+
`found: false`; an unknown store view is an `invalid_argument` error on
|
|
336
|
+
`store_view`.
|
|
337
|
+
|
|
338
|
+
`magentorest_update_product_content` (a write tool) changes any of those values in
|
|
339
|
+
**one** store view: `all`, `admin`, an empty or a missing `store_view` are refused
|
|
340
|
+
before anything is sent. It reads the product first, so an unknown SKU or image is
|
|
341
|
+
a `not_found` error and no product is ever created; checks lengths (255 characters
|
|
342
|
+
for the name, meta title, meta description and labels; 65,535 bytes for the
|
|
343
|
+
descriptions), because Magento would silently truncate, and refuses an empty value
|
|
344
|
+
(clearing a store view's value is not supported) or the same image twice; sends only the values
|
|
345
|
+
that differ from what it read (the full media entry for a changed label); and
|
|
346
|
+
returns the content read back. Repeating the same call sends nothing.
|
|
347
|
+
|
|
348
|
+
**Requires Magento 2.4.7 or later.** Magento 2.4.6 pins at store-view level a sent
|
|
349
|
+
value equal to the inherited one, and the patch version cannot be read over REST,
|
|
350
|
+
so this is not checked.
|
|
351
|
+
|
|
352
|
+
**Known side effect.** Magento's REST API has no way to update only some
|
|
353
|
+
attributes. Whenever a product is saved in a store view, Magento writes a
|
|
354
|
+
store-view value (label, position, hidden) for **every image of the product**,
|
|
355
|
+
copied from its current values. What the store shows does not change, but those
|
|
356
|
+
images stop inheriting later changes made to the default values in that store
|
|
357
|
+
view.
|
|
358
|
+
|
|
359
|
+
## Using it from an MCP host (`server.json`)
|
|
360
|
+
|
|
361
|
+
The package ships a `server.json` (the MCP registry's server manifest, schema
|
|
362
|
+
`2025-12-11`) in its root, and `package.json` carries the matching `mcpName`
|
|
363
|
+
(`io.github.hiberus-magento/magento-rest`). A host that builds its configuration
|
|
364
|
+
form from it sees four variables: `MAGENTO_REST_BASE_URL` and `MAGENTO_REST_TOKEN`
|
|
365
|
+
(required, the token secret), `MAGENTO_REST_GROUPS`, and `MCP_WRITES_ENABLED`
|
|
366
|
+
(boolean, default `false`). The standalone write switch, customer data, the field
|
|
367
|
+
file and the database are deliberately not declared, so a host's form cannot turn
|
|
368
|
+
them on. A host launches the bin named after the unscoped package, `magento-rest`,
|
|
369
|
+
which starts the MCP server (as `hiberus-magento-rest-mcp` does), so
|
|
370
|
+
`npx -y @hiberus-magento/magento-rest` works without naming a bin.
|
|
371
|
+
|
|
255
372
|
## Tool groups
|
|
256
373
|
|
|
257
374
|
A Magento project rarely needs every tool, and each tool an agent is shown costs
|
|
@@ -274,7 +391,7 @@ server, because the tools it names cannot exist.
|
|
|
274
391
|
|
|
275
392
|
| Group | Covers | Tools (`*` = write) |
|
|
276
393
|
|---|---|---|
|
|
277
|
-
| `products` | Catalog products: read, search, create, update, delete, category assignment | get_product_by_sku, search_products, advanced_product_search, create_product*, update_product*, update_product_attribute*, delete_product*, assign_product_to_category*, remove_product_from_category* |
|
|
394
|
+
| `products` | Catalog products: read, search, create, update, delete, category assignment, content per store view | get_product_by_sku, search_products, advanced_product_search, get_product_content, create_product*, update_product*, update_product_content*, update_product_attribute*, delete_product*, assign_product_to_category*, remove_product_from_category* |
|
|
278
395
|
| `store` | Store configuration: store views, websites, store groups, countries, currency | get_store_configs, get_store_views, get_websites, get_store_groups, get_countries, get_currency_info |
|
|
279
396
|
| `categories` | Category tree and the products in a category | get_category_tree, get_category_by_id, list_categories, get_products_in_category, create_category*, update_category*, delete_category*, move_category* |
|
|
280
397
|
| `customers` | Customers, their groups and addresses | get_customer_by_id, search_customers, get_customer_groups, get_customer_addresses, create_customer*, update_customer*, delete_customer* |
|
|
@@ -378,10 +495,10 @@ See the [onboarding guide](https://github.com/hiberus-magento/mcp-servers/blob/m
|
|
|
378
495
|
|
|
379
496
|
## What this server deliberately does not do
|
|
380
497
|
|
|
381
|
-
- **No database access
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
498
|
+
- **No database access unless you configure it.** Without
|
|
499
|
+
`MAGENTO_REST_DATABASE_CONNECTION` the `database` group does not exist; with it,
|
|
500
|
+
reads run in a `READ ONLY` session and `db_execute` needs its own switch,
|
|
501
|
+
`MAGENTO_REST_DATABASE_ALLOW_WRITES`. See [Database access](#database-access).
|
|
385
502
|
- **No chat proxy and no embedded model client.** It is an MCP server, nothing
|
|
386
503
|
else.
|
|
387
504
|
- **No way to turn TLS verification off.** There is no option and no honoured
|
|
@@ -421,6 +538,7 @@ See the [onboarding guide](https://github.com/hiberus-magento/mcp-servers/blob/m
|
|
|
421
538
|
|
|
422
539
|
- [Repository](https://github.com/hiberus-magento/mcp-servers) — source, issues, and the other servers in this family.
|
|
423
540
|
- [Magento REST onboarding](https://github.com/hiberus-magento/mcp-servers/blob/main/docs/magento-rest-onboarding.md) — creating a least-privilege integration, the base URL, the write switch, and what the failures mean.
|
|
541
|
+
- [HTTP mode](https://github.com/hiberus-magento/mcp-servers/blob/main/docs/http-mode.md) — running it as an HTTP service for a backend: the headers, curl examples, status codes, containers, and its limits.
|
|
424
542
|
- [Team setup guide](https://github.com/hiberus-magento/mcp-servers/blob/main/docs/team-setup.md) — where MCP client configuration lives, and which file must never hold a secret.
|
|
425
543
|
|
|
426
544
|
## License
|
package/THIRD-PARTY-NOTICES.txt
CHANGED