create_shipping_plugin
Generate shipping plugins for Webasyst to add custom delivery methods and integrate with carriers.
Instructions
Создать плагин доставки (wa-plugins/shipping/)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plugin_name | Yes | ID плагина (латиница) | |
| plugin_title | Yes | Название плагина | |
| webasyst_path | Yes | Путь к Webasyst |
Implementation Reference
- webasyst-mcp.js:747-820 (handler)The handler function that implements the create_shipping_plugin tool. It creates the directory structure for a shipping plugin in wa-plugins/shipping/, generates the plugin.php config file, the main PHP class extending waShipping with calculate(), allowedCurrency(), etc., and protective .htaccess files.async function createShippingPluginTool({ plugin_name, plugin_title, webasyst_path }) { // Shipping плагины располагаются в wa-plugins/shipping/ const p = path.join(webasyst_path, 'wa-plugins', 'shipping', plugin_name); for (const d of ['lib', 'lib/config', 'img', 'templates', 'locale']) await ensureDir(p, d); const pluginConfig = `<?php return array( 'name' => /*_wp*/('${plugin_title}'), 'description' => /*_wp*/('Плагин доставки'), 'icon' => 'img/${plugin_name}16.png', 'logo' => 'img/${plugin_name}.png', 'version' => '1.0.0', 'vendor' => 'custom', ); `; await fs.writeFile(path.join(p, 'lib', 'config', 'plugin.php'), pluginConfig); // Класс без префикса shop, метод calculate() должен быть protected const code = `<?php /** * ${plugin_title} shipping plugin. */ class ${plugin_name}Shipping extends waShipping { /** * @return array|string|false */ protected function calculate() { return array( 'default' => array( 'name' => /*_wp*/('${plugin_title}'), 'description' => '', 'est_delivery' => '', 'currency' => 'RUB', 'rate' => 350.00, ), ); } /** * @return array|string */ public function allowedCurrency() { return 'RUB'; } /** * @return array|string */ public function allowedWeightUnit() { return 'kg'; } /** * @return array */ public function requestedAddressFields() { return array(); } } `; await fs.writeFile(path.join(p, 'lib', `${plugin_name}Shipping.class.php`), code); // Создаём .htaccess для защиты await fs.writeFile(path.join(p, 'lib', '.htaccess'), 'Deny from all\n'); await fs.writeFile(path.join(p, 'templates', '.htaccess'), 'Deny from all\n'); return { content: [{ type: 'text', text: `Shipping plugin "${plugin_title}" создан в wa-plugins/shipping/${plugin_name}` }] }; }
- webasyst-mcp.js:1725-1726 (schema)The input schema definition for the create_shipping_plugin tool, specifying parameters plugin_name, plugin_title, and webasyst_path.{ name: 'create_shipping_plugin', description: 'Создать плагин доставки (wa-plugins/shipping/)', inputSchema: { type: 'object', properties: { plugin_name: { type: 'string', description: 'ID плагина (латиница)' }, plugin_title: { type: 'string', description: 'Название плагина' }, webasyst_path: { type: 'string', description: 'Путь к Webasyst' } }, required: ['plugin_name', 'plugin_title', 'webasyst_path'] } }, { name: 'create_payment_plugin', description: 'Создать плагин оплаты (wa-plugins/payment/)', inputSchema: { type: 'object', properties: { plugin_name: { type: 'string', description: 'ID плагина (латиница)' }, plugin_title: { type: 'string', description: 'Название плагина' }, webasyst_path: { type: 'string', description: 'Путь к Webasyst' } }, required: ['plugin_name', 'plugin_title', 'webasyst_path'] } },
- webasyst-mcp.js:1787-1787 (registration)Registration of the create_shipping_plugin tool handler in the switch statement within the CallToolRequestSchema handler.case 'create_shipping_plugin': return await createShippingPluginTool(args);
- webasyst-mcp.js:1695-1752 (registration)The tool is registered in the list of available tools returned by ListToolsRequestSchema handler, making it discoverable.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ // Info { name: 'list_webasyst_apps', description: 'Получить список всех приложений Webasyst', inputSchema: { type: 'object', properties: { include_system: { type: 'boolean', default: false, description: 'Включить системные приложения' } } } }, { name: 'get_app_info', description: 'Получить информацию о конкретном приложении', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' } }, required: ['app_id'] } }, { name: 'list_app_plugins', description: 'Получить список плагинов приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' } }, required: ['app_id'] } }, { name: 'get_plugin_info', description: 'Получить информацию о плагине', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, plugin_id: { type: 'string', description: 'ID плагина' } }, required: ['app_id', 'plugin_id'] } }, { name: 'list_app_themes', description: 'Получить список тем оформления приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' } }, required: ['app_id'] } }, { name: 'list_app_widgets', description: 'Получить список виджетов приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' } }, required: ['app_id'] } }, { name: 'get_routing_config', description: 'Получить конфигурацию маршрутизации', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения (опционально)' } } } }, { name: 'get_system_config', description: 'Получить системную конфигурацию', inputSchema: { type: 'object', properties: {} } }, { name: 'run_webasyst_cli', description: 'Выполнить CLI команду Webasyst', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'CLI команда для выполнения' }, args: { type: 'array', items: { type: 'string' }, description: 'Аргументы команды', default: [] } }, required: ['command'] } }, // Creation - basic { name: 'create_app_structure', description: 'Создать структуру нового приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID нового приложения' }, app_name: { type: 'string', description: 'Название приложения' }, description: { type: 'string', description: 'Описание приложения' } }, required: ['app_id', 'app_name'] } }, { name: 'create_plugin_structure', description: 'Создать структуру нового плагина', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, plugin_id: { type: 'string', description: 'ID плагина' }, plugin_name: { type: 'string', description: 'Название плагина' } }, required: ['app_id', 'plugin_id', 'plugin_name'] } }, { name: 'create_widget', description: 'Создать виджет для Dashboard', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения (webasyst для системного виджета)' }, widget_id: { type: 'string', description: 'ID виджета' }, widget_name: { type: 'string', description: 'Название виджета' }, has_settings: { type: 'boolean', default: false, description: 'Имеет настройки' } }, required: ['app_id', 'widget_id', 'widget_name'] } }, { name: 'create_action', description: 'Создать action или controller', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, module: { type: 'string', description: 'Название модуля (backend, frontend и т.д.)' }, action_type: { type: 'string', enum: ['action', 'actions', 'long', 'json', 'jsons'], default: 'action', description: 'Тип action' }, action_names: { type: 'array', items: { type: 'string' }, description: 'Названия actions' } }, required: ['app_id', 'module', 'action_names'] } }, { name: 'create_model', description: 'Создать модель для работы с БД', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, table_name: { type: 'string', description: 'Название таблицы в БД' } }, required: ['app_id', 'table_name'] } }, { name: 'create_theme', description: 'Создать тему оформления для приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, theme_id: { type: 'string', description: 'ID темы' }, theme_name: { type: 'string', description: 'Название темы' }, prototype: { type: 'string', default: 'default', description: 'Прототип темы' } }, required: ['app_id', 'theme_id', 'theme_name'] } }, // Site { name: 'create_site_plugin', description: 'Создать плагин для приложения Site', inputSchema: { type: 'object', properties: { plugin_type: { type: 'string' }, plugin_name: { type: 'string' }, plugin_title: { type: 'string' }, description: { type: 'string' }, settings: { type: 'array', items: { type: 'object' } }, frontend_assets: { type: 'boolean' }, admin_interface: { type: 'boolean' }, webasyst_path: { type: 'string' } }, required: ['plugin_name', 'plugin_title', 'webasyst_path'] } }, { name: 'create_site_widget', description: 'Создать виджет для Site', inputSchema: { type: 'object', properties: { widget_name: { type: 'string' }, widget_title: { type: 'string' }, widget_type: { type: 'string' }, has_settings: { type: 'boolean' }, is_cacheable: { type: 'boolean' }, responsive: { type: 'boolean' }, ajax_support: { type: 'boolean' }, webasyst_path: { type: 'string' } }, required: ['widget_name', 'widget_title', 'webasyst_path'] } }, { name: 'create_site_block', description: 'Создать блок конструктора Site', inputSchema: { type: 'object', properties: { block_name: { type: 'string' }, block_title: { type: 'string' }, block_category: { type: 'string' }, webasyst_path: { type: 'string' } }, required: ['block_name', 'block_title', 'webasyst_path'] } }, { name: 'create_site_theme', description: 'Создать тему для Site', inputSchema: { type: 'object', properties: { theme_name: { type: 'string' }, theme_title: { type: 'string' }, style_type: { type: 'string' }, color_scheme: { type: 'object' }, layout_features: { type: 'array', items: { type: 'string' } }, responsive_breakpoints: { type: 'boolean' }, dark_mode: { type: 'boolean' }, rtl_support: { type: 'boolean' }, webasyst_path: { type: 'string' } }, required: ['theme_name', 'theme_title', 'webasyst_path'] } }, // Shop { name: 'create_shop_plugin', description: 'Создать плагин Shop-Script', inputSchema: { type: 'object', properties: { plugin_name: { type: 'string' }, plugin_title: { type: 'string' }, description: { type: 'string' }, webasyst_path: { type: 'string' } }, required: ['plugin_name', 'plugin_title', 'webasyst_path'] } }, { name: 'create_shop_theme', description: 'Создать тему Shop-Script', inputSchema: { type: 'object', properties: { theme_name: { type: 'string' }, theme_title: { type: 'string' }, style_type: { type: 'string' }, color_scheme: { type: 'object' }, webasyst_path: { type: 'string' } }, required: ['theme_name', 'theme_title', 'webasyst_path'] } }, { name: 'create_shipping_plugin', description: 'Создать плагин доставки (wa-plugins/shipping/)', inputSchema: { type: 'object', properties: { plugin_name: { type: 'string', description: 'ID плагина (латиница)' }, plugin_title: { type: 'string', description: 'Название плагина' }, webasyst_path: { type: 'string', description: 'Путь к Webasyst' } }, required: ['plugin_name', 'plugin_title', 'webasyst_path'] } }, { name: 'create_payment_plugin', description: 'Создать плагин оплаты (wa-plugins/payment/)', inputSchema: { type: 'object', properties: { plugin_name: { type: 'string', description: 'ID плагина (латиница)' }, plugin_title: { type: 'string', description: 'Название плагина' }, webasyst_path: { type: 'string', description: 'Путь к Webasyst' } }, required: ['plugin_name', 'plugin_title', 'webasyst_path'] } }, { name: 'create_shop_report', description: 'Создать отчет Shop-Script', inputSchema: { type: 'object', properties: { report_key: { type: 'string' }, report_title: { type: 'string' }, webasyst_path: { type: 'string' } }, required: ['report_key', 'report_title', 'webasyst_path'] } }, // Generic app in external path { name: 'create_generic_app', description: 'Создать новое приложение Webasyst (в указанном пути)', inputSchema: { type: 'object', properties: { name: { type: 'string' }, title: { type: 'string' }, description: { type: 'string' }, features: { type: 'array', items: { type: 'string' } }, webasyst_path: { type: 'string' } }, required: ['name', 'title', 'webasyst_path'] } }, // UI { name: 'enable_webasyst_ui', description: 'Подключить дизайн-систему Webasyst UI 2.0', inputSchema: { type: 'object', properties: { project_type: { type: 'string' }, target_path: { type: 'string' }, include_icons: { type: 'boolean' }, include_components: { type: 'boolean' }, include_color_scheme: { type: 'boolean' } }, required: ['project_type', 'target_path'] } }, { name: 'create_ui_component', description: 'Сгенерировать UI-компонент Webasyst 2.0', inputSchema: { type: 'object', properties: { component_type: { type: 'string', enum: ['table', 'form', 'modal', 'drawer', 'chips', 'bricks', 'upload', 'bottombar', 'userpic_list', 'slider', 'toggle', 'switch', 'skeleton', 'tabs', 'progressbar', 'tooltip', 'autocomplete', 'menu', 'alert', 'paging', 'breadcrumbs', 'spinner', 'dropdown', 'card'], description: 'Тип компонента: table, form, modal, drawer, chips, bricks, upload, bottombar, userpic_list, slider, toggle, switch, skeleton, tabs, progressbar, tooltip, autocomplete, menu, alert, paging, breadcrumbs, spinner, dropdown, card' }, component_name: { type: 'string', description: 'Уникальное имя компонента (латиница, без пробелов)' }, target_path: { type: 'string', description: 'Путь к приложению/плагину' }, with_js: { type: 'boolean', default: true, description: 'Создать JS-инициализацию (для modal, drawer, upload, slider, toggle, tabs, progressbar, tooltip, autocomplete, switch, dropdown)' } }, required: ['component_type', 'component_name', 'target_path'] } }, // SEO/Analysis { name: 'setup_seo_optimization', description: 'Базовые SEO-настройки (robots/sitemap)', inputSchema: { type: 'object', properties: { site_path: { type: 'string' }, features: { type: 'array', items: { type: 'string' } }, analytics_codes: { type: 'object' }, webasyst_path: { type: 'string' } }, required: ['site_path'] } }, { name: 'analyze_project', description: 'Проанализировать проект Webasyst', inputSchema: { type: 'object', properties: { project_path: { type: 'string' }, analysis_type: { type: 'string' }, generate_report: { type: 'boolean' } }, required: ['project_path'] } }, { name: 'generate_po_template', description: 'Создать/обновить PO шаблон для приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string' }, locale: { type: 'string' } }, required: ['app_id'] } }, { name: 'compile_mo', description: 'Скомпилировать .mo из .po', inputSchema: { type: 'object', properties: { app_id: { type: 'string' }, locale: { type: 'string' } }, required: ['app_id'] } }, { name: 'check_project_compliance', description: 'Проверить базовое соответствие UI/локализации', inputSchema: { type: 'object', properties: { project_path: { type: 'string' } }, required: ['project_path'] } }, { name: 'prepare_release_bundle', description: 'Собрать архив проекта для публикации', inputSchema: { type: 'object', properties: { project_path: { type: 'string' }, output: { type: 'string' } }, required: ['project_path'] } }, // DevOps { name: 'generate_nginx_vhost', description: 'Сгенерировать nginx-конфиг', inputSchema: { type: 'object', properties: { domain: { type: 'string' }, root_path: { type: 'string' }, php_version: { type: 'string' } }, required: ['domain', 'root_path'] } }, { name: 'generate_htaccess', description: 'Сгенерировать .htaccess', inputSchema: { type: 'object', properties: { root_path: { type: 'string' } }, required: ['root_path'] } }, // UI Validation & Generation { name: 'validate_ui_usage', description: 'Проверить использование UI 2.0 (хардкод цветов, устаревшие паттерны)', inputSchema: { type: 'object', properties: { project_path: { type: 'string', description: 'Путь к приложению/плагину' }, check_colors: { type: 'boolean', default: true, description: 'Проверять хардкод цвета' }, check_components: { type: 'boolean', default: true, description: 'Проверять устаревшие паттерны' }, fix_suggestions: { type: 'boolean', default: true, description: 'Показывать предложения по исправлению' } }, required: ['project_path'] } }, { name: 'generate_color_scheme', description: 'Сгенерировать CSS-переменные цветовой схемы', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, scheme_name: { type: 'string', default: 'custom', description: 'Название схемы' }, primary_color: { type: 'string', description: 'Основной цвет (или CSS-переменная)' }, secondary_color: { type: 'string', description: 'Вторичный цвет' }, accent_color: { type: 'string', description: 'Акцентный цвет' }, text_color: { type: 'string', description: 'Цвет текста' }, background_color: { type: 'string', description: 'Цвет фона' } }, required: ['app_id'] } }, { name: 'create_responsive_layout', description: 'Создать адаптивные лейауты (Desktop + Mobile) с isMobile()', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, with_sidebar: { type: 'boolean', default: true, description: 'Включить сайдбар в Desktop' }, with_bottombar: { type: 'boolean', default: true, description: 'Включить bottombar в Mobile' } }, required: ['app_id'] } }, ]