Assistants

Connect an AI assistant to a store and work in it by asking: Cartbase is an MCP server at one address, and any assistant that takes a custom connector can use it.

The assistant acts as the person who connected it, in the one store that person picked, with exactly the access that person has in the admin. It needs no key pasted anywhere: the person signs in to Cartbase and approves.

Connect an assistant

  1. In the assistant, open the settings for connectors (some call them integrations, tools or MCP servers) and add a custom one.
  2. Give it this address:
https://admin.cartbase.ai/api/mcp
  1. The assistant opens a Cartbase page. Sign in if asked, pick the store, and press Authorize. The page names the assistant and the site it sends you back to.
  2. You are back in the assistant, connected. Ask it something: "what were my sales last week", "which products are out of stock", "find the order of maria@example.com".

A connection lasts 90 days. After that the assistant asks you to approve again.

To connect a second store, add the connector again and pick the other store.

What the assistant can do

It has sixteen tools: the ones that find and read, one for each everyday change, and three through which it reaches everything else the admin API does.

Tool What it does
search Finds orders, draft orders, products and customers by words: an order number, an email, a name, a title
fetch Opens one whole record that search found
list_orders The orders, with the filters of the admin's Orders list: payment and fulfillment status, dates, totals, customer, carrier and the rest
list_products The products, with the filters of the Products list
list_customers The customers, with the filters of the Customers list
list_inventory Stock per item: in stock, reserved, available, incoming, per location
list_metrics Every analytics metric the store has, with its unit and what it can be split by
get_metrics The named metrics per day between two dates, optionally split by one dimension
update_product Changes a product's texts or its status: the name, the subtitle, the description, the brand, what search engines show, draft or published
update_variant Changes one variant: its price, its SKU, barcode and EAN, its cost, whether its stock is tracked and whether it sells when out of stock
list_custom_fields The custom fields of one product, collection, order or customer, each with its type and the value the record holds
set_custom_field Writes one custom field's value on a product, collection, order or customer
set_stock Changes how many units of one item are in stock at one location
find_action Searches every other action of the admin by a few words or by its area, and describes one
read_action Carries out an action that only reads
run_action Carries out an action that changes the store

Five of them change the store: update_product, update_variant, set_custom_field, set_stock and run_action. Each is marked so, and an assistant asks its person before it uses a tool marked that way. A change made through one is real: it acts on the live store, as the person, and is recorded as theirs.

What the everyday tools hold to:

  • A change sends only what changes. A product's other texts, and a variant's other fields, stay as they are.
  • A price changes that one price. The variant's prices in other currencies and its quantity prices stay. Amounts are in the currency's own units, 12.90 for twelve ninety.
  • A custom field's value is in the field's own type, which list_custom_fields gives: text, a number, true or false, a date as YYYY-MM-DD, a dropdown's option, rich text as HTML, a list as an array. A value of the wrong type is refused. null clears the field.
  • Stock is set one of three ways: the count on the shelf, what can be sold (the tool adds what orders have reserved), or an amount to add or take away. What orders have reserved is never changed.

Where the platform refuses (the person's role does not allow it, the record does not exist, the value is not valid) the assistant is told in the platform's own words.

For a script or an agent of your own

The same server answers any MCP client. It speaks the current revision of the protocol and the 2025 one, over HTTP, one answer per request, with nothing kept between requests.

A client that signs a person in follows the standard path, which it finds by itself from the server's refusal:

# The server refuses a caller with no credential and names where the sign-in is described.
curl -s -i -X POST "$BASE/api/mcp" \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | grep -i "^www-authenticate"

# What protects the server, and where its sign-in is.
curl -s "$BASE/.well-known/oauth-protected-resource/api/mcp"
curl -s "$BASE/.well-known/oauth-authorization-server"

The sign-in is OAuth 2.1 for public clients with PKCE (S256):

  • POST /api/oauth/register with client_name and redirect_uris returns a client_id. An answer can be sent to an https address, to http on the same machine, or to an app's own scheme.
  • GET /api/oauth/authorize with response_type=code, client_id, redirect_uri, code_challenge, code_challenge_method=S256 and state sends the person to the approval page. Authorize sends them back with code and state; Deny sends them back with error=access_denied.
  • POST /api/oauth/token with grant_type=authorization_code, code, client_id, redirect_uri and code_verifier returns the access_token, once. A code that is unknown, used, expired, another client's or presented with the wrong verifier is answered invalid_grant.

A script that runs with no person present uses the store's secret API key as the bearer, with no sign-in:

# doc-noexec: needs a secret API key of the store (Settings, API keys).
curl -s -X POST "$BASE/api/mcp" \
  -H "authorization: Bearer $SECRET_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_orders","arguments":{"limit":5}}}'

A token of the terminal sign-in (cartbase login) opens the same door.