@agledger/mcp-server 3.1.0 → 3.2.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/CHANGELOG.md CHANGED
@@ -4,16 +4,51 @@ All notable changes to the AGLedger MCP Server will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [Unreleased]
8
+
9
+ ## [3.2.0] - 2026-11-23
10
+
11
+ ### Added
12
+
13
+ - `agledger-mcp --version` (`-V`) prints the version and exits `0`, with no credential needed.
14
+ - **`agledger_verify` takes `allowAfterRetirement` and `expectedEntryCount`.** A peer message signed more than 300 seconds after its key's retirement now fails `CHAIN_FEDERATION_WIRE_INVALID`; `allowAfterRetirement: true` accepts and counts it. `expectedEntryCount` holds the export to an entry count taken out of band, so an export cut from the end with its own (unsigned) counts deleted fails `CHAIN_POSITION_GAP` instead of verifying.
15
+ - **An OIDC-authenticated server can hand over its cert public key.** The cert carries only a thumbprint, so the agent signatures the server sealed could not be re-verified offline. `agledger_discover` now returns `agentKey.publicKeyJwk`, and `AGLEDGER_AGENT_KEYS_FILE` names a JWK Set the key is added to on each exchange, before the cert is used. A file that is not a `{"keys":[...]}` set is left alone and the call fails `AGENT_KEYS_FILE_FAILED` before anything is signed. Server processes and agledger CLI commands can share one file: each adds its key under `<file>.lock`, and one that cannot take the lock within 15 seconds fails `AGENT_KEYS_FILE_FAILED` naming it.
16
+ - `agledger_verify` `agentKeys` takes one JWK, an array, or a `{"keys":[...]}` JWK Set whose entries may wrap the key as `{"publicKeyJwk":{...}}`, as the verifier CLIs' `--agent-keys` does. Only an array was accepted.
17
+ - `agledger_api` returns a text response as the Server sent it. The `html` audit export of AGLedger Server 3.0.0 (and a `csv` or `ndjson` one) used to come back as a JSON object wrapping an escaped string; the text block is now the page itself, and `structuredContent` keeps `_raw` and `_contentType`.
18
+ - The `agledger_api` description and the README say how to reach the request fields and filters of AGLedger Server 3.0.0: `producedBy` on a record or completion, `traceId`, `originRecordId`, `producedBy[key]`, the numeric `criteriaGt/Gte/Lt/Lte` and `metadataGt/Gte/Lt/Lte` bounds on search, `GET /v1/records/counts` with `groupBy`, and `signatureMeaning` on a verdict (accepted only on an ephemeral OIDC cert; an API key gets a 422).
19
+
20
+ ### Changed
21
+
22
+ - **`agledger_verify` reports an untampered export under another Server's pin as `NOT ANCHORED`.** When the `trustAnchors` reach none of the export's keys and it verifies without them, `verdict` is `unanchored` (with `valid: false`), the summary opens `Verdict: NOT ANCHORED` and says to check the pin, and `isError` is not set. It used to read `Verdict: FAIL` like a tampered export. `isError` is now set only for a `failed` verdict.
23
+ - **`agledger_verify` fails an export cut from the end.** The export is held to the two entry counts it states: fewer entries than `exportMetadata.expectedEntries` is `CHECKPOINT_ROW_MISSING`, and fewer than `exportMetadata.totalEntries` is `CHAIN_POSITION_GAP`. The summary has an `Entry count` line saying which count applied, and `result.entryCount` carries both. An export that verified on 3.1.0 with its tail removed now fails.
24
+ - `agledger_verify` runs on `@agledger/verify-core` 2.2.0. A sealed federation message is placed in its key's window with 300 seconds allowed at each edge, so a message signed close to a key change now verifies on the key it names. A signed payload string that begins with U+FEFF no longer fails `CHAIN_PAYLOAD_BINDING_MISMATCH`.
25
+ - **Built on `@modelcontextprotocol/server` 2.x** in place of `@modelcontextprotocol/sdk` 1.x. The runtime dependency tree drops from 97 packages to 5. Tool names, descriptions, arguments and results are unchanged. `tools/list` now reports each input schema as JSON Schema 2020-12 (was draft-07) and no longer sends the default `execution.taskSupport: "forbidden"` on each tool.
26
+ - **`zod` 4 is required.** The dependency is `^4.2.0`, and the `zod` peer dependency is gone. An embedding host that held zod 3 gets zod 4 alongside it.
27
+ - **A program that embeds the exported `AgledgerMcpServer` now holds the `@modelcontextprotocol/server` 2.x `McpServer` through its `mcp` property.** Code that registers more tools on `server.mcp` must be written against the 2.x API.
28
+ - `agledger-mcp --help` prints to stdout. A fatal error prints its cause as well as its message, and the whole stack when `DEBUG` is set. SIGINT and SIGTERM end a running token command before the process exits. `--timeout` and `AGLEDGER_TIMEOUT` refuse a value under one millisecond.
29
+ - The `agledger_api` description says what a 409 `IDEMPOTENCY_KEY_IN_FLIGHT`, a 409 `IDEMPOTENT_WRITE_COMMITTED` and a 503 `SERVER_SHUTTING_DOWN` ask of the caller. The README and `--help` say that most responses carry `nextSteps`, and that listing pages, `GET /v1/schemas` and `GET /v1/admin/orgs` carry none.
30
+ - The README says the interactive API docs at `/docs` are available only when the operator enables them. Tool and resource descriptions describe the export a caller holds rather than the Server's storage.
31
+
32
+ ### Fixed
33
+
34
+ - **`agledger_api` refuses a `params` value nested below the bracket form, and sends nothing.** `{ criteriaGte: { amount: 500 } }` becomes `criteriaGte[amount]=500`; an object one level deeper, or inside an array, used to be sent as `[object Object]`. It now returns `INVALID_ARGUMENT`.
35
+ - **`agledger_api` no longer fails a write that succeeded with an empty body.** A 204, or any empty body under a JSON content type, returned `UNKNOWN_ERROR: Unexpected end of JSON input`, which an agent could retry as a failed write. An empty body is now `{}`, and a body that does not parse under a JSON content type comes back as `{ _raw, _contentType }`.
36
+ - An error result carries `httpStatus`, and `retryAfter` in seconds when the Server sent a `Retry-After` header. The Server's own fields are forwarded as sent and win over both.
37
+ - A failed connection says why. `fetch failed` is followed by the cause (`ECONNREFUSED`, `ENOTFOUND`, a certificate error), with a suggestion for each; a certificate that is not accepted points at `NODE_EXTRA_CA_CERTS`. The same holds for `agledger_discover` and the resources.
38
+ - Reading `agledger://openapi` or `agledger://llms.txt` after the Server refused the call includes the Server's `detail` and `recoveryHint`, not only `HTTP 401`.
39
+ - `agledger_discover` marks a section the Server refused with `httpStatus` and `error: true` and the Server's body. A failed scope-profiles call used to be omitted, and a refused health or identity call was stored as if it were the answer.
40
+ - An API URL with a path prefix keeps it. `https://gateway.example/agledger` used to send `/v1/records` to `https://gateway.example/v1/records`; requests now go to the prefix followed by the path, and are still pinned to the configured origin.
41
+
7
42
  ## [3.1.0] - 2026-11-05
8
43
 
9
44
  ### Added
10
45
 
11
- - **`agledger_verify` re-binds inlined evidence.** On an export fetched with `?evidence=true`, each completion's evidence body and each dispute's filed payload is hashed (SHA-256 over RFC 8785) against the hash its entry signs; an edited body fails `CHAIN_EVIDENCE_BINDING_MISMATCH` where it used to pass. `result.evidenceBinding` counts them, the summary names a failed or encrypted-mode body, and the tool description says how to fetch the export with its evidence. Built on `@agledger/verify-core` 2.1.0.
12
- - **`federationKeys` on `agledger_verify`:** verifies the peer messages a receiving Server seals from federation, against the keys you supply. `result.federationWire` reports `present`, `verified`, `failed` and `afterRetirement` counts, and a failure is `CHAIN_FEDERATION_WIRE_INVALID`. An array entry's `history`, the peer's `GET /.well-known/agledger-federation-keys.json`, trusts every key it links to that entry's key, so entries sealed before the peer changed its federation key verify; each message is placed by its signed `wire.timestamp`, and a hub may be named again for a key the history does not list. Requires `@agledger/verify-core` 2.1.0.
46
+ - **`agledger_verify` re-binds inlined evidence.** On an export fetched with `?evidence=true`, each completion's evidence body and each dispute's filed payload is hashed (SHA-256 over RFC 8785) against the hash its entry signs. An edited body fails `CHAIN_EVIDENCE_BINDING_MISMATCH` where it used to pass. `result.evidenceBinding` counts them, and the summary names a failed or encrypted-mode body. Requires `@agledger/verify-core` 2.1.0.
47
+ - **`federationKeys` on `agledger_verify`** verifies the peer messages a receiving Server seals from federation, against the keys you supply. `result.federationWire` reports `present`, `verified`, `failed` and `afterRetirement` counts, and a failure is `CHAIN_FEDERATION_WIRE_INVALID`. An entry's `history`, taken from the peer's `GET /.well-known/agledger-federation-keys.json`, lets messages sealed before the peer changed its federation key still verify.
13
48
 
14
49
  ### Fixed
15
50
 
16
- - The `agledger_api` description now states that listing pages, `GET /v1/schemas` and `GET /v1/admin/orgs` carry no `nextSteps`, and that the discovery documents and `/a2a` sit at the root rather than under `/v1/`.
51
+ - The `agledger_api` description states that listing pages, `GET /v1/schemas` and `GET /v1/admin/orgs` carry no `nextSteps`, and that the discovery documents and `/a2a` sit at the root rather than under `/v1/`.
17
52
 
18
53
  ### Changed
19
54
 
@@ -26,34 +61,33 @@ Targets API 2.0 only.
26
61
  ### Breaking
27
62
 
28
63
  - **`agledger_verify` takes `requireSuppliedKeys`, not `requireOutOfBandKeys`.** Behavior is unchanged, but the old name is refused as an unknown argument. In the result, `keyProvenance.outOfBand` is now `keyProvenance.supplied`, `optionalChecks` carries `key_anchoring`, and every result carries `keyTrust`.
29
- - **`agledger_verify` reports a verdict, as `@agledger/verify` and `agledger verify` do.** `structuredContent` carries `verdict`: `trusted` when the chain is valid and `keyTrust.status` is `walked`, `failed` when it is not valid, and `unanchored` otherwise. The text block mirrors `structuredContent` as JSON and adds a `summary` (`Verdict: PASS`, `Verdict: VERIFIED, NOT ANCHORED` or `Verdict: FAIL`) with the next step. An unanchored result is not a trusted verdict and `isError` stays false for it. Pass `trustAnchors` to get a trusted verdict.
64
+ - **`agledger_verify` reports a verdict, as `@agledger/verify` and `agledger verify` do.** `structuredContent` carries `verdict`: `trusted` when the chain is valid and `keyTrust.status` is `walked`, `failed` when it is not valid, and `unanchored` otherwise. The text block mirrors `structuredContent` as JSON and adds a `summary` (`Verdict: PASS`, `Verdict: VERIFIED, NOT ANCHORED` or `Verdict: FAIL`) with the next step. An unanchored result is not a trusted verdict, and `isError` stays false for it. Pass `trustAnchors` to get a trusted verdict.
30
65
 
31
66
  ### Added
32
67
 
33
68
  - **`trustAnchors` and `distrustedKeys` on `agledger_verify`.** `trustAnchors` takes SPKI digests (`sha256:<hex>`) of vault keys you obtained out of band, and the signed key statements in the export are walked from them. An entry signed by a key the walk does not reach fails `CHAIN_SIGNING_KEY_UNANCHORED`, and a statement that does not hold fails with `KEY_STATEMENT_INVALID`, `KEY_CLOSURE_INVALID` or `CHAIN_KEY_WINDOW_DRIFT`. `distrustedKeys` takes your `VAULT_DISTRUSTED_KEYS` entries and requires `trustAnchors`; a pin may carry a date (`sha256:<hex>@<instant>`) to vouch for what the key signed before that instant. Invalid input is refused with `INVALID_ARGUMENT`. Requires `@agledger/verify-core` 2.0.0.
34
- - **`agledger_verify` names the distrust entry an export says the Server applied.** When an API 2.0 export lists a distrusted key and your call did not pass the matching `distrustedKeys` entry, the `CHAIN_KEY_WINDOW_DRIFT` or `KEY_CLOSURE_INVALID` finding names the entry to confirm with the Server's operator.
35
- - **`agledger_verify` reports an unsigned entry written while the vault was signing.** Such an entry fails with the new `CHAIN_ENTRY_UNSIGNED`, and an entry that names a key but carries an all-zero signature fails `CHAIN_SIGNATURE_INVALID`. Both match the Server's own chain verification.
69
+ - When an API 2.0 export lists a distrusted key and your call did not pass the matching `distrustedKeys` entry, the `CHAIN_KEY_WINDOW_DRIFT` or `KEY_CLOSURE_INVALID` finding names the entry to confirm with the Server's operator.
70
+ - `agledger_verify` reports an unsigned entry written while the vault was signing as the new `CHAIN_ENTRY_UNSIGNED`, and an entry that names a key but carries an all-zero signature as `CHAIN_SIGNATURE_INVALID`.
36
71
 
37
72
  ### Changed
38
73
 
39
74
  - **A timeout returns the key to retry with, and `--timeout` exists.** A POST that times out or loses its connection returns the `Idempotency-Key` it sent as `idempotencyKey`; retry with that exact key to avoid creating a second record. `--timeout <seconds>` (or `AGLEDGER_TIMEOUT`) sets the wait for each response, default 30; anything other than a positive number up to 2147483 exits 2.
40
75
  - **A malformed API URL refuses startup.** An `--api-url` or `AGLEDGER_API_URL` that is not an absolute `http` or `https` URL exits 2 before the server accepts a connection, and names where the URL came from.
41
- - `agledger_verify` walks an export's key statements in write order (`createdAt`, then `id`). A statement that counts for nothing only because its signer is distrusted and dated before the cutoff is reported as a `keyTrust.notes` entry (`Key note:` in the verdict text) rather than a finding.
42
- - **A refused OIDC cert exchange reports the Server's `detail`.** API 2.0 error bodies carry `detail` rather than a top-level `message`, and the exchange error now reads it.
43
- - **Documentation: body signatures under cert auth.** The README states that the Server verifies the body signature on every authenticated route under cert auth and seals it into each chain entry the request writes. The server sends `X-Agent-Signature` only with the OIDC cert credential and only on a request with a body.
44
- - **Documentation: `AGLEDGER_OIDC_AGENT_ID` is an assertion, not a choice of agent.** The Server binds a cert to the agent the token names. If `AGLEDGER_OIDC_AGENT_ID` names a different agent, or the token binds none, the exchange is refused with 403 `CERT_AGENT_BINDING_MISMATCH`; a token bound to a federation shadow agent is refused with 403 `SHADOW_AGENT_CERT_FORBIDDEN`. Bind the agent with `PATCH /v1/agents/{id}` (`oidcIss` and `oidcSub`) or `claimMapping.agent_id` on the trusted issuer.
76
+ - A refused OIDC cert exchange reports the Server's `detail`, which API 2.0 error bodies carry in place of a top-level `message`.
77
+ - A key statement that counts for nothing only because its signer is distrusted and dated before the cutoff is reported as a `keyTrust.notes` entry (`Key note:` in the verdict text) rather than a finding.
78
+ - The README states that under cert auth the Server verifies the body signature on every authenticated route and seals it into each chain entry the request writes. `X-Agent-Signature` is sent only with the OIDC cert credential and only on a request with a body.
79
+ - The README states that `AGLEDGER_OIDC_AGENT_ID` is an assertion, not a choice of agent. A cert is bound to the agent the token names; if `AGLEDGER_OIDC_AGENT_ID` names a different agent, or the token binds none, the exchange is refused with 403 `CERT_AGENT_BINDING_MISMATCH`, and a token bound to a federation shadow agent is refused with 403 `SHADOW_AGENT_CERT_FORBIDDEN`. Bind the agent with `PATCH /v1/agents/{id}` (`oidcIss` and `oidcSub`) or `claimMapping.agent_id` on the trusted issuer.
45
80
 
46
81
  ## [2.11.0] - 2026-09-21
47
82
 
48
83
  ### Added
49
84
 
50
85
  - **`agledger_verify` refuses a re-attributed export.** The `actorId`, `actorRole` and `actorOwnerId` an export displays are cross-checked against the signed actor claim, and a mismatch fails with the new `CHAIN_ACTOR_ATTRIBUTION_MISMATCH`. Requires `@agledger/verify-core` 1.5.0.
51
- - **The server can authenticate with an OIDC token instead of an API key.** Set `AGLEDGER_OIDC_TOKEN_FILE` (a file holding the token, such as a Kubernetes projected service-account token) or `AGLEDGER_OIDC_TOKEN_CMD` (a shell command that prints one), plus `AGLEDGER_OIDC_AGENT_ID` to bind the cert to a specific agent. The server generates an Ed25519 key pair in memory, exchanges the token for a short-lived cert (`POST /v1/auth/oidc/cert`) and presents the cert as its bearer, so no long-lived secret sits in the MCP client configuration. An API key wins when set, then the command, then the file; the server prints a note naming any source it ignores.
86
+ - **The server can authenticate with an OIDC token instead of an API key.** Set `AGLEDGER_OIDC_TOKEN_FILE` (a file holding the token, such as a Kubernetes projected service-account token) or `AGLEDGER_OIDC_TOKEN_CMD` (a shell command that prints one), plus `AGLEDGER_OIDC_AGENT_ID` to bind the cert to a specific agent. The server generates an Ed25519 key pair in memory, exchanges the token for a short-lived cert (`POST /v1/auth/oidc/cert`) and presents the cert as its bearer, so no long-lived secret sits in the MCP client configuration. An API key wins when set, then the command, then the file; a note names any source that is ignored.
52
87
  - The token source is read on every exchange, and the cert is re-exchanged once half its lifetime has passed. A 401 on a cert forces one re-exchange and one retry with the same body and `Idempotency-Key`.
53
- - Every request body is signed with the key bound to the cert (`X-Agent-Signature-Content-Hash` and `X-Agent-Signature`), so the Server records the agent's own signature in the chain entry on the routes that accept one.
88
+ - Every request body is signed with the key bound to the cert (`X-Agent-Signature-Content-Hash` and `X-Agent-Signature`), so the agent's own signature is recorded in the chain entry on routes that accept one.
54
89
  - A failed exchange returns `OIDC_EXCHANGE_FAILED` with the Server's status, error body and `recoveryHint`; a token source that cannot produce a token returns `OIDC_TOKEN_SOURCE_FAILED`. Tokens are scrubbed from both.
55
- - A token command runs in its own process group and is killed on a 60-second timeout or more than 64 KiB of output.
56
- - `agledger_discover` fetches `/health` without a credential. A token file that cannot be read exits 2 at startup.
90
+ - A token command is killed on a 60-second timeout or more than 64 KiB of output. A token file that cannot be read exits 2 at startup.
57
91
  - **The server can act on behalf of a person or another party.** `AGLEDGER_ON_BEHALF_OF_CMD` (a shell command) or `AGLEDGER_ON_BEHALF_OF_FILE` names an RFC 8693 delegation token, which the server sends as `AGLedger-On-Behalf-Of` on every POST. The token comes from the process, never from a tool argument, and is scrubbed from every error and tool result. `agledger_discover` reports only whether a delegation is configured and its source. With the OIDC cert credential the Server records the delegation as `bound` to the agent's identity; with an API key, as `unbound`.
58
92
  - **`agledger_verify` takes `agentKeys`**, the Ed25519 public keys (JWKs) of agent certs. An entry whose sealed agent signature names one of them has that signature re-verified offline, and a failure is the new `CHAIN_AGENT_SIGNATURE_INVALID`. Without it, `agentSignatures` counts the signatures without checking them. Requires `@agledger/verify-core` 1.5.0.
59
93
 
@@ -61,12 +95,7 @@ Targets API 2.0 only.
61
95
 
62
96
  - **An argument a tool does not declare is refused.** Each tool answers an undeclared argument with `code: UNKNOWN_ARGUMENT`, naming the argument and the ones it accepts, before anything is sent. For example, `agledger_api` called with `body` instead of `params` now says so.
63
97
  - The `agledger_api` description and the README name `recoveryHint` as the field to read on Server errors, and `suggestion` for errors the tool raises itself.
64
- - The `agledger_verify` description now lists all 19 failure codes an audit export can produce, including `CHAIN_OIDC_ACTOR_MISMATCH`, `CHAIN_KEY_EXPIRED` and `CHAIN_KEY_NOT_YET_ACTIVE`.
65
-
66
- ### Changed
67
-
68
- - `LICENSE` follows SDK License Template 1.9.
69
- - The README describes AGLedger as agent memory, approvals, audit trail and notifications on one API and one signed ledger, self-hosted.
98
+ - The `agledger_verify` description lists all 19 failure codes an audit export can produce.
70
99
 
71
100
  ## [2.10.1] - 2026-09-10
72
101
 
@@ -82,25 +111,24 @@ Targets API 2.0 only.
82
111
 
83
112
  ### Fixed
84
113
 
85
- - **Tool argument descriptions are published when the host already has zod 3.** The package now declares `zod` as a peer dependency with the same `^3.25.0 || ^4.0.0` range as `@modelcontextprotocol/sdk` and imports the `zod/v4` subpath, so a single copy of zod serves both. The server warns on stderr at startup if a dependency tree still resolves two different zod versions.
86
- - **`agledger_verify` publishes `export` as a required argument.** The tool schema now lists it in `required`.
87
- - **Object query parameters are sent correctly.** `agledger_api` with `GET /v1/records/search` and a `criteria` or `metadata` filter now expands objects into bracket notation (`metadata[state]=blocked`), and a `Date` serializes as ISO-8601.
114
+ - Tool argument descriptions are published when the host already has zod 3. The package declares `zod` as a peer dependency, and the server warns on stderr at startup if a dependency tree resolves two different zod versions.
115
+ - `agledger_verify` publishes `export` as a required argument.
116
+ - Object query parameters are sent correctly. `agledger_api` with `GET /v1/records/search` and a `criteria` or `metadata` filter expands objects into bracket notation (`metadata[state]=blocked`), and a `Date` serializes as ISO-8601.
88
117
 
89
118
  ### Changed
90
119
 
91
- - **The `params` description says the body is not type-coerced.** Identifier fields such as `externalTaskId`, `correlationId`, `platformRef`, `projectRef` and `publisher` are strings, so all-digit values must be written as strings.
92
- - **The `agledger_api` description covers supersession:** `supersedesRecordId` with `?superseded=false` returns the current state of tracked work, `supersededByCount` above 1 means a fork with several current heads, and signed `criteria` differ from unsigned `metadata` as filters.
93
- - `@agledger/verify-core` moves to `^1.4.0`.
120
+ - The `params` description says the body is not type-coerced: identifier fields such as `externalTaskId`, `correlationId`, `platformRef`, `projectRef` and `publisher` are strings, so all-digit values must be written as strings.
121
+ - The `agledger_api` description covers supersession: `supersedesRecordId` with `?superseded=false` returns the current state of tracked work, `supersededByCount` above 1 means a fork with several current heads, and signed `criteria` differ from unsigned `metadata` as filters.
94
122
 
95
123
  ## [2.9.0] - 2026-08-07
96
124
 
97
125
  ### Fixed
98
126
 
99
- - **A server that refuses to start now exits non-zero.** A missing `--api-url` previously printed an error and exited 0.
100
- - **The Quick Start and `--help` show `--api-url` as required.** The README `claude_desktop_config.json` example and the `--help` usage line now include it.
101
- - **An unknown flag prints an error, points at `--help`, and exits 2.**
127
+ - A server that refuses to start now exits non-zero. A missing `--api-url` previously printed an error and exited 0.
128
+ - The Quick Start and `--help` show `--api-url` as required.
129
+ - An unknown flag prints an error, points at `--help`, and exits 2.
102
130
 
103
- ### Changed (behavior)
131
+ ### Changed
104
132
 
105
133
  - **Exit codes are a documented contract:** `0` clean, `1` runtime failure, `2` usage or configuration error. A missing `--api-key` or `--api-url` now exits 2. A launcher that checked for exactly `1` to detect bad configuration should check for 2.
106
134
 
@@ -108,7 +136,7 @@ Targets API 2.0 only.
108
136
 
109
137
  ### Added
110
138
 
111
- - **`agledger://llms.txt` resource.** It fetches live from `GET /llms.txt`, and `agledger_discover` now points to it.
139
+ - `agledger://llms.txt` resource, fetched live from `GET /llms.txt`. `agledger_discover` points to it.
112
140
 
113
141
  ### Changed
114
142
 
@@ -118,26 +146,25 @@ Targets API 2.0 only.
118
146
 
119
147
  ### Added
120
148
 
121
- - **`agledger_verify` handles ES256 chains** via `@agledger/verify-core` 1.2.0. Unsupported algorithms still fail closed as `CHAIN_UNSUPPORTED_ALGORITHM`.
149
+ - `agledger_verify` handles ES256 chains. Unsupported algorithms still fail closed as `CHAIN_UNSUPPORTED_ALGORITHM`.
122
150
 
123
151
  ## [2.6.0] - 2026-08-05
124
152
 
125
153
  ### Changed
126
154
 
127
- - **`agledger_verify` takes `@agledger/verify-core` `^1.1.0`.** Algorithm dispatch binds to the trusted verification key rather than the unverified protected header. Tampered or missing header `alg` values fail as `CHAIN_ALG_MISMATCH`, a key algorithm beyond the build fails as `CHAIN_UNSUPPORTED_ALGORITHM`, the signed kid is cross-checked against `signingKeyId` (`CHAIN_SIGNING_KEY_DRIFT`), and untagged COSE_Sign1 is rejected. Valid Ed25519 exports verify as before.
155
+ - `agledger_verify` binds algorithm dispatch to the trusted verification key rather than the unverified protected header. Tampered or missing header `alg` values fail as `CHAIN_ALG_MISMATCH`, a key algorithm beyond the build fails as `CHAIN_UNSUPPORTED_ALGORITHM`, the signed kid is cross-checked against `signingKeyId` (`CHAIN_SIGNING_KEY_DRIFT`), and untagged COSE_Sign1 is rejected. Valid Ed25519 exports verify as before.
128
156
 
129
157
  ## [2.5.6] - 2026-08-01
130
158
 
131
159
  ### Security
132
160
 
133
- - Upgraded `@modelcontextprotocol/sdk` to `^1.30.0` and refreshed transitive dependencies (`@hono/node-server`, `hono`, `fast-uri`, `body-parser`), so a fresh install reports no `npm audit` vulnerabilities. No tool-surface or behavior change.
161
+ - Upgraded `@modelcontextprotocol/sdk` to `^1.30.0` and refreshed transitive dependencies, so a fresh install reports no `npm audit` vulnerabilities. No tool-surface or behavior change.
134
162
 
135
163
  ## [2.5.5] - 2026-07-16
136
164
 
137
165
  ### Changed
138
166
 
139
- - The `agledger_discover` tool description and quickstart now lead with notarize.
140
- - The README drops outdated terminology.
167
+ - The `agledger_discover` tool description and quickstart lead with notarize.
141
168
 
142
169
  ## [2.5.4] - 2026-06-29
143
170
 
@@ -153,13 +180,13 @@ Targets API 2.0 only.
153
180
 
154
181
  ### Security
155
182
 
156
- - Replaced a regex-based trailing-slash strip with a linear scan to remove a polynomial-backtracking risk flagged by CodeQL (`js/polynomial-redos`). No tool-surface or behavior change.
183
+ - Replaced a regex-based trailing-slash strip with a linear scan to remove a polynomial-backtracking risk. No tool-surface or behavior change.
157
184
 
158
185
  ## [2.5.1] - 2026-06-10
159
186
 
160
187
  ### Changed
161
188
 
162
- - `LICENSE` is updated to the canonical AGLedger SDK license template v1.5. The README drops a retired protocol link and trims the trademark footer to match `LICENSE` section 7.
189
+ - `LICENSE` updated to the canonical AGLedger SDK license template v1.5.
163
190
 
164
191
  ## [2.5.0] - 2026-06-08
165
192
 
@@ -169,11 +196,11 @@ Aligned with AGLedger API v1.0.0 GA. The tool surface is unchanged from 2.4.x.
169
196
 
170
197
  ### Security
171
198
 
172
- - `agledger_api` rejects a `path` starting with `//` (returns a `PATH_INVALID` error result), and every request is pinned to the configured API origin. This prevents a crafted path from sending the API key to another host.
199
+ - `agledger_api` rejects a `path` starting with `//` (returns a `PATH_INVALID` error result), and every request is pinned to the configured API origin, so a crafted path cannot send the API key to another host.
173
200
 
174
201
  ### Changed
175
202
 
176
- - Added `_meta.requiredScopes` to the tools where a scope can be stated: `agledger_verify` and `agledger_discover` declare `[]`. `agledger_api` declares none, since each route enforces its own scope.
203
+ - Added `_meta.requiredScopes` to `agledger_verify` and `agledger_discover`, both `[]`. `agledger_api` declares none, since each route enforces its own scope.
177
204
 
178
205
  ## [2.4.10] - 2026-06-04
179
206
 
@@ -199,19 +226,19 @@ Published with npm build provenance (verify with `npm audit signatures`) and a C
199
226
 
200
227
  ### Changed
201
228
 
202
- - `agledger_verify` runs on `@agledger/verify-core@^0.1.3`. A denormalized `payload` rewritten while `coseSign1` stays intact fails `CHAIN_PAYLOAD_BINDING_MISMATCH`, and a signature skipped because of an upstream chain break reports `not-checked`.
229
+ - A `payload` rewritten while `coseSign1` stays intact fails `CHAIN_PAYLOAD_BINDING_MISMATCH`, and a signature skipped because of an upstream chain break reports `not-checked`.
203
230
 
204
231
  ## [2.4.6] - 2026-05-28
205
232
 
206
233
  ### Changed
207
234
 
208
- - Updated to `@agledger/verify-core` 0.1.2. The `publicKeys` argument of `agledger_verify` accepts either the compact `{keyId: SPKI-DER-base64}` map or the array from `GET /v1/verification-keys` (`[{keyId, publicKey, ...}]`), as a JSON-encoded string or a native object or array. Malformed input returns the standard `{code: "INVALID_JSON", suggestion}` error.
235
+ - The `publicKeys` argument of `agledger_verify` accepts either the compact `{keyId: SPKI-DER-base64}` map or the array from `GET /v1/verification-keys`, as a JSON-encoded string or a native object or array. Malformed input returns the standard `{code: "INVALID_JSON", suggestion}` error.
209
236
 
210
237
  ## [2.4.5] - 2026-05-28
211
238
 
212
239
  ### Changed
213
240
 
214
- - Updated to `@agledger/verify-core` 0.1.1. `agledger_verify` applies the `oidc_actor` and `key_temporal` checks to exports that carry the new fields; older exports still report them as `skipped_no_input`.
241
+ - `agledger_verify` applies the `oidc_actor` and `key_temporal` checks to exports that carry the new fields; older exports still report them as `skipped_no_input`.
215
242
 
216
243
  ## [2.4.4] - 2026-05-27
217
244
 
@@ -227,15 +254,11 @@ Published with npm build provenance (verify with `npm audit signatures`) and a C
227
254
 
228
255
  ### Fixed
229
256
 
230
- - **`agledger_verify` rejected valid exports.** It now reads `chainPosition` (with a `position` fallback for older exports) instead of only the legacy `position` field.
257
+ - `agledger_verify` rejected valid exports. It now reads `chainPosition` (with a `position` fallback for older exports) instead of only the legacy `position` field.
231
258
 
232
259
  ## [2.4.2] - 2026-05-27
233
260
 
234
- Tracks AGLedger API v0.25.5 (Verify to Gate rename). The renamed routes reach `agledger_api` automatically, and `agledger_verify` is unchanged.
235
-
236
- ### Changed
237
-
238
- - README: the Verdicts capability is described as accept/reject.
261
+ Tracks AGLedger API v0.25.5. The renamed routes reach `agledger_api` automatically, and `agledger_verify` is unchanged.
239
262
 
240
263
  ## [2.4.1] - 2026-05-21
241
264
 
@@ -251,8 +274,7 @@ Tracks AGLedger API v0.23.0, which moves the chain to a canonical COSE_Sign1 env
251
274
 
252
275
  ### Changed (breaking)
253
276
 
254
- - `agledger_verify` decodes COSE_Sign1 envelopes (RFC 9052, tag 18, EdDSA) over in-toto v1 Statement payloads with deterministic CBOR (RFC 8949 section 4.2.1), replacing the earlier JCS and detached-Ed25519 verifier.
255
- - The tool description now covers COSE_Sign1 and the new failure modes `cose_decode_failed` and `cose_header_mismatch`.
277
+ - `agledger_verify` decodes COSE_Sign1 envelopes (RFC 9052, tag 18, EdDSA) over in-toto v1 Statement payloads with deterministic CBOR (RFC 8949 section 4.2.1), replacing the earlier JCS and detached-Ed25519 verifier. New failure modes are `cose_decode_failed` and `cose_header_mismatch`.
256
278
  - `structuredContent` carries a `signatureCoverage` object (`{ signed, unsigned, skipped, total }`). Do not conclude "Ed25519-verified" from `valid: true` alone; report `signatureCoverage` or `integrityLevel`.
257
279
  - New `chainIntegrityReason: "payload_drift"` when the visible `payload` differs from the predicate signed in `coseSign1`.
258
280
  - Export format 1.0 (`exportFormatVersion: "1.0"`) is rejected with `unsupported_algorithm`. Re-export the chain with `agledger_api method=GET path=/v1/records/{id}/audit-export` from a v0.23.0 or later Server.
@@ -260,24 +282,20 @@ Tracks AGLedger API v0.23.0, which moves the chain to a canonical COSE_Sign1 env
260
282
 
261
283
  ### Changed
262
284
 
263
- - `agledger_discover` quickstart step 4 and the `agledger_api` description now say "submit a completion" with the path `/v1/records/{id}/completions` (was `/v1/records/{id}/receipts`). Update any prompts that target the old path.
264
-
265
- The three-tool surface is unchanged: `agledger_discover`, `agledger_api` and `agledger_verify`.
285
+ - The `agledger_discover` quickstart and the `agledger_api` description now say "submit a completion" with the path `/v1/records/{id}/completions` (was `/v1/records/{id}/receipts`). Update any prompts that target the old path.
266
286
 
267
287
  ## [2.3.3] - 2026-05-06
268
288
 
269
289
  ### Fixed
270
290
 
271
- - **Gemini MCP integrations work on non-trivial calls.** `agledger_api.params`, `agledger_verify.export` and `agledger_verify.publicKeys` are now declared as JSON-encoded strings, which Gemini's function-call grammar accepts. Object-native runtimes (Claude Desktop, ChatGPT MCP) can still pass a native object. Malformed JSON returns the `INVALID_JSON` error with a suggestion for retrying.
291
+ - Gemini MCP integrations work on non-trivial calls. `agledger_api.params`, `agledger_verify.export` and `agledger_verify.publicKeys` are declared as JSON-encoded strings, which Gemini's function-call grammar accepts. Object-native runtimes can still pass a native object. Malformed JSON returns the `INVALID_JSON` error with a suggestion for retrying.
272
292
 
273
293
  ## [2.3.2] - 2026-05-06
274
294
 
275
295
  ### Fixed
276
296
 
277
- - **Tool results are visible to LLM-driven MCP runtimes.** All three tools now mirror `structuredContent` into a single text content block on every success and error path.
278
- - `serverInfo.version`, `User-Agent` and the `--help` banner now read the version from `package.json`.
279
- - The `--help` banner lists all three tools, including `agledger_verify`.
280
- - The text mirror is no longer pretty-printed, which cuts token use on large responses.
297
+ - Tool results are visible to LLM-driven MCP runtimes. All three tools mirror `structuredContent` into a single, compact text content block on every success and error path.
298
+ - `serverInfo.version`, `User-Agent` and the `--help` banner read the version from `package.json`, and the banner lists all three tools.
281
299
 
282
300
  ## [2.3.1] - 2026-04-30
283
301
 
@@ -290,9 +308,11 @@ Tracks AGLedger API v0.21.5. Every `/v1/mandates/*` route is now `/v1/records/*`
290
308
  ### Changed (breaking)
291
309
 
292
310
  - Offline verifier output fields are renamed: `mandateId` to `recordId` and `contractType` to `type`; `MandateAuditExport` is now `RecordAuditExport`. The signature input `{position}:{payloadHash}:{previousHash}` is unchanged.
293
- - The `agledger_verify` description points at `/v1/records/{id}/audit-export`, and the `INVALID_EXPORT` error suggestion is updated to match.
311
+ - The `agledger_verify` description and `INVALID_EXPORT` suggestion point at `/v1/records/{id}/audit-export`.
294
312
 
295
313
  ### Changed
296
314
 
297
- - `agledger_discover` quickstart now reads: `GET /v1/schemas` to list Record types, `GET /v1/schemas/{type}` for required fields and examples, `POST /v1/records` to create a record, `POST /v1/records/{id}/receipts` to submit evidence when done.
315
+ - The `agledger_discover` quickstart reads: `GET /v1/schemas` to list Record types, `GET /v1/schemas/{type}` for required fields and examples, `POST /v1/records` to create a record, `POST /v1/records/{id}/receipts` to submit evidence when done.
298
316
  - The `agledger_api` description and the README use the Record and Type vocabulary.
317
+
318
+ Releases before 2.3.0 are listed on npm (https://www.npmjs.com/package/@agledger/mcp-server?activeTab=versions).
package/README.md CHANGED
@@ -28,17 +28,17 @@ Add to your MCP client configuration (e.g. `claude_desktop_config.json`):
28
28
  "mcpServers": {
29
29
  "agledger": {
30
30
  "command": "agledger-mcp",
31
- "args": [
32
- "--api-key", "your-api-key",
33
- "--api-url", "https://your-agledger-instance"
34
- ]
31
+ "args": ["--api-url", "https://your-agledger-instance"],
32
+ "env": { "AGLEDGER_API_KEY": "your-api-key" }
35
33
  }
36
34
  }
37
35
  }
38
36
  ```
39
37
 
40
- Both flags are required, unless an OIDC token source stands in for the key (see
41
- [below](#authenticating-with-oidc-instead-of-an-api-key)). AGLedger is
38
+ The API URL and the API key are both required, unless an OIDC token source
39
+ stands in for the key (see
40
+ [below](#authenticating-with-oidc-instead-of-an-api-key)). The key can also be
41
+ passed as `--api-key`, but the `env` form keeps it out of the process list. AGLedger is
42
42
  self-hosted, so there is no default server to call: without `--api-url`, or
43
43
  with one that is not an absolute `http` or `https` URL, the server exits before
44
44
  it accepts a connection.
@@ -68,6 +68,7 @@ Nothing is written to disk.
68
68
  |---------|-------------|
69
69
  | `AGLEDGER_OIDC_TOKEN_FILE` | A file holding an OIDC JWT, such as a Kubernetes projected service-account token. Read on every exchange, so a token rotated on disk is picked up. |
70
70
  | `AGLEDGER_OIDC_TOKEN_CMD` | A shell command whose stdout is an OIDC JWT. Run on every exchange. |
71
+ | `AGLEDGER_AGENT_KEYS_FILE` | Optional. A JWK Set file the server's cert public key is added to on each exchange, before the cert is used. The key re-verifies the agent signatures the server seals, offline: pass the file as `agentKeys` to `agledger_verify` or `--agent-keys` to a verifier. One key per server process; `agledger_discover` also shows it as `agentKey`. Server processes and agledger CLI commands can share one file: each takes `<file>.lock` while it adds its key. Public keys only. |
71
72
  | `AGLEDGER_OIDC_AGENT_ID` | Optional. An assertion of the agent id the token binds to, sent on the exchange. It never chooses the agent: when it names a different one, or the token binds none, the Server refuses the exchange with 403 `CERT_AGENT_BINDING_MISMATCH` rather than issue a cert for an agent you did not expect. Leave it unset unless you want that check. |
72
73
 
73
74
  An API key wins when one is set, then the command, then the file.
@@ -164,12 +165,12 @@ to compare, and it is recorded `unbound`.
164
165
  | Tool | Description |
165
166
  |------|-------------|
166
167
  | `agledger_discover` | Returns API health, your identity, available scopes, and a quickstart workflow. Call this first. |
167
- | `agledger_api` | Make any AGLedger API call (method, path, params). Every POST carries a generated `Idempotency-Key`; pass `idempotencyKey` to reuse the first attempt's key when retrying a call that may already have landed. The API returns `nextSteps` on every response for self-guided workflow discovery. |
168
- | `agledger_verify` | Verify a record audit export offline (COSE_Sign1 envelopes per RFC 9052, hash chain + envelope signatures, Ed25519 or ES256). No network calls. Returns the verifier's result as one JSON text block (the same object as `structuredContent`), with `summary` stating the verdict and the next step. Pass `trustAnchors` (`["sha256:<digest>"]`, the SPKI digest of a vault key the operator took out of band; the installer prints the first one) so the export's signed key statements are walked from a key you trust: an entry under a key the walk does not reach fails `CHAIN_SIGNING_KEY_UNANCHORED`, and a statement that does not hold fails `KEY_STATEMENT_INVALID`, `KEY_CLOSURE_INVALID` or `CHAIN_KEY_WINDOW_DRIFT`. The result carries `verdict`: `trusted` (text `Verdict: PASS`) only when the chain is valid and the walk reached a signature, `failed` (`Verdict: FAIL`), or `unanchored` (`Verdict: VERIFIED, NOT ANCHORED`), which is not a trusted verdict. A run is unanchored without `trustAnchors` (`keyTrust.status` `no_anchor`, the keys taken on the export's word) and when the pin was walked but no signature verified under a key it anchors (`no_anchored_signature`, as for an export of unsigned entries). `distrustedKeys` takes the operator's `VAULT_DISTRUSTED_KEYS` entries and needs `trustAnchors`, and a key both pinned and distrusted is refused (`INVALID_ARGUMENT`), as the Server refuses to start with it; a key statement a distrusted key signed counts for nothing at any instant, because the write times an export carries are not signed. Where an export lists a key retired at the instant the Server distrusts it from (`distrustedFrom`), earlier than its signed retirement, a pinned call without the same `distrustedKeys` entry fails on that key's window (`CHAIN_KEY_WINDOW_DRIFT`, or `KEY_CLOSURE_INVALID` where no closure retires it), and the finding names the entry (`distrustedKeys sha256:<hex>@<distrustedFrom>`), the listing's unsigned word, to confirm with the operator before passing it. `publicKeys` supplies keys (the `GET /v1/verification-keys` response works as is), `requireSuppliedKeys` refuses the export's embedded keys, `agentKeys` (the agents' cert public keys as JWKs) re-verifies the agent signatures sealed in the chain, and `federationKeys` (`{"<hubId>": "<key>"}`, each peer Server's federation key as its operator gives it) re-verifies the peer messages a receiving Server sealed on its `FEDERATION_*` entries, which fail `CHAIN_FEDERATION_WIRE_INVALID` when they do not hold. After a peer changes its federation key, give an array entry `history`, the JSON the peer serves at `GET /.well-known/agledger-federation-keys.json`, so the entries sealed under its earlier keys verify too. Input verify-core refuses, such as a supplied key window that is not RFC 3339, is `INVALID_ARGUMENT`. Built on the shared `@agledger/verify-core`. |
168
+ | `agledger_api` | Make any AGLedger API call (method, path, params). Every POST carries a generated `Idempotency-Key`; pass `idempotencyKey` to reuse the first attempt's key when retrying a call that may already have landed. Most responses carry `nextSteps` for self-guided workflow discovery; listing pages, `GET /v1/schemas` and `GET /v1/admin/orgs` carry none. It reaches the request fields and filters of AGLedger Server 3.0.0 as they are: `producedBy` on a record or completion, `traceId`, `originRecordId`, `producedBy[key]` and the numeric `criteriaGt/Gte/Lt/Lte` and `metadataGt/Gte/Lt/Lte` bounds on search (nested objects in `params`, sent as `criteriaGte[amount]=500`), `GET /v1/records/counts` with `groupBy`, `signatureMeaning` on a verdict (taken only on an ephemeral OIDC cert; the Server refuses it with 422 on an API key), and `format=html` on an audit export, which comes back as the page text exactly as the Server sent it. |
169
+ | `agledger_verify` | Verify a record audit export offline (COSE_Sign1 envelopes per RFC 9052, hash chain + envelope signatures, Ed25519 or ES256). No network calls. Returns the verifier's result as one JSON text block (the same object as `structuredContent`), with `summary` stating the verdict and the next step. Pass `trustAnchors` (`["sha256:<digest>"]`, the SPKI digest of a vault key the operator took out of band; the installer prints the first one) so the export's signed key statements are walked from a key you trust: an entry under a key the walk does not reach fails `CHAIN_SIGNING_KEY_UNANCHORED`, and a statement that does not hold fails `KEY_STATEMENT_INVALID`, `KEY_CLOSURE_INVALID` or `CHAIN_KEY_WINDOW_DRIFT`. The result carries `verdict`: `trusted` (text `Verdict: PASS`) only when the chain is valid and the walk reached a signature, `failed` (`Verdict: FAIL`), or `unanchored` (`Verdict: VERIFIED, NOT ANCHORED`), which is not a trusted verdict. A run is unanchored without `trustAnchors` (`keyTrust.status` `no_anchor`, the keys taken on the export's word) and when the pin was walked but no signature verified under a key it anchors (`no_anchored_signature`, as for an export of unsigned entries). A pinned run whose `trustAnchors` reach none of the export's keys, on an export that verifies without them, is `unanchored` with `valid: false` (`Verdict: NOT ANCHORED`): that is another Server's pin, or an export re-signed under keys of its own. `isError` is set only for `failed`. `distrustedKeys` takes the operator's `VAULT_DISTRUSTED_KEYS` entries and needs `trustAnchors`, and a key both pinned and distrusted is refused (`INVALID_ARGUMENT`), as the Server refuses to start with it; a key statement a distrusted key signed counts for nothing at any instant, because the write times an export carries are not signed. Where an export lists a key retired at the instant the Server distrusts it from (`distrustedFrom`), earlier than its signed retirement, a pinned call without the same `distrustedKeys` entry fails on that key's window (`CHAIN_KEY_WINDOW_DRIFT`, or `KEY_CLOSURE_INVALID` where no closure retires it), and the finding names the entry (`distrustedKeys sha256:<hex>@<distrustedFrom>`), the listing's unsigned word, to confirm with the operator before passing it. `publicKeys` supplies keys (the `GET /v1/verification-keys` response works as is), `requireSuppliedKeys` refuses the export's embedded keys, `agentKeys` (the agents' cert public keys: an array of JWKs, one JWK, or the `{"keys":[...]}` set `AGLEDGER_AGENT_KEYS_FILE` collects) re-verifies the agent signatures sealed in the chain, and `federationKeys` (`{"<hubId>": "<key>"}`, each peer Server's federation key as its operator gives it) re-verifies the peer messages a receiving Server sealed on its `FEDERATION_*` entries, which fail `CHAIN_FEDERATION_WIRE_INVALID` when they do not hold. After a peer changes its federation key, give an array entry `history`, the JSON the peer serves at `GET /.well-known/agledger-federation-keys.json`, so the entries sealed under its earlier keys verify too. Federation key histories need a Server 2.2 or later on the peer. A peer message signed more than 300 seconds after its key's retirement fails unless `allowAfterRetirement` is true. `expectedEntryCount` holds the export to an entry count taken out of band, since the counts it states are unsigned: a different number of entries fails `CHAIN_POSITION_GAP`. Input verify-core refuses, such as a supplied key window that is not RFC 3339, is `INVALID_ARGUMENT`. Built on the shared `@agledger/verify-core`. |
169
170
 
170
171
  ## Resources
171
172
 
172
- Both are fetched live from the running instance, so neither can go stale.
173
+ Both are fetched live from the running instance on every read.
173
174
 
174
175
  | Resource | Description |
175
176
  |------|-------------|
@@ -185,15 +186,15 @@ The `agledger_discover` tool returns a quickstart workflow that guides agents th
185
186
  3. `POST /v1/records`: create a record
186
187
  4. `POST /v1/records/{id}/completions`: submit a completion (evidence) when done
187
188
 
188
- Every API error response includes a `recoveryHint` naming the fix, so an agent can correct itself without a human. Errors raised by the MCP server itself (an argument the tool does not declare, a timeout, a credential failure) carry a `code` and a `suggestion` instead.
189
+ An error from the Server is passed through as sent, with its `recoveryHint` naming the fix where it gives one, so an agent can correct itself without a human. The result adds `httpStatus`, and `retryAfter` (seconds) when the Server sent a `Retry-After` header. Errors raised by the MCP server itself (an argument the tool does not declare, a timeout, a credential failure) carry a `code` and a `suggestion` instead.
189
190
 
190
191
  ## Configuration
191
192
 
192
193
  | Flag | Env Var | Description |
193
194
  |------|---------|-------------|
194
195
  | `--api-key` | `AGLEDGER_API_KEY` | AGLedger API key. Required unless an OIDC token source is set (see above). |
195
- | `--api-url` | `AGLEDGER_API_URL` | API base URL of your instance (required). AGLedger is self-hosted, so there is no default; the server refuses to start without it. |
196
- | `--timeout` | `AGLEDGER_TIMEOUT` | Seconds to wait for each API response (default 30). A positive number up to 2147483; anything else exits 2. |
196
+ | `--api-url` | `AGLEDGER_API_URL` | API base URL of your instance (required), which may carry a path prefix such as a gateway mount point. AGLedger is self-hosted, so there is no default; the server refuses to start without it. |
197
+ | `--timeout` | `AGLEDGER_TIMEOUT` | Seconds to wait for each API response (default 30). A number from 0.001 to 2147483; anything else exits 2. |
197
198
 
198
199
  A call that times out may still have been applied. On a POST, the `TIMEOUT` error carries the `idempotencyKey` that was sent: retry with exactly that key and the Server returns the original result instead of creating a second record. Reads and other methods carry no key.
199
200
 
@@ -204,11 +205,11 @@ AGLedger is change control for AI agents, delivered as a signed ledger for agent
204
205
  - **Records**: structured commitments with acceptance criteria and tolerance bands
205
206
  - **Completions**: performer evidence recording what was reported to be done
206
207
  - **Verdicts**: principal accept/reject decisions on a Completion (the Gate), with settlement signals
207
- - **Audit chain**: notarized records as COSE_Sign1 envelopes, hash-chained, Ed25519-signed, tamper-evident, verifiable offline
208
+ - **Audit chain**: notarized records as COSE_Sign1 envelopes, hash-chained, signed (Ed25519, or ES256 when the operator chooses it), tamper-evident, verifiable offline
208
209
 
209
210
  Learn more at [agledger.ai](https://www.agledger.ai) | [API docs](https://www.agledger.ai/docs/)
210
211
 
211
- Each self-hosted AGLedger instance also serves interactive Swagger UI at `{AGLEDGER_API_URL}/docs`.
212
+ Each self-hosted AGLedger instance serves its OpenAPI document at `{AGLEDGER_API_URL}/openapi.json`, and an interactive API UI at `{AGLEDGER_API_URL}/docs` when the operator enables it.
212
213
 
213
214
  ## Requirements
214
215
 
@@ -4,6 +4,13 @@ export interface ApiResponse {
4
4
  status: number;
5
5
  body: unknown;
6
6
  ok: boolean;
7
+ /** The Retry-After header as whole seconds from now, when the Server sent one. */
8
+ retryAfterSeconds?: number;
9
+ }
10
+ /** A query value the bracket form cannot carry: an object or array nested below its one level. */
11
+ export declare class QueryShapeError extends Error {
12
+ readonly param: string;
13
+ constructor(param: string);
7
14
  }
8
15
  export interface RequestOptions {
9
16
  query?: Record<string, unknown>;
@@ -26,6 +33,17 @@ export declare class ApiClient {
26
33
  /** Where the delegation token comes from, or undefined when none is configured. Never the token. */
27
34
  get delegationOrigin(): string | undefined;
28
35
  request(method: string, path: string, options?: RequestOptions): Promise<ApiResponse>;
36
+ /**
37
+ * The request URL: the base URL (with any path prefix, such as a gateway
38
+ * mount point) followed by `path`. `new URL(path, base)` would replace that
39
+ * prefix.
40
+ *
41
+ * Defense-in-depth: every request is pinned to the configured API origin. A
42
+ * protocol-relative or absolute `path` (e.g. `//evil.com/x`,
43
+ * `https://evil.com`) would send the `Authorization: Bearer` header off-host,
44
+ * and no caller may steer the client there.
45
+ */
46
+ private urlFor;
29
47
  /** The delegation token never comes back to a tool, even if the Server echoes it. */
30
48
  private scrubbed;
31
49
  private postAnonymous;