it-tools-mcp 5.8.6 → 5.8.8
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 +200 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -216,7 +216,8 @@ function getPackageMetadata() {
|
|
|
216
216
|
author: pkg.author,
|
|
217
217
|
repository: pkg.repository,
|
|
218
218
|
homepage: pkg.homepage,
|
|
219
|
-
license: pkg.license
|
|
219
|
+
license: pkg.license,
|
|
220
|
+
mcpName: pkg.mcpName
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
// Create server instance with enhanced metadata and VS Code compliance features
|
|
@@ -1286,8 +1287,203 @@ function extractReadmeSection(content, heading) {
|
|
|
1286
1287
|
: lines.slice(startIndex, endIndex);
|
|
1287
1288
|
return sectionLines.join('\n');
|
|
1288
1289
|
}
|
|
1289
|
-
//
|
|
1290
|
-
|
|
1291
|
-
|
|
1290
|
+
// CLI argument parsing
|
|
1291
|
+
function parseArgs(args) {
|
|
1292
|
+
const flags = new Set();
|
|
1293
|
+
let command = null;
|
|
1294
|
+
for (const arg of args.slice(2)) {
|
|
1295
|
+
if (arg.startsWith('--')) {
|
|
1296
|
+
flags.add(arg.substring(2));
|
|
1297
|
+
}
|
|
1298
|
+
else if (arg.startsWith('-')) {
|
|
1299
|
+
// Single char flags
|
|
1300
|
+
for (const char of arg.substring(1)) {
|
|
1301
|
+
flags.add(char);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
else if (!command) {
|
|
1305
|
+
command = arg;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
return { command, flags };
|
|
1309
|
+
}
|
|
1310
|
+
// CLI Commands
|
|
1311
|
+
async function printVersion() {
|
|
1312
|
+
console.log(`${packageInfo.name} v${packageInfo.version}`);
|
|
1313
|
+
process.exit(0);
|
|
1314
|
+
}
|
|
1315
|
+
async function printHelp() {
|
|
1316
|
+
const helpText = `
|
|
1317
|
+
${packageInfo.name} v${packageInfo.version}
|
|
1318
|
+
${packageInfo.description}
|
|
1319
|
+
|
|
1320
|
+
USAGE:
|
|
1321
|
+
${packageInfo.name} Start the MCP server
|
|
1322
|
+
${packageInfo.name} --version Display version information
|
|
1323
|
+
${packageInfo.name} --help Display this help message
|
|
1324
|
+
${packageInfo.name} --test Run server validation tests
|
|
1325
|
+
|
|
1326
|
+
OPTIONS:
|
|
1327
|
+
--version, -v Show version number
|
|
1328
|
+
--help, -h Show help information
|
|
1329
|
+
--test, -t Run validation tests and exit
|
|
1330
|
+
|
|
1331
|
+
ENVIRONMENT VARIABLES:
|
|
1332
|
+
NODE_ENV Set to 'development' for verbose logging
|
|
1333
|
+
MCP_DEV_MODE Enable development mode features
|
|
1334
|
+
|
|
1335
|
+
EXAMPLES:
|
|
1336
|
+
# Start the MCP server (normal operation)
|
|
1337
|
+
$ ${packageInfo.name}
|
|
1338
|
+
|
|
1339
|
+
# Check version
|
|
1340
|
+
$ ${packageInfo.name} --version
|
|
1341
|
+
|
|
1342
|
+
# Run tests (used by Homebrew)
|
|
1343
|
+
$ ${packageInfo.name} --test
|
|
1344
|
+
|
|
1345
|
+
For more information, visit: ${packageInfo.homepage || 'https://github.com/wrenchpilot/it-tools-mcp'}
|
|
1346
|
+
`;
|
|
1347
|
+
console.log(helpText);
|
|
1348
|
+
process.exit(0);
|
|
1349
|
+
}
|
|
1350
|
+
async function runTests() {
|
|
1351
|
+
console.log(`Running validation tests for ${packageInfo.name} v${packageInfo.version}...\n`);
|
|
1352
|
+
let allTestsPassed = true;
|
|
1353
|
+
const results = [];
|
|
1354
|
+
// Test 1: Package info validation
|
|
1355
|
+
try {
|
|
1356
|
+
if (!packageInfo.name || !packageInfo.version) {
|
|
1357
|
+
throw new Error('Package info incomplete');
|
|
1358
|
+
}
|
|
1359
|
+
results.push({ test: 'Package Info', passed: true });
|
|
1360
|
+
}
|
|
1361
|
+
catch (error) {
|
|
1362
|
+
results.push({
|
|
1363
|
+
test: 'Package Info',
|
|
1364
|
+
passed: false,
|
|
1365
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
1366
|
+
});
|
|
1367
|
+
allTestsPassed = false;
|
|
1368
|
+
}
|
|
1369
|
+
// Test 2: Tool discovery
|
|
1370
|
+
try {
|
|
1371
|
+
const { totalToolCount, toolCategories } = await discoverTools();
|
|
1372
|
+
if (totalToolCount === 0) {
|
|
1373
|
+
throw new Error('No tools discovered');
|
|
1374
|
+
}
|
|
1375
|
+
if (Object.keys(toolCategories).length === 0) {
|
|
1376
|
+
throw new Error('No tool categories found');
|
|
1377
|
+
}
|
|
1378
|
+
results.push({
|
|
1379
|
+
test: 'Tool Discovery',
|
|
1380
|
+
passed: true,
|
|
1381
|
+
message: `Found ${totalToolCount} tools in ${Object.keys(toolCategories).length} categories`
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
catch (error) {
|
|
1385
|
+
results.push({
|
|
1386
|
+
test: 'Tool Discovery',
|
|
1387
|
+
passed: false,
|
|
1388
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
1389
|
+
});
|
|
1390
|
+
allTestsPassed = false;
|
|
1391
|
+
}
|
|
1392
|
+
// Test 3: Server initialization (dry run)
|
|
1393
|
+
try {
|
|
1394
|
+
const server = new McpServer({
|
|
1395
|
+
name: packageInfo.mcpName || packageInfo.name,
|
|
1396
|
+
version: packageInfo.version
|
|
1397
|
+
});
|
|
1398
|
+
if (!server) {
|
|
1399
|
+
throw new Error('Failed to create server instance');
|
|
1400
|
+
}
|
|
1401
|
+
results.push({ test: 'Server Initialization', passed: true });
|
|
1402
|
+
}
|
|
1403
|
+
catch (error) {
|
|
1404
|
+
results.push({
|
|
1405
|
+
test: 'Server Initialization',
|
|
1406
|
+
passed: false,
|
|
1407
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
1408
|
+
});
|
|
1409
|
+
allTestsPassed = false;
|
|
1410
|
+
}
|
|
1411
|
+
// Test 4: Resource usage check
|
|
1412
|
+
try {
|
|
1413
|
+
const usage = getResourceUsage();
|
|
1414
|
+
if (usage.memory.heapUsedBytes <= 0) {
|
|
1415
|
+
throw new Error('Invalid memory usage reported');
|
|
1416
|
+
}
|
|
1417
|
+
results.push({
|
|
1418
|
+
test: 'Resource Monitoring',
|
|
1419
|
+
passed: true,
|
|
1420
|
+
message: `Memory: ${(usage.memory.heapUsedBytes / 1024 / 1024).toFixed(2)}MB`
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
catch (error) {
|
|
1424
|
+
results.push({
|
|
1425
|
+
test: 'Resource Monitoring',
|
|
1426
|
+
passed: false,
|
|
1427
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
1428
|
+
});
|
|
1429
|
+
allTestsPassed = false;
|
|
1430
|
+
}
|
|
1431
|
+
// Test 5: README resource availability
|
|
1432
|
+
try {
|
|
1433
|
+
const readmePath = path.resolve(__dirname, '../README.md');
|
|
1434
|
+
if (!fs.existsSync(readmePath)) {
|
|
1435
|
+
throw new Error('README.md not found');
|
|
1436
|
+
}
|
|
1437
|
+
const readmeContent = await getReadmeContent('full');
|
|
1438
|
+
if (!readmeContent || readmeContent.length === 0) {
|
|
1439
|
+
throw new Error('README content is empty');
|
|
1440
|
+
}
|
|
1441
|
+
results.push({ test: 'Documentation', passed: true });
|
|
1442
|
+
}
|
|
1443
|
+
catch (error) {
|
|
1444
|
+
results.push({
|
|
1445
|
+
test: 'Documentation',
|
|
1446
|
+
passed: false,
|
|
1447
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
1448
|
+
});
|
|
1449
|
+
allTestsPassed = false;
|
|
1450
|
+
}
|
|
1451
|
+
// Print results
|
|
1452
|
+
console.log('Test Results:');
|
|
1453
|
+
console.log('='.repeat(60));
|
|
1454
|
+
for (const result of results) {
|
|
1455
|
+
const status = result.passed ? '✓ PASS' : '✗ FAIL';
|
|
1456
|
+
const color = result.passed ? '\x1b[32m' : '\x1b[31m';
|
|
1457
|
+
const reset = '\x1b[0m';
|
|
1458
|
+
console.log(`${color}${status}${reset} ${result.test}`);
|
|
1459
|
+
if (result.message) {
|
|
1460
|
+
console.log(` ${result.message}`);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
console.log('='.repeat(60));
|
|
1464
|
+
console.log(allTestsPassed
|
|
1465
|
+
? '\x1b[32m✓ All tests passed!\x1b[0m'
|
|
1466
|
+
: '\x1b[31m✗ Some tests failed.\x1b[0m');
|
|
1467
|
+
process.exit(allTestsPassed ? 0 : 1);
|
|
1468
|
+
}
|
|
1469
|
+
// Main CLI entry point
|
|
1470
|
+
async function cli() {
|
|
1471
|
+
const { flags } = parseArgs(process.argv);
|
|
1472
|
+
// Handle CLI flags
|
|
1473
|
+
if (flags.has('version') || flags.has('v')) {
|
|
1474
|
+
await printVersion();
|
|
1475
|
+
}
|
|
1476
|
+
if (flags.has('help') || flags.has('h')) {
|
|
1477
|
+
await printHelp();
|
|
1478
|
+
}
|
|
1479
|
+
if (flags.has('test') || flags.has('t')) {
|
|
1480
|
+
await runTests();
|
|
1481
|
+
}
|
|
1482
|
+
// No flags provided - start the server normally
|
|
1483
|
+
await main();
|
|
1484
|
+
}
|
|
1485
|
+
// Start the CLI
|
|
1486
|
+
cli().catch((error) => {
|
|
1487
|
+
console.error("Fatal error in CLI:", error);
|
|
1292
1488
|
process.exit(1);
|
|
1293
1489
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "it-tools-mcp",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.8",
|
|
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",
|