@nekzus/mcp-server 1.19.0-alpha.22 → 1.19.0-alpha.24
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 +12 -20
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/src/http.d.ts +7 -10
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +23 -101
- package/dist/src/http.js.map +1 -1
- package/dist/src/schemas.d.ts +2 -0
- package/dist/src/schemas.d.ts.map +1 -1
- package/dist/src/schemas.js +12 -0
- package/dist/src/schemas.js.map +1 -1
- package/dist/src/server.js +1 -1
- package/dist/src/server.js.map +1 -1
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +20 -24
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/utils/version-resolver.d.ts.map +1 -1
- package/dist/src/utils/version-resolver.js.map +1 -1
- package/llms-full.txt +19 -18
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ This server features **Modular ESM Architecture (`src/`)**, **Dual Output Protoc
|
|
|
23
23
|
- **Self-Contained Vector Icons**: Pre-configured SVG Data URIs (`data:image/svg+xml`) embedded across all 19 tools, resources, and prompts for enhanced client UI presentation.
|
|
24
24
|
- **Advanced Security Scanning**: Recursive dependency checks powered by Google's `deps.dev` and OSV.dev, ecosystem awareness, and accurate version resolution.
|
|
25
25
|
- **Smart Alternatives Filtering (`npmAlternatives`)**: Intelligent search based on functional domain keywords with strict ecosystem plugin/extension filtering (e.g., excludes `express-rate-limit` when searching for alternatives to `express`).
|
|
26
|
-
- **Strict Input Validation**:
|
|
26
|
+
- **Strict Input Validation & Batch Rate Control**: Input sanitization via Zod against Path Traversal, SSRF, and Command Injection. Search queries (`npmSearch`) are capped at 100 characters and filtered for control characters. Batch analysis tools enforce a strict cap of 25 packages per request to prevent registry enumeration DoS.
|
|
27
27
|
- **Dependency & Transitive Mapping**: Complete dependency tree analysis mapping through `deps.dev`.
|
|
28
28
|
- **Package Quality & Maintenance Metrics**: Real-time scoring using OpenSSF Scorecard, GitHub repository metrics, and npms.io.
|
|
29
29
|
- **Download Trends & Performance**: Real-time download statistics and bundle size analysis.
|
|
@@ -38,7 +38,8 @@ This server implements **Defense-in-Depth** controls aligned with OWASP LLM01:20
|
|
|
38
38
|
1. **XML Data Demarcation**: Content from external packages (`README.md`, GitHub changelogs, release notes) is wrapped inside `<untrusted_external_content source="..." package="..." type="...">` tags so consuming LLM models distinguish untrusted data from instructions.
|
|
39
39
|
2. **Metadata Signaling (`_meta`)**: Responses include `_meta.untrustedExternalContent = true` and `_meta.sources` arrays for programmatic client-side detection and policy enforcement.
|
|
40
40
|
3. **Tool & Prompt Safety Warnings**: Tool descriptions and prompt definitions explicitly instruct LLM agents to treat documentation as passive data and ignore embedded execution commands.
|
|
41
|
-
4. **
|
|
41
|
+
4. **Batch Size Capping & Query Sanitization**: All 18 multi-package analysis tools enforce a 25-package limit per request (`PackageListSchema`). Search queries are sanitized and capped at 100 characters (`SearchQuerySchema`).
|
|
42
|
+
5. **Prototype Pollution Protection**: Enforces `Object.hasOwn()` checks on dictionary lookups (blocking reserved properties like `constructor` and `__proto__`).
|
|
42
43
|
|
|
43
44
|
To ensure data accuracy while maintaining high performance:
|
|
44
45
|
- **Automatic Invalidation**: The cache is automatically invalidated whenever `pnpm-lock.yaml`, `package-lock.json`, or `yarn.lock` changes in your workspace.
|
|
@@ -146,34 +147,25 @@ docker build -t nekzus/npm-sentinel-mcp .
|
|
|
146
147
|
docker run -i --rm -w /projects -v ${PWD}:/projects nekzus/npm-sentinel-mcp node dist/index.js
|
|
147
148
|
```
|
|
148
149
|
|
|
149
|
-
### Streamable HTTP
|
|
150
|
+
### Web Standard Streamable HTTP & Cloudflare Workers Integration
|
|
150
151
|
|
|
151
|
-
The package exports
|
|
152
|
+
The package exports `createMcpHttpHandler` and `WebStandardStreamableHTTPServerTransport` for serverless platforms (Cloudflare Workers, Hono, Vercel, Express, Fastify, Next.js API routes) requiring official Web Standard Streamable HTTP transport under MCP v2:
|
|
152
153
|
|
|
153
154
|
```typescript
|
|
154
|
-
import {
|
|
155
|
+
import { createMcpHttpHandler } from '@nekzus/mcp-server/http';
|
|
156
|
+
|
|
157
|
+
const handleMcpRequest = createMcpHttpHandler();
|
|
155
158
|
|
|
156
159
|
export default {
|
|
157
160
|
async fetch(request: Request): Promise<Response> {
|
|
158
|
-
|
|
159
|
-
return new Response('NPM Sentinel MCP v2 Streamable HTTP Server', { status: 200 });
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
try {
|
|
163
|
-
const payload = await request.json();
|
|
164
|
-
const mcpResponse = await handleStreamableHttpRequest(payload);
|
|
165
|
-
|
|
166
|
-
return new Response(mcpResponse.body, {
|
|
167
|
-
status: mcpResponse.status,
|
|
168
|
-
headers: mcpResponse.headers,
|
|
169
|
-
});
|
|
170
|
-
} catch {
|
|
171
|
-
return new Response(JSON.stringify({ error: 'Invalid JSON-RPC payload' }), { status: 400 });
|
|
172
|
-
}
|
|
161
|
+
return handleMcpRequest(request);
|
|
173
162
|
},
|
|
174
163
|
};
|
|
175
164
|
```
|
|
176
165
|
|
|
166
|
+
**100% MCP v2 Compliance**: Powered by `WebStandardStreamableHTTPServerTransport`, this handler natively activates all 3 MCP primitives (**Tools**, **Resources**, and **Prompts**) with peak performance, SSE streaming support, and full Web Standard `Request` $\rightarrow$ `Response` compatibility.
|
|
167
|
+
|
|
168
|
+
|
|
177
169
|
## Configuration
|
|
178
170
|
|
|
179
171
|
The server supports the following configuration parameters:
|