> 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 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 Code**, **Codex**, **Cursor**, **VS Code** and anything else that speaks MCP over Streamable HTTP with OAuth 2.1. The built-in [AI Assistant](/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.
* **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.

{% hint style="info" %}
Agent access is rolling out gradually. If the section says it is not yet available for your store, contact <support@code57.pl>.
{% endhint %}

### Step 2: connect your agent

After saving, the **Connect an agent** block shows the setup for each client. The server URL is **specific to this store**, so the same agent can be connected to several stores from different projects without mixing credentials.

{% tabs %}
{% 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. In Claude.ai or Claude Desktop add it under **Settings → Connectors → Add custom connector**.
{% 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 |
| Write      | Create, update and delete scripts and functions; set variables                              |
| Logs       | Read run logs and script errors                                                             |

### 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.

### 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**: use each store's own URL. Connecting the same server name to the same URL from two projects shares one connection, which is expected.
