Skip to main content
Glama

salla-custom-code-mcp

خادم MCP محلي صغير يضيف أدوات CSS و JavaScript المخصص لمتجر سلة، أي ما تجده في محرر الثيم ← التخصيص المتقدم. هذه الأدوات غير موجودة في MCP سلة الرسمي (mcp.salla.dev).

A tiny local MCP server that adds custom CSS / JS tools for a Salla store (theme editor → Advanced customization), which Salla's hosted MCP does not expose.

الأدوات

الأداة

الوظيفة

custom_css_get

قراءة الـ CSS المخصص

custom_css_update

استبدال الـ CSS كاملاً (مع نسخة احتياطية قبل الحفظ، وتحقق بعده)

custom_js_get

قراءة الـ JavaScript المخصص

custom_js_update

استبدال الـ JavaScript كاملاً (مع نسخة احتياطية وتحقق)

custom_js_toggle

تشغيل الـ JavaScript المخصص أو إيقافه

Related MCP server: Chrome DevTools MCP Server

طريقة العمل

  • ليس في API سلة العام endpoint للكود المخصص. لذلك يستدعي الخادم نفس الـ endpoints التي تستخدمها لوحة التاجر:

    • api.salla.dev/admin/v2/design/custom/css

    • api.salla.dev/admin/v2/design/custom/js

    • api.salla.dev/admin/v2/design/custom/js/toggle

  • الطلبات تُرسَل من داخل تبويب s.salla.sa مسجّل الدخول في ملف Chromium مخصص، عن طريق Chrome DevTools Protocol. رمز الدخول لا يخرج من المتصفح ولا يُحفظ في أي ملف.

  • إذا لم يكن المتصفح يعمل، يفتحه الخادم تلقائياً.

  • حماية من الخطأ: إذا كان الحساب المسجّل لمتجر غير SALLA_STORE_ID، يرفض الخادم الطلب ولا يغيّر شيئاً.

  • قبل كل حفظ تُنسخ النسخة السابقة إلى ~/.config/salla-custom-code/backups/<profile>/.

⚠️ هذه endpoints داخلية وغير موثّقة، وقد تغيّرها سلة في أي وقت. الحفظ يظهر مباشرة في المتجر إذا كانت النسخة منشورة.

المتطلبات

  • Node.js 22 أو أحدث (يحتاج fetch و WebSocket المدمجين).

  • Chromium أو Chrome. الافتراضي هو Chromium الخاص بـ Playwright في ~/.cache/ms-playwright/chromium-1248/chrome-linux64/chrome، ويمكن تغييره بـ SALLA_CHROME.

التثبيت

git clone https://github.com/dfsf2151/salla-custom-code-mcp.git
cd salla-custom-code-mcp
npm install

سجّله في Claude Code:

claude mcp add salla-mystore-code -s user \
  -e SALLA_STORE_ID=<رقم المتجر> \
  -e SALLA_VERSION_ID=<رقم نسخة الثيم> \
  -e SALLA_PROFILE=mystore \
  -- node /path/to/salla-custom-code-mcp/server.mjs
  • رقم المتجر: تجده في store_context_get من MCP سلة الرسمي.

  • رقم نسخة الثيم: تجده في theme_versions_list، وهو النسخة التي عليها is_default.

تسجيل الدخول أول مرة

  1. عند أول استدعاء لأي أداة، يفتح الخادم نافذة Chromium (ملفها ~/.config/salla-custom-code/profile-<SALLA_PROFILE>).

  2. سجّل الدخول فيها إلى لوحة سلة بحساب المتجر.

  3. اترك النافذة مفتوحة.

جلسة اللوحة تنتهي بعد أسبوعين تقريباً. عندها سجّل الدخول مرة أخرى في نفس النافذة.

متغيرات البيئة

المتغير

الافتراضي

الوصف

SALLA_STORE_ID

—

رقم المتجر المسموح به (حماية)

SALLA_VERSION_ID

—

نسخة الثيم الافتراضية

SALLA_PROFILE

default

اسم ملف المتصفح والنسخ الاحتياطية، مفيد لأكثر من متجر

SALLA_CDP_PORT

9333

منفذ DevTools. استخدم منفذاً مختلفاً لكل متجر

SALLA_CHROME

Chromium الخاص بـ Playwright

مسار المتصفح

سكربتات الاختبار

# قراءة فقط
SALLA_STORE_ID=... SALLA_VERSION_ID=... node scripts/smoke.mjs

# اختبار الحفظ بدون تغيير: يقرأ الـ CSS ويحفظه كما هو
SALLA_STORE_ID=... SALLA_VERSION_ID=... node scripts/noop-save.mjs

scripts/cdp.mjs أداة تصحيح لمراقبة طلبات اللوحة: navigate URL أو eval JS أو watch SECONDS أو shot FILE.png.

scripts/upload-images.mjs يرفع صوراً من جهازك إلى منتج، عن طريق جلسة اللوحة نفسها. أول صورة تصبح الصورة الرئيسية، وإذا كان للمنتج صور من قبل، فاستخدم SORT_OFFSET حتى تأتي الصور الجديدة بعدها:

node scripts/upload-images.mjs <رقم المنتج> "<النص البديل>" main.webp 2.webp 3.webp

Available Tools

5 tools
custom_css_getC

Read the store's custom CSS (theme editor → Advanced customization → CSS) for store 123456789.

Inputs: version_id.

custom_css_updateA

Replace the store's entire custom CSS. Changes are live on the published version as soon as they are saved. Always read the current CSS first and pass the full new stylesheet (not a fragment). The previous CSS is backed up locally before saving. Show the merchant the change and get their OK before calling.

Inputs: css (required), version_id.

custom_js_getA

Read the store's custom JavaScript for store 123456789. Whether it is enabled is the version's custom_js_enabled flag in the Salla MCP's theme_versions_list.

Inputs: version_id.

custom_js_toggleA

Turn the store's custom JavaScript on or off without changing the code. Get the merchant's OK first.

Inputs: enabled (required), version_id.

custom_js_updateA

Replace the store's entire custom JavaScript. Runs on every storefront page once saved (if custom JS is enabled). Always read the current JS first and pass the full new script. The previous JS is backed up locally before saving. Show the merchant the change and get their OK before calling.

Inputs: js (required), version_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a clearly distinct resource and action: CSS read/update, JS read/update, and JS enable/disable. There is no meaningful overlap between custom_css_update and custom_js_toggle or any other pair.

    Naming Consistency5/5

    All tools follow the same snake_case pattern custom_{css|js}_{get|update|toggle}. The convention is predictable and easy to map to the underlying resources.

    Tool Count5/5

    Five tools is well-scoped for managing custom CSS and JavaScript. Each tool earns its place by covering a distinct operation without unnecessary surface area.

    Completeness4/5

    The surface covers reading and replacing both CSS and JS, plus toggling JS, which is the core workflow. Minor gaps exist around backup/restore visibility or an explicit reset operation, but agents can work around them by passing empty or full content.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Chromium browser instances through Puppeteer for inspecting dev builds, capturing screenshots, and automating UI interactions. Features permission-gated tools for secure browser navigation, DOM manipulation, and JavaScript evaluation.
      10 npm
      1
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables browser automation through a persistent Chrome instance exposed via HTTP, including navigation, screenshots, clicks, typing, multi-tab and multi-profile management, proxy switching, login state export, and AI-driven task execution.
      -