# Using AI assistants

Connect the ShopDepot MCP server, give an AI coding assistant the docs and the rules it must not break.

AI assistants write good ShopDepot themes when they work from this documentation, and bad ones when they guess from Shopify or plain Twig. Give them the docs.

## Connect the MCP server

ShopDepot runs a [Model Context Protocol](https://modelcontextprotocol.io/) server for theme development at:

```text
https://shopdepot.dev/mcp
```

It is public: no account, no token, no installation. Once it is connected, your assistant can search and read these docs, look up the exact reference entry for an object, filter, function or tag, and check theme files against the same rules the platform applies when it saves a file. It does not read or change any store.

| Tool | What the assistant uses it for |
| --- | --- |
| `search_docs` | Find the guide or reference page for a task. |
| `get_doc` | Read a page as Markdown (`index` lists every page). |
| `lookup_reference` | The exact entry for `product`, `image_url`, `cart_summary`, `schema`... If it is not there, the sandbox refuses it. |
| `validate_theme_files` | Check changed files: the file contract, JSON and `{% schema %}`, Twig syntax and the sandbox, plus common mistakes. Nothing is saved. |

The server also gives the assistant a short set of rules when it connects, so it works from the docs instead of guessing from Shopify or plain Twig.

**Claude Code**

```bash
claude mcp add --transport http shopdepot https://shopdepot.dev/mcp
```

**Claude (desktop and web)** - open **Settings → Connectors → Add custom connector**, name it ShopDepot and paste the address.

**Cursor** - `.cursor/mcp.json` in the theme folder (or `~/.cursor/mcp.json` for every project):

```json
{
  "mcpServers": {
    "shopdepot": { "url": "https://shopdepot.dev/mcp" }
  }
}
```

**VS Code** - `.vscode/mcp.json`:

```json
{
  "servers": {
    "shopdepot": { "type": "http", "url": "https://shopdepot.dev/mcp" }
  }
}
```

**Other clients** - any client that supports the Streamable HTTP transport takes the address as it is. A client that only starts local servers can reach it through a bridge, for example `npx mcp-remote https://shopdepot.dev/mcp`.

> [!TIP]
> Ask the assistant to call `validate_theme_files` after every change and fix each error before it moves on. Pass `theme.json` along with the files to run the whole-theme checks as well.

## Plain Markdown for every page

- Add `.md` to any page address for its Markdown source - this page is [`/docs/themes/ai-assistants.md`](/docs/themes/ai-assistants.md).
- Every page has **Copy page as Markdown** at the top - paste it into a chat.
- [`/llms.txt`](/llms.txt) lists every page with a one-line description, in the [llms.txt](https://llmstxt.org/) format.
- [`/llms-full.txt`](/llms-full.txt) is the whole documentation in one file, for assistants with a large context.

The reference pages are generated from the platform code, so an assistant reading them sees exactly which objects, filters and functions exist.

## Tell your assistant the rules

Paste this at the start of a session, or put it in your project's instruction file (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`):

```text
This is a ShopDepot storefront theme. Documentation: https://shopdepot.dev/llms.txt
Rules:
- Templates are Twig in a sandbox. Use only the tags, filters and functions listed at
  https://shopdepot.dev/docs/reference/filters.md, /functions.md and /tags.md.
  No extends, macro, import or block. Reuse markup with render('snippet-name', {...}).
- Read data only from objects (https://shopdepot.dev/docs/reference/objects.md).
  Property names are camelCase: product.featuredMedia, not product.featured_media.
- Prices are integers in minor units. Always format with |money.
- Files: lowercase paths, at most 4 levels deep, sections/blocks/snippets referenced by
  file name only. Blocks need {% schema %}, snippets must not have one.
- Pages are cached and shared by all visitors: never print customer or cart data in
  sections. Read the cart with fetch('/cart.js').
- Store addresses end with a trailing slash: /cart/, /products/example/.
- The platform writes <title> and meta tags in content_for_header - do not add your own
  description, canonical or Open Graph tags.
- The first visible image needs loading: 'eager' or fetchpriority="high"; every other
  image is lazy automatically.
```

## Let the assistant check its own work

An assistant that edits a theme in your folder can verify what it wrote with the [CLI](cli.md), using the same rules the platform applies on save:

```bash
shopdepot theme check
```

Ask it to run `check` after every change and fix each error before it moves on. With `shopdepot theme dev` running in another terminal, every file it saves goes to your development store, and a file the platform refuses is reported with the reason instead of being saved.
