saktum 0.4.1 → 0.5.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/README.md +11 -1
- package/package.json +1 -1
- package/saktum.mjs +211 -6
package/README.md
CHANGED
|
@@ -82,6 +82,16 @@ with an honest error to the agent. Receipts follow Saktum's receipt contract and
|
|
|
82
82
|
Preview limits: local (stdio) servers; receipts are signed by the agent side (bilateral receipts, co-signed by the
|
|
83
83
|
server side, come with the Saktum gateway).
|
|
84
84
|
|
|
85
|
+
## Passports: trust you can see
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
npx saktum passport -- npx -y your-mcp-server # MCP Server Passport: identity, tools, trust, maturity
|
|
89
|
+
npx saktum passport --agent agent-mandate.json --receipts receipts.jsonl # Agent Passport: mandate and the path of its calls
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Every server recorded in the trust ledger gets a public passport page and a place in the
|
|
93
|
+
[passport gallery](https://soodhere.github.io/saktum-index/passports/).
|
|
94
|
+
|
|
85
95
|
## The trust ledger: Certificate Transparency for AI agent tools
|
|
86
96
|
|
|
87
97
|
Providers publish signed attestations to a **public, append-only, hash-chained ledger**; anyone can verify every
|
|
@@ -145,7 +155,7 @@ servers not on your allowlist, and the weakest grades. Configured secrets are ne
|
|
|
145
155
|
|
|
146
156
|
```yaml
|
|
147
157
|
- uses: actions/checkout@v4
|
|
148
|
-
- uses: soodhere/saktum-check@v0.
|
|
158
|
+
- uses: soodhere/saktum-check@v0.5.1
|
|
149
159
|
with:
|
|
150
160
|
target: "-- node build/index.js" # or an https URL
|
|
151
161
|
args: "--active --tests saktum.tests.yaml" # optional; --active only for your own server
|
package/package.json
CHANGED
package/saktum.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Saktum Check 0.
|
|
2
|
+
// Saktum Check 0.5.1 (private beta). Licensed Apache-2.0; bundled dependencies keep their own licences.
|
|
3
3
|
import { createRequire as __saktumCreateRequire } from "node:module";
|
|
4
4
|
const require = __saktumCreateRequire(import.meta.url);
|
|
5
5
|
var __create = Object.create;
|
|
@@ -33395,7 +33395,7 @@ async function connect(target) {
|
|
|
33395
33395
|
async listTools() {
|
|
33396
33396
|
const tools = [];
|
|
33397
33397
|
let cursor;
|
|
33398
|
-
for (let
|
|
33398
|
+
for (let page2 = 0; page2 < 50; page2++) {
|
|
33399
33399
|
const res = await client.request({ method: "tools/list", params: cursor ? { cursor } : {} }, PASS_THROUGH, { timeout: LIMITS.requestTimeoutMs });
|
|
33400
33400
|
guardSize(res, "tools/list response");
|
|
33401
33401
|
if (!res || !Array.isArray(res.tools))
|
|
@@ -33511,7 +33511,7 @@ var init_dist3 = __esm({
|
|
|
33511
33511
|
init_stdio2();
|
|
33512
33512
|
init_streamableHttp();
|
|
33513
33513
|
init_types2();
|
|
33514
|
-
USER_AGENT = "saktum-check/0.
|
|
33514
|
+
USER_AGENT = "saktum-check/0.5.1 (+https://saktum.dev/check)";
|
|
33515
33515
|
LIMITS = { requestTimeoutMs: 1e4, connectTimeoutMs: 6e4, maxResponseChars: 5e6 };
|
|
33516
33516
|
LimitError = class extends Error {
|
|
33517
33517
|
};
|
|
@@ -33549,7 +33549,7 @@ var init_dist3 = __esm({
|
|
|
33549
33549
|
jsonrpc: "2.0",
|
|
33550
33550
|
id: 1,
|
|
33551
33551
|
method: "initialize",
|
|
33552
|
-
params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.
|
|
33552
|
+
params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.5.1" } }
|
|
33553
33553
|
});
|
|
33554
33554
|
}
|
|
33555
33555
|
});
|
|
@@ -34862,7 +34862,7 @@ var init_engine = __esm({
|
|
|
34862
34862
|
init_runner();
|
|
34863
34863
|
init_safe();
|
|
34864
34864
|
init_scoring();
|
|
34865
|
-
ENGINE_VERSION = "0.
|
|
34865
|
+
ENGINE_VERSION = "0.5.1";
|
|
34866
34866
|
UNKNOWN_TOOL = "saktum_trust_check_no_such_tool";
|
|
34867
34867
|
INVALID_TOKEN = "saktum-check-deliberately-invalid-token";
|
|
34868
34868
|
baseOf = (pack, check) => ({
|
|
@@ -35520,6 +35520,132 @@ var init_dist4 = __esm({
|
|
|
35520
35520
|
}
|
|
35521
35521
|
});
|
|
35522
35522
|
|
|
35523
|
+
// packages/report/dist/passport.js
|
|
35524
|
+
function levelFromResult(r) {
|
|
35525
|
+
if (!r.grade || !(r.target.toolCount ?? 0))
|
|
35526
|
+
return 0;
|
|
35527
|
+
const failed = (pack) => r.findings.some((f) => f.pack === pack && f.status === "fail" && f.scored && !f.suppressed);
|
|
35528
|
+
if (failed("conformance"))
|
|
35529
|
+
return 1;
|
|
35530
|
+
if (failed("security"))
|
|
35531
|
+
return 2;
|
|
35532
|
+
return (r.readiness?.score ?? 0) >= 90 ? 4 : 3;
|
|
35533
|
+
}
|
|
35534
|
+
function renderServerPassport(r, tools, o = {}) {
|
|
35535
|
+
const name = String(r.target.serverInfo?.["name"] ?? r.target.description), version2 = String(r.target.serverInfo?.["version"] ?? "");
|
|
35536
|
+
const lvl = levelFromResult(r), g = r.grade ?? "-";
|
|
35537
|
+
const caps = r.capabilities?.capabilities ?? [];
|
|
35538
|
+
const rows = tools.slice(0, 60).map((t) => {
|
|
35539
|
+
const req = (t.inputSchema?.required ?? []).join(", ");
|
|
35540
|
+
return `<tr><td><code>${esc2(t.name)}</code><br><small>${esc2((t.description ?? "").split(/(?<=[.!?])\s/)[0].slice(0, 140))}</small></td><td>${esc2(effect(t))}</td><td>${t.outputSchema ? "yes" : "no"}</td><td>${esc2(req || "none")}</td></tr>`;
|
|
35541
|
+
}).join("");
|
|
35542
|
+
const body = `<div class="card"><div class="top"><div class="seal" style="background:${GRADE_COLOUR[g] ?? "#757575"}">${esc2(g)}</div>
|
|
35543
|
+
<div><small>MCP SERVER PASSPORT</small><h1>${esc2(name)} ${esc2(version2)}</h1><div class="muted">${esc2(r.target.transport)} \xB7 protocol ${esc2(r.target.protocolVersion ?? "unknown")} \xB7 ${esc2(String(r.target.toolCount ?? tools.length))} tools</div></div></div>
|
|
35544
|
+
<div class="chips">${chip("Trust", r.grade, GRADE_COLOUR[g])}${chip("Agent readiness", r.readiness?.grade, GRADE_COLOUR[r.readiness?.grade ?? ""])}${chip("Context", `${(r.readiness?.contextTokens ?? 0).toLocaleString("en-US")} tokens/turn`)}${chip("Assurance", r.assuranceLevel ?? "L1")}${o.ledgerEntry ? chip("Ledger entry", `#${o.ledgerEntry}`) : ""}</div></div>
|
|
35545
|
+
<div class="card"><h2>Maturity</h2>${levelBar(lvl, lvl === 4 ? "L5 also needs supply-chain evidence (provenance, no install scripts)" : void 0)}</div>
|
|
35546
|
+
<div class="card"><h2>What it can do</h2>${caps.length ? `<div class="chips">${caps.map((c) => chip(c.basis, c.label)).join("")}</div>` : `<p class="muted">No notable capabilities inferred.</p>`}${r.capabilities?.lethalTrifecta ? `<p><b>Note:</b> combines private data, untrusted content and an outbound channel.</p>` : ""}</div>
|
|
35547
|
+
<div class="card"><h2>Interface</h2>${tools.length ? `<div class="wrap"><table><tr><th>Tool</th><th>Effect</th><th>Output schema</th><th>Required inputs</th></tr>${rows}</table></div>${tools.length > 60 ? `<p class="muted">First 60 of ${tools.length} tools.</p>` : ""}` : `<p class="muted">Tool list not included.</p>`}</div>
|
|
35548
|
+
<div class="card"><h2>Verify this passport</h2><p>Generated by Saktum Check ${esc2(r.tool.version)} on ${esc2(r.run.startedAt.slice(0, 10))} from a signed result${r.signature?.kid ? ` (signer <code>${esc2(r.signature.kid)}</code>)` : ""}; tool fingerprint <code>${esc2(r.target.toolsFingerprint ?? "-")}</code>. Check it yourself: <code>npx saktum verify saktum-report.json</code>${o.ledgerEntry ? ` and <code>npx saktum ledger find "${esc2(name)}"</code>` : ""}.</p><p class="muted">Self-tested (L1) unless stated otherwise. A passport describes these exact tools at that time; any tool change needs a new one.</p></div>`;
|
|
35549
|
+
return page(`${name}: MCP Server Passport`, body);
|
|
35550
|
+
}
|
|
35551
|
+
function renderAgentPassport(m, valid, receipts) {
|
|
35552
|
+
const s = receipts?.summary;
|
|
35553
|
+
const steps = (receipts?.timeline ?? []).slice(0, 80).map((t) => `<span class="step ${t.outcome === "deny" ? "deny" : t.status === "ok" ? "ok" : "err"}${t.repeated ? " rep" : ""}" title="${esc2(t.outcome)} \xB7 ${esc2(t.status)}">${t.outcome === "deny" ? "\u26D4" : t.status === "ok" ? "\u2713" : "!"} ${esc2(t.tool)}</span>`).join('<span class="muted">\u2192</span>');
|
|
35554
|
+
const body = `<div class="card"><div class="top"><div class="seal" style="background:${valid.ok ? "#5a3fc0" : "#c62828"}">AI</div>
|
|
35555
|
+
<div><small>AGENT PASSPORT</small><h1>${esc2(m.agent.name)}</h1><div class="muted">acts for ${esc2(m.owner.name ?? m.owner.id)}${m.purpose ? ` \xB7 ${esc2(m.purpose)}` : ""}</div></div></div>
|
|
35556
|
+
<div class="chips">${chip("Mandate", valid.ok ? "valid" : "not valid", valid.ok ? "#2e7d32" : "#c62828")}${chip("Expires", m.expires)}${chip("Destructive actions", m.allow.destructive ? "allowed" : "not allowed")}${s ? chip("Receipts", receipts.verified ? "verified" : "DO NOT verify", receipts.verified ? "#2e7d32" : "#c62828") : ""}</div>${valid.ok ? "" : `<p><b>${esc2(valid.reason)}</b></p>`}</div>
|
|
35557
|
+
<div class="card"><h2>Mandate</h2><div class="grid"><div class="kv"><small>Servers</small><b>${esc2(m.allow.servers?.join(", ") ?? "any")}</b></div><div class="kv"><small>Tools</small><b>${esc2(m.allow.tools?.join(", ") ?? "any")}</b></div><div class="kv"><small>Issued</small><b>${esc2(m.issuedAt.slice(0, 10))}</b></div></div>
|
|
35558
|
+
<p class="muted">Agent identity <code>${esc2(m.agent.id)}</code>, signed by its owner <code>${esc2(m.owner.id)}</code>.</p></div>
|
|
35559
|
+
${s ? `<div class="card"><h2>What it did</h2><div class="grid"><div class="kv"><small>Tool calls</small><b>${s.calls}</b></div><div class="kv"><small>Blocked</small><b>${s.denied}</b></div><div class="kv"><small>Errors</small><b>${s.errors}</b></div><div class="kv"><small>Destructive actions</small><b>${s.destructiveAllowed}</b></div></div>
|
|
35560
|
+
${s.repeatedIdenticalCalls.length ? `<p><b>Repeated identical calls:</b> ${s.repeatedIdenticalCalls.map((x) => `${esc2(x.call)} \xD7${x.times}`).join(", ")} (possible retry storm; highlighted below).</p>` : ""}
|
|
35561
|
+
<h2 style="margin-top:14px">The path, not the answer</h2><div class="timeline">${steps}</div><p class="muted">${esc2(s.from?.slice(0, 19).replace("T", " ") ?? "")} to ${esc2(s.to?.slice(0, 19).replace("T", " ") ?? "")} \xB7 ${esc2(s.servers.join(", "))}. Each step is a signed, hash-chained receipt; arguments are stored only as digests.</p></div>` : ""}
|
|
35562
|
+
<div class="card"><h2>Verify</h2><p><code>npx saktum agent verify agent-mandate.json</code> \xB7 <code>npx saktum receipts verify</code></p><p class="muted">Preview: receipts are signed by the agent side; the Saktum gateway adds the server side's signature.</p></div>`;
|
|
35563
|
+
return page(`${m.agent.name}: Agent Passport`, body);
|
|
35564
|
+
}
|
|
35565
|
+
function renderLedgerPassport(e) {
|
|
35566
|
+
const c = e.attestation.claims, g = c.trustGrade ?? "-";
|
|
35567
|
+
const body = `<div class="card"><div class="top"><div class="seal" style="background:${GRADE_COLOUR[g] ?? "#757575"}">${esc2(g)}</div><div><small>MCP SERVER PASSPORT \xB7 TRUST LEDGER ENTRY #${e.seq}</small><h1>${esc2(e.subject.server)} ${esc2(e.subject.version ?? "")}</h1>
|
|
35568
|
+
<div class="muted">${esc2(e.attestation.subject.transport)} \xB7 ${esc2(String(e.attestation.subject.toolCount ?? "?"))} tools \xB7 checked ${esc2(e.attestation.checkedAt.slice(0, 10))} with ${esc2(e.attestation.checkedWith)}</div></div></div>
|
|
35569
|
+
<div class="chips">${chip("Trust", c.trustGrade, GRADE_COLOUR[g])}${chip("Agent readiness", c.readinessGrade, GRADE_COLOUR[c.readinessGrade ?? ""])}${chip("Assurance", c.assuranceLevel)}${chip("Recorded", e.recordedAt.slice(0, 10))}</div></div>
|
|
35570
|
+
<div class="card"><h2>Maturity evidence</h2>${levelBar(evidenceLevel(c.evidence))}</div>
|
|
35571
|
+
<div class="card"><h2>Verify</h2><p>Signed by <code>${esc2(e.signer)}</code>; tools fingerprint <code>${esc2(e.subject.toolsFingerprint ?? "-")}</code>.</p><p><code>npx saktum ledger verify</code> \xB7 <code>npx saktum ledger find "${esc2(e.subject.server)}"</code></p><p class="muted">A signed claim by the server's publisher (assurance ${esc2(c.assuranceLevel)}; L1 = self-tested). It describes the tools matching the fingerprint at that time.</p></div>
|
|
35572
|
+
<p class="muted"><a href="index.html">All passports</a> \xB7 <a href="../index.html">State of MCP Trust</a></p>`;
|
|
35573
|
+
return page(`${e.subject.server}: MCP Server Passport`, body);
|
|
35574
|
+
}
|
|
35575
|
+
function renderPassportGallery(entries) {
|
|
35576
|
+
const latest = /* @__PURE__ */ new Map();
|
|
35577
|
+
for (const e of entries)
|
|
35578
|
+
latest.set(e.subject.server, e);
|
|
35579
|
+
const cards = [...latest.values()].sort((a, b) => b.seq - a.seq).map((e) => {
|
|
35580
|
+
const g = e.attestation.claims.trustGrade ?? "-";
|
|
35581
|
+
return `<a class="card" style="display:flex;gap:12px;align-items:center;text-decoration:none;color:inherit" href="${passportSlug(e.subject.server)}.html"><div class="seal" style="width:44px;height:44px;font-size:16px;background:${GRADE_COLOUR[g] ?? "#757575"}">${esc2(g)}</div><div><b>${esc2(e.subject.server)}</b> <span class="muted">${esc2(e.subject.version ?? "")}</span><br><small>readiness ${esc2(e.attestation.claims.readinessGrade ?? "-")} \xB7 L${evidenceLevel(e.attestation.claims.evidence)} evidence \xB7 entry #${e.seq}</small></div></a>`;
|
|
35582
|
+
}).join("");
|
|
35583
|
+
return page("MCP Server Passports: the Saktum trust ledger", `<div class="card"><small>SAKTUM TRUST LEDGER</small><h1>MCP Server Passports</h1><p class="muted">Servers whose publishers recorded a signed Saktum attestation in the public, append-only ledger. Anyone can verify every entry: <code>npx saktum ledger verify</code>. Add yours: <code>npx saktum attest saktum-report.json --publish</code>.</p></div>${cards || `<p class="muted">No entries yet.</p>`}`);
|
|
35584
|
+
}
|
|
35585
|
+
function renderAssessment(org, f, receipts = []) {
|
|
35586
|
+
const risky = /* @__PURE__ */ new Set(["code-execution", "money", "sends-messages", "writes-or-deletes", "reads-private-data"]);
|
|
35587
|
+
const caps = ["code-execution", "money", "sends-messages", "writes-or-deletes", "reads-private-data", "network", "filesystem", "untrusted-content"];
|
|
35588
|
+
const grades = ["A", "B", "C", "D", "F", "-"];
|
|
35589
|
+
const heat = caps.map((c) => `<tr><td>${esc2(c)}</td>${grades.map((g) => {
|
|
35590
|
+
const n = f.servers.filter((s) => s.capabilities.includes(c) && (s.trustGrade ?? "-") === g).length;
|
|
35591
|
+
const hot = n && risky.has(c) && "CDF-".includes(g);
|
|
35592
|
+
return `<td style="text-align:center;${n ? `background:${hot ? "rgba(198,40,40,.18)" : "rgba(90,63,192,.10)"}` : ""}">${n || ""}</td>`;
|
|
35593
|
+
}).join("")}</tr>`).join("");
|
|
35594
|
+
const top = f.servers.filter((s) => s.verdict && !s.verdict.compliant || !s.trustGrade || s.capabilities.some((c) => risky.has(c)) && "CDF".includes(s.readinessGrade ?? "F")).slice(0, 12).map((s) => `<tr><td><b>${esc2(s.name)}</b></td><td>${s.machines}</td><td>${esc2(s.trustGrade ?? "not assessed")} / ${esc2(s.readinessGrade ?? "-")}</td><td>${esc2(s.verdict?.violations.filter((v) => !v.excepted).map((v) => v.message).join("; ") || (s.trustGrade ? "risky capabilities with weak agent readiness" : "could not be assessed"))}</td></tr>`).join("");
|
|
35595
|
+
const tokens = f.servers.reduce((a, s) => a + s.tokens, 0);
|
|
35596
|
+
const rec = [];
|
|
35597
|
+
if (f.nonCompliant)
|
|
35598
|
+
rec.push(`Resolve or formally except the ${f.nonCompliant} server(s) that violate policy; enforce the policy in CI (Saktum Action, policy input).`);
|
|
35599
|
+
if (f.unassessed)
|
|
35600
|
+
rec.push(`Investigate the ${f.unassessed} server(s) that could not be assessed: unknown servers are the riskiest.`);
|
|
35601
|
+
if (f.servers.some((s) => s.capabilities.includes("money") || s.capabilities.includes("code-execution")))
|
|
35602
|
+
rec.push("Put servers that move money or run code behind agent mandates with enforcement, and keep receipts for every call.");
|
|
35603
|
+
rec.push("Build an allowlist from approved results for your MCP firewall or gateway, pinned to tool fingerprints; re-check on every change.");
|
|
35604
|
+
if (tokens > 5e4)
|
|
35605
|
+
rec.push(`Tool definitions cost ${tokens.toLocaleString("en-US")} tokens per turn across distinct servers: remove duplicates and unused servers.`);
|
|
35606
|
+
const rc = receipts.map((r) => `<tr><td><b>${esc2(r.agent)}</b></td><td>${r.summary.calls}</td><td>${r.summary.denied}</td><td>${r.summary.destructiveAllowed}</td><td>${esc2(r.summary.repeatedIdenticalCalls.map((x) => `${x.call} \xD7${x.times}`).join(", ") || "none")}</td><td>${r.verified ? "verified" : "NOT verified"}</td></tr>`).join("");
|
|
35607
|
+
const body = `<div class="card"><small>MCP TRUST ASSESSMENT</small><h1>${esc2(org)}</h1><p class="muted">Prepared with Saktum on ${esc2(f.generatedAt.slice(0, 10))}${f.policyName ? ` against policy \u201C${esc2(f.policyName)}\u201D` : ""}. Evidence collected inside ${esc2(org)}'s environment; nothing was sent to Saktum.</p>
|
|
35608
|
+
<div class="grid"><div class="kv"><small>Machines</small><b>${f.machines}</b></div><div class="kv"><small>Distinct MCP servers</small><b>${f.servers.length}</b></div><div class="kv"><small>Violate policy</small><b>${f.nonCompliant}</b></div><div class="kv"><small>Not assessable</small><b>${f.unassessed}</b></div></div></div>
|
|
35609
|
+
<div class="card"><h2>Risk heat map: capability by trust grade</h2><div class="wrap"><table><tr><th>Capability</th>${grades.map((g) => `<th style="text-align:center">${g === "-" ? "n/a" : g}</th>`).join("")}</tr>${heat}</table></div><small>Red cells: risky capabilities on servers graded C or below, or not assessed.</small></div>
|
|
35610
|
+
<div class="card"><h2>Servers needing attention</h2>${top ? `<div class="wrap"><table><tr><th>Server</th><th>Machines</th><th>Trust / readiness</th><th>Why</th></tr>${top}</table></div>` : `<p>None: every assessed server meets the policy.</p>`}</div>
|
|
35611
|
+
${rc ? `<div class="card"><h2>Agent receipts</h2><div class="wrap"><table><tr><th>Agent</th><th>Calls</th><th>Blocked</th><th>Destructive</th><th>Repeated calls</th><th>Receipts</th></tr>${rc}</table></div></div>` : ""}
|
|
35612
|
+
<div class="card"><h2>Recommendations</h2><ol>${rec.map((x) => `<li>${esc2(x)}</li>`).join("")}</ol></div>
|
|
35613
|
+
<div class="card"><h2>Next steps</h2><p>1. Agree the policy and exceptions with security. 2. Enforce it in CI on MCP repositories. 3. Deploy the allowlist to the MCP firewall or gateway. 4. Extend agent mandates and receipts to production agent workflows with the Saktum gateway (design partnership).</p><p class="muted">Findings describe the servers and agents at the time of assessment and are not a guarantee of security.</p></div>`;
|
|
35614
|
+
return page(`MCP Trust Assessment: ${org}`, body);
|
|
35615
|
+
}
|
|
35616
|
+
var esc2, GRADE_COLOUR, chip, STYLE, page, levelBar, effect, passportSlug, evidenceLevel;
|
|
35617
|
+
var init_passport = __esm({
|
|
35618
|
+
"packages/report/dist/passport.js"() {
|
|
35619
|
+
"use strict";
|
|
35620
|
+
esc2 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
35621
|
+
GRADE_COLOUR = { A: "#2e7d32", B: "#558b2f", C: "#b7791f", D: "#c05621", F: "#c62828" };
|
|
35622
|
+
chip = (label, value, colour) => `<span class="chip" style="${colour ? `background:${colour};color:#fff` : ""}"><small>${esc2(label)}</small> <b>${esc2(value ?? "-")}</b></span>`;
|
|
35623
|
+
STYLE = `:root{--bg:#f7f7fb;--card:#fff;--ink:#16161d;--muted:#5b5b6e;--line:#e2e2ea;--accent:#5a3fc0;--soft:#f0eff7}
|
|
35624
|
+
@media (prefers-color-scheme:dark){:root{--bg:#101016;--card:#191922;--ink:#ededf5;--muted:#a3a3b8;--line:#2c2c3a;--accent:#8c78e6;--soft:#21212d;color-scheme:dark}}
|
|
35625
|
+
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
|
|
35626
|
+
main{max-width:920px;margin:0 auto;padding:24px 16px 48px}.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:22px;margin-bottom:16px}
|
|
35627
|
+
.top{display:flex;gap:16px;align-items:center;flex-wrap:wrap}.seal{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:800;font-size:22px;flex:none}
|
|
35628
|
+
h1{font-size:24px;margin:0}h2{font-size:16px;margin:0 0 10px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.muted{color:var(--muted)}small{color:var(--muted)}
|
|
35629
|
+
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}.chip{border:1px solid var(--line);border-radius:999px;padding:4px 10px;background:var(--soft);font-size:13px}
|
|
35630
|
+
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}.kv{background:var(--soft);border-radius:10px;padding:10px}.kv b{display:block;font-size:20px}
|
|
35631
|
+
.wrap{overflow-x:auto}table{border-collapse:collapse;width:100%}td,th{border-top:1px solid var(--line);padding:7px 6px;text-align:left;vertical-align:top;font-size:14px}
|
|
35632
|
+
code{font:12.5px ui-monospace,Menlo,Consolas,monospace;word-break:break-all}.levels{display:flex;gap:4px}.lv{flex:1;text-align:center;padding:6px 0;border-radius:6px;background:var(--soft);font-weight:700;font-size:13px}
|
|
35633
|
+
.lv.on{background:var(--accent);color:#fff}.timeline{display:flex;flex-wrap:wrap;gap:6px}.step{border-radius:8px;padding:5px 8px;font-size:12.5px;border:1px solid var(--line)}
|
|
35634
|
+
.ok{background:#e8f5e9;color:#1b5e20}.deny{background:#ffebee;color:#b71c1c}.err{background:#fff8e1;color:#7a5a00}.rep{outline:2px solid #b7791f}
|
|
35635
|
+
@media (prefers-color-scheme:dark){.ok{background:#1b3a1e;color:#a5d6a7}.deny{background:#3b1616;color:#ef9a9a}.err{background:#3a3214;color:#ffe082}}
|
|
35636
|
+
@media print{body{background:#fff}.card{break-inside:avoid}}`;
|
|
35637
|
+
page = (title, body) => `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><title>${esc2(title)}</title><style>${STYLE}</style></head><body><main>${body}</main></body></html>
|
|
35638
|
+
`;
|
|
35639
|
+
levelBar = (level, note) => `<div class="levels">${[1, 2, 3, 4, 5].map((l) => `<div class="lv${l <= level ? " on" : ""}">L${l}</div>`).join("")}</div><small>${esc2(["", "Responds", "Conformant", "Safe by default", "Agent-ready", "Assured"][level] ?? "Not assessed")}${note ? ` \xB7 ${esc2(note)}` : ""}</small>`;
|
|
35640
|
+
effect = (t) => {
|
|
35641
|
+
const a = t.annotations ?? {};
|
|
35642
|
+
return a.readOnlyHint === true ? "reads" : a.destructiveHint === true ? "can destroy" : a.readOnlyHint === false ? "changes data" : "not declared";
|
|
35643
|
+
};
|
|
35644
|
+
passportSlug = (server) => server.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80) || "server";
|
|
35645
|
+
evidenceLevel = (e) => e.agentReady ? 4 : e.safeByDefault ? 3 : e.conformant ? 2 : e.responds ? 1 : 0;
|
|
35646
|
+
}
|
|
35647
|
+
});
|
|
35648
|
+
|
|
35523
35649
|
// packages/report/dist/index.js
|
|
35524
35650
|
function owaspCoverage(r) {
|
|
35525
35651
|
return OWASP_MCP.map(([id, name]) => {
|
|
@@ -35786,6 +35912,7 @@ var init_dist5 = __esm({
|
|
|
35786
35912
|
"packages/report/dist/index.js"() {
|
|
35787
35913
|
"use strict";
|
|
35788
35914
|
init_dist4();
|
|
35915
|
+
init_passport();
|
|
35789
35916
|
SEV_ORDER = ["critical", "high", "medium", "low", "info"];
|
|
35790
35917
|
rank = (s) => SEV_ORDER.indexOf(s);
|
|
35791
35918
|
SYMBOL = { fail: "\u2717 FAIL", inconclusive: "! INCONCLUSIVE", pass: "\u2713 PASS", skipped: "- SKIPPED", info: "i INFO" };
|
|
@@ -36079,7 +36206,18 @@ async function runProxy(o) {
|
|
|
36079
36206
|
}
|
|
36080
36207
|
child.stdin.write(line + "\n");
|
|
36081
36208
|
});
|
|
36082
|
-
process.stdin.on("end", () =>
|
|
36209
|
+
process.stdin.on("end", () => {
|
|
36210
|
+
child.stdin.end();
|
|
36211
|
+
setTimeout(() => {
|
|
36212
|
+
if (child.exitCode === null)
|
|
36213
|
+
child.kill("SIGTERM");
|
|
36214
|
+
}, 2e3).unref();
|
|
36215
|
+
});
|
|
36216
|
+
for (const sig of ["SIGINT", "SIGTERM"])
|
|
36217
|
+
process.once(sig, () => {
|
|
36218
|
+
if (child.exitCode === null)
|
|
36219
|
+
child.kill("SIGTERM");
|
|
36220
|
+
});
|
|
36083
36221
|
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
36084
36222
|
let msg;
|
|
36085
36223
|
try {
|
|
@@ -37566,6 +37704,22 @@ ${r.errors.slice(0, 10).map((e) => ` ${sanitizeText(e, 200)}`).join("\n")}
|
|
|
37566
37704
|
process.stdout.write("No entries found.\n");
|
|
37567
37705
|
for (const e of hits)
|
|
37568
37706
|
process.stdout.write(`#${e.seq} ${sanitizeText(e.subject.server, 80)} ${sanitizeText(e.subject.version ?? "", 20)} trust ${e.attestation.claims.trustGrade ?? "-"} \xB7 readiness ${e.attestation.claims.readinessGrade ?? "-"} \xB7 ${e.attestation.claims.assuranceLevel} \xB7 checked ${e.attestation.checkedAt.slice(0, 10)} \xB7 signed by ${e.signer.slice(0, 24)}\u2026
|
|
37707
|
+
`);
|
|
37708
|
+
});
|
|
37709
|
+
ledger.command("pages").description("Generate public passport pages (one per server) and a gallery from a ledger (used by the ledger bot)").argument("[source]", "ledger file or https URL", DEFAULT_LEDGER_URL).option("--out <dir>", "output folder", "passports").action(async (src, o) => {
|
|
37710
|
+
const entries = parseLedger(await readLedgerText(src));
|
|
37711
|
+
const v = verifyLedger(entries);
|
|
37712
|
+
if (!v.ok)
|
|
37713
|
+
throw new Error(`The ledger does not verify: ${v.errors[0]}`);
|
|
37714
|
+
const { mkdirSync: mkdirSync4 } = await import("node:fs");
|
|
37715
|
+
mkdirSync4(o.out, { recursive: true });
|
|
37716
|
+
const latest = /* @__PURE__ */ new Map();
|
|
37717
|
+
for (const e of entries)
|
|
37718
|
+
latest.set(e.subject.server, e);
|
|
37719
|
+
for (const e of latest.values())
|
|
37720
|
+
writeFileSync3(`${o.out}/${passportSlug(e.subject.server)}.html`, renderLedgerPassport(e));
|
|
37721
|
+
writeFileSync3(`${o.out}/index.html`, renderPassportGallery(entries));
|
|
37722
|
+
process.stdout.write(`Wrote ${latest.size} passport page(s) and the gallery to ${sanitizeText(o.out)}.
|
|
37569
37723
|
`);
|
|
37570
37724
|
});
|
|
37571
37725
|
ledger.command("append").description("Append a signed attestation to a ledger file after verifying it (used by the ledger bot)").argument("<input>", "attestation JSON, or a text file (such as an issue body) containing it").requiredOption("--ledger <file>", "ledger file to append to").option("--issue <n>", "issue number that requested it").action((input, o) => {
|
|
@@ -37636,6 +37790,57 @@ ${r.errors.slice(0, 10).map((e) => ` ${e}`).join("\n")}
|
|
|
37636
37790
|
denied ${s.denied} \xB7 errors ${s.errors} \xB7 destructive actions allowed ${s.destructiveAllowed}${s.medianLatencyMs !== void 0 ? ` \xB7 median ${s.medianLatencyMs} ms` : ""}
|
|
37637
37791
|
` + s.byTool.map((t) => ` ${t.tool.padEnd(30)} ${t.count}`).join("\n") + "\n" + (s.repeatedIdenticalCalls.length ? ` Repeated identical calls (possible retry storms): ${s.repeatedIdenticalCalls.map((r) => `${r.call} \xD7${r.times}`).join(", ")}
|
|
37638
37792
|
` : "") + ` Order: ${s.order.join(" \u2192 ")}
|
|
37793
|
+
`);
|
|
37794
|
+
});
|
|
37795
|
+
program2.command("passport").description("A visual passport: for an MCP server (checks it first) or, with --agent, for an agent (mandate and receipt timeline)").argument("[target...]", "the server: https URL, or -- <command that starts it>").option("--agent <mandate>", "make an Agent Passport from this mandate instead").option("--receipts <file>", "with --agent: the agent's receipt log, for the timeline").option("--out <file>", "HTML file", "saktum-passport.html").option("--key <path>", "signing key for the server's result").option("--env <KEY=VALUE>", "environment variable for a local server (repeatable)", collect, []).option("--header <Name: value>", "HTTP header for a remote server (repeatable)", collect, []).action(async (parts, o) => {
|
|
37796
|
+
if (o.agent) {
|
|
37797
|
+
const m = JSON.parse(readFileSync7(o.agent, "utf8"));
|
|
37798
|
+
const valid = checkMandate(m);
|
|
37799
|
+
let receipts2;
|
|
37800
|
+
if (o.receipts) {
|
|
37801
|
+
const entries = parseReceiptLog(readFileSync7(o.receipts, "utf8"));
|
|
37802
|
+
const counts = /* @__PURE__ */ new Map();
|
|
37803
|
+
for (const e of entries) {
|
|
37804
|
+
const k = `${e.receipt.envelope.tool}|${e.receipt.envelope.argumentsHash}`;
|
|
37805
|
+
counts.set(k, (counts.get(k) ?? 0) + 1);
|
|
37806
|
+
}
|
|
37807
|
+
receipts2 = {
|
|
37808
|
+
verified: verifyReceiptLog(entries).ok,
|
|
37809
|
+
summary: summariseReceipts(entries),
|
|
37810
|
+
timeline: entries.map((e) => ({ tool: e.receipt.envelope.tool, outcome: e.receipt.outcome, status: e.result.status, repeated: (counts.get(`${e.receipt.envelope.tool}|${e.receipt.envelope.argumentsHash}`) ?? 0) >= 3 }))
|
|
37811
|
+
};
|
|
37812
|
+
}
|
|
37813
|
+
writeFileSync3(o.out, renderAgentPassport(m, valid.ok ? { ok: true } : { ok: false, reason: valid.reason }, receipts2));
|
|
37814
|
+
process.stdout.write(`Wrote the Agent Passport for ${sanitizeText(m.agent.name, 80)} to ${sanitizeText(o.out)}. Open it in a browser.
|
|
37815
|
+
`);
|
|
37816
|
+
return;
|
|
37817
|
+
}
|
|
37818
|
+
if (!parts.length)
|
|
37819
|
+
throw new Error("Give a server (an https URL, or -- <command>), or use --agent <mandate>.");
|
|
37820
|
+
const target = parseTarget(parts);
|
|
37821
|
+
if (target.kind === "stdio" && o.env.length)
|
|
37822
|
+
target.env = parseEnv(o.env);
|
|
37823
|
+
if (target.kind === "streamable-http" && o.header.length)
|
|
37824
|
+
target.headers = parseHeaders(o.header);
|
|
37825
|
+
const packs = existsSync5(bundledPacks) ? loadPackDir(bundledPacks) : loadEmbeddedPacks();
|
|
37826
|
+
let tools = [];
|
|
37827
|
+
const r = await runTrustCheck(target, { packs, onTools: (t) => {
|
|
37828
|
+
tools = t;
|
|
37829
|
+
} });
|
|
37830
|
+
const signed = signDocument(r, loadOrCreateKey(o.key));
|
|
37831
|
+
writeFileSync3(o.out, renderServerPassport(signed, tools));
|
|
37832
|
+
writeFileSync3(o.out.replace(/\.html?$/i, "") + ".json", JSON.stringify(signed, null, 2));
|
|
37833
|
+
process.stdout.write(`Wrote the MCP Server Passport for ${sanitizeText(String(r.target.serverInfo?.["name"] ?? "server"), 80)} to ${sanitizeText(o.out)} (trust ${r.grade ?? "-"}, readiness ${r.readiness?.grade ?? "-"}), and its signed result beside it.
|
|
37834
|
+
`);
|
|
37835
|
+
});
|
|
37836
|
+
program2.command("assess").description("An executive MCP Trust Assessment for an organisation, from a fleet inventory and agent receipts (pilot deliverable)").requiredOption("--fleet <file>", "inventory JSON from saktum fleet --out").option("--org <name>", "organisation name", "Your organisation").option("--receipts <file>", "an agent's receipt log (repeatable)", collect, []).option("--out <file>", "HTML report (print to PDF from a browser)", "saktum-assessment.html").action((o) => {
|
|
37837
|
+
const fleet = JSON.parse(readFileSync7(o.fleet, "utf8"));
|
|
37838
|
+
const rec = o.receipts.map((f) => {
|
|
37839
|
+
const e = parseReceiptLog(readFileSync7(f, "utf8"));
|
|
37840
|
+
return { agent: e[0]?.receipt.envelope.caller.agent?.slice(0, 32) ?? f, summary: summariseReceipts(e), verified: verifyReceiptLog(e).ok };
|
|
37841
|
+
});
|
|
37842
|
+
writeFileSync3(o.out, renderAssessment(o.org, fleet, rec));
|
|
37843
|
+
process.stdout.write(`Wrote the MCP Trust Assessment for ${sanitizeText(o.org, 80)} to ${sanitizeText(o.out)}: ${fleet.servers?.length ?? 0} servers, ${fleet.nonCompliant ?? 0} violating policy. Open it in a browser and print to PDF.
|
|
37639
37844
|
`);
|
|
37640
37845
|
});
|
|
37641
37846
|
program2.command("fleet").description("Merge scan-config results from many machines into one organisation inventory, checked against your policy").argument("<setups...>", "JSON files written by saktum scan-config --out").option("--policy <file>", "your organisation's policy").option("--out <file>", "inventory as JSON").option("--html <file>", "inventory as an HTML page").action(async (files, o) => {
|