@vint.tri/report_gen_mcp 1.0.24 → 1.0.26
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.
- package/README.md +7 -5
- package/dist/index.js +23 -8
- package/package.json +1 -1
- package/src/index.ts +27 -9
package/README.md
CHANGED
|
@@ -17,13 +17,13 @@ A powerful CLI tool for generating HTML reports with embedded charts, designed t
|
|
|
17
17
|
### Global Installation (Recommended)
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install -g @vint.tri/report_gen_mcp@1.0.
|
|
20
|
+
npm install -g @vint.tri/report_gen_mcp@1.0.24
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Direct Execution with npx
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npx @vint.tri/report_gen_mcp@1.0.
|
|
26
|
+
npx @vint.tri/report_gen_mcp@1.0.24 --directory ./reports
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
@@ -33,7 +33,7 @@ npx @vint.tri/report_gen_mcp@1.0.23
|
|
|
33
33
|
#### Start Server Mode
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
report_gen_mcp start-server
|
|
36
|
+
report_gen_mcp --directory ./reports start-server
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Starts an HTTP server for generating reports via REST API.
|
|
@@ -41,7 +41,7 @@ Starts an HTTP server for generating reports via REST API.
|
|
|
41
41
|
#### Generate Report Directly
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
report_gen_mcp generate \
|
|
44
|
+
report_gen_mcp --directory ./reports generate \
|
|
45
45
|
--document "path/to/document.md" \
|
|
46
46
|
--charts '{"chart1":{"type":"bar","config":{...}}}' \
|
|
47
47
|
--output "report.html"
|
|
@@ -64,7 +64,9 @@ To use this tool with Claude Desktop, add the following configuration to your Cl
|
|
|
64
64
|
"tags": [],
|
|
65
65
|
"command": "npx",
|
|
66
66
|
"args": [
|
|
67
|
-
"@vint.tri/report_gen_mcp@1.0.
|
|
67
|
+
"@vint.tri/report_gen_mcp@1.0.24",
|
|
68
|
+
"--directory",
|
|
69
|
+
"./reports"
|
|
68
70
|
]
|
|
69
71
|
}
|
|
70
72
|
}
|
package/dist/index.js
CHANGED
|
@@ -15,12 +15,16 @@ const zod_1 = require("zod");
|
|
|
15
15
|
const app = (0, express_1.default)();
|
|
16
16
|
const port = 3000;
|
|
17
17
|
app.use(express_1.default.json());
|
|
18
|
-
// Add home directory parameter
|
|
19
|
-
let homeDir = process.cwd(); // Default to current working directory
|
|
20
18
|
app.post('/generate-report', async (req, res) => {
|
|
19
|
+
// Check if tempDirectory parameter is provided
|
|
21
20
|
const { document, charts, outputFile = 'report.html', tempDirectory } = req.body;
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (!tempDirectory) {
|
|
22
|
+
return res.status(400).json({
|
|
23
|
+
error: 'tempDirectory parameter is required. Please provide the directory where reports should be generated.',
|
|
24
|
+
example: 'curl -X POST http://localhost:3000/generate-report -H "Content-Type: application/json" -d \'{"document": "# Report", "charts": {}, "tempDirectory": "/path/to/reports"}\''
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const outputPath = path_1.default.resolve(tempDirectory, outputFile);
|
|
24
28
|
try {
|
|
25
29
|
const result = await (0, reportGenerator_1.generateReport)(document, charts, outputPath);
|
|
26
30
|
// Send the file content back to the client
|
|
@@ -43,13 +47,20 @@ commander_1.program
|
|
|
43
47
|
});
|
|
44
48
|
});
|
|
45
49
|
commander_1.program
|
|
46
|
-
.command('generate')
|
|
50
|
+
.command('generate <directory>')
|
|
47
51
|
.option('--document <md>', 'Markdown document with placeholders [[chart:id]]')
|
|
48
52
|
.option('--charts <json>', 'JSON string of charts {id: {type: "bar", config: {...}}}')
|
|
49
53
|
.option('--output <file>', 'Output HTML file', 'report.html')
|
|
50
|
-
.
|
|
54
|
+
.description('Generate a report in the specified directory')
|
|
55
|
+
.action(async (directory, opts) => {
|
|
56
|
+
// Check if directory parameter is provided
|
|
57
|
+
if (!directory) {
|
|
58
|
+
console.error('Error: Directory parameter is required. Please specify the directory where reports should be generated.');
|
|
59
|
+
console.error('Example: npx @vint.tri/report_gen_mcp@latest generate /path/to/reports --document "# Report" --charts \'{}\'');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
51
62
|
const charts = JSON.parse(opts.charts);
|
|
52
|
-
const result = await (0, reportGenerator_1.generateReport)(opts.document, charts, opts.output);
|
|
63
|
+
const result = await (0, reportGenerator_1.generateReport)(opts.document, charts, path_1.default.resolve(directory, opts.output));
|
|
53
64
|
console.log(result);
|
|
54
65
|
});
|
|
55
66
|
// Handle stdio mode for Claude Desktop integration
|
|
@@ -102,7 +113,11 @@ if (process.argv.length === 2) {
|
|
|
102
113
|
else if (params.arguments && typeof params.arguments === 'object') {
|
|
103
114
|
processedParams = params.arguments;
|
|
104
115
|
}
|
|
105
|
-
|
|
116
|
+
// Check if tempDirectory parameter is provided
|
|
117
|
+
if (!processedParams.tempDirectory) {
|
|
118
|
+
throw new Error('tempDirectory parameter is required. Please provide the directory where reports should be generated.');
|
|
119
|
+
}
|
|
120
|
+
const { document, charts, outputFile = 'report.html', tempDirectory } = processedParams;
|
|
106
121
|
const outputPath = path_1.default.resolve(tempDirectory, outputFile);
|
|
107
122
|
try {
|
|
108
123
|
const result = await (0, reportGenerator_1.generateReport)(document, charts, outputPath);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -15,13 +15,18 @@ const port = 3000;
|
|
|
15
15
|
|
|
16
16
|
app.use(express.json());
|
|
17
17
|
|
|
18
|
-
// Add home directory parameter
|
|
19
|
-
let homeDir = process.cwd(); // Default to current working directory
|
|
20
|
-
|
|
21
18
|
app.post('/generate-report', async (req, res) => {
|
|
19
|
+
// Check if tempDirectory parameter is provided
|
|
22
20
|
const { document, charts, outputFile = 'report.html', tempDirectory } = req.body;
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
|
|
22
|
+
if (!tempDirectory) {
|
|
23
|
+
return res.status(400).json({
|
|
24
|
+
error: 'tempDirectory parameter is required. Please provide the directory where reports should be generated.',
|
|
25
|
+
example: 'curl -X POST http://localhost:3000/generate-report -H "Content-Type: application/json" -d \'{"document": "# Report", "charts": {}, "tempDirectory": "/path/to/reports"}\''
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const outputPath = path.resolve(tempDirectory, outputFile);
|
|
25
30
|
|
|
26
31
|
try {
|
|
27
32
|
const result = await generateReport(document, charts, outputPath);
|
|
@@ -47,13 +52,21 @@ program
|
|
|
47
52
|
});
|
|
48
53
|
|
|
49
54
|
program
|
|
50
|
-
.command('generate')
|
|
55
|
+
.command('generate <directory>')
|
|
51
56
|
.option('--document <md>', 'Markdown document with placeholders [[chart:id]]')
|
|
52
57
|
.option('--charts <json>', 'JSON string of charts {id: {type: "bar", config: {...}}}')
|
|
53
58
|
.option('--output <file>', 'Output HTML file', 'report.html')
|
|
54
|
-
.
|
|
59
|
+
.description('Generate a report in the specified directory')
|
|
60
|
+
.action(async (directory, opts) => {
|
|
61
|
+
// Check if directory parameter is provided
|
|
62
|
+
if (!directory) {
|
|
63
|
+
console.error('Error: Directory parameter is required. Please specify the directory where reports should be generated.');
|
|
64
|
+
console.error('Example: npx @vint.tri/report_gen_mcp@latest generate /path/to/reports --document "# Report" --charts \'{}\'');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
const charts = JSON.parse(opts.charts);
|
|
56
|
-
const result = await generateReport(opts.document, charts, opts.output);
|
|
69
|
+
const result = await generateReport(opts.document, charts, path.resolve(directory, opts.output));
|
|
57
70
|
console.log(result);
|
|
58
71
|
});
|
|
59
72
|
|
|
@@ -107,7 +120,12 @@ if (process.argv.length === 2) {
|
|
|
107
120
|
processedParams = params.arguments;
|
|
108
121
|
}
|
|
109
122
|
|
|
110
|
-
|
|
123
|
+
// Check if tempDirectory parameter is provided
|
|
124
|
+
if (!processedParams.tempDirectory) {
|
|
125
|
+
throw new Error('tempDirectory parameter is required. Please provide the directory where reports should be generated.');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const { document, charts, outputFile = 'report.html', tempDirectory } = processedParams;
|
|
111
129
|
const outputPath = path.resolve(tempDirectory, outputFile);
|
|
112
130
|
|
|
113
131
|
try {
|