@nekzus/mcp-server 1.5.4 → 1.5.6

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/dist/index.js CHANGED
@@ -487,99 +487,96 @@ function isNpmDownloadsData(data) {
487
487
  return false;
488
488
  }
489
489
  }
490
- async function handleNpmVersions(args) {
491
- try {
492
- const packagesToProcess = args.packages || [];
493
- if (packagesToProcess.length === 0) {
494
- throw new Error('No package names provided');
495
- }
496
- const results = await Promise.all(packagesToProcess.map(async (pkg) => {
497
- const response = await fetch(`https://registry.npmjs.org/${pkg}`);
498
- if (!response.ok) {
499
- return { name: pkg, error: `Failed to fetch package info: ${response.statusText}` };
500
- }
501
- const rawData = await response.json();
502
- if (!isNpmPackageInfo(rawData)) {
503
- return { name: pkg, error: 'Invalid package info data received' };
504
- }
505
- const versions = Object.keys(rawData.versions ?? {}).sort((a, b) => {
506
- const [aMajor = 0, aMinor = 0, aPatch = 0] = a.split('.').map(Number);
507
- const [bMajor = 0, bMinor = 0, bPatch = 0] = b.split('.').map(Number);
508
- if (aMajor !== bMajor)
509
- return aMajor - bMajor;
510
- if (aMinor !== bMinor)
511
- return aMinor - bMinor;
512
- return aPatch - bPatch;
490
+ export async function handleNpmVersions(args) {
491
+ const results = await Promise.all(args.packages.map(async (pkg) => {
492
+ try {
493
+ const response = await fetch(`https://registry.npmjs.org/${pkg}`, {
494
+ headers: {
495
+ Accept: 'application/json',
496
+ 'User-Agent': 'NPM-Sentinel-MCP',
497
+ },
513
498
  });
514
- return { name: pkg, versions };
515
- }));
516
- let text = '';
517
- for (const result of results) {
518
- if ('error' in result) {
519
- text += `❌ ${result.name}: ${result.error}\n\n`;
499
+ if (!response.ok) {
500
+ throw new Error(`Failed to fetch package info: ${response.statusText}`);
520
501
  }
521
- else {
522
- text += `📦 Available versions for ${result.name}:\n${result.versions.join('\n')}\n\n`;
502
+ const data = await response.json();
503
+ if (!isNpmPackageInfo(data)) {
504
+ throw new Error('Invalid package info format');
523
505
  }
506
+ const versions = Object.keys(data.versions);
507
+ const latestVersion = data['dist-tags']?.latest;
508
+ return {
509
+ name: pkg,
510
+ versions,
511
+ latest: latestVersion,
512
+ success: true,
513
+ };
524
514
  }
525
- return {
526
- content: [{ type: 'text', text }],
527
- isError: false,
528
- };
529
- }
530
- catch (error) {
531
- return {
532
- content: [
533
- {
534
- type: 'text',
535
- text: `Error fetching package versions: ${error instanceof Error ? error.message : 'Unknown error'}`,
536
- },
537
- ],
538
- isError: true,
539
- };
540
- }
515
+ catch (error) {
516
+ return {
517
+ name: pkg,
518
+ error: error instanceof Error ? error.message : 'Unknown error',
519
+ success: false,
520
+ };
521
+ }
522
+ }));
523
+ const content = results.map((result) => ({
524
+ type: 'text',
525
+ text: result.success
526
+ ? `📦 ${result.name}:
527
+ Latest version: ${result.latest}
528
+ Available versions: ${result.versions.join(', ')}`
529
+ : `❌ Error fetching ${result.name}: ${result.error}`,
530
+ }));
531
+ return { content, isError: false };
541
532
  }
542
- async function handleNpmLatest(args) {
543
- try {
544
- const packages = args.packages || [];
545
- let text = '';
546
- for (const pkg of packages) {
547
- const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`);
533
+ export async function handleNpmLatest(args) {
534
+ const results = await Promise.all(args.packages.map(async (pkg) => {
535
+ try {
536
+ const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`, {
537
+ headers: {
538
+ Accept: 'application/json',
539
+ 'User-Agent': 'NPM-Sentinel-MCP',
540
+ },
541
+ });
548
542
  if (!response.ok) {
549
- throw new Error(`Failed to fetch latest version for ${pkg}: ${response.statusText}`);
543
+ throw new Error(`Failed to fetch latest version: ${response.statusText}`);
550
544
  }
551
- const data = (await response.json());
552
- text += `📦 Latest version of ${pkg}\n`;
553
- text += `Version: ${data.version}\n`;
554
- text += `Description: ${data.description || 'No description available'}\n`;
555
- text += `Author: ${data.author?.name || 'Unknown'}\n`;
556
- text += `License: ${data.license || 'Unknown'}\n`;
557
- text += `Homepage: ${data.homepage || 'Not specified'}\n\n`;
558
- text += '---\n\n';
545
+ const data = await response.json();
546
+ const latestInfo = data;
547
+ return {
548
+ name: pkg,
549
+ version: latestInfo.version,
550
+ description: latestInfo.description,
551
+ author: latestInfo.author?.name,
552
+ license: latestInfo.license,
553
+ homepage: latestInfo.homepage,
554
+ success: true,
555
+ };
559
556
  }
560
- return {
561
- content: [
562
- {
563
- type: 'text',
564
- text,
565
- },
566
- ],
567
- isError: false,
568
- };
569
- }
570
- catch (error) {
571
- return {
572
- content: [
573
- {
574
- type: 'text',
575
- text: `Error fetching latest version: ${error instanceof Error ? error.message : 'Unknown error'}`,
576
- },
577
- ],
578
- isError: true,
579
- };
580
- }
557
+ catch (err) {
558
+ return {
559
+ name: pkg,
560
+ error: err instanceof Error ? err.message : 'Unknown error',
561
+ success: false,
562
+ };
563
+ }
564
+ }));
565
+ const content = results.map((result) => ({
566
+ type: 'text',
567
+ text: result.success
568
+ ? `📦 Latest version of ${result.name}:
569
+ Version: ${result.version}
570
+ Description: ${result.description || 'No description available'}
571
+ Author: ${result.author || 'Unknown'}
572
+ License: ${result.license || 'Unknown'}
573
+ Homepage: ${result.homepage || 'Not specified'}
574
+ ---`
575
+ : `❌ Error fetching latest version for ${result.name}: ${result.error}`,
576
+ }));
577
+ return { content, isError: false };
581
578
  }
582
- async function handleNpmDeps(args) {
579
+ export async function handleNpmDeps(args) {
583
580
  try {
584
581
  const packagesToProcess = args.packages || [];
585
582
  if (packagesToProcess.length === 0) {
@@ -587,7 +584,12 @@ async function handleNpmDeps(args) {
587
584
  }
588
585
  const results = await Promise.all(packagesToProcess.map(async (pkg) => {
589
586
  try {
590
- const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`);
587
+ const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`, {
588
+ headers: {
589
+ Accept: 'application/json',
590
+ 'User-Agent': 'NPM-Sentinel-MCP',
591
+ },
592
+ });
591
593
  if (!response.ok) {
592
594
  return { name: pkg, error: `Failed to fetch package info: ${response.statusText}` };
593
595
  }
@@ -637,10 +639,7 @@ async function handleNpmDeps(args) {
637
639
  }
638
640
  text += '---\n\n';
639
641
  }
640
- return {
641
- content: [{ type: 'text', text }],
642
- isError: false,
643
- };
642
+ return { content: [{ type: 'text', text }], isError: false };
644
643
  }
645
644
  catch (error) {
646
645
  return {
@@ -654,10 +653,15 @@ async function handleNpmDeps(args) {
654
653
  };
655
654
  }
656
655
  }
657
- async function handleNpmTypes(args) {
656
+ export async function handleNpmTypes(args) {
658
657
  try {
659
658
  const results = await Promise.all(args.packages.map(async (pkg) => {
660
- const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`);
659
+ const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`, {
660
+ headers: {
661
+ Accept: 'application/json',
662
+ 'User-Agent': 'NPM-Sentinel-MCP',
663
+ },
664
+ });
661
665
  if (!response.ok) {
662
666
  throw new Error(`Failed to fetch package info: ${response.statusText}`);
663
667
  }
@@ -669,7 +673,12 @@ async function handleNpmTypes(args) {
669
673
  text += `Types path: ${data.types || data.typings}\n`;
670
674
  }
671
675
  const typesPackage = `@types/${pkg.replace('@', '').replace('/', '__')}`;
672
- const typesResponse = await fetch(`https://registry.npmjs.org/${typesPackage}/latest`).catch(() => null);
676
+ const typesResponse = await fetch(`https://registry.npmjs.org/${typesPackage}/latest`, {
677
+ headers: {
678
+ Accept: 'application/json',
679
+ 'User-Agent': 'NPM-Sentinel-MCP',
680
+ },
681
+ }).catch(() => null);
673
682
  if (typesResponse?.ok) {
674
683
  const typesData = (await typesResponse.json());
675
684
  text += `📦 DefinitelyTyped package available: ${typesPackage}@${typesData.version}\n`;
@@ -687,10 +696,7 @@ async function handleNpmTypes(args) {
687
696
  text += '---\n\n';
688
697
  }
689
698
  }
690
- return {
691
- content: [{ type: 'text', text }],
692
- isError: false,
693
- };
699
+ return { content: [{ type: 'text', text }], isError: false };
694
700
  }
695
701
  catch (error) {
696
702
  return {
@@ -701,14 +707,19 @@ async function handleNpmTypes(args) {
701
707
  };
702
708
  }
703
709
  }
704
- async function handleNpmSize(args) {
710
+ export async function handleNpmSize(args) {
705
711
  try {
706
712
  const packagesToProcess = args.packages || [];
707
713
  if (packagesToProcess.length === 0) {
708
714
  throw new Error('No package names provided');
709
715
  }
710
716
  const results = await Promise.all(packagesToProcess.map(async (pkg) => {
711
- const response = await fetch(`https://bundlephobia.com/api/size?package=${pkg}`);
717
+ const response = await fetch(`https://bundlephobia.com/api/size?package=${pkg}`, {
718
+ headers: {
719
+ Accept: 'application/json',
720
+ 'User-Agent': 'NPM-Sentinel-MCP',
721
+ },
722
+ });
712
723
  if (!response.ok) {
713
724
  return { name: pkg, error: `Failed to fetch package size: ${response.statusText}` };
714
725
  }
@@ -734,10 +745,7 @@ async function handleNpmSize(args) {
734
745
  text += `Dependencies: ${result.dependencyCount}\n\n`;
735
746
  }
736
747
  }
737
- return {
738
- content: [{ type: 'text', text }],
739
- isError: false,
740
- };
748
+ return { content: [{ type: 'text', text }], isError: false };
741
749
  }
742
750
  catch (error) {
743
751
  return {
@@ -751,7 +759,7 @@ async function handleNpmSize(args) {
751
759
  };
752
760
  }
753
761
  }
754
- async function handleNpmVulnerabilities(args) {
762
+ export async function handleNpmVulnerabilities(args) {
755
763
  try {
756
764
  const packagesToProcess = args.packages || [];
757
765
  if (packagesToProcess.length === 0) {
@@ -802,10 +810,7 @@ async function handleNpmVulnerabilities(args) {
802
810
  }
803
811
  text += '---\n\n';
804
812
  }
805
- return {
806
- content: [{ type: 'text', text }],
807
- isError: false,
808
- };
813
+ return { content: [{ type: 'text', text }], isError: false };
809
814
  }
810
815
  catch (error) {
811
816
  return {
@@ -819,16 +824,24 @@ async function handleNpmVulnerabilities(args) {
819
824
  };
820
825
  }
821
826
  }
822
- async function handleNpmTrends(args) {
827
+ export async function handleNpmTrends(args) {
823
828
  try {
824
- const period = args.period || 'last-month';
829
+ // Si period es undefined, vacío o inválido, usar el valor por defecto
830
+ const period = args.period && ['last-week', 'last-month', 'last-year'].includes(args.period)
831
+ ? args.period
832
+ : 'last-month';
825
833
  const periodDays = {
826
834
  'last-week': 7,
827
835
  'last-month': 30,
828
836
  'last-year': 365,
829
837
  };
830
838
  const results = await Promise.all(args.packages.map(async (pkg) => {
831
- const response = await fetch(`https://api.npmjs.org/downloads/point/${period}/${pkg}`);
839
+ const response = await fetch(`https://api.npmjs.org/downloads/point/${period}/${pkg}`, {
840
+ headers: {
841
+ Accept: 'application/json',
842
+ 'User-Agent': 'NPM-Sentinel-MCP',
843
+ },
844
+ });
832
845
  if (!response.ok) {
833
846
  return {
834
847
  name: pkg,
@@ -871,10 +884,7 @@ async function handleNpmTrends(args) {
871
884
  }, 0);
872
885
  text += `Total downloads across all packages: ${totalDownloads.toLocaleString()}\n`;
873
886
  text += `Average daily downloads across all packages: ${Math.round(totalDownloads / periodDays[period]).toLocaleString()}\n`;
874
- return {
875
- content: [{ type: 'text', text }],
876
- isError: false,
877
- };
887
+ return { content: [{ type: 'text', text }], isError: false };
878
888
  }
879
889
  catch (error) {
880
890
  return {
@@ -885,7 +895,7 @@ async function handleNpmTrends(args) {
885
895
  };
886
896
  }
887
897
  }
888
- async function handleNpmCompare(args) {
898
+ export async function handleNpmCompare(args) {
889
899
  try {
890
900
  const results = await Promise.all(args.packages.map(async (pkg) => {
891
901
  const [infoRes, downloadsRes] = await Promise.all([
@@ -917,10 +927,7 @@ async function handleNpmCompare(args) {
917
927
  for (const pkg of results) {
918
928
  text += `${pkg.name} | ${pkg.version} | ${pkg.downloads.toLocaleString()} | ${pkg.dependencies} | ${pkg.license || 'N/A'}\n`;
919
929
  }
920
- return {
921
- content: [{ type: 'text', text }],
922
- isError: false,
923
- };
930
+ return { content: [{ type: 'text', text }], isError: false };
924
931
  }
925
932
  catch (error) {
926
933
  return {
@@ -930,10 +937,15 @@ async function handleNpmCompare(args) {
930
937
  }
931
938
  }
932
939
  // Function to get package quality metrics
933
- async function handleNpmQuality(args) {
940
+ export async function handleNpmQuality(args) {
934
941
  try {
935
942
  const results = await Promise.all(args.packages.map(async (pkg) => {
936
- const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`);
943
+ const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`, {
944
+ headers: {
945
+ Accept: 'application/json',
946
+ 'User-Agent': 'NPM-Sentinel-MCP',
947
+ },
948
+ });
937
949
  if (!response.ok) {
938
950
  return { name: pkg, error: `Failed to fetch quality data: ${response.statusText}` };
939
951
  }
@@ -964,10 +976,7 @@ async function handleNpmQuality(args) {
964
976
  text +=
965
977
  '- Note: Detailed metrics (tests, coverage, linting, types) are no longer provided by the API\n\n';
966
978
  }
967
- return {
968
- content: [{ type: 'text', text }],
969
- isError: false,
970
- };
979
+ return { content: [{ type: 'text', text }], isError: false };
971
980
  }
972
981
  catch (error) {
973
982
  return {
@@ -981,10 +990,15 @@ async function handleNpmQuality(args) {
981
990
  };
982
991
  }
983
992
  }
984
- async function handleNpmMaintenance(args) {
993
+ export async function handleNpmMaintenance(args) {
985
994
  try {
986
995
  const results = await Promise.all(args.packages.map(async (pkg) => {
987
- const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`);
996
+ const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`, {
997
+ headers: {
998
+ Accept: 'application/json',
999
+ 'User-Agent': 'NPM-Sentinel-MCP',
1000
+ },
1001
+ });
988
1002
  if (!response.ok) {
989
1003
  return { name: pkg, error: `Failed to fetch maintenance data: ${response.statusText}` };
990
1004
  }
@@ -1007,10 +1021,7 @@ async function handleNpmMaintenance(args) {
1007
1021
  text += `📦 ${result.name}\n`;
1008
1022
  text += `- Maintenance Score: ${result.score}\n\n`;
1009
1023
  }
1010
- return {
1011
- content: [{ type: 'text', text }],
1012
- isError: false,
1013
- };
1024
+ return { content: [{ type: 'text', text }], isError: false };
1014
1025
  }
1015
1026
  catch (error) {
1016
1027
  return {
@@ -1024,10 +1035,15 @@ async function handleNpmMaintenance(args) {
1024
1035
  };
1025
1036
  }
1026
1037
  }
1027
- async function handleNpmPopularity(args) {
1038
+ export async function handleNpmPopularity(args) {
1028
1039
  try {
1029
1040
  const results = await Promise.all(args.packages.map(async (pkg) => {
1030
- const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`);
1041
+ const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`, {
1042
+ headers: {
1043
+ Accept: 'application/json',
1044
+ 'User-Agent': 'NPM-Sentinel-MCP',
1045
+ },
1046
+ });
1031
1047
  if (!response.ok) {
1032
1048
  return { name: pkg, error: `Failed to fetch popularity data: ${response.statusText}` };
1033
1049
  }
@@ -1057,10 +1073,7 @@ async function handleNpmPopularity(args) {
1057
1073
  text += `- Overall Score: ${result.score}\n`;
1058
1074
  text += '- Note: Detailed metrics are no longer provided by the API\n\n';
1059
1075
  }
1060
- return {
1061
- content: [{ type: 'text', text }],
1062
- isError: false,
1063
- };
1076
+ return { content: [{ type: 'text', text }], isError: false };
1064
1077
  }
1065
1078
  catch (error) {
1066
1079
  return {
@@ -1074,7 +1087,7 @@ async function handleNpmPopularity(args) {
1074
1087
  };
1075
1088
  }
1076
1089
  }
1077
- async function handleNpmMaintainers(args) {
1090
+ export async function handleNpmMaintainers(args) {
1078
1091
  try {
1079
1092
  const results = await Promise.all(args.packages.map(async (pkg) => {
1080
1093
  const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`);
@@ -1141,7 +1154,7 @@ async function handleNpmMaintainers(args) {
1141
1154
  };
1142
1155
  }
1143
1156
  }
1144
- async function handleNpmScore(args) {
1157
+ export async function handleNpmScore(args) {
1145
1158
  try {
1146
1159
  const results = await Promise.all(args.packages.map(async (pkg) => {
1147
1160
  const response = await fetch(`https://api.npms.io/v2/package/${encodeURIComponent(pkg)}`);
@@ -1224,7 +1237,7 @@ async function handleNpmScore(args) {
1224
1237
  };
1225
1238
  }
1226
1239
  }
1227
- async function handleNpmPackageReadme(args) {
1240
+ export async function handleNpmPackageReadme(args) {
1228
1241
  try {
1229
1242
  const results = await Promise.all(args.packages.map(async (pkg) => {
1230
1243
  const response = await fetch(`https://registry.npmjs.org/${pkg}`);
@@ -1256,10 +1269,7 @@ async function handleNpmPackageReadme(args) {
1256
1269
  text += `${'='.repeat(80)}\n\n`;
1257
1270
  }
1258
1271
  }
1259
- return {
1260
- content: [{ type: 'text', text }],
1261
- isError: false,
1262
- };
1272
+ return { content: [{ type: 'text', text }], isError: false };
1263
1273
  }
1264
1274
  catch (error) {
1265
1275
  return {
@@ -1273,7 +1283,7 @@ async function handleNpmPackageReadme(args) {
1273
1283
  };
1274
1284
  }
1275
1285
  }
1276
- async function handleNpmSearch(args) {
1286
+ export async function handleNpmSearch(args) {
1277
1287
  try {
1278
1288
  const limit = args.limit || 10;
1279
1289
  const response = await fetch(`https://registry.npmjs.org/-/v1/search?text=${encodeURIComponent(args.query)}&size=${limit}`);
@@ -1312,10 +1322,7 @@ async function handleNpmSearch(args) {
1312
1322
  }
1313
1323
  text += '\n';
1314
1324
  }
1315
- return {
1316
- content: [{ type: 'text', text }],
1317
- isError: false,
1318
- };
1325
+ return { content: [{ type: 'text', text }], isError: false };
1319
1326
  }
1320
1327
  catch (error) {
1321
1328
  return {
@@ -1330,7 +1337,7 @@ async function handleNpmSearch(args) {
1330
1337
  }
1331
1338
  }
1332
1339
  // License compatibility checker
1333
- async function handleNpmLicenseCompatibility(args) {
1340
+ export async function handleNpmLicenseCompatibility(args) {
1334
1341
  try {
1335
1342
  const licenses = await Promise.all(args.packages.map(async (pkg) => {
1336
1343
  const response = await fetch(`https://registry.npmjs.org/${pkg}/latest`);
@@ -1375,10 +1382,7 @@ async function handleNpmLicenseCompatibility(args) {
1375
1382
  }
1376
1383
  text +=
1377
1384
  '\nNote: This is a basic analysis. For legal compliance, please consult with a legal expert.\n';
1378
- return {
1379
- content: [{ type: 'text', text }],
1380
- isError: false,
1381
- };
1385
+ return { content: [{ type: 'text', text }], isError: false };
1382
1386
  }
1383
1387
  catch (error) {
1384
1388
  return {
@@ -1393,7 +1397,7 @@ async function handleNpmLicenseCompatibility(args) {
1393
1397
  }
1394
1398
  }
1395
1399
  // Repository statistics analyzer
1396
- async function handleNpmRepoStats(args) {
1400
+ export async function handleNpmRepoStats(args) {
1397
1401
  try {
1398
1402
  const results = await Promise.all(args.packages.map(async (pkg) => {
1399
1403
  // First get the package info from npm to find the repository URL
@@ -1457,10 +1461,7 @@ async function handleNpmRepoStats(args) {
1457
1461
  text += '\n\n';
1458
1462
  }
1459
1463
  }
1460
- return {
1461
- content: [{ type: 'text', text }],
1462
- isError: false,
1463
- };
1464
+ return { content: [{ type: 'text', text }], isError: false };
1464
1465
  }
1465
1466
  catch (error) {
1466
1467
  return {
@@ -1474,7 +1475,7 @@ async function handleNpmRepoStats(args) {
1474
1475
  };
1475
1476
  }
1476
1477
  }
1477
- async function handleNpmDeprecated(args) {
1478
+ export async function handleNpmDeprecated(args) {
1478
1479
  try {
1479
1480
  const results = await Promise.all(args.packages.map(async (pkg) => {
1480
1481
  const response = await fetch(`https://registry.npmjs.org/${pkg}`);
@@ -1543,10 +1544,7 @@ async function handleNpmDeprecated(args) {
1543
1544
  for (const result of results) {
1544
1545
  text += result.text;
1545
1546
  }
1546
- return {
1547
- content: [{ type: 'text', text }],
1548
- isError: false,
1549
- };
1547
+ return { content: [{ type: 'text', text }], isError: false };
1550
1548
  }
1551
1549
  catch (error) {
1552
1550
  return {
@@ -1560,7 +1558,7 @@ async function handleNpmDeprecated(args) {
1560
1558
  };
1561
1559
  }
1562
1560
  }
1563
- async function handleNpmChangelogAnalysis(args) {
1561
+ export async function handleNpmChangelogAnalysis(args) {
1564
1562
  try {
1565
1563
  const results = await Promise.all(args.packages.map(async (pkg) => {
1566
1564
  // First get the package info from npm to find the repository URL
@@ -1656,10 +1654,7 @@ async function handleNpmChangelogAnalysis(args) {
1656
1654
  for (const result of results) {
1657
1655
  text += result.text;
1658
1656
  }
1659
- return {
1660
- content: [{ type: 'text', text }],
1661
- isError: false,
1662
- };
1657
+ return { content: [{ type: 'text', text }], isError: false };
1663
1658
  }
1664
1659
  catch (error) {
1665
1660
  return {
@@ -1673,7 +1668,7 @@ async function handleNpmChangelogAnalysis(args) {
1673
1668
  };
1674
1669
  }
1675
1670
  }
1676
- async function handleNpmAlternatives(args) {
1671
+ export async function handleNpmAlternatives(args) {
1677
1672
  try {
1678
1673
  const results = await Promise.all(args.packages.map(async (pkg) => {
1679
1674
  const response = await fetch(`https://registry.npmjs.org/-/v1/search?text=keywords:${pkg}&size=10`);
@@ -1726,10 +1721,7 @@ async function handleNpmAlternatives(args) {
1726
1721
  for (const result of results) {
1727
1722
  text += result.text;
1728
1723
  }
1729
- return {
1730
- content: [{ type: 'text', text }],
1731
- isError: false,
1732
- };
1724
+ return { content: [{ type: 'text', text }], isError: false };
1733
1725
  }
1734
1726
  catch (error) {
1735
1727
  return {