@nekzus/mcp-server 1.19.0-alpha.2 → 1.19.0-alpha.21
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 +194 -278
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +32 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +384 -546
- 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/http.d.ts +16 -0
- package/dist/src/http.d.ts.map +1 -0
- package/dist/src/http.js +109 -0
- package/dist/src/http.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 +23 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/index.d.ts +4 -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/dist/src/utils/version-resolver.d.ts +14 -0
- package/dist/src/utils/version-resolver.d.ts.map +1 -0
- package/dist/src/utils/version-resolver.js +76 -0
- package/dist/src/utils/version-resolver.js.map +1 -0
- package/llms-full.txt +346 -414
- package/package.json +15 -16
- package/smithery.yaml +10 -2
package/llms-full.txt
CHANGED
|
@@ -1,588 +1,520 @@
|
|
|
1
|
-
# NPM Sentinel MCP Server - Full Documentation
|
|
1
|
+
# NPM Sentinel MCP Server - Full Protocol & Technical Documentation
|
|
2
2
|
|
|
3
3
|
## Protocol Specification
|
|
4
|
-
Version:
|
|
5
|
-
Transport: stdio
|
|
6
|
-
|
|
4
|
+
Version: MCP v2 (@modelcontextprotocol/server & @modelcontextprotocol/core)
|
|
5
|
+
Transport: stdio / Streamable HTTP (SSE)
|
|
6
|
+
Capabilities: resources, prompts, tools, logging, structuredOutput
|
|
7
7
|
|
|
8
|
-
## Architecture
|
|
8
|
+
## Modular Architecture (`src/`)
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart TD
|
|
11
|
-
Client[MCP Client] <-->|MCP
|
|
12
|
-
|
|
13
|
-
Server -->|Analysis| Security[Security DB]
|
|
14
|
-
Server -->|Metrics| Stats[Download Stats]
|
|
11
|
+
Client[MCP v2 Client] <-->|MCP JSON-RPC| Transport[Stdio / HTTP Transport]
|
|
12
|
+
Transport <--> Server[src/server.ts createServer]
|
|
15
13
|
|
|
16
|
-
subgraph
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
subgraph Modular Server Core
|
|
15
|
+
Server --> ToolsReg[src/tools/index.ts]
|
|
16
|
+
Server --> ResReg[src/resources/index.ts]
|
|
17
|
+
Server --> PromptReg[src/prompts/index.ts]
|
|
18
|
+
Server --> Config[src/config.ts]
|
|
19
|
+
Server --> Cache[src/cache.ts FIFO Cache]
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
subgraph
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
subgraph Handlers Layer
|
|
23
|
+
ToolsReg --> Handlers[src/handlers/index.ts]
|
|
24
|
+
Handlers --> Registry[NPM Registry API]
|
|
25
|
+
Handlers --> DepsDev[Google deps.dev / OSV.dev]
|
|
26
|
+
Handlers --> NPMS[npms.io API]
|
|
27
|
+
Handlers --> GitHub[GitHub API / Scorecard]
|
|
27
28
|
end
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## Features & Capabilities
|
|
31
32
|
|
|
32
|
-
###
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Rate Limits: Follows npm registry limits
|
|
37
|
-
Description: Package metadata and version information interface
|
|
33
|
+
### 1. Dual Output Protocol (`structuredContent` + `content`)
|
|
34
|
+
Every tool handler call processes inputs through Zod validation (`inputSchema` and `outputSchema`) and wraps responses using `withStructuredOutput`. The client receives both:
|
|
35
|
+
- `content`: Human-readable stringified JSON formatted text item.
|
|
36
|
+
- `structuredContent`: Deserialized native JSON object matching the tool's `outputSchema`.
|
|
38
37
|
|
|
39
|
-
###
|
|
40
|
-
|
|
41
|
-
Methods: GET
|
|
42
|
-
Update Frequency: Daily
|
|
43
|
-
Severity Levels: Low, Medium, High, Critical
|
|
44
|
-
Description: Vulnerability and security analysis interface
|
|
38
|
+
### 2. Embedded Vector SVG Data URI Icons
|
|
39
|
+
All registered tools, resources, and prompts expose pre-rendered SVG Data URIs (`data:image/svg+xml`) in their `icons` array for rich presentation in modern MCP UI clients.
|
|
45
40
|
|
|
46
|
-
###
|
|
47
|
-
|
|
48
|
-
Methods: GET, SUBSCRIBE
|
|
49
|
-
Update Frequency: Real-time
|
|
50
|
-
Metrics Types: Downloads, Stars, Issues, Updates
|
|
51
|
-
Description: Package analytics and statistics interface
|
|
41
|
+
### 3. Context Diagnostics Logging
|
|
42
|
+
Handlers issue real-time diagnostic logs (`info`) using `ctx.mcpReq.log` during execution.
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
### 4. Indirect Prompt Injection Safeguards (OWASP LLM01)
|
|
45
|
+
All tools returning raw 3rd-party Markdown/text (`npmPackageReadme`, `npmChangelogAnalysis`) implement Defense-in-Depth safeguards:
|
|
46
|
+
- **XML Demarcation**: Wraps raw external text inside `<untrusted_external_content source="..." package="..." type="...">` tags.
|
|
47
|
+
- **Metadata Flags (`_meta`)**: Attaches `_meta.untrustedExternalContent = true` and `_meta.sources` arrays to response content.
|
|
48
|
+
- **Tool & Prompt Directives**: Tool schemas and prompts explicitly instruct consuming models to process content strictly as passive data.
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
### 5. Smart SemVer Version Resolution
|
|
51
|
+
All package version querying tools (`npmDeprecated`, `npmLatest`, `npmDeps`, `npmTypes`, `npmPackageReadme`, `npmLicenseCompatibility`, `npmCompare`) implement 4-step SemVer resolution:
|
|
52
|
+
- Automatically resolves major version shorthands (`express@2`), version prefixes (`v4`), wildcard sub-versions (`4.x`), and SemVer ranges (`^4`, `~4.18`) to the highest matching release.
|
|
53
|
+
- Avoids registry 404 errors when an exact SemVer string is omitted.
|
|
54
|
+
- Caches abbreviated packument lookups (`Accept: application/vnd.npm.install-v1+json`) for maximum performance.
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
interface NpmVersionsInput {
|
|
62
|
-
packages: string[];
|
|
63
|
-
}
|
|
56
|
+
---
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
## Resources Specification
|
|
59
|
+
|
|
60
|
+
### `doc://server/readme`
|
|
61
|
+
- **Content-Type**: `text/markdown`
|
|
62
|
+
- **Description**: Main NPM Sentinel MCP server README documentation.
|
|
63
|
+
- **Icon**: SVG Document Data URI.
|
|
64
|
+
|
|
65
|
+
### `doc://mcp/specification`
|
|
66
|
+
- **Content-Type**: `text/plain`
|
|
67
|
+
- **Description**: Complete Model Context Protocol technical specification (`llms-full.txt`).
|
|
68
|
+
- **Icon**: SVG Document Data URI.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Prompts Specification
|
|
73
|
+
|
|
74
|
+
### `analyze-package`
|
|
75
|
+
- **Description**: Generates an interactive prompt payload for deep AI analysis of an NPM package including security, performance, dependencies, and health metrics.
|
|
76
|
+
- **Arguments**:
|
|
77
|
+
- `package` (string, required): Name of the NPM package to analyze.
|
|
78
|
+
- **Icon**: SVG Security Data URI.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Tool Specifications (19 Tools)
|
|
83
|
+
|
|
84
|
+
All tools accept an optional `ignoreCache: true` parameter and return standardized responses.
|
|
71
85
|
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
### Standard Error Format (e.g. Empty Array `packages: []` or Invalid Input)
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"queryPackages": [],
|
|
90
|
+
"results": [],
|
|
91
|
+
"status": "error",
|
|
92
|
+
"error": "No package names provided in request",
|
|
93
|
+
"message": "The packages parameter must contain at least one package name."
|
|
74
94
|
}
|
|
75
95
|
```
|
|
76
96
|
|
|
77
|
-
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
#### 1. `npmLatest`
|
|
78
100
|
```typescript
|
|
79
101
|
interface NpmLatestInput {
|
|
80
102
|
packages: string[];
|
|
103
|
+
ignoreCache?: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface LatestVersionResult {
|
|
107
|
+
packageInput: string;
|
|
108
|
+
packageName: string;
|
|
109
|
+
versionQueried: string;
|
|
110
|
+
status: 'success' | 'error';
|
|
111
|
+
data?: {
|
|
112
|
+
version: string;
|
|
113
|
+
description: string;
|
|
114
|
+
license: string;
|
|
115
|
+
homepage: string;
|
|
116
|
+
repository: any;
|
|
117
|
+
dependencies: Record<string, string>;
|
|
118
|
+
integrity: string;
|
|
119
|
+
tarball: string;
|
|
120
|
+
distTags: Record<string, string>;
|
|
121
|
+
};
|
|
81
122
|
}
|
|
123
|
+
```
|
|
82
124
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
125
|
+
#### 2. `npmVersions`
|
|
126
|
+
```typescript
|
|
127
|
+
interface NpmVersionsInput {
|
|
128
|
+
packages: string[];
|
|
129
|
+
ignoreCache?: boolean;
|
|
87
130
|
}
|
|
88
131
|
|
|
89
|
-
interface
|
|
90
|
-
|
|
132
|
+
interface VersionsResult {
|
|
133
|
+
packageInput: string;
|
|
134
|
+
packageName: string;
|
|
135
|
+
status: 'success' | 'error';
|
|
136
|
+
data?: {
|
|
137
|
+
allVersions: string[];
|
|
138
|
+
tags: Record<string, string>;
|
|
139
|
+
latestVersionTag: string;
|
|
140
|
+
};
|
|
91
141
|
}
|
|
92
142
|
```
|
|
93
143
|
|
|
94
|
-
#### npmDeps
|
|
144
|
+
#### 3. `npmDeps`
|
|
95
145
|
```typescript
|
|
96
146
|
interface NpmDepsInput {
|
|
97
147
|
packages: string[];
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
148
|
+
ignoreCache?: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface NpmDepsResult {
|
|
152
|
+
packageInput: string;
|
|
153
|
+
packageName: string;
|
|
154
|
+
status: 'success' | 'error';
|
|
155
|
+
data?: {
|
|
156
|
+
directDependencies: Record<string, string>;
|
|
157
|
+
devDependencies: Record<string, string>;
|
|
158
|
+
peerDependencies: Record<string, string>;
|
|
159
|
+
transitiveCount: number;
|
|
160
|
+
transitiveDependenciesList: string[];
|
|
110
161
|
};
|
|
111
162
|
}
|
|
112
163
|
```
|
|
113
164
|
|
|
114
|
-
#### npmTypes
|
|
165
|
+
#### 4. `npmTypes`
|
|
115
166
|
```typescript
|
|
116
167
|
interface NpmTypesInput {
|
|
117
168
|
packages: string[];
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
169
|
+
ignoreCache?: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface NpmTypesResult {
|
|
173
|
+
packageInput: string;
|
|
174
|
+
packageName: string;
|
|
175
|
+
status: 'success' | 'error';
|
|
176
|
+
data?: {
|
|
177
|
+
hasNativeTypes: boolean;
|
|
178
|
+
definitelyTypedPackage: string | null;
|
|
179
|
+
hasDefinitelyTyped: boolean;
|
|
180
|
+
tsStatus: 'native' | 'definitely-typed' | 'none';
|
|
181
|
+
};
|
|
129
182
|
}
|
|
130
183
|
```
|
|
131
184
|
|
|
132
|
-
#### npmSize
|
|
185
|
+
#### 5. `npmSize`
|
|
133
186
|
```typescript
|
|
134
187
|
interface NpmSizeInput {
|
|
135
188
|
packages: string[];
|
|
189
|
+
ignoreCache?: boolean;
|
|
136
190
|
}
|
|
137
191
|
|
|
138
|
-
interface
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
[packageName: string]: SizeMetrics;
|
|
192
|
+
interface NpmSizeResult {
|
|
193
|
+
packageInput: string;
|
|
194
|
+
packageName: string;
|
|
195
|
+
status: 'success' | 'error';
|
|
196
|
+
data?: {
|
|
197
|
+
unpackedSize: number;
|
|
198
|
+
fileCount: number;
|
|
199
|
+
sizeFormatted: string;
|
|
200
|
+
};
|
|
148
201
|
}
|
|
149
202
|
```
|
|
150
203
|
|
|
151
|
-
#### npmVulnerabilities
|
|
204
|
+
#### 6. `npmVulnerabilities`
|
|
152
205
|
```typescript
|
|
153
206
|
interface NpmVulnerabilitiesInput {
|
|
154
207
|
packages: string[];
|
|
208
|
+
ignoreCache?: boolean;
|
|
155
209
|
}
|
|
156
210
|
|
|
157
|
-
interface
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
cvssScore?: number;
|
|
164
|
-
url?: string;
|
|
211
|
+
interface VulnerabilityAdvisory {
|
|
212
|
+
id: string;
|
|
213
|
+
summary: string;
|
|
214
|
+
details: string;
|
|
215
|
+
severity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
|
|
216
|
+
aliases: string[];
|
|
165
217
|
}
|
|
166
218
|
|
|
167
|
-
interface
|
|
168
|
-
|
|
219
|
+
interface NpmVulnerabilitiesResult {
|
|
220
|
+
packageInput: string;
|
|
221
|
+
packageName: string;
|
|
222
|
+
status: 'success' | 'error';
|
|
223
|
+
data?: {
|
|
224
|
+
vulnerabilityCount: number;
|
|
225
|
+
scannedPackagesCount: number;
|
|
226
|
+
advisories: VulnerabilityAdvisory[];
|
|
227
|
+
};
|
|
169
228
|
}
|
|
170
229
|
```
|
|
171
230
|
|
|
172
|
-
#### npmTrends
|
|
231
|
+
#### 7. `npmTrends`
|
|
173
232
|
```typescript
|
|
174
233
|
interface NpmTrendsInput {
|
|
175
234
|
packages: string[];
|
|
176
|
-
period
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
interface NpmTrendsResponse {
|
|
192
|
-
[packageName: string]: TrendMetrics;
|
|
235
|
+
period?: 'last-week' | 'last-month' | 'last-year';
|
|
236
|
+
ignoreCache?: boolean;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface NpmTrendsResult {
|
|
240
|
+
packageInput: string;
|
|
241
|
+
packageName: string;
|
|
242
|
+
status: 'success' | 'error';
|
|
243
|
+
data?: {
|
|
244
|
+
period: string;
|
|
245
|
+
totalDownloads: number;
|
|
246
|
+
downloads: Array<{ day: string; downloads: number }>;
|
|
247
|
+
};
|
|
193
248
|
}
|
|
194
249
|
```
|
|
195
250
|
|
|
196
|
-
#### npmCompare
|
|
251
|
+
#### 8. `npmCompare`
|
|
197
252
|
```typescript
|
|
198
253
|
interface NpmCompareInput {
|
|
199
254
|
packages: string[];
|
|
255
|
+
ignoreCache?: boolean;
|
|
200
256
|
}
|
|
201
257
|
|
|
202
|
-
interface
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
comparisonSummary?: string;
|
|
258
|
+
interface NpmCompareResult {
|
|
259
|
+
packagesCompared: string[];
|
|
260
|
+
metrics: Array<{
|
|
261
|
+
name: string;
|
|
262
|
+
version: string;
|
|
263
|
+
monthlyDownloads: number;
|
|
264
|
+
score: number;
|
|
265
|
+
license: string;
|
|
266
|
+
hasTypes: boolean;
|
|
267
|
+
}>;
|
|
213
268
|
}
|
|
214
269
|
```
|
|
215
270
|
|
|
216
|
-
#### npmMaintainers
|
|
271
|
+
#### 9. `npmMaintainers`
|
|
217
272
|
```typescript
|
|
218
273
|
interface NpmMaintainersInput {
|
|
219
274
|
packages: string[];
|
|
275
|
+
ignoreCache?: boolean;
|
|
220
276
|
}
|
|
221
277
|
|
|
222
|
-
interface
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
[packageName: string]: Maintainer[];
|
|
278
|
+
interface NpmMaintainersResult {
|
|
279
|
+
packageInput: string;
|
|
280
|
+
packageName: string;
|
|
281
|
+
status: 'success' | 'error';
|
|
282
|
+
data?: {
|
|
283
|
+
maintainers: Array<{ name: string; email?: string; url?: string }>;
|
|
284
|
+
};
|
|
230
285
|
}
|
|
231
286
|
```
|
|
232
287
|
|
|
233
|
-
#### npmScore
|
|
288
|
+
#### 10. `npmScore`
|
|
234
289
|
```typescript
|
|
235
290
|
interface NpmScoreInput {
|
|
236
291
|
packages: string[];
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
292
|
+
ignoreCache?: boolean;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
interface NpmScoreResult {
|
|
296
|
+
packageInput: string;
|
|
297
|
+
packageName: string;
|
|
298
|
+
status: 'success' | 'error';
|
|
299
|
+
data?: {
|
|
300
|
+
finalScore: number;
|
|
301
|
+
quality: number;
|
|
302
|
+
popularity: number;
|
|
303
|
+
maintenance: number;
|
|
304
|
+
scorecard?: any;
|
|
305
|
+
};
|
|
248
306
|
}
|
|
249
307
|
```
|
|
250
308
|
|
|
251
|
-
#### npmPackageReadme
|
|
309
|
+
#### 11. `npmPackageReadme`
|
|
252
310
|
```typescript
|
|
253
311
|
interface NpmPackageReadmeInput {
|
|
254
312
|
packages: string[];
|
|
313
|
+
ignoreCache?: boolean;
|
|
255
314
|
}
|
|
256
315
|
|
|
257
|
-
interface
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
316
|
+
interface NpmPackageReadmeResult {
|
|
317
|
+
packageInput: string;
|
|
318
|
+
packageName: string;
|
|
319
|
+
status: 'success' | 'error';
|
|
320
|
+
data?: {
|
|
321
|
+
readme: string;
|
|
262
322
|
};
|
|
263
323
|
}
|
|
264
324
|
```
|
|
265
325
|
|
|
266
|
-
#### npmSearch
|
|
326
|
+
#### 12. `npmSearch`
|
|
267
327
|
```typescript
|
|
268
328
|
interface NpmSearchInput {
|
|
269
329
|
query: string;
|
|
270
330
|
limit?: number;
|
|
271
331
|
}
|
|
272
332
|
|
|
273
|
-
interface
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
query: string;
|
|
283
|
-
results: SearchResultPackage[];
|
|
284
|
-
totalResults?: number;
|
|
333
|
+
interface NpmSearchResult {
|
|
334
|
+
total: number;
|
|
335
|
+
results: Array<{
|
|
336
|
+
name: string;
|
|
337
|
+
version: string;
|
|
338
|
+
description: string;
|
|
339
|
+
score: number;
|
|
340
|
+
keywords: string[];
|
|
341
|
+
}>;
|
|
285
342
|
}
|
|
286
343
|
```
|
|
287
344
|
|
|
288
|
-
#### npmLicenseCompatibility
|
|
345
|
+
#### 13. `npmLicenseCompatibility`
|
|
289
346
|
```typescript
|
|
290
347
|
interface NpmLicenseCompatibilityInput {
|
|
291
348
|
packages: string[];
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
interface LicenseInfo {
|
|
296
|
-
spdxId: string;
|
|
297
|
-
name: string;
|
|
298
|
-
isCompatible?: boolean;
|
|
299
|
-
issues?: string[];
|
|
349
|
+
ignoreCache?: boolean;
|
|
300
350
|
}
|
|
301
351
|
|
|
302
|
-
interface
|
|
303
|
-
|
|
304
|
-
|
|
352
|
+
interface NpmLicenseCompatibilityResult {
|
|
353
|
+
packagesAnalysed: Array<{ name: string; license: string }>;
|
|
354
|
+
isCompatible: boolean;
|
|
355
|
+
compatibilityDetails: string;
|
|
305
356
|
}
|
|
306
357
|
```
|
|
307
358
|
|
|
308
|
-
#### npmRepoStats
|
|
359
|
+
#### 14. `npmRepoStats`
|
|
309
360
|
```typescript
|
|
310
361
|
interface NpmRepoStatsInput {
|
|
311
362
|
packages: string[];
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
363
|
+
ignoreCache?: boolean;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface NpmRepoStatsResult {
|
|
367
|
+
packageInput: string;
|
|
368
|
+
packageName: string;
|
|
369
|
+
status: 'success' | 'error';
|
|
370
|
+
data?: {
|
|
371
|
+
stars: number;
|
|
372
|
+
forks: number;
|
|
373
|
+
openIssues: number;
|
|
374
|
+
scorecard?: {
|
|
375
|
+
overallScore: number;
|
|
376
|
+
checks: Array<{ name: string; score: number }>;
|
|
377
|
+
};
|
|
378
|
+
};
|
|
325
379
|
}
|
|
326
380
|
```
|
|
327
381
|
|
|
328
|
-
#### npmDeprecated
|
|
382
|
+
#### 15. `npmDeprecated`
|
|
329
383
|
```typescript
|
|
330
384
|
interface NpmDeprecatedInput {
|
|
331
385
|
packages: string[];
|
|
386
|
+
ignoreCache?: boolean;
|
|
332
387
|
}
|
|
333
388
|
|
|
334
|
-
interface
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
389
|
+
interface NpmDeprecatedResult {
|
|
390
|
+
packageInput: string;
|
|
391
|
+
packageName: string;
|
|
392
|
+
status: 'success' | 'error';
|
|
393
|
+
data?: {
|
|
394
|
+
isDeprecated: boolean;
|
|
395
|
+
deprecationReason: string | null;
|
|
396
|
+
};
|
|
342
397
|
}
|
|
343
398
|
```
|
|
344
399
|
|
|
345
|
-
#### npmChangelogAnalysis
|
|
400
|
+
#### 16. `npmChangelogAnalysis`
|
|
346
401
|
```typescript
|
|
347
402
|
interface NpmChangelogAnalysisInput {
|
|
348
403
|
packages: string[];
|
|
349
|
-
|
|
350
|
-
sinceVersion?: string;
|
|
404
|
+
ignoreCache?: boolean;
|
|
351
405
|
}
|
|
352
406
|
|
|
353
|
-
interface
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
interface NpmChangelogAnalysisResponse {
|
|
361
|
-
[packageName: string]: {
|
|
362
|
-
changelogUrl?: string;
|
|
363
|
-
entries?: ChangelogEntry[];
|
|
364
|
-
analysisSummary?: string;
|
|
407
|
+
interface NpmChangelogAnalysisResult {
|
|
408
|
+
packageInput: string;
|
|
409
|
+
packageName: string;
|
|
410
|
+
status: 'success' | 'error';
|
|
411
|
+
data?: {
|
|
412
|
+
hasChangelog: boolean;
|
|
413
|
+
releases: Array<{ tag_name: string; name: string; published_at: string; source: string }>;
|
|
365
414
|
};
|
|
366
415
|
}
|
|
367
416
|
```
|
|
368
417
|
|
|
369
|
-
#### npmAlternatives
|
|
418
|
+
#### 17. `npmAlternatives`
|
|
370
419
|
```typescript
|
|
371
420
|
interface NpmAlternativesInput {
|
|
372
421
|
packages: string[];
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
422
|
+
ignoreCache?: boolean;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Filter Algorithm:
|
|
427
|
+
* 1. Extracts functional domain keywords (excluding brand keywords).
|
|
428
|
+
* 2. Queries registry by domain keywords.
|
|
429
|
+
* 3. Applies strict candidate filter (excludes same package, @types/, ecosystem plugins prefixed with name).
|
|
430
|
+
* 4. Returns top 5 distinct alternative packages.
|
|
431
|
+
*/
|
|
432
|
+
interface NpmAlternativesResult {
|
|
433
|
+
packageInput: string;
|
|
434
|
+
packageName: string;
|
|
435
|
+
status: 'success' | 'no_alternatives_found' | 'error';
|
|
436
|
+
data?: {
|
|
437
|
+
originalPackageStats: { name: string; monthlyDownloads: number; keywords: string[] };
|
|
438
|
+
alternatives: Array<{
|
|
439
|
+
name: string;
|
|
440
|
+
description: string | null;
|
|
441
|
+
version: string;
|
|
442
|
+
monthlyDownloads: number;
|
|
443
|
+
score: number;
|
|
444
|
+
repositoryUrl: string | null;
|
|
445
|
+
keywords: string[];
|
|
446
|
+
}>;
|
|
384
447
|
};
|
|
385
448
|
}
|
|
386
449
|
```
|
|
387
450
|
|
|
388
|
-
#### npmQuality
|
|
451
|
+
#### 18. `npmQuality`
|
|
389
452
|
```typescript
|
|
390
453
|
interface NpmQualityInput {
|
|
391
454
|
packages: string[];
|
|
455
|
+
ignoreCache?: boolean;
|
|
392
456
|
}
|
|
393
457
|
|
|
394
|
-
interface
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
npmsMaintenanceScore?: number;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
interface NpmQualityResponse {
|
|
405
|
-
[packageName: string]: QualityMetrics;
|
|
458
|
+
interface NpmQualityResult {
|
|
459
|
+
packageInput: string;
|
|
460
|
+
packageName: string;
|
|
461
|
+
status: 'success' | 'error';
|
|
462
|
+
data?: {
|
|
463
|
+
qualityScore: number;
|
|
464
|
+
};
|
|
406
465
|
}
|
|
407
466
|
```
|
|
408
467
|
|
|
409
|
-
#### npmMaintenance
|
|
468
|
+
#### 19. `npmMaintenance`
|
|
410
469
|
```typescript
|
|
411
470
|
interface NpmMaintenanceInput {
|
|
412
471
|
packages: string[];
|
|
472
|
+
ignoreCache?: boolean;
|
|
413
473
|
}
|
|
414
474
|
|
|
415
|
-
interface
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
interface NpmMaintenanceResponse {
|
|
424
|
-
[packageName: string]: MaintenanceMetrics;
|
|
475
|
+
interface NpmMaintenanceResult {
|
|
476
|
+
packageInput: string;
|
|
477
|
+
packageName: string;
|
|
478
|
+
status: 'success' | 'error';
|
|
479
|
+
data?: {
|
|
480
|
+
maintenanceScore: number;
|
|
481
|
+
};
|
|
425
482
|
}
|
|
426
483
|
```
|
|
427
484
|
|
|
428
|
-
|
|
485
|
+
---
|
|
429
486
|
|
|
430
|
-
|
|
431
|
-
// When an error occurs, the standard MCP response 'content' object will have 'isError: true'.
|
|
432
|
-
// The 'text' field of that content object will contain a JSON stringified MCPError object, as defined below.
|
|
433
|
-
```typescript
|
|
434
|
-
interface MCPError {
|
|
435
|
-
error: {
|
|
436
|
-
code: number;
|
|
437
|
-
message: string;
|
|
438
|
-
data?: {
|
|
439
|
-
details: string;
|
|
440
|
-
packageName?: string;
|
|
441
|
-
context?: any;
|
|
442
|
-
};
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
```
|
|
487
|
+
## Streamable HTTP (POST) & Cloudflare Workers Integration
|
|
446
488
|
|
|
447
|
-
|
|
448
|
-
1000: Invalid package name (Rejected by security validation filter due to restricted characters or format)
|
|
449
|
-
1001: Package not found
|
|
450
|
-
1002: Version not found
|
|
451
|
-
1003: Rate limit exceeded
|
|
452
|
-
1004: Network error
|
|
453
|
-
1005: Analysis failed
|
|
454
|
-
2000: Internal server error
|
|
455
|
-
|
|
456
|
-
## Security Considerations
|
|
457
|
-
|
|
458
|
-
### Data Protection
|
|
459
|
-
- All data is processed locally
|
|
460
|
-
- No sensitive information is stored
|
|
461
|
-
- Secure communication channels
|
|
462
|
-
|
|
463
|
-
### Input Validation
|
|
464
|
-
- Strict Regex-based allowlist for package names
|
|
465
|
-
- Prevents Path Traversal (`../`)
|
|
466
|
-
- Prevents Command Injection (`&`, `;`, `|`)
|
|
467
|
-
- Prevents SSRF attacks
|
|
468
|
-
|
|
469
|
-
### Rate Limiting
|
|
470
|
-
- Implements fair usage policies
|
|
471
|
-
- Respects NPM registry limits
|
|
472
|
-
- Prevents abuse
|
|
473
|
-
|
|
474
|
-
### Authentication
|
|
475
|
-
- Supports npm token authentication
|
|
476
|
-
- Validates package access
|
|
477
|
-
- Manages credentials securely
|
|
478
|
-
|
|
479
|
-
## Integration Guide
|
|
480
|
-
|
|
481
|
-
### Docker Configuration
|
|
482
|
-
The server can be run in a Docker container with directory mounting to `/projects`. This allows for secure access to files while maintaining isolation.
|
|
483
|
-
|
|
484
|
-
#### Build
|
|
485
|
-
```bash
|
|
486
|
-
# Build the Docker image
|
|
487
|
-
docker build -t nekzus/npm-sentinel-mcp .
|
|
488
|
-
```
|
|
489
|
+
The `@nekzus/mcp-server/http` module exports `handleStreamableHttpRequest` for stateless serverless deployments (Cloudflare Workers, Express, Fastify, Next.js API routes) requiring Streamable HTTP POST transport under MCP v2:
|
|
489
490
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
{
|
|
493
|
-
"mcpServers": {
|
|
494
|
-
"npm-sentinel-mcp": {
|
|
495
|
-
"command": "docker",
|
|
496
|
-
"args": [
|
|
497
|
-
"run",
|
|
498
|
-
"-i",
|
|
499
|
-
"--rm",
|
|
500
|
-
"-w", "/projects",
|
|
501
|
-
"--mount", "type=bind,src=${PWD},dst=/projects",
|
|
502
|
-
"nekzus/npm-sentinel-mcp",
|
|
503
|
-
"node",
|
|
504
|
-
"dist/index.js"
|
|
505
|
-
]
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
```
|
|
491
|
+
```typescript
|
|
492
|
+
import { handleStreamableHttpRequest } from '@nekzus/mcp-server/http';
|
|
510
493
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
{
|
|
514
|
-
|
|
515
|
-
"npm-sentinel-mcp": {
|
|
516
|
-
"command": "docker",
|
|
517
|
-
"args": [
|
|
518
|
-
"run",
|
|
519
|
-
"-i",
|
|
520
|
-
"--rm",
|
|
521
|
-
"-w", "/projects",
|
|
522
|
-
"--mount", "type=bind,src=/path/to/workspace,dst=/projects/workspace",
|
|
523
|
-
"--mount", "type=bind,src=/path/to/other/dir,dst=/projects/other/dir,ro",
|
|
524
|
-
"nekzus/npm-sentinel-mcp",
|
|
525
|
-
"node",
|
|
526
|
-
"dist/index.js"
|
|
527
|
-
]
|
|
494
|
+
export default {
|
|
495
|
+
async fetch(request: Request): Promise<Response> {
|
|
496
|
+
if (request.method !== 'POST') {
|
|
497
|
+
return new Response('NPM Sentinel MCP v2 Streamable HTTP Server', { status: 200 });
|
|
528
498
|
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
```
|
|
532
499
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
- Add `,ro` flag for read-only access
|
|
537
|
-
- Working directory is set to `/projects`
|
|
538
|
-
- Container runs in interactive mode with auto-removal
|
|
500
|
+
try {
|
|
501
|
+
const payload = await request.json();
|
|
502
|
+
const mcpResponse = await handleStreamableHttpRequest(payload);
|
|
539
503
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
"command": "npx",
|
|
547
|
-
"args": ["-y", "@nekzus/mcp-server"]
|
|
504
|
+
return new Response(mcpResponse.body, {
|
|
505
|
+
status: mcpResponse.status,
|
|
506
|
+
headers: mcpResponse.headers,
|
|
507
|
+
});
|
|
508
|
+
} catch {
|
|
509
|
+
return new Response(JSON.stringify({ error: 'Invalid JSON-RPC payload' }), { status: 400 });
|
|
548
510
|
}
|
|
549
|
-
}
|
|
550
|
-
}
|
|
511
|
+
},
|
|
512
|
+
};
|
|
551
513
|
```
|
|
552
514
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const client = await MCPClient.connect("npm-sentinel-mcp");
|
|
557
|
-
|
|
558
|
-
// Analyze package
|
|
559
|
-
const result = await client.invoke("npmVersions", {
|
|
560
|
-
packages: ["react"]
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
// Subscribe to updates
|
|
564
|
-
const unsubscribe = await client.subscribe("npm://registry", {
|
|
565
|
-
package: "react",
|
|
566
|
-
onUpdate: (data) => console.log(data)
|
|
567
|
-
});
|
|
568
|
-
```
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## Technical Support & License
|
|
569
518
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
### Resource Usage
|
|
573
|
-
1. Subscribe to resources for real-time updates
|
|
574
|
-
2. Implement caching for frequently accessed data
|
|
575
|
-
3. Use batch operations when possible
|
|
576
|
-
4. Handle rate limits gracefully
|
|
577
|
-
|
|
578
|
-
### Error Handling
|
|
579
|
-
1. Implement proper error recovery
|
|
580
|
-
2. Provide meaningful error messages
|
|
581
|
-
3. Log errors for debugging
|
|
582
|
-
4. Handle timeout scenarios
|
|
583
|
-
|
|
584
|
-
### Performance
|
|
585
|
-
1. Use connection pooling
|
|
586
|
-
2. Implement request queuing
|
|
587
|
-
3. Cache responses
|
|
588
|
-
4. Handle concurrent requests
|
|
519
|
+
- **License**: MIT
|
|
520
|
+
- **Repository**: https://github.com/Nekzus/npm-sentinel-mcp
|