PrestaShop MCP Server
# PrestaShop MCP Server
[](LICENSE)
[](https://nodejs.org)
[](https://www.npmjs.com/package/@adsim/prestashop-mcp-server)
[]()
**Enterprise governance layer for Claude-to-PrestaShop integrations.**
79 read/write tools — audit trail, multi-site, SEO, KPI dashboards, HTTP transport.
---
## Table of Contents
- [Architecture](#architecture)
- [Why This Server](#why-this-server)
- [Quick Start](#quick-start)
- [HTTP Streamable Transport](#http-streamable-transport)
- [Available Tools (79)](#available-tools-79)
- [Enterprise Controls](#enterprise-controls)
- [Testing](#testing)
- [Multi-Target Configuration](#multi-target-configuration)
- [Security](#security)
- [Troubleshooting](#troubleshooting)
- [Changelog](#changelog)
- [Credits](#credits)
---
## Architecture
```
┌─────────────────────────────────────────────────────────┐
│ Claude Desktop / CLI │
│ (or any MCP client) │
└───────────────┬──────────────────────┬──────────────────┘
│ stdio │ HTTP (Streamable)
▼ ▼
┌─────────────────────────────────────────────────────────┐
│ PrestaShop MCP Server v3.1.0 │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
│ │ Products │ │ Orders │ │ SEO │ │ KPI │ │
│ │ 6 tools │ │ 3 tools │ │ 4 tools │ │ 6 tools │ │
│ └──────────┘ └──────────┘ └──────────┘ └───────────┘ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
│ │Customers │ │ Stock │ │ Write │ │ Analyse │ │
│ │ 4 tools │ │ 2 tools │ │ 4 tools │ │ 5 tools │ │
│ └──────────┘ └──────────┘ └──────────┘ └───────────┘ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
│ │ CMS │ │ Scoring │ │ Alerts │ │ Geography │ │
│ │ 4 tools │ │ 3 tools │ │ 2 tools │ │ 3 tools │ │
│ └──────────┘ └──────────┘ └──────────┘ └───────────┘ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
│ │Catalogue │ │Promotions│ │ Invoices │ │ + more │ │
│ │ 4 tools │ │ 4 tools │ │ 2 tools │ │ 17 tools │ │
│ └──────────┘ └──────────┘ └──────────┘ └───────────┘ │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Governance: read-only gate · audit trail │ │
│ │ multi-site · category filter · rate limit │ │
│ └─────────────────────────────────────────────────┘ │
└───────────────────────────┬─────────────────────────────┘
│ HTTPS + API Key
▼
┌───────────────────────┐
│ PrestaShop Webservice│
│ (JSON API) │
└───────────────────────┘
```
---
## Why This Server
- **Governance-first** — Read-only by default. Write operations require explicit opt-in (`PS_READONLY=false`) and back-office API key configuration.
- **Regulated environments** — Audit trail middleware logs every tool invocation with timestamp, parameters, and user context.
- **Agencies & multi-site** — Switch between PrestaShop instances at runtime via `ps_set_target`. Manage dozens of shops from a single Claude conversation.
- **79 tools** — From basic CRUD to advanced KPI dashboards, SEO audits, stock alerts, abandoned cart analysis, and cross-dataset intelligence.
---
## Quick Start
### 1. Install & run
```bash
npx -y @adsim/prestashop-mcp-server
```
### 2. Environment variables
Create a `.env` file or pass variables directly:
```env
PS_API_URL=https://your-shop.com
PS_API_KEY=YOUR_PRESTASHOP_WEBSERVICE_KEY
```
### 3. Claude Desktop configuration
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"prestashop": {
"command": "npx",
"args": ["-y", "@adsim/prestashop-mcp-server"],
"env": {
"PS_API_URL": "https://your-shop.com",
"PS_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
### 4. Claude Code (CLI)
```bash
claude mcp add prestashop -- npx -y @adsim/prestashop-mcp-server
```
Then set environment variables in your shell or `.env` file.
---
## HTTP Streamable Transport
v3.0.0 adds HTTP Streamable transport alongside the default stdio, enabling remote and browser-based MCP clients.
### Configuration
```env
PS_TRANSPORT=http # "stdio" (default) or "http"
PS_HTTP_PORT=3000 # Default: 3000
PS_HTTP_HOST=127.0.0.1 # Default: 127.0.0.1
PS_AUTH_TOKEN=my-secret # Required for HTTP mode (Bearer token)
PS_ALLOWED_ORIGINS=https://app.example.com # Optional, comma-separated
PS_DUAL_MODE=false # Set to "true" for stdio + HTTP simultaneously
```
### Health check
```bash
curl http://127.0.0.1:3000/health
```
```json
{ "status": "ok", "version": "3.1.0", "transport": "http", "tools": 79 }
```
### Dual mode
Run both stdio and HTTP simultaneously for mixed client environments:
```env
PS_TRANSPORT=http
PS_DUAL_MODE=true
```
---
## Available Tools (79)
### Site & Multi-site (4)
| Tool | Description |
|------|-------------|
| `ps_site_info` | Shop info, languages, CMS version |
| `ps_list_languages` | List active languages |
| `ps_list_targets` | List configured PrestaShop targets |
| `ps_set_target` | Switch active target at runtime |
### Products (6)
| Tool | Description |
|------|-------------|
| `ps_list_products` | List products with filters |
| `ps_get_product` | Get product details |
| `ps_search_products` | Full-text product search |
| `ps_create_product` | Create a new product |
| `ps_delete_product` | Delete a product |
| `ps_get_product_images` | Get product image URLs |
### Categories (4)
| Tool | Description |
|------|-------------|
| `ps_list_categories` | List categories |
| `ps_get_category` | Get category details |
| `ps_create_category` | Create a new category |
| `ps_update_category` | Update a category |
### Orders (3)
| Tool | Description |
|------|-------------|
| `ps_list_orders` | List orders with filters |
| `ps_get_order` | Get full order details |
| `ps_list_order_states` | List order statuses |
### Customers (4)
| Tool | Description |
|------|-------------|
| `ps_list_customers` | List customers with filters |
| `ps_get_customer` | Get customer details |
| `ps_create_customer` | Create a new customer |
| `ps_update_customer` | Update a customer |
### Stock (2)
| Tool | Description |
|------|-------------|
| `ps_list_stock` | List stock levels |
| `ps_get_product_stock` | Get stock for a specific product |
### CMS (4)
| Tool | Description |
|------|-------------|
| `ps_list_cms_pages` | List CMS pages |
| `ps_get_cms_page` | Get CMS page content |
| `ps_create_cms_page` | Create a CMS page |
| `ps_update_cms_page` | Update a CMS page |
### Catalogue (4)
| Tool | Description |
|------|-------------|
| `ps_list_carriers` | List shipping carriers |
| `ps_list_combinations` | List product combinations |
| `ps_list_product_features` | List product features |
| `ps_list_product_options` | List product options |
### Promotions (4)
| Tool | Description |
|------|-------------|
| `ps_list_cart_rules` | List cart rules / vouchers |
| `ps_list_specific_prices` | List specific price rules |
| `ps_create_specific_price` | Create a specific price |
| `ps_delete_specific_price` | Delete a specific price |
### Management (3)
| Tool | Description |
|------|-------------|
| `ps_list_order_histories` | List order status history |
| `ps_list_tax_rules` | List tax rules |
| `ps_list_addresses` | List customer addresses |
### Write Operations (4)
| Tool | Description |
|------|-------------|
| `ps_update_product` | Update product fields |
| `ps_update_stock` | Update stock quantity |
| `ps_update_order_status` | Update order status |
| `ps_create_cart_rule` | Create a cart rule / voucher |
### SEO (4)
| Tool | Description |
|------|-------------|
| `ps_audit_seo` | SEO audit for products |
| `ps_update_seo` | Update product SEO fields |
| `ps_audit_seo_categories` | SEO audit for categories |
| `ps_audit_seo_cms` | SEO audit for CMS pages |
### Analysis (5)
| Tool | Description |
|------|-------------|
| `ps_get_order_details` | Get order detail rows |
| `ps_get_customer_orders` | Get orders for a customer |
| `ps_low_stock_report` | Products below threshold |
| `ps_abandoned_cart_analysis` | Abandoned cart analysis |
| `ps_supplier_performance` | Supplier performance metrics |
### Scoring (3)
| Tool | Description |
|------|-------------|
| `ps_dead_products_report` | Products with zero sales |
| `ps_stock_rotation_score` | Stock rotation scoring |
| `ps_margin_scoring` | Product margin analysis |
### Alerts (2)
| Tool | Description |
|------|-------------|
| `ps_stock_alert_check` | Check stock against thresholds |
| `ps_configure_stock_alerts` | Configure alert thresholds |
### KPI Dashboards (6)
| Tool | Description |
|------|-------------|
| `ps_top_revenue_products` | Top products by revenue |
| `ps_average_basket_analysis` | Average basket analysis |
| `ps_customer_ltv` | Customer lifetime value |
| `ps_generate_full_report` | Full KPI dashboard |
| `ps_category_performance` | Revenue per category |
| `ps_inventory_value_report` | Inventory valuation |
### Cross-Analysis (1)
| Tool | Description |
|------|-------------|
| `ps_cross_analysis` | Cross-dataset analysis engine |
### Manufacturers (2)
| Tool | Description |
|------|-------------|
| `ps_list_manufacturers` | List manufacturers |
| `ps_get_manufacturer` | Get manufacturer details |
### Suppliers (2)
| Tool | Description |
|------|-------------|
| `ps_list_suppliers` | List suppliers |
| `ps_get_supplier` | Get supplier details |
### Geography (3)
| Tool | Description |
|------|-------------|
| `ps_list_countries` | List countries |
| `ps_list_zones` | List zones |
| `ps_list_states` | List states / provinces |
### Currencies (1)
| Tool | Description |
|------|-------------|
| `ps_list_currencies` | List currencies |
### Groups (2)
| Tool | Description |
|------|-------------|
| `ps_list_groups` | List customer groups |
| `ps_get_group` | Get group details |
### Carts (2)
| Tool | Description |
|------|-------------|
| `ps_list_carts` | List carts |
| `ps_get_cart` | Get cart details |
### Invoices & Payments (2)
| Tool | Description |
|------|-------------|
| `ps_list_order_invoices` | List order invoices |
| `ps_list_order_payments` | List order payments |
### Configuration (2)
| Tool | Description |
|------|-------------|
| `ps_list_configurations` | List configuration keys |
| `ps_get_configuration` | Get configuration value |
---
## Enterprise Controls
| Variable | Default | Description |
|----------|---------|-------------|
| `PS_API_URL` | — | PrestaShop shop URL (required) |
| `PS_API_KEY` | — | Webservice API key (required) |
| `PS_READONLY` | `true` | Block all write operations |
| `PS_TOOL_CATEGORIES` | `*` | Comma-separated tool categories to load |
| `PS_TRANSPORT` | `stdio` | Transport mode: `stdio` or `http` |
| `PS_HTTP_PORT` | `3000` | HTTP server port |
| `PS_HTTP_HOST` | `127.0.0.1` | HTTP server bind address |
| `PS_AUTH_TOKEN` | — | Bearer token for HTTP mode (required) |
| `PS_ALLOWED_ORIGINS` | — | Comma-separated allowed origins |
| `PS_DUAL_MODE` | `false` | Run stdio + HTTP simultaneously |
| `PS_TARGETS` | — | JSON array of multi-site targets |
| `PS_DATA_DIR` | `./data` | Directory for reports and exports |
| `PS_SAFE_SORT` | `true` | Disable `sort` parameter in API calls (avoids PS 1.7/8.x 500 errors) |
### Tool category filter
Only load the tools you need:
```env
PS_TOOL_CATEGORIES=products,orders,stock,seo
```
Available categories: `site`, `products`, `categories`, `orders`, `customers`, `stock`, `cms`, `catalogue`, `promotions`, `management`, `images`, `write`, `seo`, `analyse`, `scoring`, `alerts`, `kpi`, `cross-analysis`, `manufacturers`, `suppliers`, `geography`, `currencies`, `groups`, `carts`, `invoices`, `configuration`.
---
## Testing
```bash
npm test
```
622 tests across 34 test suites, 100% pass rate. Uses Vitest with mock PrestaShop client.
```bash
npm run test:coverage # Coverage report
npm run test:watch # Watch mode
```
---
## Multi-Target Configuration
Manage multiple PrestaShop shops from a single instance:
```json
{
"mcpServers": {
"prestashop": {
"command": "npx",
"args": ["-y", "@adsim/prestashop-mcp-server"],
"env": {
"PS_API_URL": "https://shop-1.com",
"PS_API_KEY": "KEY_1",
"PS_TARGETS": "[{\"name\":\"shop-2\",\"url\":\"https://shop-2.com\",\"apiKey\":\"KEY_2\"},{\"name\":\"shop-3\",\"url\":\"https://shop-3.com\",\"apiKey\":\"KEY_3\"}]"
}
}
}
}
```
Then use `ps_list_targets` and `ps_set_target` to switch between shops at runtime.
---
## Security
- **Read-only by default** — Write operations gated behind `PS_READONLY=false`
- **Bearer authentication** — HTTP transport requires `PS_AUTH_TOKEN`
- **Origin validation** — Optional `PS_ALLOWED_ORIGINS` prevents DNS rebinding
- **No credentials in code** — All secrets via environment variables
- **Minimal permissions** — Configure your PrestaShop API key with only the resources you need
- **Local binding** — HTTP transport binds to `127.0.0.1` by default
---
## Troubleshooting
### "Cannot connect to PrestaShop API"
1. Verify `PS_API_URL` is correct and reachable
2. Check your API key has the necessary resource permissions in Back Office → Advanced Parameters → Webservice
3. Ensure the webservice is enabled in PrestaShop
### "Write operation blocked"
Set `PS_READONLY=false` in your environment and enable PUT/POST methods for your API key in PrestaShop Back Office.
### "Tool not found"
Check your `PS_TOOL_CATEGORIES` filter. Remove the filter or add the required category.
### HTTP transport not responding
1. Verify `PS_TRANSPORT=http` is set
2. Check `PS_AUTH_TOKEN` is configured
3. Test with `curl http://127.0.0.1:3000/health`
---
## Changelog
### v3.1.0 — Robustness & Production Fixes
**Critical bugfixes for real-world PrestaShop stores (tested on 21K+ orders):**
- **Paginate from the END** — `fetchRecentOrders` and `fetchOrderDetailsBatch` now discover total count first, then paginate from the tail. Fixes the bug where KPI tools returned 0€ revenue on large stores (PrestaShop returns ascending order by default, `sort` is stripped in safe-sort mode).
- **Order details fallback** — When `GET /api/orders/{id}` returns empty `order_rows` (deleted languages bug), automatically falls back to `/api/order_details`. Samples 5 orders first to avoid thousands of wasted API calls.
- **SEO audit resilience** — Per-item try/catch in all 3 SEO audit tools. Corrupt multilang translations no longer crash the entire audit.
- **Date filtering robustness** — `filterByDate` includes items with missing/unparseable dates instead of silently dropping them. Prevents 0€ revenue when date fields are null.
- **Health check** — `ps_site_info` now probes key API endpoints (products, orders, CMS) and reports ok/fail status.
- **Language ID gap detection** — `ps_site_info` warns when language IDs have gaps (common source of 500 errors).
- **Debug metadata** — `ps_top_revenue_products` includes `_debug` with `total_orders_in_shop`, `start_offset`, `oldest_date`, `newest_date`, `fallback_used`, `order_details_fetched`, `order_details_matched`.
- **Safe-sort mode** — `PS_SAFE_SORT=true` (default) strips `sort` parameter from API calls to avoid PrestaShop 500 errors on 1.7/8.x.
- 622 tests across 34 test suites, 100% pass rate.
### v3.0.0
- HTTP Streamable transport (MCP SDK StreamableHTTPServerTransport)
- Dual-mode: stdio + HTTP simultaneously
- Health endpoint (`/health`)
- Bearer token authentication for HTTP mode
- Origin validation (anti-DNS-rebinding)
- 16 new resource tools (manufacturers, suppliers, geography, currencies, groups, carts, invoices, configuration)
- 6 advanced analysis tools (category performance, inventory valuation, abandoned carts, supplier performance, SEO audit for categories & CMS)
- 79 tools total, 580 tests
### v2.0.0
- Write operations (product updates, stock, order status, cart rules)
- SEO audit & update tools
- Multi-site / multi-target support
- Tool category filter (`PS_TOOL_CATEGORIES`)
- Read-only governance gate
### v1.0.0
- Initial release
- Read-only tools for products, categories, orders, customers, stock, CMS
- Catalogue, promotions, management tools
- Product image support
---
## Credits
Built by **[AdSim](https://adsim.be)** — Digital Marketing & AI Agency, Liege, Belgium.
---
*Licensed under MIT. See [LICENSE](LICENSE) for details.*
TDQS
Scored across 79 tools
Several tools have unclear boundaries: ps_get_order and ps_get_order_details appear to return nearly identical order detail, and ps_dead_products_report overlaps heavily with ps_cross_analysis using analysis_type=dead_products. Stock/alert tools (ps_low_stock_report, ps_stock_alert_check, ps_list_stock, ps_get_product_stock, ps_stock_rotation_score) and SEO update paths (ps_update_product, ps_update_category, ps_update_seo) also risk misselection.
All tools use a consistent ps_ prefix and snake_case, which is readable. However, many analytics tools are noun-first reports (ps_dead_products_report, ps_stock_rotation_score, ps_customer_ltv) while the core CRUD tools are verb-first (ps_list_*, ps_get_*, ps_create_*), creating a mixed convention across the set.
At 79 tools, the surface is extremely large for an MCP server and exceeds the point where an agent can reliably choose among tools. Much of the count comes from overlapping analytics/report tools and many read-only list/get endpoints, making the set feel overgrown rather than well-scoped.
Coverage is broad across products, categories, customers, orders, carts, stock, CMS, SEO, carriers, pricing, and reporting. However, several resources are list/get only (manufacturers, suppliers, carriers, tax rules, zones, configurations), and there are gaps in product combination/image management, order creation, and delete/update operations for some entities.