@nekzus/mcp-server 1.18.3 → 1.19.0-alpha.10
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 +162 -283
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +60 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +488 -785
- package/dist/index.js.map +1 -1
- package/dist/src/cache.d.ts +22 -0
- package/dist/src/cache.d.ts.map +1 -0
- package/dist/src/cache.js +68 -0
- package/dist/src/cache.js.map +1 -0
- package/dist/src/config.d.ts +11 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +45 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/handlers/index.d.ts +2 -0
- package/dist/src/handlers/index.d.ts.map +1 -0
- package/dist/src/handlers/index.js +2 -0
- package/dist/src/handlers/index.js.map +1 -0
- package/dist/src/icons.d.ts +21 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +29 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/prompts/index.d.ts +3 -0
- package/dist/src/prompts/index.d.ts.map +1 -0
- package/dist/src/prompts/index.js +22 -0
- package/dist/src/prompts/index.js.map +1 -0
- package/dist/src/resources/index.d.ts +3 -0
- package/dist/src/resources/index.d.ts.map +1 -0
- package/dist/src/resources/index.js +62 -0
- package/dist/src/resources/index.js.map +1 -0
- package/dist/src/schemas.d.ts +143 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/schemas.js +189 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/server.d.ts +7 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +21 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/index.d.ts +3 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +411 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/utils/fetch-retry.d.ts +5 -0
- package/dist/src/utils/fetch-retry.d.ts.map +1 -0
- package/dist/src/utils/fetch-retry.js +69 -0
- package/dist/src/utils/fetch-retry.js.map +1 -0
- package/llms-full.txt +312 -422
- package/package.json +16 -17
- package/smithery.yaml +10 -2
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const NpmMaintainerSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
name: z.string(),
|
|
5
|
+
email: z.string().optional(),
|
|
6
|
+
url: z.string().optional(),
|
|
7
|
+
})
|
|
8
|
+
.loose();
|
|
9
|
+
export const NpmPackageVersionSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
name: z.string(),
|
|
12
|
+
version: z.string(),
|
|
13
|
+
description: z.string().optional(),
|
|
14
|
+
author: z
|
|
15
|
+
.union([
|
|
16
|
+
z.string(),
|
|
17
|
+
z
|
|
18
|
+
.object({
|
|
19
|
+
name: z.string().optional(),
|
|
20
|
+
email: z.string().optional(),
|
|
21
|
+
url: z.string().optional(),
|
|
22
|
+
})
|
|
23
|
+
.loose(),
|
|
24
|
+
])
|
|
25
|
+
.optional(),
|
|
26
|
+
license: z.string().optional(),
|
|
27
|
+
repository: z
|
|
28
|
+
.object({
|
|
29
|
+
type: z.string().optional(),
|
|
30
|
+
url: z.string().optional(),
|
|
31
|
+
})
|
|
32
|
+
.loose()
|
|
33
|
+
.optional(),
|
|
34
|
+
bugs: z
|
|
35
|
+
.object({
|
|
36
|
+
url: z.string().optional(),
|
|
37
|
+
})
|
|
38
|
+
.loose()
|
|
39
|
+
.optional(),
|
|
40
|
+
homepage: z.string().optional(),
|
|
41
|
+
dependencies: z.record(z.string(), z.string()).optional(),
|
|
42
|
+
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
43
|
+
peerDependencies: z.record(z.string(), z.string()).optional(),
|
|
44
|
+
types: z.string().optional(),
|
|
45
|
+
typings: z.string().optional(),
|
|
46
|
+
dist: z
|
|
47
|
+
.object({ shasum: z.string().optional(), tarball: z.string().optional() })
|
|
48
|
+
.loose()
|
|
49
|
+
.optional(),
|
|
50
|
+
})
|
|
51
|
+
.loose();
|
|
52
|
+
export const NpmPackageInfoSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
name: z.string(),
|
|
55
|
+
'dist-tags': z.record(z.string(), z.string()),
|
|
56
|
+
versions: z.record(z.string(), NpmPackageVersionSchema),
|
|
57
|
+
time: z.record(z.string(), z.string()).optional(),
|
|
58
|
+
repository: z
|
|
59
|
+
.object({
|
|
60
|
+
type: z.string().optional(),
|
|
61
|
+
url: z.string().optional(),
|
|
62
|
+
})
|
|
63
|
+
.loose()
|
|
64
|
+
.optional(),
|
|
65
|
+
bugs: z
|
|
66
|
+
.object({
|
|
67
|
+
url: z.string().optional(),
|
|
68
|
+
})
|
|
69
|
+
.loose()
|
|
70
|
+
.optional(),
|
|
71
|
+
homepage: z.string().optional(),
|
|
72
|
+
maintainers: z.array(NpmMaintainerSchema).optional(),
|
|
73
|
+
})
|
|
74
|
+
.loose();
|
|
75
|
+
export const NpmPackageDataSchema = z
|
|
76
|
+
.object({
|
|
77
|
+
name: z.string(),
|
|
78
|
+
version: z.string(),
|
|
79
|
+
description: z.string().optional(),
|
|
80
|
+
license: z.string().optional(),
|
|
81
|
+
dependencies: z.record(z.string(), z.string()).optional(),
|
|
82
|
+
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
83
|
+
peerDependencies: z.record(z.string(), z.string()).optional(),
|
|
84
|
+
types: z.string().optional(),
|
|
85
|
+
typings: z.string().optional(),
|
|
86
|
+
})
|
|
87
|
+
.loose();
|
|
88
|
+
export const BundlephobiaDataSchema = z.object({
|
|
89
|
+
size: z.number(),
|
|
90
|
+
gzip: z.number(),
|
|
91
|
+
dependencyCount: z.number(),
|
|
92
|
+
});
|
|
93
|
+
export const NpmDownloadsDataSchema = z.object({
|
|
94
|
+
downloads: z.number(),
|
|
95
|
+
start: z.string(),
|
|
96
|
+
end: z.string(),
|
|
97
|
+
package: z.string(),
|
|
98
|
+
});
|
|
99
|
+
export const NpmSearchResultSchema = z
|
|
100
|
+
.object({
|
|
101
|
+
objects: z.array(z.object({
|
|
102
|
+
package: z.object({
|
|
103
|
+
name: z.string(),
|
|
104
|
+
version: z.string(),
|
|
105
|
+
description: z.string().optional(),
|
|
106
|
+
keywords: z.array(z.string()).optional(),
|
|
107
|
+
publisher: z
|
|
108
|
+
.object({
|
|
109
|
+
username: z.string(),
|
|
110
|
+
email: z.string().optional(),
|
|
111
|
+
})
|
|
112
|
+
.optional(),
|
|
113
|
+
links: z
|
|
114
|
+
.object({
|
|
115
|
+
npm: z.string().optional(),
|
|
116
|
+
homepage: z.string().optional(),
|
|
117
|
+
repository: z.string().optional(),
|
|
118
|
+
bugs: z.string().optional(),
|
|
119
|
+
})
|
|
120
|
+
.optional(),
|
|
121
|
+
date: z.string().optional(),
|
|
122
|
+
}),
|
|
123
|
+
score: z.object({
|
|
124
|
+
final: z.number(),
|
|
125
|
+
detail: z.object({
|
|
126
|
+
quality: z.number(),
|
|
127
|
+
popularity: z.number(),
|
|
128
|
+
maintenance: z.number(),
|
|
129
|
+
}),
|
|
130
|
+
}),
|
|
131
|
+
searchScore: z.number(),
|
|
132
|
+
})),
|
|
133
|
+
total: z.number(),
|
|
134
|
+
})
|
|
135
|
+
.loose();
|
|
136
|
+
export function isNpmPackageInfo(data) {
|
|
137
|
+
return (typeof data === 'object' &&
|
|
138
|
+
data !== null &&
|
|
139
|
+
(!('maintainers' in data) ||
|
|
140
|
+
(Array.isArray(data.maintainers) &&
|
|
141
|
+
(data.maintainers?.every((m) => typeof m === 'object' &&
|
|
142
|
+
m !== null &&
|
|
143
|
+
'name' in m &&
|
|
144
|
+
'email' in m &&
|
|
145
|
+
typeof m.name === 'string' &&
|
|
146
|
+
typeof m.email === 'string') ??
|
|
147
|
+
true))));
|
|
148
|
+
}
|
|
149
|
+
export function isNpmPackageData(data) {
|
|
150
|
+
try {
|
|
151
|
+
const result = NpmPackageDataSchema.safeParse(data);
|
|
152
|
+
if (!result.success) {
|
|
153
|
+
console.error('isNpmPackageData validation failed:', JSON.stringify(result.error.issues, null, 2));
|
|
154
|
+
}
|
|
155
|
+
return result.success;
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
console.error('isNpmPackageData threw exception:', e);
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
export function isBundlephobiaData(data) {
|
|
163
|
+
try {
|
|
164
|
+
return BundlephobiaDataSchema.parse(data) !== null;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export function isNpmDownloadsData(data) {
|
|
171
|
+
try {
|
|
172
|
+
const result = NpmDownloadsDataSchema.safeParse(data);
|
|
173
|
+
if (!result.success) {
|
|
174
|
+
console.error('isNpmDownloadsData validation failed:', JSON.stringify(result.error.issues, null, 2));
|
|
175
|
+
}
|
|
176
|
+
return result.success;
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export function isValidNpmPackageName(name) {
|
|
183
|
+
const npmPackageRegex = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
|
184
|
+
return (npmPackageRegex.test(name) &&
|
|
185
|
+
name.length <= 214 &&
|
|
186
|
+
!name.startsWith('_') &&
|
|
187
|
+
!name.startsWith('.'));
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KAClC,MAAM,CAAC;IACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,E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CAAC,GAAG,CAAC;QACrB,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { type configSchema } from './config.js';
|
|
3
|
+
export { configSchema } from './config.js';
|
|
4
|
+
export default function createServer({ config }: {
|
|
5
|
+
config: z.infer<typeof configSchema>;
|
|
6
|
+
}): import("@modelcontextprotocol/server").Server;
|
|
7
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,KAAK,YAAY,EAA+C,MAAM,aAAa,CAAC;AAK7F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;CAAE,iDAiBxF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
2
|
+
import { getPackageRootAndVersion, setNpmRegistryUrl } from './config.js';
|
|
3
|
+
import { registerAllPrompts } from './prompts/index.js';
|
|
4
|
+
import { registerAllResources } from './resources/index.js';
|
|
5
|
+
import { registerAllTools } from './tools/index.js';
|
|
6
|
+
export { configSchema } from './config.js';
|
|
7
|
+
export default function createServer({ config }) {
|
|
8
|
+
if (config.NPM_REGISTRY_URL) {
|
|
9
|
+
setNpmRegistryUrl(config.NPM_REGISTRY_URL);
|
|
10
|
+
}
|
|
11
|
+
const { packageRoot, serverVersion } = getPackageRootAndVersion();
|
|
12
|
+
const server = new McpServer({
|
|
13
|
+
name: 'npm-sentinel-mcp',
|
|
14
|
+
version: serverVersion,
|
|
15
|
+
});
|
|
16
|
+
registerAllResources(server, packageRoot);
|
|
17
|
+
registerAllPrompts(server);
|
|
18
|
+
registerAllTools(server);
|
|
19
|
+
return server.server;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAqB,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,MAAM,EAA4C;IACxF,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7B,iBAAiB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,wBAAwB,EAAE,CAAC;IAElE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC5B,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,aAAa;KACtB,CAAC,CAAC;IAEH,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1C,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEzB,OAAO,MAAM,CAAC,MAAM,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA8E9E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqdxD"}
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { handleNpmAlternatives, handleNpmChangelogAnalysis, handleNpmCompare, handleNpmDeprecated, handleNpmDeps, handleNpmLatest, handleNpmLicenseCompatibility, handleNpmMaintainers, handleNpmMaintenance, handleNpmPackageReadme, handleNpmQuality, handleNpmRepoStats, handleNpmScore, handleNpmSearch, handleNpmSize, handleNpmTrends, handleNpmTypes, handleNpmVersions, handleNpmVulnerabilities, } from '../handlers/index.js';
|
|
3
|
+
import { NPM_METRICS_ICON, NPM_REGISTRY_ICON, NPM_SECURITY_ICON } from '../icons.js';
|
|
4
|
+
// Helper schemas for structured outputs (MCP v2)
|
|
5
|
+
const BatchResultOutputSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
results: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
8
|
+
summary: z.record(z.string(), z.unknown()).optional(),
|
|
9
|
+
message: z.string().optional(),
|
|
10
|
+
})
|
|
11
|
+
.passthrough();
|
|
12
|
+
const SearchResultOutputSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
query: z.string().optional(),
|
|
15
|
+
limitUsed: z.number().optional(),
|
|
16
|
+
totalResults: z.number().optional(),
|
|
17
|
+
resultsCount: z.number().optional(),
|
|
18
|
+
results: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
19
|
+
message: z.string().optional(),
|
|
20
|
+
})
|
|
21
|
+
.passthrough();
|
|
22
|
+
const CompareResultOutputSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
queryPackages: z.array(z.string()).optional(),
|
|
25
|
+
results: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
26
|
+
message: z.string().optional(),
|
|
27
|
+
})
|
|
28
|
+
.passthrough();
|
|
29
|
+
const LicenseCompatibilityResultOutputSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
packagesAnalyzed: z.array(z.string()).optional(),
|
|
32
|
+
compatibility: z.record(z.string(), z.unknown()).optional(),
|
|
33
|
+
licenseDetails: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
34
|
+
})
|
|
35
|
+
.passthrough();
|
|
36
|
+
async function withStructuredOutput(handlerPromise) {
|
|
37
|
+
const res = await handlerPromise;
|
|
38
|
+
try {
|
|
39
|
+
const text = res.content[0]?.text;
|
|
40
|
+
if (text && (text.startsWith('{') || text.startsWith('['))) {
|
|
41
|
+
const parsed = JSON.parse(text);
|
|
42
|
+
return {
|
|
43
|
+
...res,
|
|
44
|
+
structuredContent: parsed,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch { }
|
|
49
|
+
return res;
|
|
50
|
+
}
|
|
51
|
+
export function registerAllTools(server) {
|
|
52
|
+
server.registerTool('npmVersions', {
|
|
53
|
+
description: 'Get all available versions of an NPM package',
|
|
54
|
+
inputSchema: z.object({
|
|
55
|
+
packages: z.array(z.string()).describe('List of package names to get versions for'),
|
|
56
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
57
|
+
}),
|
|
58
|
+
outputSchema: BatchResultOutputSchema,
|
|
59
|
+
icons: NPM_REGISTRY_ICON,
|
|
60
|
+
annotations: {
|
|
61
|
+
title: 'Get All Package Versions',
|
|
62
|
+
readOnlyHint: true,
|
|
63
|
+
openWorldHint: true,
|
|
64
|
+
idempotentHint: true,
|
|
65
|
+
},
|
|
66
|
+
}, async (args, ctx) => {
|
|
67
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmVersions for ${args.packages.join(', ')}`);
|
|
68
|
+
return await withStructuredOutput(handleNpmVersions(args));
|
|
69
|
+
});
|
|
70
|
+
server.registerTool('npmLatest', {
|
|
71
|
+
description: 'Get the latest version and changelog of an NPM package',
|
|
72
|
+
inputSchema: z.object({
|
|
73
|
+
packages: z.array(z.string()).describe('List of package names to get latest versions for'),
|
|
74
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
75
|
+
}),
|
|
76
|
+
outputSchema: BatchResultOutputSchema,
|
|
77
|
+
icons: NPM_REGISTRY_ICON,
|
|
78
|
+
annotations: {
|
|
79
|
+
title: 'Get Latest Package Information',
|
|
80
|
+
readOnlyHint: true,
|
|
81
|
+
openWorldHint: true,
|
|
82
|
+
idempotentHint: true,
|
|
83
|
+
},
|
|
84
|
+
}, async (args, ctx) => {
|
|
85
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmLatest for ${args.packages.join(', ')}`);
|
|
86
|
+
return await withStructuredOutput(handleNpmLatest(args));
|
|
87
|
+
});
|
|
88
|
+
server.registerTool('npmDeps', {
|
|
89
|
+
description: 'Analyze dependencies and devDependencies of an NPM package',
|
|
90
|
+
inputSchema: z.object({
|
|
91
|
+
packages: z.array(z.string()).describe('List of package names to analyze dependencies for'),
|
|
92
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
93
|
+
}),
|
|
94
|
+
outputSchema: BatchResultOutputSchema,
|
|
95
|
+
icons: NPM_REGISTRY_ICON,
|
|
96
|
+
annotations: {
|
|
97
|
+
title: 'Get Package Dependencies',
|
|
98
|
+
readOnlyHint: true,
|
|
99
|
+
openWorldHint: true,
|
|
100
|
+
idempotentHint: true,
|
|
101
|
+
},
|
|
102
|
+
}, async (args, ctx) => {
|
|
103
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmDeps for ${args.packages.join(', ')}`);
|
|
104
|
+
return await withStructuredOutput(handleNpmDeps(args));
|
|
105
|
+
});
|
|
106
|
+
server.registerTool('npmTypes', {
|
|
107
|
+
description: 'Check TypeScript types availability and version for a package',
|
|
108
|
+
inputSchema: z.object({
|
|
109
|
+
packages: z.array(z.string()).describe('List of package names to check types for'),
|
|
110
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
111
|
+
}),
|
|
112
|
+
outputSchema: BatchResultOutputSchema,
|
|
113
|
+
icons: NPM_REGISTRY_ICON,
|
|
114
|
+
annotations: {
|
|
115
|
+
title: 'Check TypeScript Type Availability',
|
|
116
|
+
readOnlyHint: true,
|
|
117
|
+
openWorldHint: true,
|
|
118
|
+
idempotentHint: true,
|
|
119
|
+
},
|
|
120
|
+
}, async (args, ctx) => {
|
|
121
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmTypes for ${args.packages.join(', ')}`);
|
|
122
|
+
return await withStructuredOutput(handleNpmTypes(args));
|
|
123
|
+
});
|
|
124
|
+
server.registerTool('npmSize', {
|
|
125
|
+
description: 'Get package size information including dependencies and bundle size',
|
|
126
|
+
inputSchema: z.object({
|
|
127
|
+
packages: z.array(z.string()).describe('List of package names to get size information for'),
|
|
128
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
129
|
+
}),
|
|
130
|
+
outputSchema: BatchResultOutputSchema,
|
|
131
|
+
icons: NPM_METRICS_ICON,
|
|
132
|
+
annotations: {
|
|
133
|
+
title: 'Get Package Size (Bundlephobia)',
|
|
134
|
+
readOnlyHint: true,
|
|
135
|
+
openWorldHint: true,
|
|
136
|
+
idempotentHint: true,
|
|
137
|
+
},
|
|
138
|
+
}, async (args, ctx) => {
|
|
139
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmSize for ${args.packages.join(', ')}`);
|
|
140
|
+
return await withStructuredOutput(handleNpmSize(args));
|
|
141
|
+
});
|
|
142
|
+
server.registerTool('npmVulnerabilities', {
|
|
143
|
+
description: 'Check for known vulnerabilities in packages',
|
|
144
|
+
inputSchema: z.object({
|
|
145
|
+
packages: z
|
|
146
|
+
.array(z.string())
|
|
147
|
+
.describe('List of package names to check for vulnerabilities'),
|
|
148
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
149
|
+
}),
|
|
150
|
+
outputSchema: BatchResultOutputSchema,
|
|
151
|
+
icons: NPM_SECURITY_ICON,
|
|
152
|
+
annotations: {
|
|
153
|
+
title: 'Check Package Vulnerabilities (OSV.dev)',
|
|
154
|
+
readOnlyHint: true,
|
|
155
|
+
openWorldHint: true,
|
|
156
|
+
idempotentHint: false,
|
|
157
|
+
},
|
|
158
|
+
}, async (args, ctx) => {
|
|
159
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmVulnerabilities for ${args.packages.join(', ')}`);
|
|
160
|
+
return await withStructuredOutput(handleNpmVulnerabilities(args));
|
|
161
|
+
});
|
|
162
|
+
server.registerTool('npmTrends', {
|
|
163
|
+
description: 'Get download trends and popularity metrics for packages',
|
|
164
|
+
inputSchema: z.object({
|
|
165
|
+
packages: z.array(z.string()).describe('List of package names to get trends for'),
|
|
166
|
+
period: z
|
|
167
|
+
.enum(['last-week', 'last-month', 'last-year'])
|
|
168
|
+
.describe('Time period for trends. Options: "last-week", "last-month", "last-year"')
|
|
169
|
+
.optional()
|
|
170
|
+
.default('last-month'),
|
|
171
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
172
|
+
}),
|
|
173
|
+
outputSchema: BatchResultOutputSchema,
|
|
174
|
+
icons: NPM_METRICS_ICON,
|
|
175
|
+
annotations: {
|
|
176
|
+
title: 'Get NPM Package Download Trends',
|
|
177
|
+
readOnlyHint: true,
|
|
178
|
+
openWorldHint: true,
|
|
179
|
+
idempotentHint: true,
|
|
180
|
+
},
|
|
181
|
+
}, async (args, ctx) => {
|
|
182
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmTrends for ${args.packages.join(', ')}`);
|
|
183
|
+
return await withStructuredOutput(handleNpmTrends(args));
|
|
184
|
+
});
|
|
185
|
+
server.registerTool('npmCompare', {
|
|
186
|
+
description: 'Compare multiple NPM packages based on various metrics',
|
|
187
|
+
inputSchema: z.object({
|
|
188
|
+
packages: z.array(z.string()).describe('List of package names to compare'),
|
|
189
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
190
|
+
}),
|
|
191
|
+
outputSchema: CompareResultOutputSchema,
|
|
192
|
+
icons: NPM_METRICS_ICON,
|
|
193
|
+
annotations: {
|
|
194
|
+
title: 'Compare NPM Packages',
|
|
195
|
+
readOnlyHint: true,
|
|
196
|
+
openWorldHint: true,
|
|
197
|
+
idempotentHint: true,
|
|
198
|
+
},
|
|
199
|
+
}, async (args, ctx) => {
|
|
200
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmCompare for ${args.packages.join(', ')}`);
|
|
201
|
+
return await withStructuredOutput(handleNpmCompare(args));
|
|
202
|
+
});
|
|
203
|
+
server.registerTool('npmMaintainers', {
|
|
204
|
+
description: 'Get maintainers information for NPM packages',
|
|
205
|
+
inputSchema: z.object({
|
|
206
|
+
packages: z.array(z.string()).describe('List of package names to get maintainers for'),
|
|
207
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
208
|
+
}),
|
|
209
|
+
outputSchema: BatchResultOutputSchema,
|
|
210
|
+
icons: NPM_METRICS_ICON,
|
|
211
|
+
annotations: {
|
|
212
|
+
title: 'Get NPM Package Maintainers',
|
|
213
|
+
readOnlyHint: true,
|
|
214
|
+
openWorldHint: true,
|
|
215
|
+
idempotentHint: true,
|
|
216
|
+
},
|
|
217
|
+
}, async (args, ctx) => {
|
|
218
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmMaintainers for ${args.packages.join(', ')}`);
|
|
219
|
+
return await withStructuredOutput(handleNpmMaintainers(args));
|
|
220
|
+
});
|
|
221
|
+
server.registerTool('npmScore', {
|
|
222
|
+
description: 'Get consolidated package score based on quality, maintenance, and popularity metrics',
|
|
223
|
+
inputSchema: z.object({
|
|
224
|
+
packages: z.array(z.string()).describe('List of package names to get scores for'),
|
|
225
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
226
|
+
}),
|
|
227
|
+
outputSchema: BatchResultOutputSchema,
|
|
228
|
+
icons: NPM_METRICS_ICON,
|
|
229
|
+
annotations: {
|
|
230
|
+
title: 'Get NPM Package Score (NPMS.io)',
|
|
231
|
+
readOnlyHint: true,
|
|
232
|
+
openWorldHint: true,
|
|
233
|
+
idempotentHint: true,
|
|
234
|
+
},
|
|
235
|
+
}, async (args, ctx) => {
|
|
236
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmScore for ${args.packages.join(', ')}`);
|
|
237
|
+
return await withStructuredOutput(handleNpmScore(args));
|
|
238
|
+
});
|
|
239
|
+
server.registerTool('npmPackageReadme', {
|
|
240
|
+
description: 'Get the README content for NPM packages',
|
|
241
|
+
inputSchema: z.object({
|
|
242
|
+
packages: z.array(z.string()).describe('List of package names to get READMEs for'),
|
|
243
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
244
|
+
}),
|
|
245
|
+
outputSchema: BatchResultOutputSchema,
|
|
246
|
+
icons: NPM_REGISTRY_ICON,
|
|
247
|
+
annotations: {
|
|
248
|
+
title: 'Get NPM Package README',
|
|
249
|
+
readOnlyHint: true,
|
|
250
|
+
openWorldHint: true,
|
|
251
|
+
idempotentHint: true,
|
|
252
|
+
},
|
|
253
|
+
}, async (args, ctx) => {
|
|
254
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmPackageReadme for ${args.packages.join(', ')}`);
|
|
255
|
+
return await withStructuredOutput(handleNpmPackageReadme(args));
|
|
256
|
+
});
|
|
257
|
+
server.registerTool('npmSearch', {
|
|
258
|
+
description: 'Search for NPM packages with optional limit',
|
|
259
|
+
inputSchema: z.object({
|
|
260
|
+
query: z.string().describe('Search query for packages'),
|
|
261
|
+
limit: z
|
|
262
|
+
.number()
|
|
263
|
+
.min(1)
|
|
264
|
+
.max(50)
|
|
265
|
+
.optional()
|
|
266
|
+
.describe('Maximum number of results to return (default: 10)'),
|
|
267
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
268
|
+
}),
|
|
269
|
+
outputSchema: SearchResultOutputSchema,
|
|
270
|
+
icons: NPM_REGISTRY_ICON,
|
|
271
|
+
annotations: {
|
|
272
|
+
title: 'Search NPM Packages',
|
|
273
|
+
readOnlyHint: true,
|
|
274
|
+
openWorldHint: true,
|
|
275
|
+
idempotentHint: false,
|
|
276
|
+
},
|
|
277
|
+
}, async (args, ctx) => {
|
|
278
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmSearch for query: "${args.query}"`);
|
|
279
|
+
return await withStructuredOutput(handleNpmSearch(args));
|
|
280
|
+
});
|
|
281
|
+
server.registerTool('npmLicenseCompatibility', {
|
|
282
|
+
description: 'Check license compatibility between multiple packages',
|
|
283
|
+
inputSchema: z.object({
|
|
284
|
+
packages: z
|
|
285
|
+
.array(z.string())
|
|
286
|
+
.min(1)
|
|
287
|
+
.describe('List of package names to check for license compatibility'),
|
|
288
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
289
|
+
}),
|
|
290
|
+
outputSchema: LicenseCompatibilityResultOutputSchema,
|
|
291
|
+
icons: NPM_REGISTRY_ICON,
|
|
292
|
+
annotations: {
|
|
293
|
+
title: 'Check NPM License Compatibility',
|
|
294
|
+
readOnlyHint: true,
|
|
295
|
+
openWorldHint: true,
|
|
296
|
+
idempotentHint: true,
|
|
297
|
+
},
|
|
298
|
+
}, async (args, ctx) => {
|
|
299
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmLicenseCompatibility for ${args.packages.join(', ')}`);
|
|
300
|
+
return await withStructuredOutput(handleNpmLicenseCompatibility(args));
|
|
301
|
+
});
|
|
302
|
+
server.registerTool('npmRepoStats', {
|
|
303
|
+
description: 'Get repository statistics for NPM packages',
|
|
304
|
+
inputSchema: z.object({
|
|
305
|
+
packages: z.array(z.string()).describe('List of package names to get repository stats for'),
|
|
306
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
307
|
+
}),
|
|
308
|
+
outputSchema: BatchResultOutputSchema,
|
|
309
|
+
icons: NPM_SECURITY_ICON,
|
|
310
|
+
annotations: {
|
|
311
|
+
title: 'Get NPM Package Repository Stats (GitHub)',
|
|
312
|
+
readOnlyHint: true,
|
|
313
|
+
openWorldHint: true,
|
|
314
|
+
idempotentHint: true,
|
|
315
|
+
},
|
|
316
|
+
}, async (args, ctx) => {
|
|
317
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmRepoStats for ${args.packages.join(', ')}`);
|
|
318
|
+
return await withStructuredOutput(handleNpmRepoStats(args));
|
|
319
|
+
});
|
|
320
|
+
server.registerTool('npmDeprecated', {
|
|
321
|
+
description: 'Check if packages are deprecated',
|
|
322
|
+
inputSchema: z.object({
|
|
323
|
+
packages: z.array(z.string()).describe('List of package names to check for deprecation'),
|
|
324
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
325
|
+
}),
|
|
326
|
+
outputSchema: BatchResultOutputSchema,
|
|
327
|
+
icons: NPM_SECURITY_ICON,
|
|
328
|
+
annotations: {
|
|
329
|
+
title: 'Check NPM Package Deprecation Status',
|
|
330
|
+
readOnlyHint: true,
|
|
331
|
+
openWorldHint: true,
|
|
332
|
+
idempotentHint: true,
|
|
333
|
+
},
|
|
334
|
+
}, async (args, ctx) => {
|
|
335
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmDeprecated for ${args.packages.join(', ')}`);
|
|
336
|
+
return await withStructuredOutput(handleNpmDeprecated(args));
|
|
337
|
+
});
|
|
338
|
+
server.registerTool('npmChangelogAnalysis', {
|
|
339
|
+
description: 'Analyze changelog and release history of packages',
|
|
340
|
+
inputSchema: z.object({
|
|
341
|
+
packages: z.array(z.string()).describe('List of package names to analyze changelogs for'),
|
|
342
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
343
|
+
}),
|
|
344
|
+
outputSchema: BatchResultOutputSchema,
|
|
345
|
+
icons: NPM_SECURITY_ICON,
|
|
346
|
+
annotations: {
|
|
347
|
+
title: 'Analyze NPM Package Changelog (GitHub)',
|
|
348
|
+
readOnlyHint: true,
|
|
349
|
+
openWorldHint: true,
|
|
350
|
+
idempotentHint: true,
|
|
351
|
+
},
|
|
352
|
+
}, async (args, ctx) => {
|
|
353
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmChangelogAnalysis for ${args.packages.join(', ')}`);
|
|
354
|
+
return await withStructuredOutput(handleNpmChangelogAnalysis(args));
|
|
355
|
+
});
|
|
356
|
+
server.registerTool('npmAlternatives', {
|
|
357
|
+
description: 'Find alternative packages with similar functionality',
|
|
358
|
+
inputSchema: z.object({
|
|
359
|
+
packages: z.array(z.string()).describe('List of package names to find alternatives for'),
|
|
360
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
361
|
+
}),
|
|
362
|
+
outputSchema: BatchResultOutputSchema,
|
|
363
|
+
icons: NPM_SECURITY_ICON,
|
|
364
|
+
annotations: {
|
|
365
|
+
title: 'Find NPM Package Alternatives',
|
|
366
|
+
readOnlyHint: true,
|
|
367
|
+
openWorldHint: true,
|
|
368
|
+
idempotentHint: false,
|
|
369
|
+
},
|
|
370
|
+
}, async (args, ctx) => {
|
|
371
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmAlternatives for ${args.packages.join(', ')}`);
|
|
372
|
+
return await withStructuredOutput(handleNpmAlternatives(args));
|
|
373
|
+
});
|
|
374
|
+
server.registerTool('npmQuality', {
|
|
375
|
+
description: 'Analyze package quality metrics',
|
|
376
|
+
inputSchema: z.object({
|
|
377
|
+
packages: z.array(z.string()).describe('List of package names to analyze'),
|
|
378
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
379
|
+
}),
|
|
380
|
+
outputSchema: BatchResultOutputSchema,
|
|
381
|
+
icons: NPM_METRICS_ICON,
|
|
382
|
+
annotations: {
|
|
383
|
+
title: 'Analyze NPM Package Quality (NPMS.io)',
|
|
384
|
+
readOnlyHint: true,
|
|
385
|
+
openWorldHint: true,
|
|
386
|
+
idempotentHint: true,
|
|
387
|
+
},
|
|
388
|
+
}, async (args, ctx) => {
|
|
389
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmQuality for ${args.packages.join(', ')}`);
|
|
390
|
+
return await withStructuredOutput(handleNpmQuality(args));
|
|
391
|
+
});
|
|
392
|
+
server.registerTool('npmMaintenance', {
|
|
393
|
+
description: 'Analyze package maintenance metrics',
|
|
394
|
+
inputSchema: z.object({
|
|
395
|
+
packages: z.array(z.string()).describe('List of package names to analyze'),
|
|
396
|
+
ignoreCache: z.boolean().optional().describe('Force a fresh lookup, ignoring the cache'),
|
|
397
|
+
}),
|
|
398
|
+
outputSchema: BatchResultOutputSchema,
|
|
399
|
+
icons: NPM_METRICS_ICON,
|
|
400
|
+
annotations: {
|
|
401
|
+
title: 'Analyze NPM Package Maintenance (NPMS.io)',
|
|
402
|
+
readOnlyHint: true,
|
|
403
|
+
openWorldHint: true,
|
|
404
|
+
idempotentHint: true,
|
|
405
|
+
},
|
|
406
|
+
}, async (args, ctx) => {
|
|
407
|
+
await ctx?.mcpReq?.log?.('info', `Executing npmMaintenance for ${args.packages.join(', ')}`);
|
|
408
|
+
return await withStructuredOutput(handleNpmMaintenance(args));
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=index.js.map
|