@agenttrust-sdk/mcp 0.2.6 → 0.3.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.
Files changed (49) hide show
  1. package/dist/embedded-data/devnet-smoke.json +4 -4
  2. package/dist/embedded-docs/architecture.mdx +174 -0
  3. package/dist/embedded-docs/getting-started/quickstart.mdx +79 -56
  4. package/dist/embedded-docs/index.mdx +54 -37
  5. package/dist/embedded-docs/integration-guides/capability-namespaces.mdx +135 -8
  6. package/dist/embedded-docs/integration-guides/custom-attestor.mdx +169 -8
  7. package/dist/embedded-docs/integration-guides/dexter-adapter.mdx +76 -0
  8. package/dist/embedded-docs/integration-guides/facilitator-adapters.mdx +85 -41
  9. package/dist/embedded-docs/integration-guides/pay-sh-adapter.mdx +90 -54
  10. package/dist/embedded-docs/integration-guides/x402-facilitator.mdx +55 -24
  11. package/dist/embedded-docs/mcp/hosted-endpoint.mdx +197 -0
  12. package/dist/embedded-docs/mcp/index.mdx +108 -0
  13. package/dist/embedded-docs/mcp/install.mdx +183 -0
  14. package/dist/embedded-docs/mcp/prompts.mdx +90 -0
  15. package/dist/embedded-docs/mcp/resources.mdx +115 -0
  16. package/dist/embedded-docs/mcp/tools.mdx +156 -0
  17. package/dist/embedded-docs/programs/policy-vault/composer.mdx +117 -0
  18. package/dist/embedded-docs/programs/policy-vault/counterparty-tier-policy.mdx +81 -9
  19. package/dist/embedded-docs/programs/policy-vault/index.mdx +77 -47
  20. package/dist/embedded-docs/programs/policy-vault/kill-switch-policy.mdx +65 -8
  21. package/dist/embedded-docs/programs/policy-vault/require-validation-policy.mdx +76 -8
  22. package/dist/embedded-docs/programs/policy-vault/spending-policy.mdx +83 -8
  23. package/dist/embedded-docs/programs/policy-vault/velocity-policy.mdx +85 -8
  24. package/dist/embedded-docs/programs/trustgate.mdx +112 -30
  25. package/dist/embedded-docs/programs/validation-registry.mdx +139 -32
  26. package/dist/embedded-docs/reference/byte-offset-reference.mdx +102 -13
  27. package/dist/embedded-docs/reference/capability-namespaces.mdx +56 -0
  28. package/dist/embedded-docs/reference/changelog.mdx +230 -13
  29. package/dist/embedded-docs/reference/deny-reason-codes.mdx +86 -0
  30. package/dist/embedded-docs/reference/devnet-program-ids.mdx +50 -8
  31. package/dist/embedded-docs/reference/discriminator-constants.mdx +104 -10
  32. package/dist/embedded-docs/reference/mainnet-program-ids.mdx +89 -5
  33. package/dist/embedded-docs/reference/quantu-agent-registry.mdx +104 -9
  34. package/dist/embedded-docs/sdk/exports-reference.mdx +239 -0
  35. package/dist/embedded-docs/sdk/gate-payment.mdx +99 -14
  36. package/dist/embedded-docs/sdk/index.mdx +141 -40
  37. package/dist/embedded-docs/sdk/mount-trustgate.mdx +178 -8
  38. package/dist/embedded-docs/verification/adversarial-harness.mdx +88 -0
  39. package/dist/embedded-docs/verification/atomic-tx-invariant.mdx +141 -0
  40. package/dist/embedded-docs/verification/chained-validation.mdx +87 -0
  41. package/dist/embedded-docs/verification/devnet-smoke.mdx +85 -0
  42. package/dist/embedded-docs/verification/index.mdx +31 -0
  43. package/dist/embedded-docs/verification/kani-proofs.mdx +144 -0
  44. package/dist/embedded-docs/verification/live-evidence.mdx +180 -0
  45. package/dist/tools/write/emit-feedback.d.ts +6 -0
  46. package/dist/tools/write/emit-feedback.js +12 -1
  47. package/dist/tools/write/emit-feedback.js.map +1 -1
  48. package/package.json +16 -15
  49. package/scripts/install-claude-desktop.sh +0 -0
@@ -5,8 +5,8 @@
5
5
  "mint": "2EGGN4fB5nkhuJQJ1mE9DrCBqmuCECSAvocMU4xbNqMY",
6
6
  "transferAmount": "1000",
7
7
  "signedTransfer": {
8
- "signature": "4fPgTL7EGJniGJgf2uQ4NkLXmwKJiF7SNW7dACvVJE8jTgUE9y5wTFbFFaNVSSJ7KAvpMQXgJ7P2y62duiga9Vmt",
9
- "explorer": "https://explorer.solana.com/tx/4fPgTL7EGJniGJgf2uQ4NkLXmwKJiF7SNW7dACvVJE8jTgUE9y5wTFbFFaNVSSJ7KAvpMQXgJ7P2y62duiga9Vmt?cluster=devnet"
8
+ "signature": "uXL2Kk1C9JQPSQ8gY4VpRUyKNP2muP4ouF1kToz6BoAdNygVrbxaqwy9xHPCLupczAKsYHKyFkTvHEZ1P5ZDyhs",
9
+ "explorer": "https://explorer.solana.com/tx/uXL2Kk1C9JQPSQ8gY4VpRUyKNP2muP4ouF1kToz6BoAdNygVrbxaqwy9xHPCLupczAKsYHKyFkTvHEZ1P5ZDyhs?cluster=devnet"
10
10
  },
11
11
  "emitFeedback": {
12
12
  "signature": "jMobmWJUAXuL8FmQujfxW9NmeMbzADUoABzqjiMeuc5m3YXyeuZeUw1ZJc29JGsqyWQGDY8q3vrtBdamhKXraag",
@@ -19,6 +19,6 @@
19
19
  "asset": "C6cuZeDT4kmCC1RXw8mzaoLGwmAMe5fHDvutAjicVi8B",
20
20
  "atomStats": "4z9RiK6B49QZbmqPM9yNZWgfxYD3tvQ3NETU6X89f5mv"
21
21
  },
22
- "facilitatorBalanceSol": "6.990858",
23
- "capturedAt": "2026-05-07T19:29:46.411Z"
22
+ "facilitatorBalanceSol": "8.905693",
23
+ "capturedAt": "2026-05-06T17:53:48.313Z"
24
24
  }
@@ -0,0 +1,174 @@
1
+ ---
2
+ title: Architecture
3
+ description: How the three Anchor programs, the SDK, and the facilitator-adapter layer compose into one settlement path.
4
+ ---
5
+
6
+ AgentTrust is three Anchor programs plus a TypeScript surface that mounts them on any x402 facilitator. This page is the wiring. Byte-precise PDA layouts, instruction signatures, and deny-reason codes live under [Programs](/programs/policy-vault).
7
+
8
+ ## Composition diagram
9
+
10
+ ```
11
+ ┌───────────────────────────────────────────────────────────────────────┐
12
+ │ x402 Facilitator (Pay.sh ★ default · Dexter · atxp · MCPay) │
13
+ │ │
14
+ │ import { mountTrustGate } from "@agenttrust-sdk/trustgate/express" │
15
+ │ await mountTrustGate(app, { atomicityEnforced: true, … }) │
16
+ │ │
17
+ │ ★ Pay.sh = Solana Foundation's first x402 facilitator (May 5, 2026) │
18
+ └───────────────────────────────────────────────────────────────────────┘
19
+
20
+ ▼ POST /verify | /settle | /dispute
21
+ ┌──────────────────────────────────────────────────────────┐
22
+ │ TrustGate (Anchor program) │
23
+ │ ├─ init_authority (per-facilitator PDA) │
24
+ │ ├─ emit_feedback ── PDA-signed CPI ──┐ │
25
+ │ └─ dispute_payment │ │
26
+ └─────────────────┬──────────────────────┼─────────────────┘
27
+ │ │
28
+ │ CPI │ CPI
29
+ ▼ ▼
30
+ ┌─────────────────────────────┐ ┌──────────────────────────────┐
31
+ │ PolicyVault │ │ Quantu agent-registry-8004 │
32
+ │ ├─ gate_payment composer │ │ ├─ give_feedback │
33
+ │ │ (fail-fast 5 policies) │ │ └─ atom-engine::AtomStats │
34
+ │ ├─ KillSwitch • Spending │ │ (tier @ byte 551) │
35
+ │ ├─ Velocity • Counterparty │ │ │
36
+ │ └─ RequireValidation │ │ Pinned commit: bfb09ad │
37
+ │ │ │ Read via byte-offset parser │
38
+ │ reads ValidationAttestation│ │ (zero Cargo dep) │
39
+ └─────────────────┬───────────┘ └──────────────────────────────┘
40
+
41
+
42
+ ┌──────────────────────────────────────────┐
43
+ │ ValidationRegistry │
44
+ │ ├─ register_namespace / _attestor │
45
+ │ ├─ request / respond / revoke │
46
+ │ └─ ValidationAttestation PDA │
47
+ │ (read by PolicyVault parser) │
48
+ └──────────────────────────────────────────┘
49
+ ```
50
+
51
+ A single `composeAtomicSettleTx()` call in the SDK builds one Solana transaction with three instructions in canonical order: `gate_payment_strict` → SPL `transferChecked` → `emit_feedback`. The transaction either commits all three or none — never two of three. That is the load-bearing safety property the SDK enforces at three layers.
52
+
53
+ ## The three programs
54
+
55
+ ### PolicyVault — the decision engine
56
+
57
+ Five orthogonal policy kinds compose under one `gate_payment` instruction with fail-fast semantics:
58
+
59
+ | Order | Policy | What it checks |
60
+ |---|---|---|
61
+ | 1 | `KillSwitch` | per-agent paused flag — multisig-controlled emergency stop |
62
+ | 2 | `Spending` | per-tx, daily (UTC midnight), weekly (ISO Monday) limits |
63
+ | 3 | `Velocity` | sliding-window cumulative spend, payer-tier-decayed limits |
64
+ | 4 | `CounterpartyTier` | payee `AtomStats.trust_tier` (byte 551), risk score, confidence |
65
+ | 5 | `RequireValidation` | gates against a `ValidationAttestation` PDA (capability proof) |
66
+
67
+ The composer returns `Allow`, `Deny(reason)`, or `RequireValidation(capability_hash)`. State changes — daily / weekly counters, velocity ledger — apply only on `Allow`. `Deny` and `RequireValidation` mutate nothing.
68
+
69
+ A strict variant — `gate_payment_strict` — converts non-`Allow` into `Err`. That is the variant the SDK's atomic composer uses: any `Deny` on the gate fails the entire bundled transaction. The Phase J5 Kani proof `gate_payment_strict_correctness` pins the biconditional — strict returns `Ok(())` if and only if the lazy composer returns `Allow` — so a future change cannot silently re-route the `Deny` arm to an `Ok` return.
70
+
71
+ Byte-precise reference: [PolicyVault](/programs/policy-vault). Composer: [Composer](/programs/policy-vault/composer).
72
+
73
+ ### TrustGate — the facilitator-side program
74
+
75
+ Two PDAs, three instructions:
76
+
77
+ | PDA | Seeds | Role |
78
+ |---|---|---|
79
+ | `TrustGateAuthority` | `["trustgate_auth", facilitator]` | Per-facilitator PDA signer for the CPI |
80
+ | `FeedbackEmissionLog` | `["feedback_log", payment_id_hash]` | Init-only idempotency receipt |
81
+
82
+ `emit_feedback` PDA-signs a CPI into Quantu's `agent-registry-8004::give_feedback`. The `FeedbackEmissionLog` is created via Anchor's `init` constraint — a second tx with the same `payment_id_hash` fails account-already-in-use, so retries cannot double-emit. `dispute_payment` writes a negative-score variant for disputed payments.
83
+
84
+ Byte-precise reference: [TrustGate](/programs/trustgate). SDK reference: [SDK → mountTrustGate](/sdk/mount-trustgate).
85
+
86
+ ### ValidationRegistry — the third ERC-8004 leg
87
+
88
+ Five instructions over four PDAs:
89
+
90
+ | Instruction | Effect |
91
+ |---|---|
92
+ | `register_namespace` | permissionless; caller computes `SHA256(name_utf8)` |
93
+ | `register_attestor` | self-registration with display URI |
94
+ | `request_validation` | open a request for `(subject, capability)` |
95
+ | `respond_to_validation` | attestor writes the attestation PDA |
96
+ | `revoke_validation` | original attestor sets `revoked = true` |
97
+
98
+ The v1 sybil-resistance model is downstream-consumer filtering: PolicyVault stores a per-policy `accepted_attestors[]` array (length 2). Only attestations from those keys flip `RequireValidation` to `Allow`. Permissionless registration plus opinionated downstream filtering trades global gatekeeping for local trust — the only model that scales with the number of facilitators.
99
+
100
+ Byte-precise reference: [ValidationRegistry](/programs/validation-registry). v1 capability namespaces seeded on devnet: [Reference → Capability namespaces](/reference/capability-namespaces).
101
+
102
+ ## The FacilitatorAdapter pattern
103
+
104
+ Every x402 facilitator carries the same payment intent but differs in headers, body shape, proof payload, retry behavior, and settlement metadata. The adapter layer isolates those differences in five methods:
105
+
106
+ | Method | Responsibility |
107
+ |---|---|
108
+ | `parseRequest(req)` | translate the facilitator's request into `VerifyContext` |
109
+ | `formatChallenge(decision, ctx)` | render `Allow` / `Deny` / `RequireValidation` in that facilitator's wire format |
110
+ | `formatSettlement(ctx)` | produce settlement metadata or an unsigned transaction skeleton |
111
+ | `validatePaymentProof(proof, ctx)` | verify proof shape and cross-check the verify-time context |
112
+ | `emitFeedback(ctx, settlement)` | call the feedback CPI idempotently |
113
+
114
+ Routes (`/verify`, `/settle`, `/dispute`), the policy gate, and the registry reads do not branch on facilitator name. Pay.sh is the canonical implementation in [`trustgate/server/src/facilitators/pay-sh/`](https://github.com/agenttrust-labs/agenttrust/tree/main/trustgate/server/src/facilitators/pay-sh); Dexter, atxp, and MCPay share the same interface. Adding a fifth facilitator stays under a hundred lines.
115
+
116
+ Walkthrough: [Pay.sh adapter](/integration-guides/pay-sh-adapter). Build your own: [Facilitator adapters](/integration-guides/facilitator-adapters).
117
+
118
+ ## The atomic-tx invariant
119
+
120
+ `gate_payment_strict` mutates state on `Allow`:
121
+
122
+ - `PolicyAccount.spending_today_used`, `spending_today_anchor`
123
+ - `PolicyAccount.spending_week_used`, `spending_week_anchor`
124
+ - `VelocityLedger.cumulative_amount`, `last_commit_slot`
125
+
126
+ If the SPL transfer reverts after that mutation — and the two instructions are in *different* Solana transactions — the gate's state is durable while no value moved. Subsequent `gate_payment` calls read the inflated counters and may deny a legitimate payment, or velocity caps appear hit when nothing real has happened.
127
+
128
+ The corruption vector is most cleanly triggered by a Token-2022 mint with a `TransferHook` extension that reverts on a compliance check, but it is mint-extension-agnostic: any failing inner instruction in a split flow corrupts state the same way.
129
+
130
+ The SDK closes the corruption vector at three layers:
131
+
132
+ 1. **Compile-time literal-type guard.** `AtomicityEnforced` is the literal type `{ atomicityEnforced: true }`. TypeScript rejects callers passing `false` or omitting the field. No runtime cost.
133
+ 2. **Runtime guard.** `assertAtomicityEnforced` throws `AtomicityNotEnforcedError` for any value that isn't strictly `=== true`. Catches `as any` cast bypasses.
134
+ 3. **Composer structure.** `composeAtomicSettleTx` returns one `Transaction` with exactly three instructions in canonical order (gate, transfer, feedback). Any other shape is a programming error.
135
+
136
+ Plus the on-chain Kani proof `gate_payment_strict_correctness` pins the strict handler's contract end-to-end: `Ok(())` if and only if the composer returned `Allow`. Full proof: [Verification → Atomic-tx invariant](/verification/atomic-tx-invariant). Background: [`docs/proofs/transfer-hook-atomicity.md`](https://github.com/agenttrust-labs/agenttrust/blob/main/docs/proofs/transfer-hook-atomicity.md).
137
+
138
+ ## ERC-8004 wiring
139
+
140
+ Quantu Labs published two of the three ERC-8004 legs on Solana:
141
+
142
+ - `agent-registry-8004` — agent identity plus the reputation surface (the `give_feedback` instruction). Each agent gets a Metaplex Core asset plus a Borsh-typed `AgentAccount` PDA.
143
+ - `atom-engine` — confidence-weighted reputation aggregation. The `AtomStats` PDA stores `tier_immediate` and `tier_confirmed` as single bytes.
144
+
145
+ The third leg — capability validation — was scaffolded in `8004-solana` v0.4 then archived in v0.5.0 pending a redesign. AgentTrust's `ValidationRegistry` productizes it. The semantics align with the ERC-8004 V variant: who attests to a capability the payer's policy requires (KYC tier, audit attestation, jurisdictional compliance, model-card provenance, payment-network membership).
146
+
147
+ PolicyVault reads from both Quantu legs:
148
+
149
+ | Field | Source PDA | Offset | Width |
150
+ |---|---|---|---|
151
+ | trust tier (immediate) | `AtomStats` | byte 551 | u8 |
152
+ | trust tier (confirmed) | `AtomStats` | byte 555 | u8 |
153
+ | risk score | `AtomStats` | byte 549 | u8 |
154
+ | confidence | `AtomStats` | byte 557 | u16 LE |
155
+ | schema version canary | `AtomStats` | byte 560 | u8 (must equal 1) |
156
+
157
+ A schema bump on the Quantu side fails the canary check loud rather than silently misreading fields. Full byte-offset reference: [Reference → Byte offsets](/reference/byte-offset-reference).
158
+
159
+ ## Read next
160
+
161
+ <Cards>
162
+ <Card title="PolicyVault composer" href="/programs/policy-vault/composer">
163
+ The pure-Rust orchestration that ties the five policy kinds together.
164
+ </Card>
165
+ <Card title="Atomic-tx invariant" href="/verification/atomic-tx-invariant">
166
+ Three layers of proof that gate + transfer + feedback execute as one tx or none.
167
+ </Card>
168
+ <Card title="Live evidence" href="/verification/live-evidence">
169
+ Six Kani proofs, devnet smoke traces, the chained-validation 4-sig trace.
170
+ </Card>
171
+ <Card title="Pay.sh adapter" href="/integration-guides/pay-sh-adapter">
172
+ The canonical FacilitatorAdapter implementation, end to end.
173
+ </Card>
174
+ </Cards>
@@ -1,100 +1,123 @@
1
1
  ---
2
2
  title: Quickstart
3
- description: Run AgentTrust with Pay.sh in under 10 minutes.
3
+ description: Hit the hosted devnet build, install the SDK, wire the MCP server. Three paths, no clone, under five minutes.
4
4
  ---
5
5
 
6
- This page gets you from a clean checkout to a Pay.sh + AgentTrust server you can hit locally. It shows the x402 challenge, the Pay.sh retry, the AgentTrust decision, and the feedback receipt path.
6
+ Three live paths. Each runs against the hosted devnet endpoints under `*.agenttrust.tech`. None require a local clone.
7
7
 
8
- ## 1. Install
8
+ ## 1. Hit the live demo
9
+
10
+ The demo at [`demo.agenttrust.tech`](https://demo.agenttrust.tech) runs the full Pay.sh + AgentTrust flow against deployed devnet programs. With no payment proof, `/protected` returns a real x402 v2 challenge:
9
11
 
10
12
  ```bash
11
- pnpm install
13
+ curl -i https://demo.agenttrust.tech/protected
12
14
  ```
13
15
 
14
- The public SDK package is `@agenttrust-sdk/trustgate`. The Pay.sh demo imports the server workspace package directly so it can exercise the adapter layer before packaging.
15
-
16
- ## 2. Build the demo
16
+ The response carries `HTTP/2 402` with a SERVICE-signed `payment-required` envelope (base64). To walk the full Allow settle emit_feedback path, install Pay.sh and let it pay:
17
17
 
18
18
  ```bash
19
- pnpm --filter ./examples/pay-sh-demo build
19
+ pay --sandbox curl https://demo.agenttrust.tech/protected
20
20
  ```
21
21
 
22
- ## 3. Start the server
22
+ Three deterministic counterparties drive each decision branch. Fetch their pubkeys from the demo's health endpoint:
23
23
 
24
24
  ```bash
25
- pnpm --filter ./examples/pay-sh-demo dev
25
+ curl -s https://demo.agenttrust.tech/health | jq '.counterparties'
26
26
  ```
27
27
 
28
- The server listens on `:3402` and exposes:
28
+ | Tier | Header | Decision |
29
+ | --- | --- | --- |
30
+ | 0 | `X-Demo-Payer-Agent: <tier-0 pubkey>` | `402 Deny — CounterpartyTierBelowMin` |
31
+ | 1 | `X-Demo-Payer-Agent: <tier-1 pubkey>` | `402 Deny — CounterpartyTierBelowMin` |
32
+ | 3 | `X-Demo-Payer-Agent: <tier-3 pubkey>` | `200 Allow + X-Payment-Receipt` |
29
33
 
30
- | Route | Purpose |
31
- | --- | --- |
32
- | `GET /health` | deterministic demo counterparties and facilitator key |
33
- | `GET /protected` | Pay.sh-gated resource |
34
+ The full atomic-settlement trace (gate, transfer, feedback) for the tier-3 path is captured under [Verification → Devnet smoke](/verification/devnet-smoke).
34
35
 
35
- ## 4. Drive the Pay.sh path
36
+ ## 2. Install the SDK
36
37
 
37
- Without a payment proof, `/protected` returns `402 Payment Required` with a base64 x402 v2 challenge.
38
+ Add [`@agenttrust-sdk/trustgate@0.2.0`](https://www.npmjs.com/package/@agenttrust-sdk/trustgate) to any Node project:
38
39
 
39
40
  ```bash
40
- curl -i https://demo.agenttrust.tech/protected
41
+ pnpm add @agenttrust-sdk/trustgate
41
42
  ```
42
43
 
43
- With Pay.sh installed, let the CLI pay and retry.
44
+ Mount the middleware on an Express app:
44
45
 
45
- ```bash
46
- pay --sandbox curl https://demo.agenttrust.tech/protected
47
- ```
46
+ ```ts
47
+ import express from "express";
48
+ import { Keypair } from "@solana/web3.js";
49
+ import { mountTrustGate } from "@agenttrust-sdk/trustgate/express";
48
50
 
49
- For a deterministic Allow path, use the tier-3 demo counterparty.
51
+ const app = express();
52
+ app.use(express.json());
50
53
 
51
- ```bash
52
- PAYER=$(curl -s https://demo.agenttrust.tech/health | jq -r '.counterparties[2].agent')
53
- pay --sandbox curl -H "X-Demo-Payer-Agent: $PAYER" https://demo.agenttrust.tech/protected
54
- ```
55
-
56
- For a deterministic Deny path, use tier 0.
54
+ await mountTrustGate(app, {
55
+ rpcUrl: "https://api.devnet.solana.com",
56
+ facilitatorKeypair: Keypair.fromSecretKey(/* your facilitator key */),
57
+ network: "solana-devnet",
58
+ atomicityEnforced: true, // literal `true` — TS rejects `false`
59
+ });
57
60
 
58
- ```bash
59
- PAYER=$(curl -s https://demo.agenttrust.tech/health | jq -r '.counterparties[0].agent')
60
- pay --sandbox curl -H "X-Demo-Payer-Agent: $PAYER" https://demo.agenttrust.tech/protected
61
+ app.listen(3000);
61
62
  ```
62
63
 
63
- ## 5. Run the same flow without the CLI
64
+ The `atomicityEnforced: true` literal is the SDK's load-bearing guard. The compile-time type rejects callers who omit it, the runtime throws on `as any` bypasses, and the on-chain `gate_payment_strict_correctness` Kani proof binds the strict handler's return value to the composer's `Allow` arm. Full details: [Atomic-tx invariant](/verification/atomic-tx-invariant).
64
65
 
65
- The integration tests synthesize Pay.sh proof bodies and drive the same Express route in-process.
66
+ You now have:
66
67
 
67
- ```bash
68
- pnpm --filter ./examples/pay-sh-demo test
69
- ```
68
+ - `POST /verify` — read-only `gate_payment` simulation
69
+ - `POST /settle` — one-tx atomic settle (gate + transfer + feedback)
70
+ - `POST /dispute` — dispute path
71
+ - `GET /receipt/:hash` — `FeedbackEmissionLog` lookup by payment hash
70
72
 
71
- ## What happens inside
73
+ ## 3. Wire the MCP server
72
74
 
73
- ```ts
74
- adapter.parseRequest(req)
75
- -> VerifyContext
76
- -> decide(ctx)
77
- -> adapter.formatChallenge(decision, ctx)
78
- -> adapter.validatePaymentProof(proof, ctx)
79
- -> adapter.emitFeedback(ctx, settlement)
75
+ [`@agenttrust-sdk/mcp@0.2.6`](https://www.npmjs.com/package/@agenttrust-sdk/mcp) exposes 18 tools to any Model Context Protocol client. For Claude Desktop, drop this into your config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "agenttrust": {
81
+ "command": "npx",
82
+ "args": ["-y", "@agenttrust-sdk/mcp"],
83
+ "env": {
84
+ "RPC_URL": "https://api.devnet.solana.com",
85
+ "NETWORK": "solana-devnet"
86
+ }
87
+ }
88
+ }
89
+ }
80
90
  ```
81
91
 
82
- The local demo stubs RPC and CPI so CI can run without devnet. The server package carries the real Anchor path: `trustgate/server/src/chain.ts` loads the deployed devnet programs, `/verify` simulates `gate_payment`, and `/settle` delegates proof validation plus feedback emission through the active adapter.
92
+ Restart Claude Desktop. Then ask:
83
93
 
84
- Production fills these same dependency seams:
94
+ - *"What demo agents are available on AgentTrust?"*
95
+ - *"Simulate a 5-USDC payment from the tier-3 demo agent to the tier-0 demo agent against policy 1. What does the gate decide?"*
96
+ - *"Search the AgentTrust docs for the atomic-tx invariant."*
85
97
 
86
- | Seam | Demo implementation | Production implementation |
87
- | --- | --- |
88
- | `decide(ctx)` | static tier table | `simulateGatePayment` against devnet programs |
89
- | `validateOnChainTx` | synthetic confirmed tx | RPC + SPL transfer parser |
90
- | `emitFeedbackCpi` | synthetic feedback signature | Anchor call into `trustgate::emit_feedback` |
98
+ A hosted HTTP transport is also live at [`mcp.agenttrust.tech`](https://mcp.agenttrust.tech) for clients that speak `StreamableHTTPServerTransport`. Full setup: [MCP → Install](/mcp/install).
91
99
 
92
- ## Pinned devnet IDs
100
+ ## What's running where
93
101
 
94
102
  <ProgramIdsTable />
95
103
 
104
+ | Surface | URL |
105
+ | --- | --- |
106
+ | Demo | [`demo.agenttrust.tech`](https://demo.agenttrust.tech) |
107
+ | Facilitator (`/verify` + `/settle`) | [`api.agenttrust.tech`](https://api.agenttrust.tech) |
108
+ | MCP HTTP endpoint | [`mcp.agenttrust.tech`](https://mcp.agenttrust.tech) |
109
+ | Repo | [`github.com/agenttrust-labs/agenttrust`](https://github.com/agenttrust-labs/agenttrust) |
110
+
96
111
  ## Read next
97
112
 
98
- - [Pay.sh adapter](/integration-guides/pay-sh-adapter)
99
- - [Facilitator adapters](/integration-guides/facilitator-adapters)
100
- - [Atomic-tx invariant](/sdk/atomic-tx-invariant)
113
+ <Cards>
114
+ <Card title="Architecture" href="/architecture">
115
+ How the three programs, the SDK, and the adapter layer compose into one settlement path.
116
+ </Card>
117
+ <Card title="Pay.sh adapter" href="/integration-guides/pay-sh-adapter">
118
+ The live Pay.sh integration end to end — challenge, retry, settle, feedback.
119
+ </Card>
120
+ <Card title="Atomic-tx invariant" href="/verification/atomic-tx-invariant">
121
+ Why gate + transfer + feedback must execute as one Solana transaction or none.
122
+ </Card>
123
+ </Cards>
@@ -1,64 +1,81 @@
1
1
  ---
2
- title: Introduction
3
- description: AgentTrust is the Solana policy and feedback layer for x402 facilitators.
2
+ title: AgentTrust
3
+ description: Three Anchor programs that complete the third leg of ERC-8004 on Solana — the policy, settlement, and feedback layer for x402 facilitators.
4
4
  ---
5
5
 
6
- AgentTrust is the Solana policy and feedback layer for x402 facilitators.
7
-
8
- Pay.sh is the first concrete adapter: an AgentTrust-aware service can emit a Pay.sh x402 challenge, verify the SERVICE signature, run the policy decision, and settle with feedback tied to the same payment context. The same adapter contract is designed for Dexter, atxp_ai, MCPay, and the next facilitator without rewriting the routes.
6
+ Quantu Labs shipped two of the three ERC-8004 legs on Solana agent identity (`agent-registry-8004`) and reputation (`atom-engine`). The third leg, capability validation, was archived in v0.5.0 pending a redesign. AgentTrust ships that third leg, plus a policy engine that reads Quantu's reputation tier byte by byte, plus a facilitator-side program that emits feedback through Quantu's existing CPI surface.
9
7
 
10
8
  <KaniProofBadge />
11
9
 
12
- ## What AgentTrust ships today
10
+ ## Hit it now
13
11
 
14
- AgentTrust ships as three Anchor programs, a TypeScript SDK, and a facilitator-adapter layer.
12
+ Three live paths against the hosted devnet build. No clone, no setup.
15
13
 
16
- | Part | Reads | Writes | Result |
17
- | --- | --- | --- | --- |
18
- | PolicyVault | payer and payee trust data | policy counters and velocity ledgers | `Allow`, `Deny`, or `RequireValidation` |
19
- | TrustGate | PolicyVault decisions | Quantu feedback logs | x402 status and ERC-8004 feedback |
20
- | ValidationRegistry | attestor profiles and attestations | capability attestations | reusable validation evidence |
21
- | Pay.sh adapter | x402 v2 `PaymentRequirements` | SERVICE-signed challenge and feedback receipt | live Pay.sh integration path |
14
+ ```bash
15
+ # 1. See an x402 challenge from a real facilitator
16
+ curl -i https://demo.agenttrust.tech/protected
22
17
 
23
- ## Facilitator status
18
+ # 2. Install the SDK
19
+ pnpm add @agenttrust-sdk/trustgate
24
20
 
25
- | Facilitator | Status | Notes |
26
- | --- | --- | --- |
27
- | Pay.sh | live | First concrete adapter; launch announced by Solana Foundation with Google Cloud on May 5, 2026. |
28
- | Dexter | in flight | Worked example for the next adapter path; current repo carries a roadmap stub until full wiring lands. |
29
- | atxp_ai | roadmap | Stubbed explicitly so callers see a planned integration, not an accidental absence. |
30
- | MCPay | roadmap | Stubbed explicitly for the same adapter contract. |
21
+ # 3. Wire the MCP server into Claude Desktop / Cursor
22
+ npx -y @agenttrust-sdk/mcp
23
+ ```
31
24
 
32
- Pay.sh launch reference: [Solana Foundation launch note](https://solana.com/news/solana-foundation-launches-pay-sh-in-collaboration-with-google-cloud).
25
+ ## What's deployed
33
26
 
34
- ## Devnet deployment
27
+ <ProgramIdsTable />
35
28
 
36
- The current Frontier build is deployed on Solana devnet and keeps the same adapter boundary for mainnet rollout.
29
+ [SDK on npm](https://www.npmjs.com/package/@agenttrust-sdk/trustgate) ·
30
+ [MCP on npm](https://www.npmjs.com/package/@agenttrust-sdk/mcp) ·
31
+ [Repo](https://github.com/agenttrust-labs/agenttrust) ·
32
+ [Hosted demo](https://demo.agenttrust.tech) ·
33
+ [Hosted facilitator](https://api.agenttrust.tech) ·
34
+ [Hosted MCP](https://mcp.agenttrust.tech)
37
35
 
38
- <ProgramIdsTable />
36
+ ## The three programs
39
37
 
40
- ## The shortest path
38
+ **PolicyVault** is the decision engine. Five orthogonal policy kinds — `KillSwitch`, `Spending`, `Velocity`, `CounterpartyTier`, `RequireValidation` — composed under one `gate_payment` instruction with fail-fast semantics. The composer returns `Allow`, `Deny(reason)`, or `RequireValidation(capability_hash)`. `CounterpartyTier` reads byte 551 of Quantu's `AtomStats` through a manual byte-offset parser pinned to commit `bfb09ad` (zero Cargo dep on Quantu's crate, schema-version canary at byte 560 catches drift).
41
39
 
42
- Run the Pay.sh demo, then copy the adapter shape into your own facilitator.
40
+ **TrustGate** is the facilitator-side program. One PDA per facilitator (`TrustGateAuthority`) signs the CPI into Quantu's `agent-registry-8004::give_feedback`. `FeedbackEmissionLog` is the per-payment idempotency receipt — Anchor's `init` constraint fails on the second tx with the same `payment_id_hash`, so retries cannot double-emit. The TypeScript SDK, [`@agenttrust-sdk/trustgate@0.2.0`](https://www.npmjs.com/package/@agenttrust-sdk/trustgate), mounts on any Express app in five lines.
43
41
 
44
- ```bash
45
- pnpm --filter ./examples/pay-sh-demo dev
46
- ```
42
+ **ValidationRegistry** productizes the third leg. Five instructions — `register_namespace`, `register_attestor`, `request_validation`, `respond_to_validation`, `revoke_validation` — over four PDAs. The v1 sybil-resistance model is downstream-consumer filtering: PolicyVault stores a per-policy `accepted_attestors[]` array; only attestations from those keys flip the gate to `Allow`. Permissionless registration plus opinionated downstream filtering is the only model that scales with the number of facilitators.
43
+
44
+ ## How they compose
47
45
 
48
- ```bash
49
- pay --sandbox curl https://demo.agenttrust.tech/protected
50
46
  ```
47
+ x402 facilitator (Pay.sh, Dexter, atxp, MCPay)
48
+
49
+ ▼ POST /verify | /settle | /dispute
50
+ TrustGate ─CPI─► agent-registry-8004::give_feedback
51
+
52
+ │ reads
53
+
54
+ PolicyVault ─reads─► AtomStats (Quantu) ◀── byte 551 (tier)
55
+
56
+ └─reads─► ValidationAttestation ◀── byte 8 / 40 / 72 / 208 / 216
57
+ (ValidationRegistry)
58
+ ```
59
+
60
+ The full wiring story is on [Architecture](/architecture). Byte-precise PDA layouts, instruction signatures, and deny-reason codes live under [Programs](/programs/policy-vault).
51
61
 
52
- ## Read next
62
+ ## Foundation alignment
63
+
64
+ Pay.sh is the Solana Foundation's first x402 facilitator, [launched 2026-05-05 with Google Cloud](https://solana.com/news/solana-foundation-launches-pay-sh-in-collaboration-with-google-cloud). AgentTrust ships day-one Pay.sh integration as the canonical adapter — Dexter, atxp, and MCPay share the same five-method `FacilitatorAdapter` contract, so adding a fifth facilitator stays under a hundred lines. Walkthrough: [Pay.sh adapter](/integration-guides/pay-sh-adapter).
65
+
66
+ ## Where to next
53
67
 
54
68
  <Cards>
55
69
  <Card title="Quickstart" href="/getting-started/quickstart">
56
- Run the Pay.sh demo and inspect Allow / Deny paths.
70
+ Hit the live demo, install the SDK, wire the MCP server.
71
+ </Card>
72
+ <Card title="Architecture" href="/architecture">
73
+ The wiring diagram, the FacilitatorAdapter pattern, the atomic-tx invariant.
57
74
  </Card>
58
- <Card title="Pay.sh adapter" href="/integration-guides/pay-sh-adapter">
59
- Walk through the live adapter end to end.
75
+ <Card title="Live evidence" href="/verification/live-evidence">
76
+ Six Kani proofs, devnet smoke traces, the chained-validation 4-sig trace, every claim with an Explorer URL.
60
77
  </Card>
61
- <Card title="Architecture overview" href="/getting-started/architecture-overview">
62
- See why the adapter layer exists and how it composes with the programs.
78
+ <Card title="MCP server" href="/mcp">
79
+ Eighteen tools that expose every SDK surface to Claude Desktop and Cursor.
63
80
  </Card>
64
81
  </Cards>