salla-mcp
MCP server for Salla — e-commerce platform, orders, products (Saudi Arabia).
MCP server for the Salla e-commerce platform (Saudi Arabia). Manage products, categories, brands, orders, customers, coupons, branches, and store settings through the Salla Admin API v2 — with OAuth 2.0, automatic token refresh, and rate-limit aware retries. Salla uses OAuth 2.0. You can run this server in one of two ways. Set SALLA_ACCESS_TOKEN. Salla access tokens expire after 14 days, after which calls fail with 401 and you must supply a new token. Good for quick local use; for anything long-running, use auto-refresh below.
Summary extracted from the README.
salla-mcp
MCP server for the Salla e-commerce platform (Saudi Arabia). Manage products, categories, brands, orders, customers, coupons, branches, and store settings through the Salla Admin API v2 — with OAuth 2.0, automatic token refresh, and rate-limit aware retries.
Tools (22)
Products
| Tool | Description |
|---|---|
list_products |
List products (pagination + status filter) |
get_product |
Get a product by ID |
get_product_by_sku |
Get a product by SKU |
create_product |
Create a new product |
update_product |
Update an existing product |
delete_product |
Delete a product |
bulk_update_quantities |
Bulk-update stock by product/variant ID or SKU |
Categories & brands
| Tool | Description |
|---|---|
list_categories |
List categories (keyword + status filter) |
get_category |
Get a category by ID |
create_category |
Create a category |
list_brands |
List brands |
Orders
| Tool | Description |
|---|---|
list_orders |
List orders (pagination + status filter) |
get_order |
Get an order by ID |
update_order_status |
Update an order's fulfillment status |
list_order_statuses |
List valid order statuses for the store |
get_order_histories |
Get an order's status-change timeline |
Customers, store & operations
| Tool | Description |
|---|---|
list_customers |
List customers |
get_customer |
Get a customer by ID |
get_store_info |
Get store information and settings |
list_coupons |
List discount coupons |
list_abandoned_carts |
List abandoned carts |
list_branches |
List store branches |
Quick Start
{
"mcpServers": {
"salla": {
"command": "npx",
"args": ["-y", "@theyahia/salla-mcp"],
"env": {
"SALLA_ACCESS_TOKEN": "<YOUR_ACCESS_TOKEN>"
}
}
}
}
Authentication
Salla uses OAuth 2.0. You can run this server in one of two ways.
Option 1 — Static access token (simplest)
Set SALLA_ACCESS_TOKEN. Salla access tokens expire after 14 days, after which calls
fail with 401 and you must supply a new token. Good for quick local use; for anything
long-running, use auto-refresh below.
Option 2 — Auto-refresh (recommended for long-running use)
Provide your app's OAuth credentials and a refresh token, and the server refreshes the
access token automatically — proactively before expiry and reactively on a 401:
{
"mcpServers": {
"salla": {
"command": "npx",
"args": ["-y", "@theyahia/salla-mcp"],
"env": {
"SALLA_CLIENT_ID": "<CLIENT_ID>",
"SALLA_CLIENT_SECRET": "<CLIENT_SECRET>",
"SALLA_REFRESH_TOKEN": "<REFRESH_TOKEN>"
}
}
}
}
Salla refresh tokens are single-use and rotate on every refresh (and themselves expire
after ~1 month). To survive restarts, the server persists the latest tokens to a token
store file (SALLA_TOKEN_STORE, default ~/.salla-mcp/token.json) and reloads them on
start. Concurrent refreshes are collapsed into one request, which Salla requires.
Where credentials come from
Create an app in the Salla Partners portal and install it on a
store. In Easy Mode, Salla delivers the access token to your app's configured webhook
on the app.store.authorize event. In Custom Mode, you take the Client ID /
Client Secret from the app's keys and run the standard authorization-code exchange
against https://accounts.salla.sa/oauth2/token. See the
Salla authorization docs.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SALLA_ACCESS_TOKEN |
One of these two setups | – | OAuth 2.0 access token |
SALLA_CLIENT_ID |
For auto-refresh | – | OAuth app client ID |
SALLA_CLIENT_SECRET |
For auto-refresh | – | OAuth app client secret |
SALLA_REFRESH_TOKEN |
For auto-refresh | – | OAuth refresh token (rotated on use) |
SALLA_TOKEN_STORE |
No | ~/.salla-mcp/token.json |
Where rotated tokens are persisted |
SALLA_BASE_URL |
No | https://api.salla.dev/admin/v2 |
API base URL |
SALLA_TIMEOUT_MS |
No | 15000 |
Per-request timeout |
SALLA_MAX_RETRIES |
No | 3 |
Retries for 429/5xx responses |
SALLA_TOKEN_URL |
No | https://accounts.salla.sa/oauth2/token |
OAuth token endpoint |
Rate Limits
Salla enforces per-plan limits over a 1-minute window (Plus 120, Pro 360, Special 720
requests/min). On 429 the server honors the Retry-After header and retries with
exponential backoff; transient 5xx responses are retried too, up to SALLA_MAX_RETRIES.
Demo Prompts
- "List all products in my Salla store"
- "Create a new product called 'Premium Dates' for 150 SAR"
- "What order statuses can I set, and move order 1001 to completed"
- "Sync stock: set SKU ABC-1 to 40 units"
- "Show me the abandoned carts from this week"
Troubleshooting
Salla authentication is not configured— setSALLA_ACCESS_TOKEN, or the threeSALLA_CLIENT_ID/SALLA_CLIENT_SECRET/SALLA_REFRESH_TOKENvariables.Salla HTTP 401with a static token — the token has expired (14-day lifetime); generate a new one or switch to auto-refresh.- Repeated
401after refresh — your refresh token may have been consumed elsewhere (they are single-use). Delete the token store file and re-supply a fresh refresh token. Salla HTTP 429— you hit the plan rate limit; the server already retries, but sustained high volume needs a higher Salla plan.
Development
npm install
npm run dev # run the server with tsx (stdio)
npm test # vitest
npm run lint # eslint
npm run typecheck # tsc --noEmit
npm run build # emit dist/
License
MIT