5 months ago

How to Install Claude Code, Add Shopify Toolkit & Connect Your Shopify Store

How to Install Claude Code, Add Shopify Toolkit & Connect Your Shopify Store
3 views

Claude Code is Anthropic's official agentic CLI tool that lets you work with AI directly inside your terminal. Paired with the Shopify MCP (Model Context Protocol) toolkit, you can build, debug, and manage your Shopify store using natural language — right from the command line.


1. Prerequisites

Before you begin, make sure you have the following installed:

  • Node.js v18 or later (node -v to check)
  • npm v9 or later (npm -v to check)
  • A Shopify Partner account or an existing Shopify store
  • An Anthropic API key from console.anthropic.com

2. Install Claude Code CLI

Claude Code is installed globally as an npm package. Run the following command in your terminal:

bash
npm install -g @anthropic-ai/claude-code

Once installed, verify it works:

bash
claude --version

You should see the installed version number printed in your terminal. Now authenticate with your Anthropic API key:

bash
claude auth login

This opens a browser window. Log in with your Anthropic account or paste your API key when prompted. Your credentials are stored locally and securely.


3. Start Claude Code in Your Project

Navigate to your Shopify theme or app directory and launch Claude Code:

bash
cd your-shopify-project claude

Claude Code reads the files in your current directory and gives the AI full context of your project. You can now chat, ask it to write code, or run tasks in natural language.


4. Add the Shopify MCP Toolkit

MCP (Model Context Protocol) is an open standard that lets Claude connect to external services and tools. The Shopify MCP server gives Claude direct access to your store's data — products, orders, customers, metafields, and more.

Install the Shopify MCP server globally:

bash
npm install -g @shopify/mcp-server

Now configure it inside Claude Code by adding it to your MCP settings. Run:

bash
claude mcp add shopify

Or manually add it to your Claude Code config file (~/.claude/config.json):

json
{ "mcpServers": { "shopify": { "command": "npx", "args": ["-y", "@shopify/mcp-server"], "env": { "SHOPIFY_ACCESS_TOKEN": "your_access_token_here", "MYSHOPIFY_DOMAIN": "your-store.myshopify.com" } } } }

Replace your_access_token_here and your-store.myshopify.com with your actual credentials (see Step 5).


5. Connect Claude Code to Your Shopify Store

To let Claude interact with your store, you need a custom app access token from Shopify.

Step 1 — Create a Custom App:

  1. In your Shopify admin, go to Settings → Apps and sales channels
  2. Click Develop apps → Create an app
  3. Give it a name like Claude Code MCP

Step 2 — Configure API Scopes:

In the app's Configuration tab, select the Admin API scopes you want Claude to access. For a typical development workflow, enable:

  • read_products, write_products
  • read_orders, write_orders
  • read_customers
  • read_inventory, write_inventory
  • read_metaobjects, write_metaobjects

Step 3 — Generate Access Token:

Go to API credentials → Install app → Reveal token once. Copy it immediately — it is only shown once.

Paste this token into your Claude config file as SHOPIFY_ACCESS_TOKEN.

Step 4 — Restart Claude Code:

bash
claude

Claude will now recognize the Shopify MCP server. Test the connection by asking:

"List my last 5 Shopify orders."


6. Advantages

Using Claude Code with the Shopify toolkit offers powerful benefits for developers and store owners:

  • Natural Language Store Management — Describe what you want ("Create a 10% discount for all products tagged 'summer'") and Claude executes it via the API.
  • Accelerated Theme Development — Claude reads your Liquid, JavaScript, and CSS files with full context and writes accurate, store-specific code suggestions.
  • Live Data Queries — Instantly fetch orders, inventory levels, customer data, and metafields without leaving your terminal or writing GraphQL queries manually.
  • Automated Repetitive Tasks — Bulk-update product descriptions, generate SEO metadata, or restructure metafields across hundreds of products with a single prompt.
  • Debugging with Context — Claude sees both your code and your live store data simultaneously, making it far faster to diagnose theme bugs or API issues.
  • No Context Switching — Stay in your terminal. No toggling between the Shopify admin, API docs, and your editor.

7. Precautions

While powerful, this setup gives AI direct write-access to a live store. Take these precautions seriously:

  • Never use a Production store for initial testing. Always set up a Shopify development store first. Mistakes on a live store can affect real customers and real orders.
  • Limit API scopes to what you actually need. Do not enable write_orders or write_customers unless your workflow explicitly requires it. The principle of least privilege applies here.
  • Store your access token securely. Never commit ~/.claude/config.json or any .env file containing your SHOPIFY_ACCESS_TOKEN to a public or private repository. Add it to .gitignore immediately.
  • Review every action before confirming. Claude Code shows you what it plans to do before executing. Always read the proposed changes — especially for bulk operations on products or orders.
  • Be specific in your prompts. Vague instructions like "clean up products" can have unintended consequences. Always specify exactly what fields, collections, or IDs you want affected.
  • Keep an eye on API rate limits. Shopify enforces rate limits on its Admin API. Bulk operations triggered by Claude can hit these limits, causing partial failures. Add delays or check for rate limit headers when scripting large tasks.
  • Audit your app permissions regularly. Rotate your access tokens every few months and remove scopes you no longer use via the Shopify admin.

Conclusion

Claude Code combined with the Shopify MCP toolkit is a significant productivity upgrade for any Shopify developer. It collapses the gap between writing code, querying live data, and executing store operations — all from a single terminal session. Respect the precautions above, start with a development store, and you will have a powerful, safe AI-driven workflow for your Shopify projects.

Happy building!

Command Palette

Search for a command to run...