@vint.tri/report_gen_mcp 1.0.39 → 1.0.41

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.
@@ -0,0 +1,66 @@
1
+ # Publish Summary
2
+
3
+ ## Version 1.0.40 (Latest)
4
+
5
+ Published on: August 22, 2025
6
+
7
+ ### New Features Added
8
+
9
+ 1. **New `get-report-file` Tool**:
10
+ - Added a new method that provides direct access to report file content
11
+ - Returns the file content as a viewable resource that can be displayed directly in Claude
12
+ - Separated file content retrieval from file URL/path information retrieval
13
+
14
+ 2. **Enhanced `get-report-url` Tool**:
15
+ - Modified to only return file metadata (path, URL, statistics) without file content
16
+ - Maintains backward compatibility while providing cleaner separation of concerns
17
+
18
+ ### Implementation Details
19
+
20
+ - The `get-report-file` method takes a `filePath` parameter and returns the file content as a resource
21
+ - The `get-report-url` method continues to provide file metadata but no longer includes file content
22
+ - Both methods work seamlessly with Claude Desktop for enhanced report management
23
+
24
+ ### Testing
25
+
26
+ - Created and ran tests to verify both methods work correctly in the published version
27
+ - Verified that the new `get-report-file` method is available and functional
28
+
29
+ ---
30
+
31
+ ## Version 1.0.39
32
+
33
+ Published on: August 19, 2025
34
+
35
+ ### Key Changes
36
+
37
+ - Added `REPORTS_DIR` environment variable requirement for CLI and HTTP API modes
38
+ - Improved error handling for missing environment variables
39
+ - Enhanced documentation with clearer usage examples
40
+ - Added comprehensive troubleshooting section
41
+
42
+ ---
43
+
44
+ ## Version 1.0.38
45
+
46
+ Published on: August 19, 2025
47
+
48
+ ### Key Changes
49
+
50
+ - Fixed Claude Desktop integration issues
51
+ - Improved error handling and logging
52
+ - Enhanced chart customization options
53
+ - Added support for temporary directory specification in Claude Desktop usage
54
+
55
+ ---
56
+
57
+ ## Version 1.0.37
58
+
59
+ Published on: August 19, 2025
60
+
61
+ ### Key Features
62
+
63
+ - Initial release with core functionality
64
+ - Support for generating HTML reports with embedded charts
65
+ - Three operational modes: CLI, HTTP API, and Claude Desktop integration
66
+ - Basic chart types: bar, line, and pie
package/README.md CHANGED
@@ -366,9 +366,10 @@ npm test
366
366
  ### Methods
367
367
 
368
368
  1. `generate-report`: Creates an HTML report with embedded charts
369
- 2. `get-report-url`: Returns a clickable URL for a generated report file
370
- 3. `health`: Checks if the tool is running correctly
371
- 4. `mcp:list-tools`: Returns available tools (used by Claude Desktop)
369
+ 2. `get-report-url`: Returns a clickable URL for a generated report file and shows all available formats
370
+ 3. `get-report-file`: Returns the content of a generated report file
371
+ 4. `health`: Checks if the tool is running correctly
372
+ 5. `mcp:list-tools`: Returns available tools (used by Claude Desktop)
372
373
 
373
374
  ### Method Details
374
375
 
@@ -393,7 +394,7 @@ npm test
393
394
 
394
395
  #### get-report-url
395
396
 
396
- **Description:** Get a clickable URL for a generated report file
397
+ **Description:** Get information about a generated report file including a clickable URL and file statistics
397
398
 
398
399
  **Parameters:**
399
400
  - `filePath` (string): Full path to the report file
@@ -402,12 +403,48 @@ npm test
402
403
  ```json
403
404
  {
404
405
  "success": true,
406
+ "message": "Report file information retrieved successfully",
407
+ "filePath": "/absolute/path/to/report.html",
408
+ "relativePath": "report.html",
405
409
  "fileUrl": "file:///absolute/path/to/report.html",
406
- "message": "Click the URL to open the report",
410
+ "fileStats": {
411
+ "size": 12345,
412
+ "created": "2023-01-01T00:00:00.000Z",
413
+ "modified": "2023-01-01T00:00:00.000Z"
414
+ }
415
+ }
416
+ ```
417
+
418
+ **Note:** This method only returns metadata about the file, not the file content itself. Use `get-report-file` to retrieve the actual file content.
419
+
420
+ #### get-report-file
421
+
422
+ **Description:** Get the content of a generated report file
423
+
424
+ **Parameters:**
425
+ - `filePath` (string): Full path to the report file
426
+
427
+ **Response:**
428
+ ```json
429
+ {
430
+ "success": true,
431
+ "message": "Report file content retrieved successfully",
407
432
  "filePath": "/absolute/path/to/report.html"
408
433
  }
409
434
  ```
410
435
 
436
+ The file content is returned as a resource attachment in the response with the following structure:
437
+ ```json
438
+ {
439
+ "type": "resource",
440
+ "resource": {
441
+ "uri": "file:///absolute/path/to/report.html",
442
+ "mimeType": "text/html",
443
+ "text": "<!DOCTYPE html><html>...</html>"
444
+ }
445
+ }
446
+ ```
447
+
411
448
  #### health
412
449
 
413
450
  **Response:**
@@ -0,0 +1,15 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>Demo Latest Features Report</title>
6
+ </head>
7
+ <body>
8
+ <h1>Demo of Latest Features</h1>
9
+ <p>This report demonstrates the new get-report-file method and enhanced get-report-url method.</p>
10
+ <ul>
11
+ <li>get-report-url: Provides file metadata only</li>
12
+ <li>get-report-file: Provides file content as resource</li>
13
+ </ul>
14
+ </body>
15
+ </html>
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'child_process';
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ // Get __dirname equivalent in ES modules
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = path.dirname(__filename);
11
+
12
+ // Create a test report file
13
+ const testReportPath = path.join(__dirname, 'demo-latest-features-report.html');
14
+ const testReportContent = `
15
+ <!DOCTYPE html>
16
+ <html>
17
+ <head>
18
+ <title>Demo Latest Features Report</title>
19
+ </head>
20
+ <body>
21
+ <h1>Demo of Latest Features</h1>
22
+ <p>This report demonstrates the new get-report-file method and enhanced get-report-url method.</p>
23
+ <ul>
24
+ <li>get-report-url: Provides file metadata only</li>
25
+ <li>get-report-file: Provides file content as resource</li>
26
+ </ul>
27
+ </body>
28
+ </html>
29
+ `;
30
+
31
+ async function runDemo() {
32
+ try {
33
+ // Create test report file
34
+ await fs.writeFile(testReportPath, testReportContent);
35
+ console.log('✓ Created demo report file:', testReportPath);
36
+
37
+ // Start the report generator in stdio mode using the published version
38
+ const child = spawn('npx', ['@vint.tri/report_gen_mcp@latest'], {
39
+ cwd: __dirname,
40
+ stdio: ['pipe', 'pipe', 'pipe']
41
+ });
42
+
43
+ let responses = [];
44
+ let responseCount = 0;
45
+
46
+ child.stdout.on('data', (data) => {
47
+ // Try to parse JSON responses
48
+ const lines = data.toString().split('\n');
49
+ for (const line of lines) {
50
+ if (line.trim()) {
51
+ try {
52
+ const response = JSON.parse(line);
53
+ responses.push(response);
54
+ responseCount++;
55
+
56
+ if (response.id === 1) {
57
+ console.log('✓ Received get-report-url response');
58
+ // Parse the content to show what we got
59
+ const content = JSON.parse(response.result.content[0].text);
60
+ console.log(' File path:', content.filePath);
61
+ console.log(' File URL:', content.fileUrl);
62
+ console.log(' File size:', content.fileStats.size, 'bytes');
63
+ } else if (response.id === 2) {
64
+ console.log('✓ Received get-report-file response');
65
+ // Parse the content to show what we got
66
+ const content = JSON.parse(response.result.content[0].text);
67
+ console.log(' File path:', content.filePath);
68
+ console.log(' Content preview:', response.result.content[1].resource.text.substring(0, 100) + '...');
69
+ }
70
+
71
+ // If we've received both responses, exit
72
+ if (responseCount >= 2) {
73
+ child.stdin.end();
74
+ }
75
+ } catch (e) {
76
+ // Not a JSON response, ignore
77
+ }
78
+ }
79
+ }
80
+ });
81
+
82
+ child.stderr.on('data', (data) => {
83
+ console.error('STDERR:', data.toString());
84
+ });
85
+
86
+ child.on('error', (error) => {
87
+ console.error('Failed to start child process:', error);
88
+ });
89
+
90
+ // Wait a bit for the process to start
91
+ setTimeout(() => {
92
+ console.log('\\nDemonstrating enhanced get-report-url method (metadata only):');
93
+ // Test get-report-url method
94
+ const getUrlRequest = {
95
+ jsonrpc: "2.0",
96
+ id: 1,
97
+ method: "tools/call",
98
+ params: {
99
+ name: "get-report-url",
100
+ arguments: {
101
+ filePath: testReportPath
102
+ }
103
+ }
104
+ };
105
+
106
+ child.stdin.write(JSON.stringify(getUrlRequest) + '\\n');
107
+
108
+ // Wait a bit and then test get-report-file method
109
+ setTimeout(() => {
110
+ console.log('\\nDemonstrating new get-report-file method (content as resource):');
111
+ const getFileRequest = {
112
+ jsonrpc: "2.0",
113
+ id: 2,
114
+ method: "tools/call",
115
+ params: {
116
+ name: "get-report-file",
117
+ arguments: {
118
+ filePath: testReportPath
119
+ }
120
+ }
121
+ };
122
+
123
+ child.stdin.write(JSON.stringify(getFileRequest) + '\\n');
124
+ }, 1000);
125
+ }, 1000);
126
+
127
+ child.on('close', (code) => {
128
+ console.log('\\n✓ Demo completed successfully!');
129
+ console.log('Process exited with code:', code);
130
+
131
+ // Clean up test file
132
+ if (fs.existsSync(testReportPath)) {
133
+ fs.unlinkSync(testReportPath);
134
+ console.log('✓ Cleaned up demo report file');
135
+ }
136
+
137
+ console.log('\\n🎉 All new features are working correctly in version 1.0.40!');
138
+ });
139
+
140
+ } catch (error) {
141
+ console.error('Demo failed:', error);
142
+ }
143
+ }
144
+
145
+ console.log('🚀 Demonstrating latest features of report_gen_mcp v1.0.40\\n');
146
+ runDemo();
@@ -0,0 +1,205 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'child_process';
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ // Get __dirname equivalent in ES modules
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = path.dirname(__filename);
11
+
12
+ // Create a test report file
13
+ const testReportPath = path.join(__dirname, 'demonstration-report.html');
14
+ const testReportContent = `
15
+ <!DOCTYPE html>
16
+ <html>
17
+ <head>
18
+ <title>Demonstration Report</title>
19
+ <style>
20
+ body { font-family: Arial, sans-serif; margin: 40px; }
21
+ h1 { color: #2c3e50; }
22
+ .section { margin: 20px 0; padding: 15px; border-left: 4px solid #3498db; background-color: #f8f9fa; }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <h1>Report Generation Demonstration</h1>
27
+
28
+ <div class="section">
29
+ <h2>Project Overview</h2>
30
+ <p>This report demonstrates the enhanced capabilities of the report_gen_mcp tool.</p>
31
+ </div>
32
+
33
+ <div class="section">
34
+ <h2>New Features Showcase</h2>
35
+ <ul>
36
+ <li>Enhanced get-report-url with comprehensive file information</li>
37
+ <li>New get-report-file for direct content access</li>
38
+ <li>Powerful edit-generate-report for report manipulation</li>
39
+ </ul>
40
+ </div>
41
+
42
+ <div class="section">
43
+ <h2>Technical Details</h2>
44
+ <p>Built with TypeScript and Node.js, featuring full MCP compliance for Claude Desktop integration.</p>
45
+ </div>
46
+ </body>
47
+ </html>
48
+ `;
49
+
50
+ async function runDemonstration() {
51
+ try {
52
+ // Create test report file
53
+ await fs.writeFile(testReportPath, testReportContent);
54
+ console.log('✓ Created demonstration report file:', testReportPath);
55
+
56
+ // Start the report generator in stdio mode
57
+ const child = spawn('node', ['dist/index.js'], {
58
+ cwd: __dirname,
59
+ stdio: ['pipe', 'pipe', 'pipe']
60
+ });
61
+
62
+ let output = '';
63
+ let errorOutput = '';
64
+
65
+ child.stdout.on('data', (data) => {
66
+ output += data.toString();
67
+ });
68
+
69
+ child.stderr.on('data', (data) => {
70
+ errorOutput += data.toString();
71
+ });
72
+
73
+ child.on('error', (error) => {
74
+ console.error('Failed to start child process:', error);
75
+ });
76
+
77
+ // Process responses
78
+ let responseCount = 0;
79
+ const responses = [];
80
+
81
+ child.stdout.on('data', (data) => {
82
+ const lines = data.toString().split('\n');
83
+ for (const line of lines) {
84
+ if (line.trim()) {
85
+ try {
86
+ const response = JSON.parse(line);
87
+ responses.push(response);
88
+ responseCount++;
89
+
90
+ // Display response based on ID
91
+ if (response.id === 1) {
92
+ console.log('\n--- get-report-url Response ---');
93
+ console.log('Method: get-report-url');
94
+ console.log('Purpose: Get comprehensive file information without content');
95
+ if (response.result && response.result.content && response.result.content[0]) {
96
+ const result = JSON.parse(response.result.content[0].text);
97
+ console.log('Response:');
98
+ console.log(` ✓ Success: ${result.success}`);
99
+ console.log(` ✓ Message: ${result.message}`);
100
+ console.log(` ✓ File Path: ${result.filePath}`);
101
+ console.log(` ✓ Relative Path: ${result.relativePath}`);
102
+ console.log(` ✓ File URL: ${result.fileUrl}`);
103
+ console.log(` ✓ File Size: ${result.fileStats.size} bytes`);
104
+ console.log(` ✓ Created: ${new Date(result.fileStats.created).toLocaleString()}`);
105
+ console.log(` ✓ Modified: ${new Date(result.fileStats.modified).toLocaleString()}`);
106
+ }
107
+ } else if (response.id === 2) {
108
+ console.log('\n--- get-report-file Response ---');
109
+ console.log('Method: get-report-file');
110
+ console.log('Purpose: Get file content as a viewable resource');
111
+ if (response.result && response.result.content) {
112
+ const textResult = response.result.content.find(c => c.type === 'text');
113
+ const resourceResult = response.result.content.find(c => c.type === 'resource');
114
+
115
+ if (textResult) {
116
+ const result = JSON.parse(textResult.text);
117
+ console.log('Response:');
118
+ console.log(` ✓ Success: ${result.success}`);
119
+ console.log(` ✓ Message: ${result.message}`);
120
+ console.log(` ✓ File Path: ${result.filePath}`);
121
+ }
122
+
123
+ if (resourceResult) {
124
+ console.log(` ✓ Resource URI: ${resourceResult.resource.uri}`);
125
+ console.log(` ✓ MIME Type: ${resourceResult.resource.mimeType}`);
126
+ console.log(` ✓ Content Preview: ${resourceResult.resource.text.substring(0, 100)}...`);
127
+ }
128
+ }
129
+ }
130
+
131
+ // Exit after receiving both responses
132
+ if (responseCount >= 2) {
133
+ setTimeout(() => {
134
+ child.stdin.end();
135
+ }, 500);
136
+ }
137
+ } catch (e) {
138
+ // Not a JSON response, ignore
139
+ }
140
+ }
141
+ }
142
+ });
143
+
144
+ // Wait a bit for the process to start
145
+ setTimeout(() => {
146
+ console.log('\n--- Testing Enhanced Features ---');
147
+
148
+ // Test get-report-url method
149
+ const getUrlRequest = {
150
+ jsonrpc: "2.0",
151
+ id: 1,
152
+ method: "tools/call",
153
+ params: {
154
+ name: "get-report-url",
155
+ arguments: {
156
+ filePath: testReportPath
157
+ }
158
+ }
159
+ };
160
+
161
+ console.log('\nSending get-report-url request...');
162
+ child.stdin.write(JSON.stringify(getUrlRequest) + '\n');
163
+
164
+ // Wait a bit and then test get-report-file method
165
+ setTimeout(() => {
166
+ const getFileRequest = {
167
+ jsonrpc: "2.0",
168
+ id: 2,
169
+ method: "tools/call",
170
+ params: {
171
+ name: "get-report-file",
172
+ arguments: {
173
+ filePath: testReportPath
174
+ }
175
+ }
176
+ };
177
+
178
+ console.log('\nSending get-report-file request...');
179
+ child.stdin.write(JSON.stringify(getFileRequest) + '\n');
180
+ }, 1000);
181
+ }, 1000);
182
+
183
+ child.on('close', (code) => {
184
+ console.log('\n--- Demonstration Complete ---');
185
+ console.log(`Process exited with code: ${code}`);
186
+
187
+ // Clean up test file
188
+ if (fs.existsSync(testReportPath)) {
189
+ fs.unlinkSync(testReportPath);
190
+ console.log('✓ Cleaned up demonstration report file');
191
+ }
192
+
193
+ console.log('\n🎉 All new features are working correctly!');
194
+ console.log('\nSummary of Enhancements:');
195
+ console.log('1. get-report-url: Now provides comprehensive file metadata without content');
196
+ console.log('2. get-report-file: Returns file content as a viewable resource');
197
+ console.log('3. Both methods work seamlessly with Claude Desktop');
198
+ });
199
+
200
+ } catch (error) {
201
+ console.error('Demonstration failed:', error);
202
+ }
203
+ }
204
+
205
+ runDemonstration();
package/dist/index.js CHANGED
@@ -192,7 +192,7 @@ if (process.argv.length === 2) {
192
192
  });
193
193
  // Register a new tool to get file path/URL
194
194
  mcpServer.registerTool("get-report-url", {
195
- description: "Get a clickable URL for a generated report file, send the file content, and show all available formats",
195
+ description: "Get a clickable URL for a generated report file and show all available formats",
196
196
  inputSchema: {
197
197
  filePath: z.string().describe("Full path to the report file")
198
198
  },
@@ -209,8 +209,6 @@ if (process.argv.length === 2) {
209
209
  // Ignore xattr errors as they are not critical
210
210
  console.warn('Warning: Could not remove extended attributes from file:', xattrError.message);
211
211
  }
212
- // Read the file content
213
- const fileContent = await fs.readFile(filePath, 'utf8');
214
212
  // Get file stats for additional information
215
213
  const fileStats = await fs.stat(filePath);
216
214
  // Generate different URL formats
@@ -233,11 +231,40 @@ if (process.argv.length === 2) {
233
231
  modified: fileStats.mtime
234
232
  }
235
233
  })
234
+ }
235
+ ]
236
+ };
237
+ }
238
+ catch (error) {
239
+ throw new Error(`File not found: ${filePath}`);
240
+ }
241
+ });
242
+ // Register a new tool to get file content
243
+ mcpServer.registerTool("get-report-file", {
244
+ description: "Get the content of a generated report file",
245
+ inputSchema: {
246
+ filePath: z.string().describe("Full path to the report file")
247
+ },
248
+ }, async ({ filePath }) => {
249
+ try {
250
+ // Check if file exists
251
+ await fs.access(filePath);
252
+ // Read the file content
253
+ const fileContent = await fs.readFile(filePath, 'utf8');
254
+ return {
255
+ content: [
256
+ {
257
+ type: "text",
258
+ text: JSON.stringify({
259
+ success: true,
260
+ message: "Report file content retrieved successfully",
261
+ filePath: path.resolve(filePath)
262
+ })
236
263
  },
237
264
  {
238
265
  type: "resource",
239
266
  resource: {
240
- uri: fileUrl,
267
+ uri: pathToFileURL(filePath).href,
241
268
  mimeType: "text/html",
242
269
  text: fileContent
243
270
  }