shopify-listing-audit-mcp
# shopify-listing-audit-mcp
An MCP server that audits Shopify product pages and hands the results to Claude (or any MCP client) to fix.
Ask Claude *"audit gymshark.com and tell me which product pages to fix first"* and it calls these tools, gets a scored, rule-based audit back, and writes the fixes.
I built this as an open companion to [Trion](https://gettrion.com), the Shopify conversion tool I'm building. Trion's main engine is private; this repo shows the core pattern: **deterministic checks decide what's wrong, and the model only does the writing.**
## Why it's built this way
Language models are good at rewriting copy but less reliable at deciding *what* is wrong: ask twice and you can get different issues. Merchants need a score they can trust and compare over time, so the work is split:
| Layer | Does | Why |
|---|---|---|
| `audit.py` (plain Python rules) | Scores each listing 0 to 100 and names each issue with a fix | Same input gives the same output, so every score can be explained and tested |
| MCP tools (`server.py`) | Expose the audit to any MCP client, read-only | The model gets structured facts, not raw HTML |
| `improve_listing` prompt | Tells the model to rewrite using **only facts already in the listing** and to mark anything uncertain | Keeps a person in the loop before anything goes live |
## Tools
| Tool | What it returns |
|---|---|
| `list_products(store_url, limit)` | Handles, titles, prices and image counts from the store's public catalogue |
| `audit_listing(store_url, handle)` | Score, every finding with severity and suggested fix, and listing stats |
| `audit_store(store_url, limit)` | Average score, most common issues, and the five worst listings to fix first |
There is also one prompt, `improve_listing`, which audits a listing and then rewrites its title and description.
All tools are marked `readOnlyHint` and use only the public `/products.json` feed that most Shopify stores expose. There are no API keys, no admin access, and no writes to the store.
## Checks
Images: count, missing alt text, resolution under 1000px, mixed aspect ratios, colour variants without their own photo.
Copy: missing or thin description (under 50 words), title too short or too long.
Catalogue: missing product type, no tags.
Each finding is weighted high (20), medium (10) or low (5) and subtracted from 100. All thresholds are listed at the top of [`audit.py`](src/listing_audit_mcp/audit.py) so they're easy to tune.
Example output for a weak listing:
```json
{
"handle": "lip-tint",
"score": 40,
"findings": [
{ "check": "image_count", "severity": "medium",
"message": "Only 1 image(s); shoppers usually want 3+.",
"fix": "Add detail and lifestyle shots." },
{ "check": "image_resolution", "severity": "medium",
"message": "1 image(s) under 1000px on the short side.",
"fix": "Upload images at least 1000px so zoom stays sharp." }
]
}
```
## Run it
```bash
git clone https://github.com/DaganeMahamed/shopify-listing-audit-mcp
cd shopify-listing-audit-mcp
pip install -e ".[dev]"
pytest # 11 tests, no network needed
```
### Connect to Claude Code
```bash
claude mcp add listing-audit -- python -m listing_audit_mcp.server
```
### Connect to Claude Desktop
Add this to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"listing-audit": {
"command": "python",
"args": ["-m", "listing_audit_mcp.server"]
}
}
}
```
Then ask: *"Use audit_store on allbirds.com and tell me the three fixes that would matter most."*
## Tests
The tests run against fixture products (one strong, one weak, one empty) and a mocked HTTP client, so they don't depend on any live store. They cover each check, the worst-first ranking, URL handling, and the error returned when a store blocks its feed.
## Limits and what I'd do next
- **The tool can't see the images.** It checks image metadata (count, size, alt text) but not whether a photo is actually good. Next step: a vision check, scored against click-through data rather than the model's opinion.
- **The rules are heuristics, not proven.** "50+ words" and "3+ images" are reasonable defaults, not measured results. Trion runs a 14-day before/after comparison to test which changes actually move conversion; this repo doesn't.
- **Some stores turn off the public feed.** The tool returns a clear error instead of guessing.
## License
MIT
TDQS
Scored across 3 tools
The three tools are clearly separable: list_products discovers catalogue items, audit_listing scores a single product, and audit_store batch-audits and ranks. The only mild overlap is that audit_store effectively subsumes audit_listing over many products, but the singular-vs-batch distinction is stated explicitly.
All three follow a strict snake_case verb_noun pattern (list_products, audit_listing, audit_store) with no deviations. The shared 'audit_' prefix also reads as a coherent family of operations.
Three tools is lean but sufficient for a read-only listing audit workflow: discover, audit one, audit many. It sits near the thin end of the scale, though each tool earns its place without redundancy.
The core lifecycle (find products, score a listing, rank a store's worst listings) is covered with consistent store_url/handle arguments. Minor gaps exist: no way to fetch full product details for a single handle, and no pagination beyond the limit cap, but the stated audit purpose is served.