it-tools-mcp 5.2.8 → 5.2.9

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/build/index.js CHANGED
@@ -204,7 +204,7 @@ export function getResourceUsage() {
204
204
  */
205
205
  // Get package metadata for enhanced server info
206
206
  function getPackageMetadata() {
207
- const __dirname = path.dirname(new URL(import.meta.url).pathname);
207
+ // Use module-level __dirname (correctly handles Windows paths via fileURLToPath)
208
208
  const pkgPath = path.resolve(__dirname, '../package.json');
209
209
  const pkgRaw = fs.readFileSync(pkgPath, 'utf-8');
210
210
  const pkg = JSON.parse(pkgRaw);
@@ -61,37 +61,26 @@ export function registerFormatJson(server) {
61
61
  };
62
62
  }
63
63
  catch (secondError) {
64
- // If normalization fails, try using Function constructor for JavaScript object literals
65
- try {
66
- const evaluated = new Function('return ' + json)();
67
- const formatted = JSON.stringify(evaluated, null, indent);
68
- return {
69
- content: [
70
- {
71
- type: "text",
72
- text: `Formatted JSON (converted from JavaScript object):\n${formatted}`,
73
- },
74
- ],
75
- };
76
- }
77
- catch (evalError) {
78
- return {
79
- content: [
80
- {
81
- type: "text",
82
- text: `Error parsing JSON: ${firstError instanceof Error ? firstError.message : 'Unknown error'}
64
+ // Security: Do NOT use Function() constructor or eval() as they enable code injection
65
+ // Only JSON.parse() should be used - it's safe and sufficient for JSON formatting
66
+ return {
67
+ content: [
68
+ {
69
+ type: "text",
70
+ text: `Error parsing JSON: ${firstError instanceof Error ? firstError.message : 'Unknown error'}
71
+
72
+ Attempted normalization failed: ${secondError instanceof Error ? secondError.message : 'Unknown error'}
83
73
 
84
- Tried to normalize JavaScript object notation but failed.
85
- Please ensure your input is valid JSON or JavaScript object notation.
74
+ Please ensure your input is valid JSON.
86
75
 
87
- Examples of supported formats:
76
+ Supported format:
88
77
  - Valid JSON: {"name":"John","age":30}
89
- - JavaScript object: {'name':'John','age':30}
90
- - Unquoted keys: {name:'John',age:30}`,
91
- },
92
- ],
93
- };
94
- }
78
+
79
+ Note: For security reasons, JavaScript object literals and code evaluation are not supported.
80
+ Please convert your input to valid JSON format before formatting.`,
81
+ },
82
+ ],
83
+ };
95
84
  }
96
85
  }
97
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "it-tools-mcp",
3
- "version": "5.2.8",
3
+ "version": "5.2.9",
4
4
  "description": "MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.",
5
5
  "mcpName": "io.github.wrenchpilot/it-tools-mcp",
6
6
  "type": "module",