saktum 0.4.0 → 0.5.0

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.
Files changed (3) hide show
  1. package/README.md +11 -1
  2. package/package.json +1 -1
  3. package/saktum.mjs +212 -10
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.4.0
158
+ - uses: soodhere/saktum-check@v0.5.0
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saktum",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Test MCP servers in one command: conformance, sign-in, security (OWASP MCP Top 10), agent experience, context cost and performance.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/saktum.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Saktum Check 0.4.0 (private beta). Licensed Apache-2.0; bundled dependencies keep their own licences.
2
+ // Saktum Check 0.5.0 (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 page = 0; page < 50; page++) {
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.4.0 (+https://saktum.dev/check)";
33514
+ USER_AGENT = "saktum-check/0.5.0 (+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.4.0" } }
33552
+ params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.5.0" } }
33553
33553
  });
33554
33554
  }
33555
33555
  });
@@ -33819,7 +33819,7 @@ var init_leakage = __esm({
33819
33819
  "use strict";
33820
33820
  init_safe();
33821
33821
  SECRET_PATTERNS = [
33822
- { name: "AWS access key", re: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/ },
33822
+ { name: "AWS access key", re: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/, valid: (m) => !/EXAMPLE$/.test(m[0]) },
33823
33823
  { name: "GitHub token", re: /\bgh[pousr]_[A-Za-z0-9]{36,}\b/ },
33824
33824
  { name: "Slack token", re: /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/ },
33825
33825
  { name: "Stripe live key", re: /\b(?:sk|rk)_live_[0-9a-zA-Z]{20,}\b/ },
@@ -33827,7 +33827,14 @@ var init_leakage = __esm({
33827
33827
  { name: "AI provider key", re: /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{32,}\b/ },
33828
33828
  { name: "private key", re: /-----BEGIN (?:RSA |EC |OPENSSH |DSA |ENCRYPTED )?PRIVATE KEY-----/ },
33829
33829
  { name: "JSON Web Token", re: /\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/ },
33830
- { name: "password or secret assignment", re: /\b(?:password|passwd|client_secret|api_secret|secret_key)\b["']?\s*[:=]\s*["']?(?!\{|\$|<|%|x{4})[^\s"',;]{8,}/i }
33830
+ {
33831
+ name: "password or secret assignment",
33832
+ re: /\b(?:password|passwd|client_secret|api_secret|secret_key)\b["']?\s*[:=]\s*["']?(?!\{|\$|<|%|x{4})([^\s"',;]{8,})/i,
33833
+ valid: (m) => {
33834
+ const v = (m[1] ?? "").replace(/[).,;:!?]+$/, "");
33835
+ return v.length >= 8 && /[A-Za-z]/.test(v) && /\d/.test(v) && !/example|placeholder|changeme|your[-_]?|redacted/i.test(v);
33836
+ }
33837
+ }
33831
33838
  ];
33832
33839
  LEAK_PATTERNS = [
33833
33840
  { name: "JavaScript stack trace", re: /\n?\s+at\s+[\w$.<>\[\] ]+\s+\(?(?:file:\/\/)?[\w./\\:-]+:\d+:\d+\)?/ },
@@ -33841,9 +33848,10 @@ var init_leakage = __esm({
33841
33848
  secrets: (ctx) => {
33842
33849
  for (const s of sources(ctx))
33843
33850
  for (const p of SECRET_PATTERNS) {
33844
- const m = s.text.match(p.re);
33845
- if (m)
33846
- return { status: "fail", subject: s.where, message: `Found what looks like ${/^[aeiou]/i.test(p.name) ? "an" : "a"} ${p.name} in ${s.where}. Anyone who can list tools or trigger an error can read it.`, evidence: { excerpt: redact(s.text, m[0]) } };
33851
+ const all = new RegExp(p.re.source, p.re.flags.includes("g") ? p.re.flags : p.re.flags + "g");
33852
+ for (const m of s.text.matchAll(all))
33853
+ if (!p.valid || p.valid(m))
33854
+ return { status: "fail", subject: s.where, message: `Found what looks like ${/^[aeiou]/i.test(p.name) ? "an" : "a"} ${p.name} in ${s.where}. Anyone who can list tools or trigger an error can read it.`, evidence: { excerpt: redact(s.text, m[0]) } };
33847
33855
  }
33848
33856
  return { status: "pass", message: "No secrets found in tool definitions or probe responses." };
33849
33857
  },
@@ -34854,7 +34862,7 @@ var init_engine = __esm({
34854
34862
  init_runner();
34855
34863
  init_safe();
34856
34864
  init_scoring();
34857
- ENGINE_VERSION = "0.4.0";
34865
+ ENGINE_VERSION = "0.5.0";
34858
34866
  UNKNOWN_TOOL = "saktum_trust_check_no_such_tool";
34859
34867
  INVALID_TOKEN = "saktum-check-deliberately-invalid-token";
34860
34868
  baseOf = (pack, check) => ({
@@ -35512,6 +35520,132 @@ var init_dist4 = __esm({
35512
35520
  }
35513
35521
  });
35514
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) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[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
+
35515
35649
  // packages/report/dist/index.js
35516
35650
  function owaspCoverage(r) {
35517
35651
  return OWASP_MCP.map(([id, name]) => {
@@ -35778,6 +35912,7 @@ var init_dist5 = __esm({
35778
35912
  "packages/report/dist/index.js"() {
35779
35913
  "use strict";
35780
35914
  init_dist4();
35915
+ init_passport();
35781
35916
  SEV_ORDER = ["critical", "high", "medium", "low", "info"];
35782
35917
  rank = (s) => SEV_ORDER.indexOf(s);
35783
35918
  SYMBOL = { fail: "\u2717 FAIL", inconclusive: "! INCONCLUSIVE", pass: "\u2713 PASS", skipped: "- SKIPPED", info: "i INFO" };
@@ -37558,6 +37693,22 @@ ${r.errors.slice(0, 10).map((e) => ` ${sanitizeText(e, 200)}`).join("\n")}
37558
37693
  process.stdout.write("No entries found.\n");
37559
37694
  for (const e of hits)
37560
37695
  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
37696
+ `);
37697
+ });
37698
+ 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) => {
37699
+ const entries = parseLedger(await readLedgerText(src));
37700
+ const v = verifyLedger(entries);
37701
+ if (!v.ok)
37702
+ throw new Error(`The ledger does not verify: ${v.errors[0]}`);
37703
+ const { mkdirSync: mkdirSync4 } = await import("node:fs");
37704
+ mkdirSync4(o.out, { recursive: true });
37705
+ const latest = /* @__PURE__ */ new Map();
37706
+ for (const e of entries)
37707
+ latest.set(e.subject.server, e);
37708
+ for (const e of latest.values())
37709
+ writeFileSync3(`${o.out}/${passportSlug(e.subject.server)}.html`, renderLedgerPassport(e));
37710
+ writeFileSync3(`${o.out}/index.html`, renderPassportGallery(entries));
37711
+ process.stdout.write(`Wrote ${latest.size} passport page(s) and the gallery to ${sanitizeText(o.out)}.
37561
37712
  `);
37562
37713
  });
37563
37714
  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) => {
@@ -37628,6 +37779,57 @@ ${r.errors.slice(0, 10).map((e) => ` ${e}`).join("\n")}
37628
37779
  denied ${s.denied} \xB7 errors ${s.errors} \xB7 destructive actions allowed ${s.destructiveAllowed}${s.medianLatencyMs !== void 0 ? ` \xB7 median ${s.medianLatencyMs} ms` : ""}
37629
37780
  ` + 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(", ")}
37630
37781
  ` : "") + ` Order: ${s.order.join(" \u2192 ")}
37782
+ `);
37783
+ });
37784
+ 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) => {
37785
+ if (o.agent) {
37786
+ const m = JSON.parse(readFileSync7(o.agent, "utf8"));
37787
+ const valid = checkMandate(m);
37788
+ let receipts2;
37789
+ if (o.receipts) {
37790
+ const entries = parseReceiptLog(readFileSync7(o.receipts, "utf8"));
37791
+ const counts = /* @__PURE__ */ new Map();
37792
+ for (const e of entries) {
37793
+ const k = `${e.receipt.envelope.tool}|${e.receipt.envelope.argumentsHash}`;
37794
+ counts.set(k, (counts.get(k) ?? 0) + 1);
37795
+ }
37796
+ receipts2 = {
37797
+ verified: verifyReceiptLog(entries).ok,
37798
+ summary: summariseReceipts(entries),
37799
+ 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 }))
37800
+ };
37801
+ }
37802
+ writeFileSync3(o.out, renderAgentPassport(m, valid.ok ? { ok: true } : { ok: false, reason: valid.reason }, receipts2));
37803
+ process.stdout.write(`Wrote the Agent Passport for ${sanitizeText(m.agent.name, 80)} to ${sanitizeText(o.out)}. Open it in a browser.
37804
+ `);
37805
+ return;
37806
+ }
37807
+ if (!parts.length)
37808
+ throw new Error("Give a server (an https URL, or -- <command>), or use --agent <mandate>.");
37809
+ const target = parseTarget(parts);
37810
+ if (target.kind === "stdio" && o.env.length)
37811
+ target.env = parseEnv(o.env);
37812
+ if (target.kind === "streamable-http" && o.header.length)
37813
+ target.headers = parseHeaders(o.header);
37814
+ const packs = existsSync5(bundledPacks) ? loadPackDir(bundledPacks) : loadEmbeddedPacks();
37815
+ let tools = [];
37816
+ const r = await runTrustCheck(target, { packs, onTools: (t) => {
37817
+ tools = t;
37818
+ } });
37819
+ const signed = signDocument(r, loadOrCreateKey(o.key));
37820
+ writeFileSync3(o.out, renderServerPassport(signed, tools));
37821
+ writeFileSync3(o.out.replace(/\.html?$/i, "") + ".json", JSON.stringify(signed, null, 2));
37822
+ 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.
37823
+ `);
37824
+ });
37825
+ 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) => {
37826
+ const fleet = JSON.parse(readFileSync7(o.fleet, "utf8"));
37827
+ const rec = o.receipts.map((f) => {
37828
+ const e = parseReceiptLog(readFileSync7(f, "utf8"));
37829
+ return { agent: e[0]?.receipt.envelope.caller.agent?.slice(0, 32) ?? f, summary: summariseReceipts(e), verified: verifyReceiptLog(e).ok };
37830
+ });
37831
+ writeFileSync3(o.out, renderAssessment(o.org, fleet, rec));
37832
+ 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.
37631
37833
  `);
37632
37834
  });
37633
37835
  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) => {