altweb-context 1.0.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.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # altweb-context — MCP server for signed context capsules
2
+
3
+ Load ALTWEB capsules into AI agents with **verification before injection**:
4
+ content is returned only when the capsule is signed, the signature verifies,
5
+ and the signer's public key is in your local trust file. Everything else is
6
+ refused with an explicit reason — and the refusal is the default: an empty
7
+ trust file rejects every capsule, signed or not.
8
+
9
+ ## Why
10
+
11
+ The context that steers an agent — instructions, personas, skills, memory —
12
+ is usually plain Markdown with no provenance, so anything that can write it
13
+ can poison it. A capsule is Markdown compiled into a self-contained artifact
14
+ with an ECDSA P-256 signature. This server is the gatekeeper: your agent
15
+ loads only context signed by keys you trust, and refuses the rest at load
16
+ time before any content reaches the model.
17
+
18
+ ## Tools
19
+
20
+ | Tool | What it does |
21
+ |---|---|
22
+ | `load_capsule` | Verify + return markdown content (refuses unsigned / tampered / untrusted). The verified provenance header is separated from the content by markers embedding a random per-load nonce, so content can never imitate its own chain of custody |
23
+ | `verify_capsule` | Provenance report (signed? verified? trusted? encrypted?) without content |
24
+ | `list_trusted_keys` | Show the signers currently trusted |
25
+
26
+ `source` accepts: a `.altweb.html` file path, a raw `.altweb` hash file, a URL
27
+ with `#hash`, a URL to a hosted standalone capsule, or the hash string itself.
28
+
29
+ ## Trust file
30
+
31
+ `~/.altweb/trusted-keys.json` (override with `ALTWEB_TRUST_FILE`):
32
+
33
+ ```json
34
+ {
35
+ "keys": [
36
+ {
37
+ "name": "Alice",
38
+ "publicKey": "<base64url SPKI public key>",
39
+ "fingerprint": "ab:12:cd:34:ef:56:78:90"
40
+ }
41
+ ]
42
+ }
43
+ ```
44
+
45
+ Trust is matched on the **full public key** (the same base64url SPKI string a
46
+ capsule carries in its envelope). The 8-byte fingerprint printed by
47
+ `altweb keygen`/`verify` is a human-readable label only — 64 bits is too
48
+ short to anchor trust — so entries without `publicKey` are never matched.
49
+ The easiest way to trust a signer: attempt `load_capsule` once and copy the
50
+ ready-made entry from the `UNTRUSTED_KEY` refusal message (it includes the
51
+ full public key), or take `publicKey` from the signer's
52
+ `~/.altweb/identity.json`.
53
+
54
+ ## Setup (Claude Code example)
55
+
56
+ ```bash
57
+ claude mcp add altweb-context -- npx -y altweb-context
58
+ ```
59
+
60
+ Or in any MCP client config:
61
+
62
+ ```json
63
+ {
64
+ "mcpServers": {
65
+ "altweb-context": { "command": "npx", "args": ["-y", "altweb-context"] }
66
+ }
67
+ }
68
+ ```
69
+
70
+ From a source checkout instead: `npm run build -w altweb-context`, then point
71
+ `command` at `node packages/mcp/dist/altweb-context.mjs`.
72
+
73
+ ## Guarantees and limits
74
+
75
+ - A valid signature proves **who** authored the capsule and that the bytes are
76
+ intact — it does not make the content safe. Trust decisions stay with you:
77
+ the trust file is the policy.
78
+ - Encrypted capsules need the `password` argument; the signature covers the
79
+ decrypted payload, so verification happens after decryption.