@cyanheads/nist-nvd-mcp-server 0.2.0 → 0.3.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/AGENTS.md +45 -21
- package/CLAUDE.md +45 -21
- package/Dockerfile +15 -4
- package/README.md +69 -65
- package/changelog/0.3.x/0.3.0.md +48 -0
- package/changelog/0.3.x/0.3.1.md +34 -0
- package/changelog/template.md +62 -40
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.d.ts +1 -0
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.js +1 -0
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.d.ts +17 -16
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.js +7 -5
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.d.ts +6 -2
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.js +4 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.d.ts +17 -12
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.js +12 -6
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.js +2 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.d.ts +4 -2
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.js +3 -1
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.js.map +1 -1
- package/dist/mcp-server/tools/formatting/cpe-match.d.ts +26 -16
- package/dist/mcp-server/tools/formatting/cpe-match.d.ts.map +1 -1
- package/dist/mcp-server/tools/formatting/cpe-match.js +26 -13
- package/dist/mcp-server/tools/formatting/cpe-match.js.map +1 -1
- package/dist/mcp-server/tools/schemas/brief-cve.d.ts +2 -2
- package/dist/mcp-server/tools/schemas/full-cve.d.ts +13 -14
- package/dist/mcp-server/tools/schemas/full-cve.d.ts.map +1 -1
- package/dist/mcp-server/tools/schemas/full-cve.js +17 -20
- package/dist/mcp-server/tools/schemas/full-cve.js.map +1 -1
- package/dist/services/nvd-cpe/nvd-cpe-service.d.ts.map +1 -1
- package/dist/services/nvd-cve/nvd-cve-service.d.ts.map +1 -1
- package/dist/services/nvd-cve/nvd-cve-service.js +20 -14
- package/dist/services/nvd-cve/nvd-cve-service.js.map +1 -1
- package/dist/services/nvd-cve/types.d.ts +21 -14
- package/dist/services/nvd-cve/types.d.ts.map +1 -1
- package/dist/services/nvd-http/nvd-http-client.d.ts.map +1 -1
- package/dist/services/nvd-source/nvd-source-service.d.ts.map +1 -1
- package/manifest.json +1 -1
- package/package.json +11 -11
- package/server.json +9 -3
package/AGENTS.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** nist-nvd-mcp-server
|
|
4
|
-
**Version:** 0.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/
|
|
8
|
-
**Zod:** ^4.
|
|
4
|
+
**Version:** 0.3.1
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
|
|
6
|
+
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/server` ^2.0.0
|
|
8
|
+
**Zod:** ^4.6.5
|
|
9
9
|
|
|
10
10
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
11
11
|
|
|
@@ -35,7 +35,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
35
35
|
- **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
|
|
36
36
|
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
37
37
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
38
|
-
- **
|
|
38
|
+
- **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
|
|
39
39
|
- **Secrets in env vars only** — never hardcoded.
|
|
40
40
|
- **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
|
|
41
41
|
|
|
@@ -158,6 +158,23 @@ export function getServerConfig() {
|
|
|
158
158
|
|
|
159
159
|
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
160
160
|
|
|
161
|
+
For env booleans use `z.stringbool()`, never `z.coerce.boolean()` — `Boolean("false")` is `true`, so a coerced flag can't be disabled through the environment. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` and rejects anything else, so `=false` actually disables.
|
|
162
|
+
|
|
163
|
+
### Server identity and instructions
|
|
164
|
+
|
|
165
|
+
`createApp()` accepts optional identity fields forwarded to the SDK's `initialize` response and the server manifest (`/.well-known/mcp.json`):
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
await createApp({
|
|
169
|
+
name: 'nist-nvd-mcp-server',
|
|
170
|
+
title: 'nist-nvd-mcp-server', // human-readable display name
|
|
171
|
+
websiteUrl: 'https://github.com/cyanheads/nist-nvd-mcp-server',
|
|
172
|
+
instructions: 'Use nvd_search_cpes to resolve a product to its CPE name before auditing it.',
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
177
|
+
|
|
161
178
|
---
|
|
162
179
|
|
|
163
180
|
## Context
|
|
@@ -166,13 +183,13 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
166
183
|
|
|
167
184
|
| Property | Description |
|
|
168
185
|
|:---------|:------------|
|
|
169
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
186
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
|
|
170
187
|
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
171
|
-
| `ctx.
|
|
188
|
+
| `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. Always present. |
|
|
189
|
+
| `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
|
|
172
190
|
| `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
|
|
173
191
|
| `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
|
|
174
192
|
| `ctx.signal` | `AbortSignal` for cancellation. Forwarded to NVD HTTP requests. |
|
|
175
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
176
193
|
| `ctx.requestId` | Unique request ID. |
|
|
177
194
|
| `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
|
|
178
195
|
|
|
@@ -182,7 +199,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
182
199
|
|
|
183
200
|
Handlers throw — the framework catches, classifies, and formats.
|
|
184
201
|
|
|
185
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required
|
|
202
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
186
203
|
|
|
187
204
|
```ts
|
|
188
205
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
@@ -194,7 +211,7 @@ errors: [
|
|
|
194
211
|
],
|
|
195
212
|
async handler(input, ctx) {
|
|
196
213
|
const item = await db.find(input.id);
|
|
197
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
214
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
|
|
198
215
|
return item;
|
|
199
216
|
}
|
|
200
217
|
```
|
|
@@ -272,9 +289,9 @@ src/
|
|
|
272
289
|
|
|
273
290
|
## Skills
|
|
274
291
|
|
|
275
|
-
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
292
|
+
Skills are modular instructions in `framework-skills/` at the project root. Read them directly when a task matches — e.g., `framework-skills/add-tool/SKILL.md` when adding a tool. `bun run list-skills` prints the full registry. The directory is deliberately not `skills/`: Claude Code and Codex auto-load a plugin's root `skills/`, so a server that ships `.claude-plugin/` or `.codex-plugin/` would hand these development skills to every agent that installs it. Keep `skills/` free for skills meant for those agents.
|
|
276
293
|
|
|
277
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
294
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `framework-skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
278
295
|
|
|
279
296
|
Available skills:
|
|
280
297
|
|
|
@@ -293,8 +310,9 @@ Available skills:
|
|
|
293
310
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
294
311
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
295
312
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
296
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
297
|
-
| `release-
|
|
313
|
+
| `git-wrapup` | Land working-tree changes as a commit stack — version bump, changelog, verify, commit by concern, release commit on top. No tag, no push to main; opens the release PR when the project declares release PR mode |
|
|
314
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixes as ordinary commits on top of the stack, PR body kept in sync. Release PR mode only |
|
|
315
|
+
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
298
316
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
299
317
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
300
318
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
@@ -303,7 +321,7 @@ Available skills:
|
|
|
303
321
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
304
322
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
305
323
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
306
|
-
| `api-context` | Context interface, logger, state,
|
|
324
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
307
325
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
308
326
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
309
327
|
| `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
|
|
@@ -346,11 +364,11 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
346
364
|
|
|
347
365
|
## Bundling
|
|
348
366
|
|
|
349
|
-
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
|
|
367
|
+
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
|
|
350
368
|
|
|
351
369
|
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
352
370
|
|
|
353
|
-
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
371
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `framework-skills/polish-docs-meta/references/readme.md`.
|
|
354
372
|
|
|
355
373
|
---
|
|
356
374
|
|
|
@@ -364,23 +382,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
364
382
|
---
|
|
365
383
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
366
384
|
breaking: false # optional — true flags breaking changes
|
|
367
|
-
security: false # optional — true
|
|
385
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
368
386
|
---
|
|
369
387
|
|
|
370
388
|
# 0.1.0 — YYYY-MM-DD
|
|
371
389
|
...
|
|
372
390
|
```
|
|
373
391
|
|
|
374
|
-
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
392
|
+
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section — set it only for a security fix in this server's *own source code*, never for a routine dependency or transitive CVE bump (record those under `## Dependencies`). When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
375
393
|
|
|
376
394
|
`agent-notes` is an optional free-form field for maintenance agents processing the release downstream. Content here won't appear in the rendered CHANGELOG — it's consumed by agents running the `maintenance` skill. Use it for adoption instructions that don't fit the human-facing sections: new files to create, fields to populate, one-time migration steps. Omit entirely when there's nothing to say.
|
|
377
395
|
|
|
378
|
-
**Section order
|
|
396
|
+
**Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Include only sections with entries — don't ship empty headers.
|
|
379
397
|
|
|
380
398
|
**Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
|
|
381
399
|
|
|
382
400
|
---
|
|
383
401
|
|
|
402
|
+
## Publishing
|
|
403
|
+
|
|
404
|
+
**Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
384
408
|
## Imports
|
|
385
409
|
|
|
386
410
|
```ts
|
package/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** nist-nvd-mcp-server
|
|
4
|
-
**Version:** 0.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/
|
|
8
|
-
**Zod:** ^4.
|
|
4
|
+
**Version:** 0.3.1
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
|
|
6
|
+
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/server` ^2.0.0
|
|
8
|
+
**Zod:** ^4.6.5
|
|
9
9
|
|
|
10
10
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
11
11
|
|
|
@@ -35,7 +35,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
35
35
|
- **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
|
|
36
36
|
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
37
37
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
38
|
-
- **
|
|
38
|
+
- **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
|
|
39
39
|
- **Secrets in env vars only** — never hardcoded.
|
|
40
40
|
- **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
|
|
41
41
|
|
|
@@ -158,6 +158,23 @@ export function getServerConfig() {
|
|
|
158
158
|
|
|
159
159
|
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
160
160
|
|
|
161
|
+
For env booleans use `z.stringbool()`, never `z.coerce.boolean()` — `Boolean("false")` is `true`, so a coerced flag can't be disabled through the environment. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` and rejects anything else, so `=false` actually disables.
|
|
162
|
+
|
|
163
|
+
### Server identity and instructions
|
|
164
|
+
|
|
165
|
+
`createApp()` accepts optional identity fields forwarded to the SDK's `initialize` response and the server manifest (`/.well-known/mcp.json`):
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
await createApp({
|
|
169
|
+
name: 'nist-nvd-mcp-server',
|
|
170
|
+
title: 'nist-nvd-mcp-server', // human-readable display name
|
|
171
|
+
websiteUrl: 'https://github.com/cyanheads/nist-nvd-mcp-server',
|
|
172
|
+
instructions: 'Use nvd_search_cpes to resolve a product to its CPE name before auditing it.',
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
177
|
+
|
|
161
178
|
---
|
|
162
179
|
|
|
163
180
|
## Context
|
|
@@ -166,13 +183,13 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
166
183
|
|
|
167
184
|
| Property | Description |
|
|
168
185
|
|:---------|:------------|
|
|
169
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
186
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
|
|
170
187
|
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
171
|
-
| `ctx.
|
|
188
|
+
| `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. Always present. |
|
|
189
|
+
| `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
|
|
172
190
|
| `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
|
|
173
191
|
| `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
|
|
174
192
|
| `ctx.signal` | `AbortSignal` for cancellation. Forwarded to NVD HTTP requests. |
|
|
175
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
176
193
|
| `ctx.requestId` | Unique request ID. |
|
|
177
194
|
| `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
|
|
178
195
|
|
|
@@ -182,7 +199,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
182
199
|
|
|
183
200
|
Handlers throw — the framework catches, classifies, and formats.
|
|
184
201
|
|
|
185
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required
|
|
202
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
186
203
|
|
|
187
204
|
```ts
|
|
188
205
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
@@ -194,7 +211,7 @@ errors: [
|
|
|
194
211
|
],
|
|
195
212
|
async handler(input, ctx) {
|
|
196
213
|
const item = await db.find(input.id);
|
|
197
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
214
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
|
|
198
215
|
return item;
|
|
199
216
|
}
|
|
200
217
|
```
|
|
@@ -272,9 +289,9 @@ src/
|
|
|
272
289
|
|
|
273
290
|
## Skills
|
|
274
291
|
|
|
275
|
-
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
292
|
+
Skills are modular instructions in `framework-skills/` at the project root. Read them directly when a task matches — e.g., `framework-skills/add-tool/SKILL.md` when adding a tool. `bun run list-skills` prints the full registry. The directory is deliberately not `skills/`: Claude Code and Codex auto-load a plugin's root `skills/`, so a server that ships `.claude-plugin/` or `.codex-plugin/` would hand these development skills to every agent that installs it. Keep `skills/` free for skills meant for those agents.
|
|
276
293
|
|
|
277
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
294
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `framework-skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
278
295
|
|
|
279
296
|
Available skills:
|
|
280
297
|
|
|
@@ -293,8 +310,9 @@ Available skills:
|
|
|
293
310
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
294
311
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
295
312
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
296
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
297
|
-
| `release-
|
|
313
|
+
| `git-wrapup` | Land working-tree changes as a commit stack — version bump, changelog, verify, commit by concern, release commit on top. No tag, no push to main; opens the release PR when the project declares release PR mode |
|
|
314
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixes as ordinary commits on top of the stack, PR body kept in sync. Release PR mode only |
|
|
315
|
+
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
298
316
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
299
317
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
300
318
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
@@ -303,7 +321,7 @@ Available skills:
|
|
|
303
321
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
304
322
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
305
323
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
306
|
-
| `api-context` | Context interface, logger, state,
|
|
324
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
307
325
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
308
326
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
309
327
|
| `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
|
|
@@ -346,11 +364,11 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
346
364
|
|
|
347
365
|
## Bundling
|
|
348
366
|
|
|
349
|
-
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
|
|
367
|
+
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
|
|
350
368
|
|
|
351
369
|
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
352
370
|
|
|
353
|
-
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
371
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `framework-skills/polish-docs-meta/references/readme.md`.
|
|
354
372
|
|
|
355
373
|
---
|
|
356
374
|
|
|
@@ -364,23 +382,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
364
382
|
---
|
|
365
383
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
366
384
|
breaking: false # optional — true flags breaking changes
|
|
367
|
-
security: false # optional — true
|
|
385
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
368
386
|
---
|
|
369
387
|
|
|
370
388
|
# 0.1.0 — YYYY-MM-DD
|
|
371
389
|
...
|
|
372
390
|
```
|
|
373
391
|
|
|
374
|
-
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
392
|
+
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section — set it only for a security fix in this server's *own source code*, never for a routine dependency or transitive CVE bump (record those under `## Dependencies`). When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
375
393
|
|
|
376
394
|
`agent-notes` is an optional free-form field for maintenance agents processing the release downstream. Content here won't appear in the rendered CHANGELOG — it's consumed by agents running the `maintenance` skill. Use it for adoption instructions that don't fit the human-facing sections: new files to create, fields to populate, one-time migration steps. Omit entirely when there's nothing to say.
|
|
377
395
|
|
|
378
|
-
**Section order
|
|
396
|
+
**Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Include only sections with entries — don't ship empty headers.
|
|
379
397
|
|
|
380
398
|
**Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
|
|
381
399
|
|
|
382
400
|
---
|
|
383
401
|
|
|
402
|
+
## Publishing
|
|
403
|
+
|
|
404
|
+
**Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
384
408
|
## Imports
|
|
385
409
|
|
|
386
410
|
```ts
|
package/Dockerfile
CHANGED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
#
|
|
4
4
|
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
5
|
# source code into JavaScript, and prepares the production assets.
|
|
6
|
+
#
|
|
7
|
+
# Pinned to the builder's own platform. The build emits portable JavaScript, so
|
|
8
|
+
# there is nothing to gain from running it once per target architecture — and
|
|
9
|
+
# under a multi-arch build the emulated leg is actively broken: Bun 1.4.0 aborts
|
|
10
|
+
# with SIGABRT inside qemu, so `bun run build` dies before it compiles anything.
|
|
11
|
+
# The production stage below stays per-target and resolves its own dependencies.
|
|
6
12
|
# ==============================================================================
|
|
7
|
-
FROM oven/bun:1.
|
|
13
|
+
FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS build
|
|
8
14
|
|
|
9
15
|
WORKDIR /usr/src/app
|
|
10
16
|
|
|
@@ -30,7 +36,7 @@ RUN bun run build
|
|
|
30
36
|
# application. It uses a slim base image and only includes production
|
|
31
37
|
# dependencies and build artifacts.
|
|
32
38
|
# ==============================================================================
|
|
33
|
-
FROM oven/bun:1.
|
|
39
|
+
FROM oven/bun:1.4.0-slim AS production
|
|
34
40
|
|
|
35
41
|
WORKDIR /usr/src/app
|
|
36
42
|
|
|
@@ -51,8 +57,13 @@ COPY package.json bun.lock ./
|
|
|
51
57
|
|
|
52
58
|
# Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
|
|
53
59
|
# that are not needed in the final production image.
|
|
60
|
+
# `--omit=peer` drops the framework's optional peer tiers (test runner, service
|
|
61
|
+
# SDKs, parsers) that Bun would otherwise auto-install. Anything this server
|
|
62
|
+
# actually imports belongs in its own `dependencies`, so nothing needed at
|
|
63
|
+
# runtime is lost. The OTEL step below carries the same flag — without it, that
|
|
64
|
+
# install re-resolves the graph and pulls every optional peer back in.
|
|
54
65
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
55
|
-
bun install --production --frozen-lockfile --ignore-scripts
|
|
66
|
+
bun install --production --omit=peer --frozen-lockfile --ignore-scripts
|
|
56
67
|
|
|
57
68
|
# Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
|
|
58
69
|
# These are not bundled by default to keep the base image lean. Enable at build time
|
|
@@ -60,7 +71,7 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
|
60
71
|
ARG OTEL_ENABLED=true
|
|
61
72
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
62
73
|
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
63
|
-
bun add --omit=dev --ignore-scripts @hono/otel \
|
|
74
|
+
bun add --omit=dev --omit=peer --ignore-scripts @hono/otel \
|
|
64
75
|
@opentelemetry/instrumentation-http \
|
|
65
76
|
@opentelemetry/exporter-metrics-otlp-http \
|
|
66
77
|
@opentelemetry/exporter-trace-otlp-http \
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/nist-nvd-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/nist-nvd-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Overview
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
CVE and CPE data from the NIST National Vulnerability Database. Search and audit vulnerabilities by keyword, severity, CWE, or CISA KEV status, resolve products to CPE names, and track a CVE's revision history from any MCP client. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
|
|
33
|
+
|
|
34
|
+
### Tools
|
|
33
35
|
|
|
34
36
|
| Tool | Description |
|
|
35
37
|
|:-----|:------------|
|
|
@@ -39,106 +41,108 @@ Five tools for vulnerability research, CPE auditing, and change tracking against
|
|
|
39
41
|
| `nvd_audit_cpe` | Find all CVEs affecting a specific product version by CPE name or virtual match string. |
|
|
40
42
|
| `nvd_get_cve_history` | Retrieve the change history for a CVE — score revisions, status transitions, and reference additions. |
|
|
41
43
|
|
|
42
|
-
###
|
|
44
|
+
### Resources
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
| Resource | Description |
|
|
47
|
+
|:---------|:------------|
|
|
48
|
+
| `nvd://cve/{cveId}` | Full CVE record by ID — same data as `nvd_get_cve` for a single ID, as a stable URI for injectable context. |
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
- Severity filter by CVSS v2/v3/v4 label (LOW, MEDIUM, HIGH, CRITICAL)
|
|
48
|
-
- CWE weakness filter (e.g., `CWE-79`, `NVD-CWE-Other`)
|
|
49
|
-
- CISA KEV filter — limit results to known-exploited vulnerabilities
|
|
50
|
-
- Convenience date shorthands: `pubDays` and `lastModDays` for "last N days" queries
|
|
51
|
-
- Explicit ISO 8601 date range parameters (`pubStartDate`/`pubEndDate`, etc.) with 120-day max span
|
|
52
|
-
- Auto-clamps convenience date params that exceed 120 days and reports clamped values in the response enrichment
|
|
53
|
-
- Pagination via `limit` (up to 2000) and `offset`
|
|
54
|
-
- Every row carries a truncated description alongside the ID, so results are distinguishable without a follow-up fetch
|
|
55
|
-
- Results are always brief; call `nvd_get_cve` for full detail
|
|
50
|
+
All resource data is also reachable via tools.
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
## Capability reference
|
|
58
53
|
|
|
59
|
-
### `
|
|
54
|
+
### `nvd_search_cves` <sub>tool</sub>
|
|
55
|
+
|
|
56
|
+
- Full-text keyword search (AND-semantics across words), or `exactPhrase: true` for an exact-phrase match — requires `keyword`
|
|
57
|
+
- Filters: CVSS severity band (LOW/MEDIUM/HIGH/CRITICAL — CRITICAL requires `severityVersion: "v3"` or `"v4"`), CWE ID, CISA KEV status, `noRejected` (default true)
|
|
58
|
+
- Date filters: `pubDays`/`lastModDays` convenience shorthands (auto-clamped to 120 days, clamping reported in the enrichment) or explicit ISO 8601 ranges (120-day max span, both ends required); the two forms per axis are mutually exclusive
|
|
59
|
+
- Pagination via `limit` (up to 2000, default 20) and `offset`
|
|
60
|
+
- Always returns brief summaries with a truncated description; call `nvd_get_cve` for full detail
|
|
61
|
+
|
|
62
|
+
---
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
### `nvd_get_cve` <sub>tool</sub>
|
|
62
65
|
|
|
63
66
|
- Batch up to 100 CVE IDs per call
|
|
64
|
-
- Full mode:
|
|
65
|
-
-
|
|
66
|
-
- `includeReferences: false`
|
|
67
|
-
-
|
|
68
|
-
- Rendered text
|
|
67
|
+
- Full mode (default): CVSS scores across v2.0/v3.0/v3.1/v4.0, CWE weaknesses, CPE configurations, CISA KEV fields, references
|
|
68
|
+
- `brief: true` returns trimmed rows (ID, status, top severity, KEV name, truncated description) — recommended for batches over 10
|
|
69
|
+
- `includeReferences: false` strips the references array; `allLanguages: true` renders every localized description instead of English-only
|
|
70
|
+
- `missingIds` enrichment field lists any requested IDs NVD didn't return
|
|
71
|
+
- Rendered text caps references at 15 per record, with a `… N more` trailer
|
|
69
72
|
|
|
70
73
|
---
|
|
71
74
|
|
|
72
|
-
### `nvd_search_cpes`
|
|
75
|
+
### `nvd_search_cpes` <sub>tool</sub>
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- Keyword search (e.g., `"apache http server"`, `"openssl"`) or partial CPEv2.3 pattern
|
|
77
|
+
- Keyword search (e.g. `"apache http server"`) or a partial CPEv2.3 pattern via `cpeMatchString` — at least one required
|
|
77
78
|
- Returns full CPE name, human-readable title, deprecation status, and superseding CPEs
|
|
78
|
-
- Pagination via `limit` (up to 10,000
|
|
79
|
-
- Use
|
|
79
|
+
- Pagination via `limit` (up to 10,000, default 20) and `offset` — a vendor-level keyword can match tens of thousands of entries, so page rather than narrowing further
|
|
80
|
+
- Use before `nvd_audit_cpe` to resolve the exact CPE name a product needs
|
|
80
81
|
|
|
81
82
|
---
|
|
82
83
|
|
|
83
|
-
### `nvd_audit_cpe`
|
|
84
|
-
|
|
85
|
-
Full CVE audit for a specific product version.
|
|
84
|
+
### `nvd_audit_cpe` <sub>tool</sub>
|
|
86
85
|
|
|
87
|
-
- Two modes: exact `cpeName` (NVD auto-applies `isVulnerable`) or `virtualMatchString` with optional
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
- Echoes the CPE identifier used in the response enrichment so callers can verify the correct product was queried
|
|
86
|
+
- Two modes: exact `cpeName` (NVD auto-applies `isVulnerable`) or `virtualMatchString` with optional `versionStart`/`versionEnd` bounds (inclusive/exclusive)
|
|
87
|
+
- Client-side `severityMin` filter drops low-signal entries from the fetched page — it can only remove what `limit` already retrieved
|
|
88
|
+
- Returns full CVE records (CVSS scores, CWE, CPE configurations, KEV fields, references)
|
|
89
|
+
- Pagination via `limit` (up to 2000, default 20) and `offset` — page at a modest limit rather than raising it, since each result is a full record
|
|
90
|
+
- `auditTarget` enrichment field echoes the CPE identifier used, so callers can verify the correct product was queried
|
|
93
91
|
|
|
94
92
|
---
|
|
95
93
|
|
|
96
|
-
### `nvd_get_cve_history`
|
|
97
|
-
|
|
98
|
-
Track a CVE's lifecycle over time.
|
|
94
|
+
### `nvd_get_cve_history` <sub>tool</sub>
|
|
99
95
|
|
|
100
96
|
- Returns change events: CVSS revisions, status transitions, reference additions, CPE configuration updates
|
|
101
|
-
- `order` picks
|
|
102
|
-
- Paginated via `limit` and `offset`,
|
|
103
|
-
-
|
|
97
|
+
- `order` picks the anchor end — `newest` (default) reads most-recent-first, `oldest` reads NVD's native order
|
|
98
|
+
- Paginated via `limit` (up to 2000, default 20) and `offset`, counted from the end `order` anchors to
|
|
99
|
+
- The history endpoint is markedly slower without an API key — set `NVD_API_KEY` and raise `NVD_REQUEST_TIMEOUT_MS`
|
|
104
100
|
|
|
105
|
-
|
|
101
|
+
---
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|:-----|:-----|:------------|
|
|
109
|
-
| Resource | `nvd://cve/{cveId}` | Full CVE record by ID — same data as `nvd_get_cve` for a single ID, as a stable URI for injectable context. |
|
|
103
|
+
### `nvd://cve/{cveId}` <sub>resource</sub>
|
|
110
104
|
|
|
111
|
-
|
|
105
|
+
- Full CVE record as `application/json` — same data as `nvd_get_cve` for one ID, with references and English-only descriptions
|
|
106
|
+
- `cveId` must match `CVE-YYYY-NNNNN`; a well-formed but unknown ID throws `cve_not_found`
|
|
112
107
|
|
|
113
108
|
## Features
|
|
114
109
|
|
|
115
|
-
Built on [`@cyanheads/mcp-ts-core`](https://
|
|
116
|
-
|
|
117
|
-
- Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
|
|
118
|
-
- Unified error handling — handlers throw, framework catches, classifies, and formats
|
|
119
|
-
- Pluggable auth: `none`, `jwt`, `oauth`
|
|
120
|
-
- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
|
|
121
|
-
- Structured logging with optional OpenTelemetry tracing
|
|
122
|
-
- STDIO and Streamable HTTP transports
|
|
110
|
+
Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core): stdio and Streamable HTTP transports, pluggable auth (`none` / `jwt` / `oauth`), swappable storage (`in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`), structured logging with optional OpenTelemetry tracing.
|
|
123
111
|
|
|
124
112
|
NVD-specific:
|
|
125
113
|
|
|
126
114
|
- Request pacer enforces NVD's 5 req/30s (no key) and 50 req/30s (with key) limits with automatic queuing, at a minimum inter-request gap derived from the window and limit
|
|
127
115
|
- Retry wraps the pacer rather than sitting inside it — every attempt takes its own turn in the queue, so retries count against the rate budget instead of bursting past it
|
|
128
|
-
- A 403's `Retry-After` holds the whole queue until NVD's window resets
|
|
129
|
-
- Deterministic rejections fail fast instead of consuming retries
|
|
130
|
-
- HTML-response guard catches NVD rate-limit pages served as HTML instead of 403
|
|
116
|
+
- A 403's `Retry-After` holds the whole queue until NVD's window resets; keyless, a 403 fails fast and names `NVD_API_KEY` rather than spending the 5-request budget on retries that cannot outlast a 30-second window
|
|
117
|
+
- Deterministic rejections fail fast instead of consuming retries — NVD answers both a bad parameter and a refused API key with HTTP 404, separated only by a `message` header, so a refused key surfaces as a config fault naming `NVD_API_KEY` rather than as a malformed CVE ID
|
|
118
|
+
- HTML-response guard catches NVD rate-limit pages served as HTML instead of a 403
|
|
131
119
|
|
|
132
120
|
Agent-friendly output:
|
|
133
121
|
|
|
134
122
|
- An `enrichment` block on every response, carried on both `structuredContent` and the rendered text — total results, returned count, page offset, the filters actually applied, and any date-clamping events, so agents can reason about what was really queried
|
|
135
|
-
- `missingIds` in batch CVE lookups — per-ID parity check instead of a silent partial result
|
|
123
|
+
- `missingIds` in batch CVE lookups — a per-ID parity check instead of a silent partial result
|
|
136
124
|
- CPE echo in audit responses — `cpeName` or `virtualMatchString` reflected back so callers can verify the correct product was audited
|
|
137
|
-
- Empty-result notices that name the cause — an unmatched query, a severity threshold that emptied the page,
|
|
138
|
-
- An audit that finds nothing is a result, not an error — a product with no CVEs in NVD returns an empty page with `totalCount: 0` on either input arm, so "no known vulnerabilities" reads as the answer it is
|
|
125
|
+
- Empty-result notices that name the cause — an unmatched query, a severity threshold that emptied the page, an offset past the end of the result set, and a clean audit ("no known vulnerabilities") are told apart rather than all reading as errors or "nothing found"
|
|
139
126
|
|
|
140
127
|
## Getting started
|
|
141
128
|
|
|
129
|
+
### Public Hosted Instance
|
|
130
|
+
|
|
131
|
+
A public instance is available at `https://nist-nvd.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"mcpServers": {
|
|
136
|
+
"nist-nvd-mcp-server": {
|
|
137
|
+
"type": "streamable-http",
|
|
138
|
+
"url": "https://nist-nvd.caseyjhand.com/mcp"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Self-Hosted / Local
|
|
145
|
+
|
|
142
146
|
Add the following to your MCP client configuration file.
|
|
143
147
|
|
|
144
148
|
```json
|
|
@@ -205,7 +209,7 @@ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 NVD_API_KEY=... bun run start:http
|
|
|
205
209
|
|
|
206
210
|
### Prerequisites
|
|
207
211
|
|
|
208
|
-
- [Bun v1.
|
|
212
|
+
- [Bun v1.4.0](https://bun.sh/) or higher (or Node.js v24+).
|
|
209
213
|
- Optional: [NVD API key](https://nvd.nist.gov/developers/request-an-api-key) — free, raises rate limit from 5 req/30s to 50 req/30s.
|
|
210
214
|
|
|
211
215
|
### Installation
|
|
@@ -308,7 +312,7 @@ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rule
|
|
|
308
312
|
|
|
309
313
|
## Contributing
|
|
310
314
|
|
|
311
|
-
Issues
|
|
315
|
+
Issues are welcome. Run checks and tests before submitting:
|
|
312
316
|
|
|
313
317
|
```sh
|
|
314
318
|
bun run devcheck
|