it-tools-mcp 5.2.5 → 5.2.7
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
|
@@ -275,8 +275,35 @@ function mcpLog(level, message, data) {
|
|
|
275
275
|
// Only send if level meets minimum threshold
|
|
276
276
|
if (levelValue >= currentLogLevel && mcpTransportReady) {
|
|
277
277
|
try {
|
|
278
|
-
//
|
|
279
|
-
|
|
278
|
+
// Prepare safe data for notification
|
|
279
|
+
let safeData = undefined;
|
|
280
|
+
try {
|
|
281
|
+
if (data instanceof Error) {
|
|
282
|
+
safeData = { error: data.message, stack: data.stack };
|
|
283
|
+
}
|
|
284
|
+
else if (typeof data === 'object' && data !== null) {
|
|
285
|
+
safeData = data;
|
|
286
|
+
}
|
|
287
|
+
else if (data !== undefined) {
|
|
288
|
+
safeData = { info: data };
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
catch (e) {
|
|
292
|
+
safeData = { info: String(data) };
|
|
293
|
+
}
|
|
294
|
+
// Send MCP logging notification (notifications/message)
|
|
295
|
+
server.server.notification({
|
|
296
|
+
method: "notifications/message",
|
|
297
|
+
params: {
|
|
298
|
+
level,
|
|
299
|
+
logger: packageInfo.name || 'it-tools-mcp',
|
|
300
|
+
data: {
|
|
301
|
+
message,
|
|
302
|
+
...(safeData !== undefined ? { details: safeData } : {}),
|
|
303
|
+
timestamp: new Date().toISOString()
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
280
307
|
}
|
|
281
308
|
catch (error) {
|
|
282
309
|
// Fallback to console if MCP notification fails
|
|
@@ -313,6 +340,25 @@ server.registerTool("logging_setLevel", {
|
|
|
313
340
|
}]
|
|
314
341
|
};
|
|
315
342
|
});
|
|
343
|
+
// Also register the JSON-RPC method name expected by the MCP spec so
|
|
344
|
+
// clients that call "logging/setLevel" receive a proper response instead
|
|
345
|
+
// of a Method Not Found (-32601). This bridges the tool-style registration
|
|
346
|
+
// with the spec-compliant JSON-RPC method name.
|
|
347
|
+
server.server.setRequestHandler(z.object({
|
|
348
|
+
method: z.literal("logging/setLevel"),
|
|
349
|
+
params: z.object({ level: z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']) })
|
|
350
|
+
}), async (request) => {
|
|
351
|
+
const { level } = request.params;
|
|
352
|
+
const oldLevelName = Object.keys(LOG_LEVELS).find(k => LOG_LEVELS[k] === currentLogLevel);
|
|
353
|
+
currentLogLevel = LOG_LEVELS[level];
|
|
354
|
+
mcpLog('info', `Log level changed from ${oldLevelName} to ${level}`);
|
|
355
|
+
// Per-spec the server may return an empty result. Returning an empty
|
|
356
|
+
// object here avoids surprising clients/tools that strictly validate
|
|
357
|
+
// response shapes (the Inspector/CLI validates responses and will
|
|
358
|
+
// reject unknown keys). If clients need details, they can call the
|
|
359
|
+
// `logging_status` tool or rely on logging notifications.
|
|
360
|
+
return {};
|
|
361
|
+
});
|
|
316
362
|
// Add logging status tool
|
|
317
363
|
server.registerTool("logging_status", {
|
|
318
364
|
description: "Get current MCP logging configuration and status",
|
|
@@ -26,7 +26,8 @@ export function registerGenerateQr(server) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
// Generate QR code as base64 data URL
|
|
29
|
-
|
|
29
|
+
// Use stderr for debug logs so we don't corrupt stdio-based MCP transport
|
|
30
|
+
console.error(`[DEBUG] Generating QR code for: "${text}" with size: ${size}`);
|
|
30
31
|
const dataUrl = await QRCode.toDataURL(text, {
|
|
31
32
|
type: 'image/png',
|
|
32
33
|
errorCorrectionLevel: 'M',
|
|
@@ -37,7 +38,7 @@ export function registerGenerateQr(server) {
|
|
|
37
38
|
light: '#FFFFFF' // White
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
|
-
console.
|
|
41
|
+
console.error(`[DEBUG] QR code generated successfully`);
|
|
41
42
|
// Extract just the base64 data (remove the data:image/png;base64, prefix)
|
|
42
43
|
const base64Data = dataUrl.split(',')[1];
|
|
43
44
|
const markdown = ``;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "it-tools-mcp",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.7",
|
|
4
4
|
"description": "Full MCP 2025-06-18 compliant server with 121+ IT tools, logging, ping, progress tracking, cancellation, and sampling utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/index.js",
|