@nekzus/mcp-server 1.7.9 → 1.8.1
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/README.md +53 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +315 -287
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
package/dist/index.js
CHANGED
|
@@ -3070,297 +3070,320 @@ export async function handleNpmAlternatives(args) {
|
|
|
3070
3070
|
}
|
|
3071
3071
|
}
|
|
3072
3072
|
// Get __dirname in an ES module environment
|
|
3073
|
-
|
|
3074
|
-
const
|
|
3075
|
-
//
|
|
3076
|
-
|
|
3077
|
-
//
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
version: '1.7.9',
|
|
3081
|
-
capabilities: {
|
|
3082
|
-
resources: {},
|
|
3083
|
-
},
|
|
3084
|
-
});
|
|
3085
|
-
// Update paths to be relative to the package
|
|
3086
|
-
const README_PATH = path.join(packageRoot, 'README.md');
|
|
3087
|
-
const LLMS_FULL_TEXT_PATH = path.join(packageRoot, 'llms-full.txt');
|
|
3088
|
-
// Register README.md resource
|
|
3089
|
-
server.resource('serverReadme', 'doc://server/readme', {
|
|
3090
|
-
name: 'Server README',
|
|
3091
|
-
description: 'Main documentation and usage guide for this NPM Info Server.',
|
|
3092
|
-
mimeType: 'text/markdown',
|
|
3093
|
-
}, async (uri) => {
|
|
3094
|
-
try {
|
|
3095
|
-
const readmeContent = fs.readFileSync(README_PATH, 'utf-8');
|
|
3096
|
-
return {
|
|
3097
|
-
contents: [
|
|
3098
|
-
{
|
|
3099
|
-
uri: uri.href,
|
|
3100
|
-
text: readmeContent,
|
|
3101
|
-
mimeType: 'text/markdown',
|
|
3102
|
-
},
|
|
3103
|
-
],
|
|
3104
|
-
};
|
|
3105
|
-
}
|
|
3106
|
-
catch (error) {
|
|
3107
|
-
console.error(`Error reading README.md for resource ${uri.href}:`, error.message);
|
|
3108
|
-
throw {
|
|
3109
|
-
code: -32002,
|
|
3110
|
-
message: `Resource not found or unreadable: ${uri.href}`,
|
|
3111
|
-
data: { uri: uri.href, cause: error.message },
|
|
3112
|
-
};
|
|
3113
|
-
}
|
|
3114
|
-
});
|
|
3115
|
-
// Register llms-full.txt resource (MCP Specification)
|
|
3116
|
-
server.resource('mcpSpecification', 'doc://mcp/specification', {
|
|
3117
|
-
name: 'MCP Full Specification',
|
|
3118
|
-
description: 'The llms-full.txt content providing a comprehensive overview of the Model Context Protocol.',
|
|
3119
|
-
mimeType: 'text/plain',
|
|
3120
|
-
}, async (uri) => {
|
|
3073
|
+
// Define session configuration schema (empty for now, can be extended later)
|
|
3074
|
+
export const configSchema = z.object({});
|
|
3075
|
+
// Create server function for Smithery CLI
|
|
3076
|
+
export default function createServer({ config, }) {
|
|
3077
|
+
// Handle both ESM and CJS environments
|
|
3078
|
+
let __filename;
|
|
3079
|
+
let __dirname;
|
|
3121
3080
|
try {
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
contents: [
|
|
3125
|
-
{
|
|
3126
|
-
uri: uri.href,
|
|
3127
|
-
text: specContent,
|
|
3128
|
-
mimeType: 'text/plain',
|
|
3129
|
-
},
|
|
3130
|
-
],
|
|
3131
|
-
};
|
|
3081
|
+
__filename = fileURLToPath(import.meta.url);
|
|
3082
|
+
__dirname = path.dirname(__filename);
|
|
3132
3083
|
}
|
|
3133
3084
|
catch (error) {
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
message: `Resource not found or unreadable: ${uri.href}`,
|
|
3138
|
-
data: { uri: uri.href, cause: error.message },
|
|
3139
|
-
};
|
|
3085
|
+
// Fallback for CJS environment (Smithery HTTP build)
|
|
3086
|
+
__filename = process.argv[1] || '.';
|
|
3087
|
+
__dirname = path.dirname(__filename);
|
|
3140
3088
|
}
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
}
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
}
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
},
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
.
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
}, {
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
}
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
}
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
});
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3089
|
+
// The package root will be one level above __dirname (which is 'dist/' after compilation)
|
|
3090
|
+
const packageRoot = path.join(__dirname, '..');
|
|
3091
|
+
// Create server instance
|
|
3092
|
+
const server = new McpServer({
|
|
3093
|
+
name: 'npm-sentinel-mcp',
|
|
3094
|
+
version: '1.8.1',
|
|
3095
|
+
capabilities: {
|
|
3096
|
+
resources: {},
|
|
3097
|
+
},
|
|
3098
|
+
});
|
|
3099
|
+
// Update paths to be relative to the package
|
|
3100
|
+
const README_PATH = path.join(packageRoot, 'README.md');
|
|
3101
|
+
const LLMS_FULL_TEXT_PATH = path.join(packageRoot, 'llms-full.txt');
|
|
3102
|
+
// Register README.md resource
|
|
3103
|
+
server.resource('serverReadme', 'doc://server/readme', {
|
|
3104
|
+
name: 'Server README',
|
|
3105
|
+
description: 'Main documentation and usage guide for this NPM Info Server.',
|
|
3106
|
+
mimeType: 'text/markdown',
|
|
3107
|
+
}, async (uri) => {
|
|
3108
|
+
try {
|
|
3109
|
+
const readmeContent = fs.readFileSync(README_PATH, 'utf-8');
|
|
3110
|
+
return {
|
|
3111
|
+
contents: [
|
|
3112
|
+
{
|
|
3113
|
+
uri: uri.href,
|
|
3114
|
+
text: readmeContent,
|
|
3115
|
+
mimeType: 'text/markdown',
|
|
3116
|
+
},
|
|
3117
|
+
],
|
|
3118
|
+
};
|
|
3119
|
+
}
|
|
3120
|
+
catch (error) {
|
|
3121
|
+
console.error(`Error reading README.md for resource ${uri.href}:`, error.message);
|
|
3122
|
+
throw {
|
|
3123
|
+
code: -32002,
|
|
3124
|
+
message: `Resource not found or unreadable: ${uri.href}`,
|
|
3125
|
+
data: { uri: uri.href, cause: error.message },
|
|
3126
|
+
};
|
|
3127
|
+
}
|
|
3128
|
+
});
|
|
3129
|
+
// Register llms-full.txt resource (MCP Specification)
|
|
3130
|
+
server.resource('mcpSpecification', 'doc://mcp/specification', {
|
|
3131
|
+
name: 'MCP Full Specification',
|
|
3132
|
+
description: 'The llms-full.txt content providing a comprehensive overview of the Model Context Protocol.',
|
|
3133
|
+
mimeType: 'text/plain',
|
|
3134
|
+
}, async (uri) => {
|
|
3135
|
+
try {
|
|
3136
|
+
const specContent = fs.readFileSync(LLMS_FULL_TEXT_PATH, 'utf-8');
|
|
3137
|
+
return {
|
|
3138
|
+
contents: [
|
|
3139
|
+
{
|
|
3140
|
+
uri: uri.href,
|
|
3141
|
+
text: specContent,
|
|
3142
|
+
mimeType: 'text/plain',
|
|
3143
|
+
},
|
|
3144
|
+
],
|
|
3145
|
+
};
|
|
3146
|
+
}
|
|
3147
|
+
catch (error) {
|
|
3148
|
+
console.error(`Error reading llms-full.txt for resource ${uri.href}:`, error.message);
|
|
3149
|
+
throw {
|
|
3150
|
+
code: -32002,
|
|
3151
|
+
message: `Resource not found or unreadable: ${uri.href}`,
|
|
3152
|
+
data: { uri: uri.href, cause: error.message },
|
|
3153
|
+
};
|
|
3154
|
+
}
|
|
3155
|
+
});
|
|
3156
|
+
// Add NPM tools - Ensuring each tool registration is complete and correct
|
|
3157
|
+
server.tool('npmVersions', 'Get all available versions of an NPM package', {
|
|
3158
|
+
packages: z.array(z.string()).describe('List of package names to get versions for'),
|
|
3159
|
+
}, {
|
|
3160
|
+
title: 'Get All Package Versions',
|
|
3161
|
+
readOnlyHint: true,
|
|
3162
|
+
openWorldHint: true,
|
|
3163
|
+
idempotentHint: true,
|
|
3164
|
+
}, async (args) => {
|
|
3165
|
+
return await handleNpmVersions(args);
|
|
3166
|
+
});
|
|
3167
|
+
server.tool('npmLatest', 'Get the latest version and changelog of an NPM package', {
|
|
3168
|
+
packages: z.array(z.string()).describe('List of package names to get latest versions for'),
|
|
3169
|
+
}, {
|
|
3170
|
+
title: 'Get Latest Package Information',
|
|
3171
|
+
readOnlyHint: true,
|
|
3172
|
+
openWorldHint: true,
|
|
3173
|
+
idempotentHint: true, // Result for 'latest' tag can change, but call itself is idempotent
|
|
3174
|
+
}, async (args) => {
|
|
3175
|
+
return await handleNpmLatest(args);
|
|
3176
|
+
});
|
|
3177
|
+
server.tool('npmDeps', 'Analyze dependencies and devDependencies of an NPM package', {
|
|
3178
|
+
packages: z.array(z.string()).describe('List of package names to analyze dependencies for'),
|
|
3179
|
+
}, {
|
|
3180
|
+
title: 'Get Package Dependencies',
|
|
3181
|
+
readOnlyHint: true,
|
|
3182
|
+
openWorldHint: true,
|
|
3183
|
+
idempotentHint: true,
|
|
3184
|
+
}, async (args) => {
|
|
3185
|
+
return await handleNpmDeps(args);
|
|
3186
|
+
});
|
|
3187
|
+
server.tool('npmTypes', 'Check TypeScript types availability and version for a package', {
|
|
3188
|
+
packages: z.array(z.string()).describe('List of package names to check types for'),
|
|
3189
|
+
}, {
|
|
3190
|
+
title: 'Check TypeScript Type Availability',
|
|
3191
|
+
readOnlyHint: true,
|
|
3192
|
+
openWorldHint: true,
|
|
3193
|
+
idempotentHint: true,
|
|
3194
|
+
}, async (args) => {
|
|
3195
|
+
return await handleNpmTypes(args);
|
|
3196
|
+
});
|
|
3197
|
+
server.tool('npmSize', 'Get package size information including dependencies and bundle size', {
|
|
3198
|
+
packages: z.array(z.string()).describe('List of package names to get size information for'),
|
|
3199
|
+
}, {
|
|
3200
|
+
title: 'Get Package Size (Bundlephobia)',
|
|
3201
|
+
readOnlyHint: true,
|
|
3202
|
+
openWorldHint: true,
|
|
3203
|
+
idempotentHint: true,
|
|
3204
|
+
}, async (args) => {
|
|
3205
|
+
return await handleNpmSize(args);
|
|
3206
|
+
});
|
|
3207
|
+
server.tool('npmVulnerabilities', 'Check for known vulnerabilities in packages', {
|
|
3208
|
+
packages: z.array(z.string()).describe('List of package names to check for vulnerabilities'),
|
|
3209
|
+
}, {
|
|
3210
|
+
title: 'Check Package Vulnerabilities (OSV.dev)',
|
|
3211
|
+
readOnlyHint: true,
|
|
3212
|
+
openWorldHint: true,
|
|
3213
|
+
idempotentHint: false, // Vulnerability data can change frequently
|
|
3214
|
+
}, async (args) => {
|
|
3215
|
+
return await handleNpmVulnerabilities(args);
|
|
3216
|
+
});
|
|
3217
|
+
server.tool('npmTrends', 'Get download trends and popularity metrics for packages', {
|
|
3218
|
+
packages: z.array(z.string()).describe('List of package names to get trends for'),
|
|
3219
|
+
period: z
|
|
3220
|
+
.enum(['last-week', 'last-month', 'last-year'])
|
|
3221
|
+
.describe('Time period for trends. Options: "last-week", "last-month", "last-year"')
|
|
3222
|
+
.optional()
|
|
3223
|
+
.default('last-month'),
|
|
3224
|
+
}, {
|
|
3225
|
+
title: 'Get NPM Package Download Trends',
|
|
3226
|
+
readOnlyHint: true,
|
|
3227
|
+
openWorldHint: true,
|
|
3228
|
+
idempotentHint: true, // Trends for a fixed past period are idempotent
|
|
3229
|
+
}, async (args) => {
|
|
3230
|
+
return await handleNpmTrends(args);
|
|
3231
|
+
});
|
|
3232
|
+
server.tool('npmCompare', 'Compare multiple NPM packages based on various metrics', {
|
|
3233
|
+
packages: z.array(z.string()).describe('List of package names to compare'),
|
|
3234
|
+
}, {
|
|
3235
|
+
title: 'Compare NPM Packages',
|
|
3236
|
+
readOnlyHint: true,
|
|
3237
|
+
openWorldHint: true,
|
|
3238
|
+
idempotentHint: true,
|
|
3239
|
+
}, async (args) => {
|
|
3240
|
+
return await handleNpmCompare(args);
|
|
3241
|
+
});
|
|
3242
|
+
server.tool('npmMaintainers', 'Get maintainers information for NPM packages', {
|
|
3243
|
+
packages: z.array(z.string()).describe('List of package names to get maintainers for'),
|
|
3244
|
+
}, {
|
|
3245
|
+
title: 'Get NPM Package Maintainers',
|
|
3246
|
+
readOnlyHint: true,
|
|
3247
|
+
openWorldHint: true,
|
|
3248
|
+
idempotentHint: true,
|
|
3249
|
+
}, async (args) => {
|
|
3250
|
+
return await handleNpmMaintainers(args);
|
|
3251
|
+
});
|
|
3252
|
+
server.tool('npmScore', 'Get consolidated package score based on quality, maintenance, and popularity metrics', {
|
|
3253
|
+
packages: z.array(z.string()).describe('List of package names to get scores for'),
|
|
3254
|
+
}, {
|
|
3255
|
+
title: 'Get NPM Package Score (NPMS.io)',
|
|
3256
|
+
readOnlyHint: true,
|
|
3257
|
+
openWorldHint: true,
|
|
3258
|
+
idempotentHint: true, // Score for a version is stable, for 'latest' can change
|
|
3259
|
+
}, async (args) => {
|
|
3260
|
+
return await handleNpmScore(args);
|
|
3261
|
+
});
|
|
3262
|
+
server.tool('npmPackageReadme', 'Get the README content for NPM packages', {
|
|
3263
|
+
packages: z.array(z.string()).describe('List of package names to get READMEs for'),
|
|
3264
|
+
}, {
|
|
3265
|
+
title: 'Get NPM Package README',
|
|
3266
|
+
readOnlyHint: true,
|
|
3267
|
+
openWorldHint: true,
|
|
3268
|
+
idempotentHint: true,
|
|
3269
|
+
}, async (args) => {
|
|
3270
|
+
return await handleNpmPackageReadme(args);
|
|
3271
|
+
});
|
|
3272
|
+
server.tool('npmSearch', 'Search for NPM packages with optional limit', {
|
|
3273
|
+
query: z.string().describe('Search query for packages'),
|
|
3274
|
+
limit: z
|
|
3275
|
+
.number()
|
|
3276
|
+
.min(1)
|
|
3277
|
+
.max(50)
|
|
3278
|
+
.optional()
|
|
3279
|
+
.describe('Maximum number of results to return (default: 10)'),
|
|
3280
|
+
}, {
|
|
3281
|
+
title: 'Search NPM Packages',
|
|
3282
|
+
readOnlyHint: true,
|
|
3283
|
+
openWorldHint: true,
|
|
3284
|
+
idempotentHint: false, // Search results can change
|
|
3285
|
+
}, async (args) => {
|
|
3286
|
+
return await handleNpmSearch(args);
|
|
3287
|
+
});
|
|
3288
|
+
server.tool('npmLicenseCompatibility', 'Check license compatibility between multiple packages', {
|
|
3289
|
+
packages: z
|
|
3290
|
+
.array(z.string())
|
|
3291
|
+
.min(1)
|
|
3292
|
+
.describe('List of package names to check for license compatibility'),
|
|
3293
|
+
}, {
|
|
3294
|
+
title: 'Check NPM License Compatibility',
|
|
3295
|
+
readOnlyHint: true,
|
|
3296
|
+
openWorldHint: true,
|
|
3297
|
+
idempotentHint: true,
|
|
3298
|
+
}, async (args) => {
|
|
3299
|
+
return await handleNpmLicenseCompatibility(args);
|
|
3300
|
+
});
|
|
3301
|
+
server.tool('npmRepoStats', 'Get repository statistics for NPM packages', {
|
|
3302
|
+
packages: z.array(z.string()).describe('List of package names to get repository stats for'),
|
|
3303
|
+
}, {
|
|
3304
|
+
title: 'Get NPM Package Repository Stats (GitHub)',
|
|
3305
|
+
readOnlyHint: true,
|
|
3306
|
+
openWorldHint: true,
|
|
3307
|
+
idempotentHint: true, // Stats for a repo at a point in time, though they change over time
|
|
3308
|
+
}, async (args) => {
|
|
3309
|
+
return await handleNpmRepoStats(args);
|
|
3310
|
+
});
|
|
3311
|
+
server.tool('npmDeprecated', 'Check if packages are deprecated', {
|
|
3312
|
+
packages: z.array(z.string()).describe('List of package names to check for deprecation'),
|
|
3313
|
+
}, {
|
|
3314
|
+
title: 'Check NPM Package Deprecation Status',
|
|
3315
|
+
readOnlyHint: true,
|
|
3316
|
+
openWorldHint: true,
|
|
3317
|
+
idempotentHint: true, // Deprecation status is generally stable for a version
|
|
3318
|
+
}, async (args) => {
|
|
3319
|
+
return await handleNpmDeprecated(args);
|
|
3320
|
+
});
|
|
3321
|
+
server.tool('npmChangelogAnalysis', 'Analyze changelog and release history of packages', {
|
|
3322
|
+
packages: z.array(z.string()).describe('List of package names to analyze changelogs for'),
|
|
3323
|
+
}, {
|
|
3324
|
+
title: 'Analyze NPM Package Changelog (GitHub)',
|
|
3325
|
+
readOnlyHint: true,
|
|
3326
|
+
openWorldHint: true,
|
|
3327
|
+
idempotentHint: true,
|
|
3328
|
+
}, async (args) => {
|
|
3329
|
+
return await handleNpmChangelogAnalysis(args);
|
|
3330
|
+
});
|
|
3331
|
+
server.tool('npmAlternatives', 'Find alternative packages with similar functionality', {
|
|
3332
|
+
packages: z.array(z.string()).describe('List of package names to find alternatives for'),
|
|
3333
|
+
}, {
|
|
3334
|
+
title: 'Find NPM Package Alternatives',
|
|
3335
|
+
readOnlyHint: true,
|
|
3336
|
+
openWorldHint: true,
|
|
3337
|
+
idempotentHint: false, // Search-based, results can change
|
|
3338
|
+
}, async (args) => {
|
|
3339
|
+
return await handleNpmAlternatives(args);
|
|
3340
|
+
});
|
|
3341
|
+
server.tool('npmQuality', 'Analyze package quality metrics', {
|
|
3342
|
+
packages: z.array(z.string()).describe('List of package names to analyze'),
|
|
3343
|
+
}, {
|
|
3344
|
+
title: 'Analyze NPM Package Quality (NPMS.io)',
|
|
3345
|
+
readOnlyHint: true,
|
|
3346
|
+
openWorldHint: true,
|
|
3347
|
+
idempotentHint: true, // Score for a version is stable, for 'latest' can change
|
|
3348
|
+
}, async (args) => {
|
|
3349
|
+
return await handleNpmQuality(args);
|
|
3350
|
+
});
|
|
3351
|
+
server.tool('npmMaintenance', 'Analyze package maintenance metrics', {
|
|
3352
|
+
packages: z.array(z.string()).describe('List of package names to analyze'),
|
|
3353
|
+
}, {
|
|
3354
|
+
title: 'Analyze NPM Package Maintenance (NPMS.io)',
|
|
3355
|
+
readOnlyHint: true,
|
|
3356
|
+
openWorldHint: true,
|
|
3357
|
+
idempotentHint: true, // Score for a version is stable, for 'latest' can change
|
|
3358
|
+
}, async (args) => {
|
|
3359
|
+
return await handleNpmMaintenance(args);
|
|
3360
|
+
});
|
|
3361
|
+
return server.server;
|
|
3362
|
+
}
|
|
3363
|
+
// STDIO compatibility for backward compatibility
|
|
3364
|
+
async function main() {
|
|
3365
|
+
// Create server with empty configuration
|
|
3366
|
+
const server = createServer({
|
|
3367
|
+
config: {},
|
|
3368
|
+
});
|
|
3369
|
+
// Start receiving messages on stdin and sending messages on stdout
|
|
3370
|
+
const transport = new StdioServerTransport();
|
|
3371
|
+
await server.connect(transport);
|
|
3372
|
+
process.stdin.on('close', () => {
|
|
3373
|
+
server.close();
|
|
3374
|
+
});
|
|
3375
|
+
// Handle uncaught errors
|
|
3376
|
+
process.on('uncaughtException', (error) => {
|
|
3377
|
+
console.error('Fatal error:', error);
|
|
3378
|
+
server.close();
|
|
3379
|
+
process.exit(1);
|
|
3380
|
+
});
|
|
3381
|
+
process.on('unhandledRejection', (error) => {
|
|
3382
|
+
console.error('Unhandled rejection:', error);
|
|
3383
|
+
server.close();
|
|
3384
|
+
process.exit(1);
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3364
3387
|
// Type guard for NpmPackageVersionSchema
|
|
3365
3388
|
function isNpmPackageVersionData(data) {
|
|
3366
3389
|
try {
|
|
@@ -3373,4 +3396,9 @@ function isNpmPackageVersionData(data) {
|
|
|
3373
3396
|
return false;
|
|
3374
3397
|
}
|
|
3375
3398
|
}
|
|
3399
|
+
// Run STDIO server when executed directly (for backward compatibility)
|
|
3400
|
+
main().catch((error) => {
|
|
3401
|
+
console.error('Server error:', error);
|
|
3402
|
+
process.exit(1);
|
|
3403
|
+
});
|
|
3376
3404
|
//# sourceMappingURL=index.js.map
|