@cyanheads/nist-nvd-mcp-server 0.1.3
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 +410 -0
- package/CLAUDE.md +410 -0
- package/Dockerfile +99 -0
- package/LICENSE +201 -0
- package/README.md +306 -0
- package/changelog/0.1.x/0.1.0.md +19 -0
- package/changelog/0.1.x/0.1.1.md +29 -0
- package/changelog/0.1.x/0.1.2.md +12 -0
- package/changelog/0.1.x/0.1.3.md +22 -0
- package/changelog/template.md +119 -0
- package/dist/config/server-config.d.ts +15 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +27 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts +6 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/index.js +6 -0
- package/dist/mcp-server/resources/definitions/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.js +36 -0
- package/dist/mcp-server/resources/definitions/nvd-cve.resource.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +10 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +10 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.d.ts +116 -0
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.js +329 -0
- package/dist/mcp-server/tools/definitions/nvd-audit-cpe.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.d.ts +45 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.js +132 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve-history.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.d.ts +36 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.js +183 -0
- package/dist/mcp-server/tools/definitions/nvd-get-cve.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.d.ts +40 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.js +140 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cpes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.d.ts +90 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.js +342 -0
- package/dist/mcp-server/tools/definitions/nvd-search-cves.tool.js.map +1 -0
- package/dist/services/nvd-cpe/nvd-cpe-service.d.ts +27 -0
- package/dist/services/nvd-cpe/nvd-cpe-service.d.ts.map +1 -0
- package/dist/services/nvd-cpe/nvd-cpe-service.js +58 -0
- package/dist/services/nvd-cpe/nvd-cpe-service.js.map +1 -0
- package/dist/services/nvd-cpe/types.d.ts +41 -0
- package/dist/services/nvd-cpe/types.d.ts.map +1 -0
- package/dist/services/nvd-cpe/types.js +6 -0
- package/dist/services/nvd-cpe/types.js.map +1 -0
- package/dist/services/nvd-cve/nvd-cve-service.d.ts +79 -0
- package/dist/services/nvd-cve/nvd-cve-service.d.ts.map +1 -0
- package/dist/services/nvd-cve/nvd-cve-service.js +345 -0
- package/dist/services/nvd-cve/nvd-cve-service.js.map +1 -0
- package/dist/services/nvd-cve/types.d.ts +185 -0
- package/dist/services/nvd-cve/types.d.ts.map +1 -0
- package/dist/services/nvd-cve/types.js +6 -0
- package/dist/services/nvd-cve/types.js.map +1 -0
- package/dist/services/nvd-http/nvd-http-client.d.ts +26 -0
- package/dist/services/nvd-http/nvd-http-client.d.ts.map +1 -0
- package/dist/services/nvd-http/nvd-http-client.js +175 -0
- package/dist/services/nvd-http/nvd-http-client.js.map +1 -0
- package/package.json +91 -0
- package/server.json +125 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
+
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
+
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
+
# with a concrete date.
|
|
6
|
+
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
|
+
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
|
+
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
|
+
# inside the value as a key separator and fails GitHub's strict parser.
|
|
11
|
+
summary: ""
|
|
12
|
+
|
|
13
|
+
# Set `true` when consumers must change code to upgrade: API removals,
|
|
14
|
+
# signature changes, config renames, behavior changes that break existing
|
|
15
|
+
# usage. Flagged as `Breaking` in the rollup.
|
|
16
|
+
breaking: false
|
|
17
|
+
|
|
18
|
+
# Set `true` if this release contains any security fix. Pairs with the
|
|
19
|
+
# `## Security` section below. Flagged as `Security` in the rollup so
|
|
20
|
+
# users can triage upgrade urgency at a glance.
|
|
21
|
+
security: false
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# <version> — YYYY-MM-DD
|
|
25
|
+
|
|
26
|
+
<!--
|
|
27
|
+
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
28
|
+
template.
|
|
29
|
+
|
|
30
|
+
Audience: someone scanning release notes to decide what affects them. Lead
|
|
31
|
+
each bullet with the symbol or concept name in **bold** so they can skip
|
|
32
|
+
what's irrelevant and zoom in on what's not.
|
|
33
|
+
|
|
34
|
+
Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
|
|
35
|
+
name the symbol, state what changed, stop. Use a second sentence only when
|
|
36
|
+
it carries weight. If a bullet feels long, it is.
|
|
37
|
+
|
|
38
|
+
Cut: mechanism walkthroughs (those belong in JSDoc, AGENTS.md, or the
|
|
39
|
+
relevant skill), ceremonial framings ("This release introduces…",
|
|
40
|
+
backwards-compat paragraphs), file-by-file test enumerations, internal
|
|
41
|
+
implementation notes. Prefer code/symbol names over English re-explanations.
|
|
42
|
+
|
|
43
|
+
Narrative intro: skip by default. Add one short sentence only when the
|
|
44
|
+
release theme genuinely needs framing the bullets can't carry.
|
|
45
|
+
|
|
46
|
+
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
47
|
+
Fixed, Security. Include only sections with entries; delete the rest
|
|
48
|
+
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
49
|
+
|
|
50
|
+
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
51
|
+
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
52
|
+
bumps on shipped skills. Nothing more.
|
|
53
|
+
|
|
54
|
+
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
55
|
+
context. Once per item per entry — don't re-link the same issue in summary,
|
|
56
|
+
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
57
|
+
for themselves.
|
|
58
|
+
|
|
59
|
+
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
60
|
+
inside its own UI, not in npm reads or local editors.
|
|
61
|
+
|
|
62
|
+
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
63
|
+
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
64
|
+
|
|
65
|
+
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
66
|
+
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
67
|
+
resolves to whatever real item already owns 42, and timeline previews pull
|
|
68
|
+
in that unrelated item's metadata.
|
|
69
|
+
|
|
70
|
+
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
71
|
+
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
72
|
+
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
73
|
+
|
|
74
|
+
<theme — omit version number, GitHub prepends it>
|
|
75
|
+
← blank line
|
|
76
|
+
<1-2 sentence context: what this release does>
|
|
77
|
+
← blank line
|
|
78
|
+
Dependency bumps: ← section header
|
|
79
|
+
← blank line
|
|
80
|
+
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
81
|
+
← blank line
|
|
82
|
+
Changed: ← only sections with entries
|
|
83
|
+
← blank line
|
|
84
|
+
- `format()` output includes `query` in text mode
|
|
85
|
+
← blank line
|
|
86
|
+
Added:
|
|
87
|
+
← blank line
|
|
88
|
+
- `manifest.json` scaffolded for MCPB bundle support
|
|
89
|
+
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
90
|
+
← blank line
|
|
91
|
+
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
92
|
+
|
|
93
|
+
Never a flat comma-separated string. Always structured markdown with
|
|
94
|
+
sections. The tag must scan well as a rendered GitHub Release page.
|
|
95
|
+
-->
|
|
96
|
+
|
|
97
|
+
## Added
|
|
98
|
+
|
|
99
|
+
-
|
|
100
|
+
|
|
101
|
+
## Changed
|
|
102
|
+
|
|
103
|
+
-
|
|
104
|
+
|
|
105
|
+
<!-- ## Deprecated
|
|
106
|
+
|
|
107
|
+
- -->
|
|
108
|
+
|
|
109
|
+
<!-- ## Removed
|
|
110
|
+
|
|
111
|
+
- -->
|
|
112
|
+
|
|
113
|
+
## Fixed
|
|
114
|
+
|
|
115
|
+
-
|
|
116
|
+
|
|
117
|
+
<!-- ## Security
|
|
118
|
+
|
|
119
|
+
- -->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration for nist-nvd-mcp-server.
|
|
3
|
+
* Parses NVD API key and request timeout from environment variables.
|
|
4
|
+
* @module config/server-config
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
declare const ServerConfigSchema: z.ZodObject<{
|
|
8
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
9
|
+
requestTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
12
|
+
/** Returns the parsed server config, parsing from environment variables on first call. */
|
|
13
|
+
export declare function getServerConfig(): ServerConfig;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;;iBAWtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,0FAA0F;AAC1F,wBAAgB,eAAe,IAAI,YAAY,CAM9C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration for nist-nvd-mcp-server.
|
|
3
|
+
* Parses NVD API key and request timeout from environment variables.
|
|
4
|
+
* @module config/server-config
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
8
|
+
const ServerConfigSchema = z.object({
|
|
9
|
+
apiKey: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe('NIST NVD API key. Without it, rate limit is 5 req/30s. With it, 50 req/30s. Get one free at nvd.nist.gov/developers/request-an-api-key.'),
|
|
13
|
+
requestTimeoutMs: z.coerce
|
|
14
|
+
.number()
|
|
15
|
+
.default(10_000)
|
|
16
|
+
.describe('HTTP request timeout in milliseconds. Default: 10000 (10s).'),
|
|
17
|
+
});
|
|
18
|
+
let _config;
|
|
19
|
+
/** Returns the parsed server config, parsing from environment variables on first call. */
|
|
20
|
+
export function getServerConfig() {
|
|
21
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
22
|
+
apiKey: 'NVD_API_KEY',
|
|
23
|
+
requestTimeoutMs: 'NVD_REQUEST_TIMEOUT_MS',
|
|
24
|
+
});
|
|
25
|
+
return _config;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=server-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,yIAAyI,CAC1I;IACH,gBAAgB,EAAE,CAAC,CAAC,MAAM;SACvB,MAAM,EAAE;SACR,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,6DAA6D,CAAC;CAC3E,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,0FAA0F;AAC1F,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,MAAM,EAAE,aAAa;QACrB,gBAAgB,EAAE,wBAAwB;KAC3C,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview nist-nvd-mcp-server MCP server entry point.
|
|
4
|
+
* Registers NVD tools and resources, initializes HTTP client and domain services.
|
|
5
|
+
* @module index
|
|
6
|
+
*/
|
|
7
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
import { getServerConfig } from './config/server-config.js';
|
|
9
|
+
import { nvdCveResource } from './mcp-server/resources/definitions/index.js';
|
|
10
|
+
import { nvdAuditCpe, nvdGetCve, nvdGetCveHistory, nvdSearchCpes, nvdSearchCves, } from './mcp-server/tools/definitions/index.js';
|
|
11
|
+
import { initNvdCpeService } from './services/nvd-cpe/nvd-cpe-service.js';
|
|
12
|
+
import { initNvdCveService } from './services/nvd-cve/nvd-cve-service.js';
|
|
13
|
+
import { initNvdHttpClient } from './services/nvd-http/nvd-http-client.js';
|
|
14
|
+
await createApp({
|
|
15
|
+
tools: [nvdGetCve, nvdSearchCves, nvdAuditCpe, nvdSearchCpes, nvdGetCveHistory],
|
|
16
|
+
resources: [nvdCveResource],
|
|
17
|
+
prompts: [],
|
|
18
|
+
instructions: 'This server provides read-only access to the NIST National Vulnerability Database (NVD).\n' +
|
|
19
|
+
'- Use nvd_search_cves to discover CVEs by keyword, severity, CWE, date range, or CISA KEV status.\n' +
|
|
20
|
+
'- Use nvd_get_cve for full CVSS details on specific CVE IDs (up to 100 per call).\n' +
|
|
21
|
+
'- Use nvd_search_cpes to find the correct CPE name for a product before auditing.\n' +
|
|
22
|
+
'- Use nvd_audit_cpe to find all CVEs affecting a specific product version.\n' +
|
|
23
|
+
'- Use nvd_get_cve_history to track when a CVE was re-scored or escalated.\n' +
|
|
24
|
+
'- Rate limit: 5 req/30s without API key, 50 req/30s with NVD_API_KEY.',
|
|
25
|
+
setup(core) {
|
|
26
|
+
const cfg = getServerConfig();
|
|
27
|
+
initNvdHttpClient(cfg.apiKey, cfg.requestTimeoutMs);
|
|
28
|
+
initNvdCveService(core.config, core.storage);
|
|
29
|
+
initNvdCpeService(core.config, core.storage);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,MAAM,SAAS,CAAC;IACd,KAAK,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,CAAC;IAC/E,SAAS,EAAE,CAAC,cAAc,CAAC;IAC3B,OAAO,EAAE,EAAE;IACX,YAAY,EACV,4FAA4F;QAC5F,qGAAqG;QACrG,qFAAqF;QACrF,qFAAqF;QACrF,8EAA8E;QAC9E,6EAA6E;QAC7E,uEAAuE;IAEzE,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;QAC9B,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACpD,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resource exposing a single CVE record by ID via a stable URI.
|
|
3
|
+
* @module src/mcp-server/resources/definitions/nvd-cve
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const nvdCveResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
7
|
+
cveId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
9
|
+
//# sourceMappingURL=nvd-cve.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nvd-cve.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/nvd-cve.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAMrD,eAAO,MAAM,cAAc;;wCAiCzB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resource exposing a single CVE record by ID via a stable URI.
|
|
3
|
+
* @module src/mcp-server/resources/definitions/nvd-cve
|
|
4
|
+
*/
|
|
5
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { notFound, validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getNvdCveService } from '../../../services/nvd-cve/nvd-cve-service.js';
|
|
8
|
+
const CVE_ID_REGEX = /^CVE-\d{4}-\d{4,}$/i;
|
|
9
|
+
export const nvdCveResource = resource('nvd://cve/{cveId}', {
|
|
10
|
+
name: 'NVD CVE Record',
|
|
11
|
+
description: 'Fetch a single CVE record by ID from the NIST NVD via a stable URI. ' +
|
|
12
|
+
'Returns the same full data as nvd_get_cve for a single ID: CVSS scores, CWE weaknesses, ' +
|
|
13
|
+
'CPE configurations, CISA KEV fields, and references.',
|
|
14
|
+
mimeType: 'application/json',
|
|
15
|
+
params: z.object({
|
|
16
|
+
cveId: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('CVE identifier (e.g., "CVE-2021-44228"). Must match the format CVE-YYYY-NNNNN.'),
|
|
19
|
+
}),
|
|
20
|
+
async handler(params, ctx) {
|
|
21
|
+
const { cveId } = params;
|
|
22
|
+
if (!CVE_ID_REGEX.test(cveId)) {
|
|
23
|
+
throw validationError(`Invalid CVE ID format: "${cveId}". Expected format: CVE-YYYY-NNNNN.`, {
|
|
24
|
+
cveId,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
ctx.log.debug('Fetching CVE resource', { cveId });
|
|
28
|
+
const service = getNvdCveService();
|
|
29
|
+
const result = await service.fetchById([cveId.toUpperCase()], true, ctx);
|
|
30
|
+
if (result.cves.length === 0) {
|
|
31
|
+
throw notFound(`CVE ${cveId} not found in the NVD database.`, { cveId });
|
|
32
|
+
}
|
|
33
|
+
return result.cves[0];
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=nvd-cve.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nvd-cve.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/nvd-cve.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,mBAAmB,EAAE;IAC1D,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,sEAAsE;QACtE,0FAA0F;QAC1F,sDAAsD;IACxD,QAAQ,EAAE,kBAAkB;IAE5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CAAC,gFAAgF,CAAC;KAC9F,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,eAAe,CAAC,2BAA2B,KAAK,qCAAqC,EAAE;gBAC3F,KAAK;aACN,CAAC,CAAC;QACL,CAAC;QAED,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;QAEnC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAEzE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,QAAQ,CAAC,OAAO,KAAK,iCAAiC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel export for all NVD MCP tool definitions.
|
|
3
|
+
* @module mcp-server/tools/definitions
|
|
4
|
+
*/
|
|
5
|
+
export { nvdAuditCpe } from './nvd-audit-cpe.tool.js';
|
|
6
|
+
export { nvdGetCve } from './nvd-get-cve.tool.js';
|
|
7
|
+
export { nvdGetCveHistory } from './nvd-get-cve-history.tool.js';
|
|
8
|
+
export { nvdSearchCpes } from './nvd-search-cpes.tool.js';
|
|
9
|
+
export { nvdSearchCves } from './nvd-search-cves.tool.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel export for all NVD MCP tool definitions.
|
|
3
|
+
* @module mcp-server/tools/definitions
|
|
4
|
+
*/
|
|
5
|
+
export { nvdAuditCpe } from './nvd-audit-cpe.tool.js';
|
|
6
|
+
export { nvdGetCve } from './nvd-get-cve.tool.js';
|
|
7
|
+
export { nvdGetCveHistory } from './nvd-get-cve-history.tool.js';
|
|
8
|
+
export { nvdSearchCpes } from './nvd-search-cpes.tool.js';
|
|
9
|
+
export { nvdSearchCves } from './nvd-search-cves.tool.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool for finding CVEs affecting a specific product and version by CPE.
|
|
3
|
+
* @module src/mcp-server/tools/definitions/nvd-audit-cpe
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const nvdAuditCpe: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
cpeName: z.ZodOptional<z.ZodString>;
|
|
9
|
+
virtualMatchString: z.ZodOptional<z.ZodString>;
|
|
10
|
+
versionStart: z.ZodOptional<z.ZodString>;
|
|
11
|
+
versionStartType: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
including: "including";
|
|
13
|
+
excluding: "excluding";
|
|
14
|
+
}>>;
|
|
15
|
+
versionEnd: z.ZodOptional<z.ZodString>;
|
|
16
|
+
versionEndType: z.ZodDefault<z.ZodEnum<{
|
|
17
|
+
including: "including";
|
|
18
|
+
excluding: "excluding";
|
|
19
|
+
}>>;
|
|
20
|
+
severityMin: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
LOW: "LOW";
|
|
22
|
+
MEDIUM: "MEDIUM";
|
|
23
|
+
HIGH: "HIGH";
|
|
24
|
+
CRITICAL: "CRITICAL";
|
|
25
|
+
}>>;
|
|
26
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
cves: z.ZodArray<z.ZodObject<{
|
|
29
|
+
cveId: z.ZodString;
|
|
30
|
+
vulnStatus: z.ZodString;
|
|
31
|
+
published: z.ZodString;
|
|
32
|
+
lastModified: z.ZodString;
|
|
33
|
+
descriptions: z.ZodArray<z.ZodObject<{
|
|
34
|
+
lang: z.ZodString;
|
|
35
|
+
value: z.ZodString;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
cvssScores: z.ZodArray<z.ZodObject<{
|
|
38
|
+
version: z.ZodString;
|
|
39
|
+
sourceType: z.ZodString;
|
|
40
|
+
baseScore: z.ZodNumber;
|
|
41
|
+
severity: z.ZodString;
|
|
42
|
+
vectorString: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
severity: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
label: z.ZodString;
|
|
46
|
+
score: z.ZodNumber;
|
|
47
|
+
fromVersion: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
weaknesses: z.ZodArray<z.ZodObject<{
|
|
50
|
+
source: z.ZodString;
|
|
51
|
+
cweIds: z.ZodArray<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
configurations: z.ZodArray<z.ZodObject<{
|
|
54
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
55
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
56
|
+
cpeMatch: z.ZodArray<z.ZodObject<{
|
|
57
|
+
vulnerable: z.ZodBoolean;
|
|
58
|
+
criteria: z.ZodString;
|
|
59
|
+
versionStartIncluding: z.ZodOptional<z.ZodString>;
|
|
60
|
+
versionStartExcluding: z.ZodOptional<z.ZodString>;
|
|
61
|
+
versionEndIncluding: z.ZodOptional<z.ZodString>;
|
|
62
|
+
versionEndExcluding: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
references: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
url: z.ZodString;
|
|
68
|
+
source: z.ZodOptional<z.ZodString>;
|
|
69
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
}, z.core.$strip>>>;
|
|
71
|
+
cisaKev: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
exploitAddDate: z.ZodString;
|
|
73
|
+
actionDueDate: z.ZodString;
|
|
74
|
+
requiredAction: z.ZodString;
|
|
75
|
+
vulnerabilityName: z.ZodString;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
queryMeta: z.ZodObject<{
|
|
79
|
+
totalResults: z.ZodNumber;
|
|
80
|
+
returned: z.ZodNumber;
|
|
81
|
+
cpeName: z.ZodOptional<z.ZodString>;
|
|
82
|
+
virtualMatchString: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
}, z.core.$strip>, readonly [{
|
|
85
|
+
readonly reason: "missing_cpe_input";
|
|
86
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
87
|
+
readonly when: "Neither cpeName nor virtualMatchString was provided.";
|
|
88
|
+
readonly recovery: "Provide either cpeName (exact CPEv2.3 string) or virtualMatchString (partial match pattern) — use nvd_search_cpes to find the correct CPE.";
|
|
89
|
+
}, {
|
|
90
|
+
readonly reason: "conflicting_cpe_inputs";
|
|
91
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
92
|
+
readonly when: "Both cpeName and virtualMatchString were provided simultaneously.";
|
|
93
|
+
readonly recovery: "Provide only one of cpeName or virtualMatchString per call, not both.";
|
|
94
|
+
}, {
|
|
95
|
+
readonly reason: "version_range_without_match_string";
|
|
96
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
97
|
+
readonly when: "versionStart or versionEnd was provided without virtualMatchString.";
|
|
98
|
+
readonly recovery: "Version range parameters require virtualMatchString; provide that parameter or use cpeName for exact-version queries.";
|
|
99
|
+
}, {
|
|
100
|
+
readonly reason: "invalid_cpe_format";
|
|
101
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
102
|
+
readonly when: "cpeName or virtualMatchString does not start with \"cpe:2.3:\" — not a valid CPEv2.3 string.";
|
|
103
|
+
readonly recovery: "Provide a valid CPEv2.3 string starting with \"cpe:2.3:\". Use nvd_search_cpes to find the correct CPE name.";
|
|
104
|
+
}, {
|
|
105
|
+
readonly reason: "cpe_not_found";
|
|
106
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
107
|
+
readonly when: "The cpeName is valid format but NVD returns no matching CVEs — the CPE may be misspelled or absent from NVD.";
|
|
108
|
+
readonly recovery: "Use nvd_search_cpes to verify the exact CPE name exists in the NVD dictionary before auditing.";
|
|
109
|
+
}, {
|
|
110
|
+
readonly reason: "rate_limited";
|
|
111
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
112
|
+
readonly when: "NVD returned HTTP 403 indicating the rate limit was exceeded.";
|
|
113
|
+
readonly retryable: true;
|
|
114
|
+
readonly recovery: "Wait for the NVD rate window to reset or set the NVD_API_KEY environment variable for higher limits.";
|
|
115
|
+
}]>;
|
|
116
|
+
//# sourceMappingURL=nvd-audit-cpe.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nvd-audit-cpe.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/nvd-audit-cpe.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA2HjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoRtB,CAAC"}
|