iwgt 2.4.1 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "2.0",
|
|
3
|
-
"generatedAt": "2025-10-
|
|
3
|
+
"generatedAt": "2025-10-07T12:42:07.444Z",
|
|
4
4
|
"description": "Справочник по библиотеке common.v2.js для InSales - набор готовых скриптов для разработки шаблонов",
|
|
5
5
|
"installation": {
|
|
6
6
|
"method": "liquid_tag",
|
package/dist/server-http.js
CHANGED
|
@@ -68,21 +68,26 @@ const httpServer = createServer(async (req, res) => {
|
|
|
68
68
|
// SSE endpoint
|
|
69
69
|
if (req.url === '/sse' && req.method === 'GET') {
|
|
70
70
|
console.log('📡 New SSE connection established');
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
71
|
+
try {
|
|
72
|
+
// Создаем новый MCP сервер для этого соединения
|
|
73
|
+
const widgetServer = new WidgetServer();
|
|
74
|
+
const transport = new SSEServerTransport('/message', res);
|
|
75
|
+
// Инициализируем сервер (без stdio транспорта)
|
|
76
|
+
// await widgetServer.run(); // Не вызываем run(), так как он создает stdio транспорт
|
|
77
|
+
// Подключаем транспорт
|
|
78
|
+
await widgetServer['server'].connect(transport);
|
|
79
|
+
console.log('✅ MCP server connected via SSE');
|
|
80
|
+
// Обработка закрытия соединения
|
|
81
|
+
req.on('close', () => {
|
|
82
|
+
console.log('📡 SSE connection closed');
|
|
83
|
+
transport.close();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('❌ Error initializing MCP server:', error);
|
|
88
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
89
|
+
res.end(JSON.stringify({ error: 'Failed to initialize MCP server' }));
|
|
90
|
+
}
|
|
86
91
|
return;
|
|
87
92
|
}
|
|
88
93
|
// Message endpoint для отправки сообщений
|