> For the complete documentation index, see [llms.txt](https://docs.datajet-app.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datajet-app.com/integrations/ai-coding-agents.md).

# AI Coding Agents

Connect Claude, Claude Code, Codex, Cursor or any MCP client to a store's scripts

### Introduction

DataJet runs an [MCP](https://modelcontextprotocol.io) server, so the AI coding agent you already use on your computer can work on a store's scripts and functions directly: list and read them, create new ones, change existing ones, validate DataJet Liquid, and read run logs when something fails.

The connection is **yours to control**. Nothing can connect on its own: every agent has to be approved by a user who is logged into the store's DataJet admin, gets only the permissions chosen at approval, expires after a lifetime you pick, and can be revoked at any time.

Supported clients include **Claude** (custom connector, also available in Claude Code), **Claude Code**, **Codex**, **Cursor**, **VS Code** and anything else that speaks MCP over Streamable HTTP with OAuth 2.1. The built-in [AI Assistant](https://docs.datajet-app.com/misc/ai-assitant.md) keeps working as before; this page is about agents running outside DataJet.

#### What a connected agent can do

* **Read**: list scripts, Liquid functions and checkout functions, read their code, metadata and variables, validate Liquid and function JavaScript, and look up products, variants, collections and the shop's timezone and currency so it uses real handles and IDs instead of guessing.
* **Write**: create scripts and functions, update their code, metadata, scopes and variables, delete them.
* **Logs**: read run logs and recent errors of a script.

Scripts and functions created by an agent are **inactive** until you turn them on in DataJet, exactly like scripts created by the AI Assistant.

The agent also receives the DataJet scripting rules (which resources to read before writing, the extended Liquid syntax, mandatory validation) every time it connects, so it writes DataJet Liquid rather than generic Shopify Liquid.

### Step 1: enable agent access

Open **Settings → AI agent access**, tick **Let me connect my own AI agents to this store**, pick a **Connection lifetime** (7, 30 or 90 days) and save.

### Step 2: connect your agent

After saving, the **Connect an agent** block shows the setup for each client. Coding agents use a server URL **specific to this store**, so the same agent can be connected to several stores from different projects without mixing credentials. The Claude connector uses one URL for all your stores (see [Several stores on one connection](#several-stores-on-one-connection)).

{% tabs %}
{% tab title="Claude" %}
In Claude (web or Desktop) open **Settings → Connectors → Add custom connector**, paste the URL below and click **Connect**. You name the store on the next page. The connector is also available in Claude Code when you are signed in with the same Claude account.

```
https://datajet.code57.pl/mcp
```

{% endtab %}

{% tab title="Claude Code" %}
Run the command in your terminal, then open the `/mcp` menu in Claude Code and authenticate the `datajet` server.

```bash
claude mcp add --transport http datajet https://datajet.code57.pl/mcp/<store-handle>
```

{% endtab %}

{% tab title="Codex" %}

```bash
codex mcp add datajet --url https://datajet.code57.pl/mcp/<store-handle>
codex mcp login datajet
```

Or add it to `~/.codex/config.toml`:

```toml
[mcp_servers.datajet]
url = "https://datajet.code57.pl/mcp/<store-handle>"
```

{% endtab %}

{% tab title="Cursor" %}
Add the server to `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` for every project), then open **Cursor Settings → MCP & Integrations** and connect it.

```json
{
  "mcpServers": {
    "datajet": { "url": "https://datajet.code57.pl/mcp/<store-handle>" }
  }
}
```

{% endtab %}

{% tab title="VS Code" %}
Add the server to `.vscode/mcp.json` in your workspace and start it from the MCP view.

```json
{
  "servers": {
    "datajet": { "type": "http", "url": "https://datajet.code57.pl/mcp/<store-handle>" }
  }
}
```

{% endtab %}

{% tab title="Other" %}
Any MCP client that supports Streamable HTTP with OAuth 2.1 (PKCE and dynamic client registration) can connect with the server URL shown in Settings.
{% endtab %}
{% endtabs %}

`<store-handle>` is the first part of the store's `myshopify.com` domain; the exact URL is shown in Settings.

### Step 3: approve the connection

The first time the agent connects, your browser opens a DataJet page describing the agent and the permissions it asks for. Click **Approve in DataJet**: the store's admin opens in a new tab with the approval form.

Choose the permissions and click **Approve**. **Read** and **Logs** are selected by default; enable **Write** only when you want the agent to create or change scripts.

Return to your terminal or editor: the agent is connected. Requests that are not approved within 15 minutes expire; run the connect step again.

| Permission | Allows                                                                                                                                                                |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Read       | List and read scripts, functions, variables; validate code; read docs, examples and recipes; read-only lookups of products, variants, collections and basic shop info |
| Write      | Create, update and delete scripts and functions; set variables                                                                                                        |
| Logs       | Read run logs and script errors                                                                                                                                       |

{% hint style="info" %}
Store data access is read-only and limited to the catalog (products, variants, collections) and basic shop information (timezone, currency). Orders, customers and other store data are not available to agents.
{% endhint %}

### Working with a connected agent

Ask the agent in plain language, for example:

* "List the DataJet scripts on this store and tell me which ones are inactive."
* "Create an event script for `orders/create` that tags orders above 500 EUR with `vip`. Keep it inactive."
* "The `sync-stock` script failed last night. Read its logs and propose a fix."

The agent reads DataJet's documentation, examples and recipes through the connection and validates every script before saving it. If an agent ignores the DataJet rules, ask it to call the `get_guidelines` tool first.

Code changes made by an agent appear in the DataJet editor immediately.

### Several stores on one connection

A Claude connector (`https://datajet.code57.pl/mcp`) can work on several stores without reconnecting:

* "Which stores is DataJet connected to?" lists the stores and the active one.
* "Add the store `other-store` to DataJet" returns an approval link. Open it signed in to that store's Shopify admin (DataJet installed, agent access enabled), choose the permissions and approve.
* "Switch to `other-store`" makes it the active store; everything the agent does from then on happens on that store.

Permissions are chosen per store, so a store approved without **Write** stays read-only even when another store on the same connection has Write. Revoking the agent in one store's settings removes only that store from the connection.

### Managing connections

**Settings → AI agent access → Connected agents** lists every approved agent with its permissions, connection date, last use and expiry.

* **Revoke** disconnects one agent immediately. Its next request fails and it has to be approved again.
* **Connection lifetime** is the maximum age of a connection. After it, the agent has to be approved again.
* **Disabling agent access** revokes every connected agent at once.

Every tool call made by an agent is recorded (tool name, outcome and duration, never the content) and kept for 90 days.

### Troubleshooting

* **"MCP server datajet already exists in local config"** (Claude Code): remove the old entry with `claude mcp remove datajet`, then run the connect command again.
* **"Enable AI agent access in Settings first"** when approving: the store has not enabled the feature, or it was disabled after the request was made. Enable it and run the connect step again.
* **"This request is for another store"**: the agent is connecting to a different store than the admin you are logged into. Open the approval link from that store's admin.
* **The agent reports 401 or re-authenticates**: the connection expired or was revoked. Approve it again.
* **Several stores**: with the Claude connector, ask the agent to add and switch stores. With coding agents, use each store's own URL; connecting the same server name to the same URL from two projects shares one connection, which is expected.
