retailcrm-mcp
Production-grade MCP server for RetailCRM e-commerce CRM, providing 39 tools and 2 prompt skills to manage orders, customers, products, inventory, payments, tasks, references, and analytics via API v5. Token-efficient summary outputs by default, Docker-ready, and supports both stdio and HTTP transports.
README
retailcrm-mcp
Production-grade MCP server for RetailCRM e-commerce CRM. 39 tools + 2 prompt skills for managing orders, customers, products, inventory, payments, tasks, references, and analytics via API v5.
API traffic is transported by the official retailcrm/api-client-php client, pinned to 6.15.32, invoked from Node through a PHP bridge (bin/retailcrm-api.php). The server ships as a self-contained Docker image — no host PHP or Composer required.
Forked from theYahia/retailcrm-mcp (MIT).
Output is token-efficient by default
Read tools return a compact, shaped summary of only the fields an agent needs — not the full RetailCRM payload. Control verbosity per call:
| Param | Effect |
|---|---|
| (default) | detail:"summary" — essential fields + a pagination block |
detail:"full" |
All shaped fields (line items, delivery, payments, address…) |
raw:true |
The untouched RetailCRM response (for debugging) |
⚠️ v3 was a breaking change vs v2: default output is the shaped summary instead of raw JSON. Pass
raw:trueto restore the old payload.
Tools (39)
Orders
| Tool | Description |
|---|---|
list_orders |
List orders by status, customer, number, date range |
get_order |
Get one order by ID or externalId |
create_order |
Create an order; link an existing customer (customer_id/customer_external_id) or create one inline |
update_order |
Update status, customer, delivery, comments |
orders_history |
Order change history incl. status transitions (incremental sync) |
Customers
| Tool | Description |
|---|---|
list_customers |
Search customers by name, email, phone, date |
get_customer |
Get one customer by ID or externalId |
create_customer |
Create a customer |
update_customer |
Edit an existing customer |
merge_customers |
Merge duplicates (destructive) |
customers_history |
Customer change log (growth/churn, incremental sync) |
Products & inventory
| Tool | Description |
|---|---|
list_products |
Catalog products by name, group, active, price |
list_product_groups |
Product category tree |
store_inventories |
Stock levels & cost prices per offer/warehouse |
Payments
| Tool | Description |
|---|---|
order_payment_create |
Record a payment on an order |
order_payment_edit |
Edit a payment |
order_payment_delete |
Delete a payment (destructive) |
Notes & tasks
| Tool | Description |
|---|---|
customer_notes_list / customer_notes_create / customer_notes_delete |
Free-text customer notes |
tasks_list / tasks_create / tasks_edit |
Follow-up tasks/reminders |
Marketing & finance
| Tool | Description |
|---|---|
list_segments |
Customer segments (RFM/marketing cohorts) |
list_costs / create_cost |
Expense records for margin analytics |
Files
| Tool | Description |
|---|---|
files_list / files_get / files_upload |
Attach & retrieve files (raw octet-stream upload) |
References
| Tool | Description |
|---|---|
list_statuses / list_delivery_types / list_payment_types / list_stores |
Order/delivery/payment/store reference data |
list_sites |
Sites the API key can act on (fill the site param) |
list_countries / list_order_types / list_order_methods |
Address & order reference data |
Analytics
| Tool | Description |
|---|---|
get_orders_summary |
Period-scoped order stats: exact count + revenue, AOV, status distribution |
get_customers_summary |
New-customer count for a date range |
Prompt Skills (2)
| Skill | Description |
|---|---|
new-orders |
Quick daily overview of today's orders |
customer-search |
Find a customer by name, email, or phone |
Setup
- In RetailCRM, go to Settings > Integration > API keys.
- Create an API key with the required permissions (orders, customers, store, references). For a multi-site key, pass the
sitecode on create/edit tools (seelist_sites). - Note your domain (the
yourstorepart ofyourstore.retailcrm.ru).
Environment Variables
Secrets are provided via environment variables only — never on the command line, in config files, or in logs.
| Variable | Required | Description |
|---|---|---|
RETAILCRM_DOMAIN |
Yes | Your RetailCRM domain (e.g. yourstore.retailcrm.ru) |
RETAILCRM_API_KEY |
Yes | API key (sent via the X-API-KEY header by the PHP client) |
RETAILCRM_READONLY |
No | 1 to expose only read tools (hide create/update/merge/delete) |
RETAILCRM_RATE_LIMIT |
No | Client-side requests/second cap (RetailCRM allows ~10/s) |
RETAILCRM_PHP_BIN |
No | PHP executable for the local (non-Docker) path (default php) |
RETAILCRM_PHP_BRIDGE |
No | Path to bin/retailcrm-api.php (set automatically in Docker) |
PORT / HOST |
No | HTTP server bind (default 3000 / 127.0.0.1, --http mode only) |
RETAILCRM_HTTP_ALLOWED_HOSTS |
No | Comma-separated allowed Host values for DNS-rebinding protection |
RETAILCRM_DNS_PROTECTION |
No | off to disable DNS-rebinding protection (HTTP mode) |
RETAILCRM_URLis still accepted as a fallback forRETAILCRM_DOMAIN.
Docker (recommended)
Build the self-contained image (Node + PHP CLI/cURL + compiled server + PHP bridge + Composer production dependencies — official retailcrm/api-client-php 6.15.32):
docker build -t retailcrm-mcp:3.1.0 .
Run over stdio:
docker run --rm -i \
-e RETAILCRM_DOMAIN=yourstore.retailcrm.ru \
-e RETAILCRM_API_KEY=your-api-key \
retailcrm-mcp:3.1.0
Run the Streamable HTTP server instead by appending --http:
docker run --rm -p 127.0.0.1:3000:3000 \
-e RETAILCRM_DOMAIN=yourstore.retailcrm.ru \
-e RETAILCRM_API_KEY=your-api-key \
-e HOST=0.0.0.0 \
retailcrm-mcp:3.1.0 --http
Usage with Claude Desktop / MCP clients
{
"mcpServers": {
"retailcrm": {
"command": "docker",
"args": [
"run", "--rm", "-i", "--init",
"-e", "RETAILCRM_DOMAIN",
"-e", "RETAILCRM_API_KEY",
"retailcrm-mcp:3.1.0"
],
"env": {
"RETAILCRM_DOMAIN": "yourstore.retailcrm.ru",
"RETAILCRM_API_KEY": "your-api-key"
}
}
}
}
Optional: local Node + PHP + Composer
If you prefer not to use Docker, run the same stack locally:
# 1. Node dependencies + compile
npm install
npm run build
# 2. PHP dependencies (Composer >= 2; plugins and scripts disabled)
composer install --no-dev --no-interaction --no-progress --no-scripts --no-plugins --optimize-autoloader
# 3. Run (stdio)
RETAILCRM_DOMAIN=yourstore.retailcrm.ru \
RETAILCRM_API_KEY=your-api-key \
node dist/index.js
# Or the HTTP server
RETAILCRM_DOMAIN=yourstore.retailcrm.ru \
RETAILCRM_API_KEY=your-api-key \
node dist/index.js --http
Requires Node >= 18 and PHP >= 8.1 with the cURL, JSON, mbstring, and openssl extensions.
Architecture & the raw-upload exception
- All normal RetailCRM traffic (GET and form POST) goes through the official
retailcrm/api-client-php6.15.32 client (SimpleClientFactory::createClient+CustomMethods/CustomApiMethod), executed insidebin/retailcrm-api.php. - The Node client (
src/client.ts) talks to the bridge over JSON on stdin/stdout with a versioned, fail-closed protocol: malformed, empty, or non-JSON bridge output is always an error, never success. files_uploadis the one documented compatibility exception. The official v6.15.32FilesUploadRequestdoes not preserve this MCP's?filename=query parameter and caller MIME type, so the bridge performs that single call with PHP cURL — same normalized origin,X-API-KEYheader, 15-second timeout, and bounded error handling. Every other tool uses the official client.- Retry policy is unchanged: 3 attempts,
429always retried, timeout/5xx retried for GETs only (never for ambiguous POSTs), optional client-side rate gate.
Demo Prompts
1. Daily order overview: "Show me all orders created today with status 'new'. Summarize the total count and revenue."
2. Customer lookup and order history: "Find the customer with email anna@example.com. Show their full profile and recent orders."
3. Stock check: "Is the product with externalId SKU-42 in stock, and in which warehouse?"
Webhooks / Triggers
RetailCRM does not support API-created webhooks. Use Triggers in the admin panel (Settings > Triggers) to send HTTP requests to external endpoints on order/customer events.
Error Handling
- Rate limits / 5xx: automatic retry with exponential backoff + jitter (up to 3 attempts).
- API errors: RetailCRM error details are parsed and returned to the model as a tool result with
isError: true, so the agent can self-correct (e.g. retry withby:"externalId"). - Timeouts: 15-second whole-call timeout, enforced by terminating the bridge process.
Development
npm install
npm test # vitest (mock-based; no live API key needed)
npm run lint # eslint
npm run typecheck # tsc --noEmit
npm run dev # stdio dev mode (tsx)
npm run build # clean + compile to dist/
License
MIT — upstream © Yahia (theYahia/retailcrm-mcp); retailcrm/api-client-php is MIT © RetailCRM.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。