@vint.tri/report_gen_mcp 1.4.0 → 1.4.1

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.
@@ -64,7 +64,8 @@
64
64
 
65
65
  1. **Путь к файлу**: Абсолютный путь к созданному отчету
66
66
  2. **Ссылка на файл**: Кликабельная file:// ссылка для открытия отчета в браузере
67
- 3. **Содержимое файла**: Полный текст HTML содержимого отчета
67
+ 3. **HTTP ссылка**: Если сервер запущен, ссылка вида http://localhost:3000/report/filename.html для доступа к отчету через веб-интерфейс
68
+ 4. **Содержимое файла**: Полный текст HTML содержимого отчета
68
69
 
69
70
  Обязательно покажите пользователю содержимое файла, чтобы он мог сразу ознакомиться с результатом без необходимости открывать файл отдельно.
70
71
 
@@ -76,6 +77,7 @@
76
77
 
77
78
  📁 Путь к файлу: /полный/путь/к/отчету.html
78
79
  🌐 Ссылка для открытия в браузере: file:///полный/путь/к/отчету.html
80
+ 🔗 HTTP ссылка: http://localhost:3000/report/отчет.html
79
81
 
80
82
  📄 Содержимое отчета:
81
83
  <!DOCTYPE html>
@@ -522,6 +524,7 @@
522
524
 
523
525
  📁 Путь к файлу: /path/to/report.html
524
526
  🌐 Ссылка для открытия в браузере: file:///path/to/report.html
527
+ 🔗 HTTP ссылка: http://localhost:3000/report/report.html
525
528
 
526
529
  Содержимое отчета:
527
530
  <!DOCTYPE html>
package/dist/index.js CHANGED
@@ -38,6 +38,10 @@ if (!isStdioMode) {
38
38
  const app = express();
39
39
  const port = 3000;
40
40
  app.use(express.json());
41
+ // Serve static files from the reports directory at /report/ endpoint
42
+ if (reportsDir) {
43
+ app.use('/report', express.static(reportsDir));
44
+ }
41
45
  app.post('/generate-report', async (req, res) => {
42
46
  // For HTTP API mode, use the REPORTS_DIR environment variable
43
47
  // This endpoint only runs in non-stdio mode where reportsDir is guaranteed to be defined
@@ -103,7 +107,7 @@ if (process.argv.length === 2) {
103
107
  // No command specified, run in stdio mode using MCP SDK
104
108
  const mcpServer = new McpServer({
105
109
  name: "report_gen_mcp",
106
- version: "1.4.0",
110
+ version: "1.4.1",
107
111
  }, {
108
112
  // Disable health check to prevent automatic calls
109
113
  capabilities: {
@@ -263,8 +267,10 @@ if (process.argv.length === 2) {
263
267
  fileUrl: fileUrl,
264
268
  fileContent: fileContent
265
269
  };
270
+ // Generate HTTP link if server is running
271
+ const httpLink = reportsDir ? `http://localhost:${port}/report/${path.basename(outputPath)}` : null;
266
272
  // Return comprehensive information for neural network to use
267
- // Neural network should present to user: file path, web link, and file content
273
+ // Neural network should present to user: file path, web link, HTTP link, and file content
268
274
  return {
269
275
  content: [
270
276
  {
@@ -274,8 +280,7 @@ if (process.argv.length === 2) {
274
280
  FOR THE NEURAL NETWORK: Please present the following information to the user:
275
281
  1. Path to file: ${outputPath}
276
282
  2. Web browser link: ${fileUrl}
277
- 3. File content:
278
- ${fileContent}`
283
+ ${httpLink ? `3. HTTP link: ${httpLink}\n4. File content:\n${fileContent}` : `3. File content:\n${fileContent}`}`
279
284
  }
280
285
  ]
281
286
  };
@@ -386,6 +391,8 @@ ${fileContent}`
386
391
  await fs.writeFile(filePath, fileContent, 'utf8');
387
392
  // Generate proper file URL
388
393
  const fileUrl = pathToFileURL(filePath).href;
394
+ // Generate HTTP link if server is running
395
+ const httpLink = reportsDir ? `http://localhost:${port}/report/${path.basename(filePath)}` : null;
389
396
  return {
390
397
  content: [
391
398
  {
@@ -395,7 +402,7 @@ ${fileContent}`
395
402
  FOR THE NEURAL NETWORK: Please present the following information to the user:
396
403
  1. Path to file: ${filePath}
397
404
  2. Web browser link: ${fileUrl}
398
- 3. Operation performed: ${operation}`
405
+ ${httpLink ? `3. HTTP link: ${httpLink}\n4. Operation performed: ${operation}` : `3. Operation performed: ${operation}`}`
399
406
  }
400
407
  ]
401
408
  };
@@ -496,10 +503,12 @@ FOR THE NEURAL NETWORK: Please present the following information to the user:
496
503
  // Generate proper file URL
497
504
  const { pathToFileURL } = await import('url');
498
505
  const fileUrl = pathToFileURL(fullPath).href;
506
+ // Generate HTTP link if server is running
507
+ const httpLink = reportsDir ? `http://localhost:${port}/report/${path.basename(fullPath)}` : null;
499
508
  return {
500
509
  content: [{
501
510
  type: "text",
502
- text: `Image successfully generated!\n\nFile saved to: ${fullPath}\nWeb link: ${fileUrl}`
511
+ text: `Image successfully generated!\n\nFile saved to: ${fullPath}\nWeb link: ${fileUrl}${httpLink ? `\nHTTP link: ${httpLink}` : ''}`
503
512
  }]
504
513
  };
505
514
  }
@@ -599,10 +608,12 @@ FOR THE NEURAL NETWORK: Please present the following information to the user:
599
608
  // Создаем file URI для выходного файла
600
609
  const { pathToFileURL } = await import('url');
601
610
  const fileUrl = pathToFileURL(path.resolve(fullOutputPath)).href;
611
+ // Generate HTTP link if server is running
612
+ const httpLink = reportsDir ? `http://localhost:${port}/report/${path.basename(fullOutputPath)}` : null;
602
613
  return {
603
614
  content: [{
604
615
  type: "text",
605
- text: `Image successfully edited!\n\nOutput file: ${fullOutputPath}\nWeb link: ${fileUrl}`
616
+ text: `Image successfully edited!\n\nOutput file: ${fullOutputPath}\nWeb link: ${fileUrl}${httpLink ? `\nHTTP link: ${httpLink}` : ''}`
606
617
  }]
607
618
  };
608
619
  }
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vint.tri/report_gen_mcp",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "CLI tool for generating HTML reports with embedded charts and images",
5
5
  "main": "dist/index.js",
6
6
  "bin": {