it-tools-mcp 4.1.14 → 4.1.15

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.
Files changed (2) hide show
  1. package/build/index.js +50 -53
  2. package/package.json +4 -2
package/build/index.js CHANGED
@@ -252,14 +252,21 @@ const server = new McpServer({
252
252
  license: packageInfo.license,
253
253
  }, {
254
254
  capabilities: {
255
- tools: {},
256
- resources: {},
257
- prompts: {},
255
+ tools: {
256
+ listChanged: true
257
+ },
258
+ resources: {
259
+ listChanged: true
260
+ },
261
+ prompts: {
262
+ listChanged: true
263
+ },
258
264
  sampling: {},
259
265
  roots: {
260
266
  listChanged: true
261
267
  },
262
- logging: {}
268
+ logging: {},
269
+ completions: {}
263
270
  }
264
271
  });
265
272
  // MCP Logging Functions
@@ -1271,79 +1278,71 @@ async function main() {
1271
1278
  try {
1272
1279
  // VS Code MCP Compliance: Dev Mode Support
1273
1280
  const isTest = process.env.NODE_ENV === 'test' && process.env.MCP_TEST_MODE === 'true';
1274
- if (isDevelopment) {
1275
- mcpLog('info', "🔧 IT Tools MCP Server starting in DEVELOPMENT mode");
1276
- mcpLog('debug', " - Enhanced logging enabled");
1277
- mcpLog('debug', " - Hot reload capabilities active");
1278
- mcpLog('debug', " - Debug information available");
1279
- }
1281
+ mcpLog('info', 'Starting IT Tools MCP Server', {
1282
+ version: packageInfo.version,
1283
+ environment: isDevelopment ? 'development' : 'production',
1284
+ nodeVersion: process.version
1285
+ });
1280
1286
  // Add error handling for unhandled rejections
1281
1287
  process.on('unhandledRejection', (reason, promise) => {
1282
- mcpLog('error', 'Unhandled Rejection', { promise: promise.toString(), reason });
1288
+ // Only log to stderr in development or for critical errors
1289
+ if (isDevelopment) {
1290
+ mcpLog('error', 'Unhandled Rejection', { promise: promise.toString(), reason });
1291
+ }
1283
1292
  });
1284
1293
  process.on('uncaughtException', (error) => {
1285
1294
  mcpLog('critical', 'Uncaught Exception', error.message);
1286
1295
  process.exit(1);
1287
1296
  });
1297
+ // Register tools and connect
1298
+ mcpLog('debug', 'Registering tools...');
1299
+ const startTime = Date.now();
1288
1300
  await registerAllTools(server);
1301
+ const toolLoadTime = Date.now() - startTime;
1302
+ const { totalToolCount, toolCategories } = await discoverTools();
1303
+ mcpLog('info', 'Tools registered successfully', {
1304
+ totalTools: totalToolCount,
1305
+ categories: Object.keys(toolCategories).length,
1306
+ loadTimeMs: toolLoadTime
1307
+ });
1308
+ mcpLog('debug', 'Connecting to MCP transport...');
1289
1309
  const transport = new StdioServerTransport();
1290
1310
  await server.connect(transport);
1291
1311
  // Mark MCP transport as ready for logging
1292
1312
  mcpTransportReady = true;
1293
- // Log startup information based on environment
1313
+ mcpLog('info', 'MCP Server started successfully', {
1314
+ transport: 'stdio',
1315
+ ready: true
1316
+ });
1317
+ // Exit handler for test automation
1294
1318
  if (isTest) {
1295
- mcpLog('info', "IT Tools MCP Server running on stdio");
1296
- // Exit after stdin closes (for test automation)
1319
+ mcpLog('debug', 'Test mode: Setting up exit handler');
1297
1320
  process.stdin.on('end', () => {
1321
+ mcpLog('debug', 'Test mode: stdin ended, exiting...');
1298
1322
  setTimeout(() => process.exit(0), 100);
1299
1323
  });
1300
1324
  }
1301
- else if (isDevelopment) {
1302
- mcpLog('info', "🚀 IT Tools MCP Server connected successfully");
1303
- mcpLog('info', `📊 Loaded ${await getToolCount()} tools across ${await getCategoryCount()} categories`);
1304
- mcpLog('info', `🔗 Protocol: Model Context Protocol (MCP) via stdio`);
1305
- mcpLog('info', `📦 Version: ${packageInfo.version}`);
1306
- }
1307
- else {
1308
- // Production mode - simple ready message
1309
- mcpLog('info', `IT Tools MCP Server v${packageInfo.version} ready - ${await getToolCount()} tools loaded`);
1310
- }
1311
- // Enhanced monitoring in development mode
1312
- if (isDevelopment && !isTest) {
1313
- // More frequent monitoring in dev mode (every minute)
1314
- setInterval(() => {
1315
- const usage = getResourceUsage();
1316
- if (usage.memory.heapUsedBytes > 200 * 1024 * 1024) {
1317
- mcpLog('warning', "⚠️ High memory usage detected", usage.memory);
1318
- }
1319
- // Log periodic status in dev mode
1320
- mcpLog('debug', `📈 Status: Memory ${usage.memory.heapUsed}, CPU ${usage.cpu.user}ms user, ${usage.cpu.system}ms system`);
1321
- }, 60 * 1000); // Every minute in dev mode
1322
- }
1323
- else if (!isTest) {
1324
- // Production monitoring (every 5 minutes)
1325
+ // Production monitoring (every 5 minutes) - no logging unless critical
1326
+ if (!isTest) {
1327
+ mcpLog('debug', 'Setting up production monitoring');
1325
1328
  setInterval(() => {
1326
1329
  const usage = getResourceUsage();
1327
1330
  if (usage.memory.heapUsedBytes > 200 * 1024 * 1024) {
1328
- mcpLog('warning', "High memory usage detected", usage.memory);
1331
+ // Critical memory issues
1332
+ mcpLog('critical', 'High memory usage detected', usage.memory);
1329
1333
  }
1330
1334
  }, 5 * 60 * 1000);
1331
1335
  }
1332
1336
  // Handle graceful shutdown
1333
1337
  const shutdown = () => {
1334
- if (isDevelopment) {
1335
- mcpLog('info', "🛑 Shutting down IT Tools MCP Server (Development Mode)...");
1336
- }
1337
- else {
1338
- mcpLog('info', "Shutting down IT Tools MCP Server...");
1339
- }
1338
+ mcpLog('info', 'Graceful shutdown initiated');
1340
1339
  process.exit(0);
1341
1340
  };
1342
1341
  process.on('SIGINT', shutdown);
1343
1342
  process.on('SIGTERM', shutdown);
1344
1343
  }
1345
1344
  catch (error) {
1346
- mcpLog('critical', "Failed to start MCP server", error instanceof Error ? error.message : 'Unknown error');
1345
+ mcpLog('emergency', 'Fatal error starting MCP server', error instanceof Error ? error.message : 'Unknown error');
1347
1346
  process.exit(1);
1348
1347
  }
1349
1348
  }
@@ -1384,10 +1383,8 @@ function extractReadmeSection(content, heading) {
1384
1383
  : lines.slice(startIndex, endIndex);
1385
1384
  return sectionLines.join('\n');
1386
1385
  }
1387
- // Start the server if this file is executed directly
1388
- if (import.meta.url === `file://${process.argv[1]}`) {
1389
- main().catch((error) => {
1390
- mcpLog('emergency', "Fatal error starting MCP server", error instanceof Error ? error.message : 'Unknown error');
1391
- process.exit(1);
1392
- });
1393
- }
1386
+ // Start the server
1387
+ main().catch((error) => {
1388
+ console.error("Fatal error in main():", error);
1389
+ process.exit(1);
1390
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "it-tools-mcp",
3
- "version": "4.1.14",
3
+ "version": "4.1.15",
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",
@@ -72,8 +72,10 @@
72
72
  "tools",
73
73
  "resources",
74
74
  "prompts",
75
+ "completions",
75
76
  "sampling",
76
- "roots"
77
+ "roots",
78
+ "logging"
77
79
  ],
78
80
  "toolCount": 116,
79
81
  "categories": [