cverdict-mcp 0.1.5 → 0.1.6
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 +4 -2
- package/dist/cverdict-mcp.mjs +261 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ proxy and the data bases. Nothing but JSON-RPC goes to stdout.
|
|
|
89
89
|
|
|
90
90
|
## Tools
|
|
91
91
|
|
|
92
|
-
All
|
|
92
|
+
All are read-only (`readOnlyHint: true`) and return `structuredContent` plus the same JSON as
|
|
93
93
|
one text block. The result types are in [`shared/contract.ts`](../shared/contract.ts), section
|
|
94
94
|
"MCP tool results".
|
|
95
95
|
|
|
@@ -101,8 +101,10 @@ one text block. The result types are in [`shared/contract.ts`](../shared/contrac
|
|
|
101
101
|
| `woke_up` | `woke.json` | Old CVEs that gained exploitation evidence since `since` (default 7 days before the data was generated), with their dated signals. Filter by `kinds`: `kev` (CISA KEV), `catalog` (ENISA EU KEV or CIRCL as exploited), `exploitdb`, `metasploit`, `nuclei`, `poc`, `epss`. A `kev` or `catalog` listing in the period counts even when it came while the CVE was still in the window | `limit` 1 to 50 (default 25), `offset` |
|
|
102
102
|
| `receipts` | `receipts.json` | How often CVErdict, CVSS 7 or more and EPSS 10% or more flagged a CVE before CISA listed it: the forward log and the hindsight backtest, without the per-CVE lists. `id` adds one CVE's entries | |
|
|
103
103
|
| `search_cves` | `index.json` | Window CVEs whose ID, CNA, vendor, product or title contain every word of `query`, highest score first | `query` 2 to 100 characters, at most 8 words; `limit` 1 to 50 (default 20), `offset` |
|
|
104
|
+
| `check_inventory` | `index.json`, `woke.json` | Per name: the window CVEs and old CVEs that woke up whose vendor or product equals the name (ignoring case and extra spaces, as the site's watchlist matches), most urgent first (tier, then soonest KEV due date, then score), each with tier, verdict, score and KEV due date; `matched` and `total` (in the chosen `tiers`), `omitted`, `no_match`, and the feed for the name's slug `https://cverdict.dev/feeds/v/<slug>.xml`, which folds case, accents and punctuation, so it can carry spellings the name does not match (`umbraco cms` and `umbraco-cms` share one) | `names` 1 to 200, each 1 to 80 characters after trimming; `per_name` 1 to 25 (default 10); to keep the answer under about 17,000 tokens, the least urgent CVEs across all names are left out, with a `note`, so an exploited CVE is never dropped for a quieter one; no control or invisible characters, and at most 20 KB of names together; `tiers`, `knob` |
|
|
105
|
+
| `changes_since` | `events.json` | Verdict events after `since`, newest first, with every event field (`id`, `at`, `type`, `cve`, `vendor`, `product`, `tier_before`, `tier_after`, `score`, `title`, `via`, `url`, `detail`, `backfill`; tiers at the default evidence bar of 50), the span the log covers (`log`, with `capped: true` when the log reached `max_items` and dropped its lower-ranked events) and `next_since` (the log's `generated_at`). To page, pass the first page's `next_since` as `until` on later pages, so events added by a new run between pages do not shift them and every page names the same `next_since`; pass that as `since` to catch up later. Filters: `names` (as `check_inventory` matches), `types` (`kev_added`, `catalog_listed`, `vendor_exploited`, `tier_up`, `fast_lane`, `metasploit_module`, `nuclei_template`, `exploitdb_entry`) | `since` within the log's 7 days, else an error saying where it starts: a date-time is exclusive (so `next_since` repeats nothing), a date takes the whole day from 00:00:00Z, where backfilled items are stamped; `until` optional; `limit` 1 to 50 (default 25), `offset` |
|
|
104
106
|
|
|
105
|
-
Dates (`published_since`, `since`) are UTC: `2026-10-01`, `2026-10-01T06:00Z` or
|
|
107
|
+
Dates (`published_since`, `since`, `until`) are UTC: `2026-10-01`, `2026-10-01T06:00Z` or
|
|
106
108
|
`2026-10-01T06:00:00.000Z`. A date that does not exist is an error. A filter the server cannot
|
|
107
109
|
apply is always an error, never silently dropped.
|
|
108
110
|
|
package/dist/cverdict-mcp.mjs
CHANGED
|
@@ -194,7 +194,7 @@ function mergeDefs(...defs) {
|
|
|
194
194
|
function esc(str) {
|
|
195
195
|
return JSON.stringify(str);
|
|
196
196
|
}
|
|
197
|
-
function slugify(input) {
|
|
197
|
+
function slugify$1(input) {
|
|
198
198
|
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
199
199
|
}
|
|
200
200
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
@@ -3821,7 +3821,7 @@ function _toUpperCase() {
|
|
|
3821
3821
|
}
|
|
3822
3822
|
// @__NO_SIDE_EFFECTS__
|
|
3823
3823
|
function _slugify() {
|
|
3824
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
3824
|
+
return /* @__PURE__ */ _overwrite((input) => slugify$1(input));
|
|
3825
3825
|
}
|
|
3826
3826
|
// @__NO_SIDE_EFFECTS__
|
|
3827
3827
|
function _array(Class, element, params) {
|
|
@@ -24126,7 +24126,7 @@ var MCP_SERVER = {
|
|
|
24126
24126
|
name: `io.github.${BRAND.repo}`,
|
|
24127
24127
|
title: BRAND.name,
|
|
24128
24128
|
/** Same as mcp/package.json (checked by a test). */
|
|
24129
|
-
version: "0.1.
|
|
24129
|
+
version: "0.1.6",
|
|
24130
24130
|
/** npm package name: `npx -y cverdict-mcp`. */
|
|
24131
24131
|
npm: `${BRAND.slug}-mcp`,
|
|
24132
24132
|
/** Where the server is documented. */
|
|
@@ -24177,6 +24177,16 @@ var MCP_TOOLS = [
|
|
|
24177
24177
|
name: "search_cves",
|
|
24178
24178
|
title: "Search the 30-day window",
|
|
24179
24179
|
description: "Find CVEs published in the last 30 days by words in the ID, CNA, vendor, product or title (all words must match), highest score first." + UNTRUSTED
|
|
24180
|
+
},
|
|
24181
|
+
{
|
|
24182
|
+
name: "check_inventory",
|
|
24183
|
+
title: "Check a list of vendors and products",
|
|
24184
|
+
description: "Which tracked CVEs hit a list of vendors or products (1 to 200 names, e.g. from an asset inventory): per name, the matching CVEs most urgent first (tier, then soonest CISA KEV due date, then score) with verdict, score and KEV due date, plus the Atom feed for the name's slug (it may also carry other spellings). A name must equal a CVE's vendor or product, ignoring case, as the site's watchlist matches; no_match: true flags a name with no tracked CVE (check the spelling, or try search_cves). omitted counts what was left out (per_name, or the size budget)." + UNTRUSTED
|
|
24185
|
+
},
|
|
24186
|
+
{
|
|
24187
|
+
name: "changes_since",
|
|
24188
|
+
title: "What changed since a time",
|
|
24189
|
+
description: "Verdict events after since, newest first: CISA KEV and exploited-catalog listings, vendor exploitation notes, tier rises, fast-lane flags, first Metasploit, Nuclei or Exploit-DB entries. Tiers are at the default evidence bar. To page, pass the first page's next_since as until; to catch up later, pass it as since. The log keeps 7 days; an older since is an error that says where it starts. Filter by names (as check_inventory matches) and types." + UNTRUSTED
|
|
24180
24190
|
}
|
|
24181
24191
|
];
|
|
24182
24192
|
/** Plain-language verdict per tier, as in the README's tier table. */
|
|
@@ -24192,6 +24202,11 @@ var MCP_MSG = {
|
|
|
24192
24202
|
notCveId: "Not a CVE ID. Expected CVE-YYYY-NNNN.",
|
|
24193
24203
|
detailTooMany: (max) => `detail: true takes at most ${max} IDs; ask again in groups of ${max}.`,
|
|
24194
24204
|
tooManyWords: (max) => `query takes at most ${max} words.`,
|
|
24205
|
+
inventoryCut: (shown, of) => `To keep this answer under about 17,000 tokens it shows the ${shown} most urgent of ${of} CVEs across all names; omitted counts what each name left out. For the rest, ask again with fewer names or with tiers.`,
|
|
24206
|
+
badName: (max) => `names: each name needs 1 to ${max} characters after trimming.`,
|
|
24207
|
+
oddName: "names: a name may not contain control or invisible characters.",
|
|
24208
|
+
namesTooLong: "names: these names are too long together for one answer; ask again with fewer names.",
|
|
24209
|
+
beforeLog: (from, to, days) => `since is older than the event log: events.json holds the ${days} days from ${from} to ${to}. Ask again with since on or after ${from}; for older changes use woke_up or get_verdict.`,
|
|
24195
24210
|
badDate: (field) => `${field} must be a UTC date (2026-10-01) or date-time (2026-10-01T06:00Z).`,
|
|
24196
24211
|
notPublished: (file) => file === "meta.json" ? `meta.json is not at the first data base that answered, so no tool can answer. Check CVERDICT_DATA_BASE, or read the files directly: ${BROWSE_DATA}` : `${file} is not on the data branch yet, so this tool has nothing to read. The other tools still work.`,
|
|
24197
24212
|
schema: (found, expected) => `The published data uses schema version ${String(found)}; this server reads version ${expected}. Update the server: ${MCP_SERVER.docs}`,
|
|
@@ -24233,6 +24248,16 @@ var ROW_COLS = [
|
|
|
24233
24248
|
"kd",
|
|
24234
24249
|
"b"
|
|
24235
24250
|
];
|
|
24251
|
+
var EVENT_TYPES = [
|
|
24252
|
+
"kev_added",
|
|
24253
|
+
"catalog_listed",
|
|
24254
|
+
"vendor_exploited",
|
|
24255
|
+
"tier_up",
|
|
24256
|
+
"fast_lane",
|
|
24257
|
+
"metasploit_module",
|
|
24258
|
+
"nuclei_template",
|
|
24259
|
+
"exploitdb_entry"
|
|
24260
|
+
];
|
|
24236
24261
|
/** `catalog`: a first exploited listing in ENISA EU KEV or the CIRCL catalog (the eukev/circl E chips). */
|
|
24237
24262
|
var WAKE_KINDS = [
|
|
24238
24263
|
"kev",
|
|
@@ -24271,7 +24296,7 @@ function rowsFromTable(table) {
|
|
|
24271
24296
|
* - Files are checked before use: schema_version, generated_at, and the exact ROW_COLS of row
|
|
24272
24297
|
* tables, so no `__proto__` column can reach rowFromColumns.
|
|
24273
24298
|
* - Parsed files are cached per pipeline run. meta.json is refetched after 300 s (raw and the site
|
|
24274
|
-
* cache for 300 s anyway); any other file is reused while its generated_at
|
|
24299
|
+
* cache for 300 s anyway); any other file is reused while its generated_at names meta's instant, and
|
|
24275
24300
|
* otherwise refetched at most once per 300 s. When a refresh fails, the last good copy answers
|
|
24276
24301
|
* and the answer's data.warning says so.
|
|
24277
24302
|
* - Nothing runs between calls: no polling, and every timer is cleared when its call ends.
|
|
@@ -24301,6 +24326,13 @@ var DEFAULTS = {
|
|
|
24301
24326
|
now: Date.now
|
|
24302
24327
|
};
|
|
24303
24328
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
24329
|
+
var TIER_SET = new Set(TIERS);
|
|
24330
|
+
/** A short string: ids, types and sources are tens of characters. */
|
|
24331
|
+
var short = (v) => typeof v === "string" && v.length <= 200;
|
|
24332
|
+
/** Every EventItem field with its type, so the tool never trips over a mirror's file. */
|
|
24333
|
+
function isEvent(i) {
|
|
24334
|
+
return short(i.id) && short(i.type) && short(i.cve) && short(i.via) && typeof i.title === "string" && typeof i.detail === "string" && (i.url === null || typeof i.url === "string") && TIER_SET.has(i.tier_after) && (i.tier_before === null || TIER_SET.has(i.tier_before)) && Number.isFinite(i.score) && typeof i.backfill === "boolean";
|
|
24335
|
+
}
|
|
24304
24336
|
function need(ok, why) {
|
|
24305
24337
|
if (!ok) throw new BadData(why);
|
|
24306
24338
|
}
|
|
@@ -24334,6 +24366,12 @@ var parse = {
|
|
|
24334
24366
|
need(Array.isArray(j.items) && isObject(j.tracking), "items or tracking missing");
|
|
24335
24367
|
return j;
|
|
24336
24368
|
},
|
|
24369
|
+
events: (j) => {
|
|
24370
|
+
need(Array.isArray(j.items) && Number.isInteger(j.days) && Number.isInteger(j.max_items) && Number.isFinite(Date.parse(j.generated_at)), "items, days, max_items or generated_at missing");
|
|
24371
|
+
need(j.items.every((i) => isObject(i) && typeof i.at === "string" && Number.isFinite(Date.parse(i.at)) && typeof i.vendor === "string" && typeof i.product === "string"), "an item has no valid at, vendor or product");
|
|
24372
|
+
need(j.items.every(isEvent), "an item has a field of the wrong type");
|
|
24373
|
+
return j;
|
|
24374
|
+
},
|
|
24337
24375
|
receipts: (j) => {
|
|
24338
24376
|
need(isObject(j.forward) && Array.isArray(j.forward.items), "forward log missing");
|
|
24339
24377
|
return j;
|
|
@@ -24523,7 +24561,7 @@ var DataClient = class {
|
|
|
24523
24561
|
const cache = path.startsWith("cve/") ? this.shardCache : this.files;
|
|
24524
24562
|
const hit = cache.get(path);
|
|
24525
24563
|
const now = this.o.now();
|
|
24526
|
-
if (hit && (gen !== null && hit.gen === gen || now - hit.checkedAt < this.o.metaTtlMs)) return hit;
|
|
24564
|
+
if (hit && (gen !== null && Date.parse(hit.gen) === Date.parse(gen) || now - hit.checkedAt < this.o.metaTtlMs)) return hit;
|
|
24527
24565
|
let f = this.inflight.get(path);
|
|
24528
24566
|
if (!f) {
|
|
24529
24567
|
const mine = {
|
|
@@ -24654,8 +24692,10 @@ var CHIPS = [
|
|
|
24654
24692
|
c("vendor.functional", "X", "up", 24, "cvelist", "Vendor: working exploit", "The CNA’s CVSS v3 vector says functional or autonomous exploit code exists (E:F/E:H). That is weaponization, not proof of attacks: about a quarter of such CVEs reach KEV. VulDB vectors are ignored."),
|
|
24655
24693
|
c("vendor.poc", "X", "up", 10, "cvelist", "Vendor: PoC", "The CNA’s CVSS vector says a proof of concept exists (E:P). VulDB vectors are ignored."),
|
|
24656
24694
|
c("epss.mid", "X", "up", 8, "epss", "EPSS 1–10%", "EPSS between 1% and 10% (only trusted after 14 days)."),
|
|
24695
|
+
c("fast.lane", "X", "up", 12, "computed", "Fast lane", "Less than 14 days old, attack vector Network with no user interaction, CISA SSVC automatable with total impact (or CVSS 9.0 or more while SSVC is not in yet), on an internet-facing edge device or a product already in CISA KEV. Attack tools can now turn a public reproducer into an exploit within hours for some bugs, before exploit feeds see it, so this stands in for an exploit sign. It is not evidence of attacks. The strongest X chip counts, so a real exploit replaces it."),
|
|
24657
24696
|
c("x.none", "X", "down", -14, "computed", "No exploit yet", "Two weeks after publication there is still no public exploit and EPSS is below 1%."),
|
|
24658
|
-
c("x.
|
|
24697
|
+
c("x.early", "X", "down", -3, "computed", "No exploit yet (early)", "Less than 14 days old and no exploit signal yet. Weak evidence, so a small penalty: severity, SSVC and KEV history alone stay under the default evidence bar. Not applied to internet-facing edge devices, and replaced by the fast lane when that fires."),
|
|
24698
|
+
c("x.too_new", "X", "unknown", 0, "computed", "Too new", "No exploit chip, but absence is not settled: a PoC repo is too new to vet, an exploit source could not be loaded this run, or the CVE is an internet-facing edge device under 14 days old."),
|
|
24659
24699
|
c("sev.crit_net", "SEV", "up", 13, "cvelist", "Critical · network", "CVSS ≥ 9.0 and attack vector Network."),
|
|
24660
24700
|
c("sev.crit", "SEV", "up", 6, "cvelist", "Critical", "CVSS ≥ 9.0, not network-reachable."),
|
|
24661
24701
|
c("sev.high", "SEV", "up", 1, "cvelist", "High", "CVSS 7.0–8.9. Half of all new CVEs are High or Critical, so this barely moves the needle."),
|
|
@@ -24685,6 +24725,7 @@ var CHIPS = [
|
|
|
24685
24725
|
c("circl.suspected", "INFO", "info", 0, "circl-kev", "CIRCL: suspected", "CIRCL lists exploitation as suspected, not confirmed (CC0-1.0). Information only."),
|
|
24686
24726
|
c("circl.attempts", "INFO", "info", 0, "circl-kev", "CIRCL: attempts", "CIRCL lists it as confirmed in its known-exploited catalog (CC0-1.0), but the only evidence is exploitation attempts, such as hits on a sinkhole. Attempts are not proof that an attack worked: information only."),
|
|
24687
24727
|
c("honeypot.siberkapan", "INFO", "info", 0, "siberkapan", "Honeypot attempts", "SiberKapan’s honeypot and web sensors in Turkey saw exploitation attempts (CC-BY-4.0). Attempts are not proof that an attack worked, and one sensor network gives too little data to set points: information only."),
|
|
24728
|
+
c("edge.device", "INFO", "info", 0, "computed", "Edge device", "An internet-facing edge device: VPN, firewall, load balancer, email gateway, file transfer, webmail, remote support, SD-WAN or edge router (curated list in shared/edge.ts, explained in docs/SCORING.md). These are often attacked before any exploit is public, so the early no-exploit penalty does not apply."),
|
|
24688
24729
|
c("tag.eol", "INFO", "info", 0, "cvelist", "Unsupported product", "The product was unsupported when the CVE was assigned: there may be no patch. Replace or mitigate.")
|
|
24689
24730
|
];
|
|
24690
24731
|
Object.fromEntries(CHIPS.map((d) => [d.id, d]));
|
|
@@ -24702,9 +24743,24 @@ function shardOf(cveId) {
|
|
|
24702
24743
|
return (fnv1a(cveId.trim().toUpperCase()) % 256).toString(16).padStart(2, "0");
|
|
24703
24744
|
}
|
|
24704
24745
|
var CVE_ID_RE = /^CVE-\d{4}-\d{4,}$/;
|
|
24746
|
+
/**
|
|
24747
|
+
* Slug of a vendor or product name: NFKD, accents dropped, lower case, every run of other
|
|
24748
|
+
* characters becomes one hyphen, no hyphen at either end, at most SLUG_MAX characters. "" when
|
|
24749
|
+
* nothing is left (a name with no ASCII letters or digits).
|
|
24750
|
+
*/
|
|
24751
|
+
function slugify(name) {
|
|
24752
|
+
return name.normalize("NFKD").replace(/\p{M}+/gu, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64).replace(/-+$/, "");
|
|
24753
|
+
}
|
|
24754
|
+
// shared/watch.ts
|
|
24755
|
+
var normalizeName = (s) => s.trim().toLowerCase().replace(/\s+/g, " ");
|
|
24756
|
+
/** True when a normalized name in `list` equals the vendor or the product. */
|
|
24757
|
+
function matchesName(list, vendor, product) {
|
|
24758
|
+
if (list.length === 0) return false;
|
|
24759
|
+
return vendor !== "" && list.includes(normalizeName(vendor)) || product !== "" && list.includes(normalizeName(product));
|
|
24760
|
+
}
|
|
24705
24761
|
// mcp/src/tools.ts
|
|
24706
24762
|
/**
|
|
24707
|
-
* The
|
|
24763
|
+
* The MCP tools as plain functions over the published files: (call, args, now) -> result.
|
|
24708
24764
|
* No SDK imports, so they are unit-tested with a fake fetch. Every result starts with `data`, which
|
|
24709
24765
|
* names the run and every file the answer came from (McpData in shared/contract.ts).
|
|
24710
24766
|
*/
|
|
@@ -24717,10 +24773,17 @@ var LIMITS = {
|
|
|
24717
24773
|
offset: 1e5,
|
|
24718
24774
|
queryWords: 8,
|
|
24719
24775
|
withinDays: 60,
|
|
24720
|
-
overdueDays: 14
|
|
24776
|
+
overdueDays: 14,
|
|
24777
|
+
names: 200,
|
|
24778
|
+
nameChars: 80,
|
|
24779
|
+
perName: 25
|
|
24721
24780
|
};
|
|
24781
|
+
/** Bytes of JSON check_inventory answers with at most (about 17,000 tokens); the least urgent CVEs are left out to fit. */
|
|
24782
|
+
var INVENTORY_BUDGET = 61440;
|
|
24722
24783
|
var DAY_MS = 864e5;
|
|
24723
24784
|
var TITLE_MAX = 160;
|
|
24785
|
+
/** Pipeline event details run to about 120 characters; a mirror may send more. */
|
|
24786
|
+
var DETAIL_MAX = 300;
|
|
24724
24787
|
/** UTC date or date-time: anchored, no nested quantifiers; applied after a length cap of 30. */
|
|
24725
24788
|
var DATE_RE = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?Z)?$/;
|
|
24726
24789
|
/** Milliseconds for a DATE_RE string, or NaN when it does not match or does not exist (2026-02-30). */
|
|
@@ -25018,9 +25081,178 @@ async function searchCves(call, a, now) {
|
|
|
25018
25081
|
items: p.items.map((r) => mcpRow(r, knob))
|
|
25019
25082
|
};
|
|
25020
25083
|
}
|
|
25084
|
+
/** Control, format and lone surrogate characters: no vendor name has them, and JSON escapes each in 6 bytes. */
|
|
25085
|
+
var ODD_CHAR_RE = /[\p{Cc}\p{Cf}\p{Cs}]/u;
|
|
25086
|
+
/** Names as the watchlist keeps them (shared/watch.ts): normalized, deduped, 1 to WATCH_NAME_MAX characters. */
|
|
25087
|
+
function watchNames(raw) {
|
|
25088
|
+
const out = [];
|
|
25089
|
+
for (const s of raw) {
|
|
25090
|
+
const n = normalizeName(s);
|
|
25091
|
+
if (!n || n.length > LIMITS.nameChars) throw new InputError(MCP_MSG.badName(LIMITS.nameChars));
|
|
25092
|
+
if (ODD_CHAR_RE.test(n)) throw new InputError(MCP_MSG.oddName);
|
|
25093
|
+
if (!out.includes(n)) out.push(n);
|
|
25094
|
+
}
|
|
25095
|
+
if (out.length > LIMITS.names) throw new InputError(`names takes at most ${LIMITS.names} names.`);
|
|
25096
|
+
if (Buffer.byteLength(JSON.stringify(out)) > 20480) throw new InputError(MCP_MSG.namesTooLong);
|
|
25097
|
+
return out;
|
|
25098
|
+
}
|
|
25099
|
+
var TIER_RANK = {
|
|
25100
|
+
exploited: 0,
|
|
25101
|
+
likely: 1,
|
|
25102
|
+
watch: 2,
|
|
25103
|
+
quiet: 3
|
|
25104
|
+
};
|
|
25105
|
+
/** Soonest KEV due date first, none last. */
|
|
25106
|
+
var byDue = (a, b) => a === b ? 0 : a === null ? 1 : b === null ? -1 : a.localeCompare(b);
|
|
25107
|
+
/** Most urgent first: tier, then the soonest KEV due date, then score, newest, id. */
|
|
25108
|
+
var byUrgency = (a, b) => TIER_RANK[a.tier] - TIER_RANK[b.tier] || byDue(a.kev_due, b.kev_due) || b.score - a.score || b.published.localeCompare(a.published) || a.id.localeCompare(b.id);
|
|
25109
|
+
async function checkInventory(call, a, now) {
|
|
25110
|
+
const knob = a.knob ?? 50;
|
|
25111
|
+
const names = watchNames(a.names);
|
|
25112
|
+
const tiers = a.tiers?.length ? [...new Set(a.tiers)] : [...TIERS];
|
|
25113
|
+
const want = new Set(tiers);
|
|
25114
|
+
const { rows } = await call.file("index.json", parse.rows);
|
|
25115
|
+
const woke = await call.file("woke.json", parse.woke);
|
|
25116
|
+
const seen = new Set(rows.map((r) => r.id));
|
|
25117
|
+
const tracked = [...rows, ...woke.items.map((i) => i.row).filter((r) => !seen.has(r.id))];
|
|
25118
|
+
const matched = new Map(names.map((n) => [n, []]));
|
|
25119
|
+
for (const r of tracked) {
|
|
25120
|
+
if (!matchesName(names, r.v, r.p)) continue;
|
|
25121
|
+
for (const n of names) if (matchesName([n], r.v, r.p)) matched.get(n).push(r);
|
|
25122
|
+
}
|
|
25123
|
+
const all = names.map((name) => {
|
|
25124
|
+
const rs = matched.get(name);
|
|
25125
|
+
const items = rs.map((r) => {
|
|
25126
|
+
const m = mcpRow(r, knob);
|
|
25127
|
+
return {
|
|
25128
|
+
id: m.id,
|
|
25129
|
+
tier: m.tier,
|
|
25130
|
+
verdict: VERDICT[m.tier],
|
|
25131
|
+
score: m.score,
|
|
25132
|
+
kev_due: m.kev_due,
|
|
25133
|
+
in_kev: m.in_kev,
|
|
25134
|
+
exploited: m.exploited,
|
|
25135
|
+
weaponized: m.weaponized,
|
|
25136
|
+
published: m.published,
|
|
25137
|
+
vendor: m.vendor,
|
|
25138
|
+
product: m.product,
|
|
25139
|
+
title: m.title
|
|
25140
|
+
};
|
|
25141
|
+
}).filter((i) => want.has(i.tier)).sort(byUrgency);
|
|
25142
|
+
const slug = slugify(name);
|
|
25143
|
+
return {
|
|
25144
|
+
name,
|
|
25145
|
+
feed: slug ? `${BRAND.siteUrl}/feeds/v/${slug}.xml` : null,
|
|
25146
|
+
matched: rs.length,
|
|
25147
|
+
items
|
|
25148
|
+
};
|
|
25149
|
+
});
|
|
25150
|
+
const meta = await call.meta();
|
|
25151
|
+
const data = await dataBlock(call, now);
|
|
25152
|
+
const scope = `CVEs published in the ${meta.window.days}-day window (index.json) and old CVEs that woke up (woke.json). A name matches a CVE whose vendor or product equals it, ignoring case and extra spaces. Older CISA KEV CVEs are not listed here: use kev_due or get_verdict.`;
|
|
25153
|
+
const asked = a.per_name ?? 10;
|
|
25154
|
+
const queue = all.flatMap(({ items }, n) => items.slice(0, asked).map((item, k) => ({
|
|
25155
|
+
item,
|
|
25156
|
+
k,
|
|
25157
|
+
n
|
|
25158
|
+
}))).sort((x, y) => byUrgency(x.item, y.item) || x.k - y.k || x.n - y.n);
|
|
25159
|
+
const build = (shown) => {
|
|
25160
|
+
const count = new Array(all.length).fill(0);
|
|
25161
|
+
for (const { n } of queue.slice(0, shown)) count[n]++;
|
|
25162
|
+
return {
|
|
25163
|
+
data,
|
|
25164
|
+
knob,
|
|
25165
|
+
tiers,
|
|
25166
|
+
per_name: asked,
|
|
25167
|
+
note: shown < queue.length ? MCP_MSG.inventoryCut(shown, queue.length) : null,
|
|
25168
|
+
scope,
|
|
25169
|
+
names: all.map(({ name, feed, matched, items }, n) => {
|
|
25170
|
+
const kept = items.slice(0, count[n]);
|
|
25171
|
+
return {
|
|
25172
|
+
name,
|
|
25173
|
+
feed,
|
|
25174
|
+
matched,
|
|
25175
|
+
total: items.length,
|
|
25176
|
+
omitted: items.length - kept.length,
|
|
25177
|
+
no_match: matched === 0,
|
|
25178
|
+
items: kept
|
|
25179
|
+
};
|
|
25180
|
+
})
|
|
25181
|
+
};
|
|
25182
|
+
};
|
|
25183
|
+
const fits = (r) => Buffer.byteLength(JSON.stringify(r)) <= INVENTORY_BUDGET;
|
|
25184
|
+
let out = build(queue.length);
|
|
25185
|
+
if (!fits(out)) {
|
|
25186
|
+
let lo = 0;
|
|
25187
|
+
let hi = queue.length - 1;
|
|
25188
|
+
out = build(0);
|
|
25189
|
+
if (!fits(out)) throw new InputError(MCP_MSG.namesTooLong);
|
|
25190
|
+
while (lo < hi) {
|
|
25191
|
+
const mid = Math.ceil((lo + hi) / 2);
|
|
25192
|
+
const r = build(mid);
|
|
25193
|
+
if (fits(r)) [lo, out] = [mid, r];
|
|
25194
|
+
else hi = mid - 1;
|
|
25195
|
+
}
|
|
25196
|
+
}
|
|
25197
|
+
return out;
|
|
25198
|
+
}
|
|
25199
|
+
/** An event as the agent gets it: only EventItem's fields, upstream text on one line and capped. */
|
|
25200
|
+
function eventOut(e) {
|
|
25201
|
+
return {
|
|
25202
|
+
id: e.id,
|
|
25203
|
+
at: e.at,
|
|
25204
|
+
type: e.type,
|
|
25205
|
+
cve: e.cve,
|
|
25206
|
+
vendor: cut(oneLine(e.vendor), TITLE_MAX),
|
|
25207
|
+
product: cut(oneLine(e.product), TITLE_MAX),
|
|
25208
|
+
tier_before: e.tier_before,
|
|
25209
|
+
tier_after: e.tier_after,
|
|
25210
|
+
score: e.score,
|
|
25211
|
+
title: cut(oneLine(e.title), TITLE_MAX),
|
|
25212
|
+
via: e.via,
|
|
25213
|
+
url: e.url,
|
|
25214
|
+
detail: cut(oneLine(e.detail), DETAIL_MAX),
|
|
25215
|
+
backfill: e.backfill
|
|
25216
|
+
};
|
|
25217
|
+
}
|
|
25218
|
+
async function changesSince(call, a, now) {
|
|
25219
|
+
const sinceMs = dateArg("since", a.since);
|
|
25220
|
+
const after = a.since.length === 10 ? (ms) => ms >= sinceMs : (ms) => ms > sinceMs;
|
|
25221
|
+
const untilMs = a.until === void 0 ? null : dateArg("until", a.until);
|
|
25222
|
+
const names = a.names?.length ? watchNames(a.names) : null;
|
|
25223
|
+
const types = a.types?.length ? [...new Set(a.types)] : null;
|
|
25224
|
+
const ev = await call.file("events.json", parse.events);
|
|
25225
|
+
const genMs = Date.parse(ev.generated_at);
|
|
25226
|
+
const to = new Date(genMs).toISOString();
|
|
25227
|
+
const from = (/* @__PURE__ */ new Date(genMs - ev.days * DAY_MS)).toISOString();
|
|
25228
|
+
if (sinceMs < Date.parse(from)) throw new InputError(MCP_MSG.beforeLog(from, to, ev.days));
|
|
25229
|
+
const want = types && new Set(types);
|
|
25230
|
+
const p = page(ev.items.filter((e) => {
|
|
25231
|
+
const at = Date.parse(e.at);
|
|
25232
|
+
return after(at) && (untilMs === null || at <= untilMs) && (!want || want.has(e.type)) && (!names || matchesName(names, e.vendor, e.product));
|
|
25233
|
+
}).sort((x, y) => Date.parse(y.at) - Date.parse(x.at)), a.offset, a.limit ?? 25);
|
|
25234
|
+
return {
|
|
25235
|
+
data: await dataBlock(call, now),
|
|
25236
|
+
since: new Date(sinceMs).toISOString(),
|
|
25237
|
+
until: untilMs === null ? null : new Date(untilMs).toISOString(),
|
|
25238
|
+
log: {
|
|
25239
|
+
from,
|
|
25240
|
+
to,
|
|
25241
|
+
days: ev.days,
|
|
25242
|
+
previous_at: ev.previous_at ?? null,
|
|
25243
|
+
max_items: ev.max_items,
|
|
25244
|
+
capped: ev.items.length >= ev.max_items
|
|
25245
|
+
},
|
|
25246
|
+
next_since: new Date(untilMs === null ? genMs : Math.min(untilMs, genMs)).toISOString(),
|
|
25247
|
+
names,
|
|
25248
|
+
types,
|
|
25249
|
+
...p,
|
|
25250
|
+
items: p.items.map(eventOut)
|
|
25251
|
+
};
|
|
25252
|
+
}
|
|
25021
25253
|
// mcp/src/server.ts
|
|
25022
25254
|
/**
|
|
25023
|
-
* The MCP server factory: one McpServer with the
|
|
25255
|
+
* The MCP server factory: one McpServer with the read-only tools over a DataClient. It knows
|
|
25024
25256
|
* nothing about transports, so the same factory serves stdio (mcp/src/stdio.ts) and would serve a
|
|
25025
25257
|
* web-standard handler (createMcpHandler) unchanged. Inputs are bounded by zod schemas; every
|
|
25026
25258
|
* failure comes back as a tool result with isError: true, never as a thrown protocol error.
|
|
@@ -25036,8 +25268,10 @@ var tiers = array(_enum(TIERS)).min(1).max(4);
|
|
|
25036
25268
|
var knob = number$1().int().min(30).max(80).optional().describe(`The evidence bar: the minimum score (out of 100) to flag a CVE as likely exploited next (the Likely next tier), 30 to 80. Default 50, as on the site. Exploited CVEs and those with a Metasploit module or Nuclei template pass at any value.`);
|
|
25037
25269
|
var limit = (def) => number$1().int().min(1).max(LIMITS.page).optional().describe(`Items per page, 1 to ${LIMITS.page}. Default ${def}.`);
|
|
25038
25270
|
var offset = number$1().int().min(0).max(LIMITS.offset).optional().describe("Items to skip: next_offset of the previous page.");
|
|
25039
|
-
var
|
|
25271
|
+
var utc = string().max(30).regex(DATE_RE, "expected a UTC date (2026-10-01) or date-time (2026-10-01T06:00Z)").refine((s) => !Number.isNaN(parseUtc(s)), "not a real date");
|
|
25272
|
+
var date = (what) => utc.optional().describe(what);
|
|
25040
25273
|
var cveId = string().min(1).max(32);
|
|
25274
|
+
var names = array(string().min(1).max(LIMITS.nameChars * 2)).min(1).max(LIMITS.names);
|
|
25041
25275
|
var SCHEMAS = {
|
|
25042
25276
|
get_verdict: object({
|
|
25043
25277
|
ids: array(cveId).min(1).max(LIMITS.ids).describe("CVE IDs, e.g. [\"CVE-2026-96951\"]."),
|
|
@@ -25072,6 +25306,20 @@ var SCHEMAS = {
|
|
|
25072
25306
|
knob,
|
|
25073
25307
|
limit: limit(20),
|
|
25074
25308
|
offset
|
|
25309
|
+
}),
|
|
25310
|
+
check_inventory: object({
|
|
25311
|
+
names: names.describe(`Vendor or product names, each up to ${LIMITS.nameChars} characters, e.g. ["fortinet","vmware"].`),
|
|
25312
|
+
tiers: tiers.optional().describe("Default: all four."),
|
|
25313
|
+
knob: knob.describe(`The evidence bar, 30 to 80 (default 50), as in get_verdict.`),
|
|
25314
|
+
per_name: number$1().int().min(1).max(LIMITS.perName).optional().describe(`CVEs per name, 1 to ${LIMITS.perName} (default 10). If the answer would be too large, the least urgent across all names are left out, with a note.`)
|
|
25315
|
+
}),
|
|
25316
|
+
changes_since: object({
|
|
25317
|
+
since: utc.describe("Events after this UTC date-time (next_since of an earlier answer), or from 00:00Z of this date, within the log's 7 days."),
|
|
25318
|
+
until: date("Only events at or before this time. On later pages, pass next_since of the first page."),
|
|
25319
|
+
names: names.optional().describe("Only events whose vendor or product is one of these names."),
|
|
25320
|
+
types: array(_enum(EVENT_TYPES)).min(1).max(EVENT_TYPES.length).optional().describe(`Only these event types: ${EVENT_TYPES.join(", ")}.`),
|
|
25321
|
+
limit: limit(25),
|
|
25322
|
+
offset
|
|
25075
25323
|
})
|
|
25076
25324
|
};
|
|
25077
25325
|
var HANDLERS = {
|
|
@@ -25080,7 +25328,9 @@ var HANDLERS = {
|
|
|
25080
25328
|
kev_due: kevDue,
|
|
25081
25329
|
woke_up: wokeUp,
|
|
25082
25330
|
receipts,
|
|
25083
|
-
search_cves: searchCves
|
|
25331
|
+
search_cves: searchCves,
|
|
25332
|
+
check_inventory: checkInventory,
|
|
25333
|
+
changes_since: changesSince
|
|
25084
25334
|
};
|
|
25085
25335
|
/** structuredContent plus the same JSON as one text block (spec: SHOULD), or an isError text. */
|
|
25086
25336
|
function answer(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cverdict-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Read-only MCP server for CVErdict: CVE verdicts, scores and evidence links for AI agents, from open CISA KEV, EPSS and exploit data.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"mcpName": "io.github.markusweldon/cverdict",
|