@agledger/mcp-server 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +115 -22
- package/README.md +3 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +52 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -1
- package/src/server.ts +70 -1
- package/tests/server.test.ts +96 -4
package/LICENSE
CHANGED
|
@@ -2,33 +2,126 @@ Copyright (c) 2026 AGLedger LLC. All rights reserved.
|
|
|
2
2
|
|
|
3
3
|
PROPRIETARY SOFTWARE LICENSE
|
|
4
4
|
|
|
5
|
-
This software
|
|
6
|
-
proprietary property of AGLedger LLC. The Software is
|
|
7
|
-
|
|
5
|
+
This software, together with its associated documentation files (the "Software"),
|
|
6
|
+
is the proprietary property of AGLedger LLC ("Licensor"). The Software is
|
|
7
|
+
licensed, not sold. Your right to use the Software is limited as set out below.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
BY DOWNLOADING, INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE (INCLUDING
|
|
10
|
+
VIA `npm install`, `pip install`, OR ANY EQUIVALENT PACKAGE-MANAGER COMMAND),
|
|
11
|
+
YOU AGREE TO THE TERMS OF THIS LICENSE. IF YOU DO NOT AGREE, DO NOT DOWNLOAD,
|
|
12
|
+
INSTALL, OR USE THE SOFTWARE.
|
|
12
13
|
|
|
13
|
-
1.
|
|
14
|
-
copies of the Software, except as required to use it with the AGLedger API.
|
|
14
|
+
1. GRANT OF USE
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Licensor grants you a limited, non-exclusive, non-transferable, revocable
|
|
17
|
+
license to install and use the Software solely for the purpose of integrating
|
|
18
|
+
with a self-hosted AGLedger deployment operated by you or your organization, or
|
|
19
|
+
by a third party on your behalf with your authorization. The Software is not
|
|
20
|
+
designed for, and is not licensed for use with, any AGLedger-hosted service.
|
|
21
|
+
AGLedger operates the AGLedger software on a self-hosted model; there is no
|
|
22
|
+
hosted AGLedger API.
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
except to the extent permitted by applicable law.
|
|
24
|
+
2. RESTRICTIONS
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
https://agledger.ai/terms.
|
|
26
|
+
You may not:
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
(a) copy, modify, merge, publish, distribute, sublicense, sell, rent, lease,
|
|
29
|
+
or transfer copies of the Software, except as strictly required to use
|
|
30
|
+
the Software for its intended integration purpose;
|
|
31
|
+
(b) offer the Software, or the functionality enabled by the Software, as a
|
|
32
|
+
hosted or managed service to third parties, whether as a standalone
|
|
33
|
+
offering or embedded within a larger service;
|
|
34
|
+
(c) use the Software to build, train, or benchmark a product or service that
|
|
35
|
+
competes with AGLedger;
|
|
36
|
+
(d) reverse engineer, decompile, or disassemble the Software, except to the
|
|
37
|
+
extent expressly permitted by applicable law that cannot be waived by
|
|
38
|
+
contract;
|
|
39
|
+
(e) circumvent, disable, or tamper with any authentication, license, or usage-
|
|
40
|
+
enforcement mechanism of the Software or of any AGLedger deployment;
|
|
41
|
+
(f) remove, alter, or obscure any copyright, trademark, patent, or other
|
|
42
|
+
proprietary notice in the Software;
|
|
43
|
+
(g) use the Software in violation of U.S. Export Administration Regulations,
|
|
44
|
+
economic sanctions, or other applicable export and trade-control laws.
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
3. OPEN SOURCE COMPONENTS
|
|
32
47
|
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
The Software may include third-party open-source components, each subject to
|
|
49
|
+
its own license terms. A list of such components and their licenses is included
|
|
50
|
+
with or referenced from the Software. In the event of a conflict between this
|
|
51
|
+
License and an open-source license, the open-source license governs solely with
|
|
52
|
+
respect to that component.
|
|
53
|
+
|
|
54
|
+
4. NO WARRANTY
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
|
|
57
|
+
KIND, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE
|
|
58
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
|
59
|
+
NONINFRINGEMENT. AGLEDGER LLC DOES NOT WARRANT THAT THE SOFTWARE WILL BE ERROR-
|
|
60
|
+
FREE, SECURE, OR UNINTERRUPTED.
|
|
61
|
+
|
|
62
|
+
5. LIMITATION OF LIABILITY
|
|
63
|
+
|
|
64
|
+
The limitations in this Section 5 are a material inducement to AGLedger LLC to
|
|
65
|
+
make the Software publicly available at no charge, and they apply notwithstanding
|
|
66
|
+
any failure of essential purpose of any limited remedy and regardless of the
|
|
67
|
+
theory of liability (contract, tort, strict liability, statute, or otherwise).
|
|
68
|
+
|
|
69
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL AGLEDGER
|
|
70
|
+
LLC BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY,
|
|
71
|
+
OR PUNITIVE DAMAGES, OR FOR LOSS OF PROFITS, REVENUE, DATA, USE, GOODWILL, OR
|
|
72
|
+
BUSINESS OPPORTUNITY, ARISING FROM OR RELATED TO THE SOFTWARE, EVEN IF ADVISED
|
|
73
|
+
OF THE POSSIBILITY OF SUCH DAMAGES. AGLEDGER LLC'S TOTAL AGGREGATE LIABILITY
|
|
74
|
+
FOR ALL CLAIMS RELATED TO THE SOFTWARE SHALL NOT EXCEED ONE HUNDRED U.S.
|
|
75
|
+
DOLLARS ($100.00). Any claim must be commenced within one (1) year after the
|
|
76
|
+
cause of action accrues, to the maximum extent permitted by applicable law.
|
|
77
|
+
|
|
78
|
+
6. EXPORT COMPLIANCE
|
|
79
|
+
|
|
80
|
+
The Software may include cryptographic functionality (including Ed25519, AES-
|
|
81
|
+
256-GCM, SHA-256, and X25519). AGLedger LLC classifies the Software under
|
|
82
|
+
ECCN 5D002 in good faith. To the extent AGLedger LLC makes the source code of
|
|
83
|
+
the Software publicly available through a public repository, that source code
|
|
84
|
+
is subject to the treatment afforded under 15 CFR § 742.15(b) of the U.S.
|
|
85
|
+
Export Administration Regulations. Binary and object-code distributions are
|
|
86
|
+
subject to License Exception ENC under 15 CFR § 740.17, subject to the one-
|
|
87
|
+
time notification and any required Encryption Registration to the U.S. Bureau
|
|
88
|
+
of Industry and Security (BIS) and the NSA ENC Encryption Request Coordinator.
|
|
89
|
+
This statement is not a warranty; you are responsible for independently
|
|
90
|
+
confirming the correct classification and license authority for your use,
|
|
91
|
+
destination, and end-user. You shall not export or re-export the Software to
|
|
92
|
+
any destination, entity, or end-use prohibited by applicable export, sanctions,
|
|
93
|
+
or trade-control laws.
|
|
94
|
+
|
|
95
|
+
7. TRADEMARKS
|
|
96
|
+
|
|
97
|
+
AGLedger, Agentic Ledger, Settlement Signal, and Agentic Operations and
|
|
98
|
+
Accountability Protocol (AOAP) are trademarks of AGLedger LLC. All other
|
|
99
|
+
trademarks are the property of their respective owners.
|
|
100
|
+
|
|
101
|
+
8. PATENTS
|
|
102
|
+
|
|
103
|
+
The Software is covered by one or more U.S. patent applications pending before
|
|
104
|
+
the U.S. Patent and Trademark Office in AGLedger LLC's patent portfolio.
|
|
105
|
+
|
|
106
|
+
9. RELATIONSHIP TO OTHER AGLEDGER AGREEMENTS
|
|
107
|
+
|
|
108
|
+
If you are also a Licensee under an AGLedger Software License Agreement
|
|
109
|
+
executed with an Order Form, that Software License Agreement governs your
|
|
110
|
+
organization's use of the Licensed Software (including the Software distributed
|
|
111
|
+
under this License) and supersedes this License to the extent of any conflict.
|
|
112
|
+
Absent such an agreement, this License is the exclusive and entire license
|
|
113
|
+
between you and AGLedger LLC for the Software.
|
|
114
|
+
|
|
115
|
+
10. GOVERNING LAW
|
|
116
|
+
|
|
117
|
+
This License is governed by the laws of the State of Idaho, without regard to
|
|
118
|
+
its conflict-of-laws provisions. Any dispute arising out of or related to this
|
|
119
|
+
License shall first be subject to good-faith negotiation for thirty (30) days,
|
|
120
|
+
and then, at AGLedger LLC's option, to binding arbitration under the rules of
|
|
121
|
+
the American Arbitration Association in Ada County, Idaho, or to the state or
|
|
122
|
+
federal courts located in Ada County, Idaho. You consent to the personal
|
|
123
|
+
jurisdiction and venue of those forums.
|
|
124
|
+
|
|
125
|
+
11. CONTACT
|
|
126
|
+
|
|
127
|
+
For licensing inquiries, contact: legal@agledger.ai
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The official [MCP](https://modelcontextprotocol.io) server for the [AGLedger](https://agledger.ai) API -- accountability and audit infrastructure for agentic systems.
|
|
4
4
|
|
|
5
|
-
Connects any MCP-compatible AI agent (Claude, Cursor, Windsurf, etc.) to the AGLedger API with
|
|
5
|
+
Connects any MCP-compatible AI agent (Claude, Cursor, Windsurf, etc.) to the AGLedger API with 2 universal API-pass-through tools plus an offline audit verifier. No SDK code required -- just point your agent at this server.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -37,6 +37,7 @@ agledger-mcp --api-key <key> [--api-url <url>]
|
|
|
37
37
|
|------|-------------|
|
|
38
38
|
| `agledger_discover` | Returns API health, your identity, available scopes, and a quickstart workflow. Call this first. |
|
|
39
39
|
| `agledger_api` | Make any AGLedger API call (method, path, params). The API returns `nextSteps` on every response for self-guided workflow discovery. |
|
|
40
|
+
| `agledger_verify` | Verify a mandate audit export offline (RFC 8785 hash chain + Ed25519 signatures). No network calls. Returns `valid`, `verifiedEntries`, and a `brokenAt` pointer on failure. |
|
|
40
41
|
|
|
41
42
|
### Agent workflow
|
|
42
43
|
|
|
@@ -78,4 +79,4 @@ Each self-hosted AGLedger instance also serves interactive Swagger UI at `{AGLED
|
|
|
78
79
|
|
|
79
80
|
Proprietary. See [LICENSE](./LICENSE).
|
|
80
81
|
|
|
81
|
-
AGLedger
|
|
82
|
+
AGLedger, Agentic Ledger, Settlement Signal, and Agentic Operations and Accountability Protocol (AOAP) are trademarks of AGLedger LLC. Patent pending.
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoCD,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;gBAEf,OAAO,EAAE,wBAAwB;IAc7C,OAAO,CAAC,aAAa;IA6NrB,OAAO,CAAC,iBAAiB;CAkC1B"}
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { verifyExport } from '@agledger/sdk/verify';
|
|
3
4
|
import { ApiClient } from './api-client.js';
|
|
4
5
|
const QUICKSTART = {
|
|
5
6
|
description: 'To track accountability for your work, follow these steps in order:',
|
|
@@ -39,7 +40,7 @@ export class AgledgerMcpServer {
|
|
|
39
40
|
constructor(options) {
|
|
40
41
|
const apiUrl = options.apiUrl ?? 'https://agledger.example.com';
|
|
41
42
|
this.client = new ApiClient(apiUrl, options.apiKey, options.timeoutMs);
|
|
42
|
-
this.mcp = new McpServer({ name: 'agledger-mcp-server', version: '2.1.
|
|
43
|
+
this.mcp = new McpServer({ name: 'agledger-mcp-server', version: '2.1.1' }, { capabilities: { tools: {}, resources: {} } });
|
|
43
44
|
this.registerTools();
|
|
44
45
|
this.registerResources();
|
|
45
46
|
}
|
|
@@ -161,6 +162,56 @@ export class AgledgerMcpServer {
|
|
|
161
162
|
return errorResult(err instanceof Error ? err.message : String(err), 'UNKNOWN_ERROR');
|
|
162
163
|
}
|
|
163
164
|
});
|
|
165
|
+
this.mcp.registerTool('agledger_verify', {
|
|
166
|
+
title: 'Verify Audit Export',
|
|
167
|
+
description: 'Verify an AGLedger audit export offline. Recomputes RFC 8785 canonical hashes, ' +
|
|
168
|
+
'walks the hash chain, and verifies every Ed25519 signature. ' +
|
|
169
|
+
'No network calls — trust is rooted in the export\'s embedded signing keys (and/or ' +
|
|
170
|
+
'the publicKeys override). On failure, brokenAt pinpoints the first entry that failed ' +
|
|
171
|
+
'and why (payload_hash_mismatch, chain_break, signature_invalid, unknown_key, ' +
|
|
172
|
+
'position_gap, malformed_entry, unsupported_algorithm). ' +
|
|
173
|
+
'Obtain the export via agledger_api with method=GET, path=/v1/mandates/{id}/audit-export.',
|
|
174
|
+
inputSchema: {
|
|
175
|
+
export: z
|
|
176
|
+
.record(z.string(), z.unknown())
|
|
177
|
+
.describe('The parsed audit export JSON (the response body from GET /v1/mandates/{id}/audit-export).'),
|
|
178
|
+
publicKeys: z
|
|
179
|
+
.record(z.string(), z.string())
|
|
180
|
+
.optional()
|
|
181
|
+
.describe('Optional map of signingKeyId → SPKI DER base64 public key. Merged over any keys ' +
|
|
182
|
+
'embedded in the export. Use this to verify against an independently-trusted key set.'),
|
|
183
|
+
requireKeyId: z
|
|
184
|
+
.string()
|
|
185
|
+
.optional()
|
|
186
|
+
.describe('If set, every entry must reference this keyId. Rejects exports signed by a ' +
|
|
187
|
+
'retired or unexpected key even if cryptographically valid.'),
|
|
188
|
+
},
|
|
189
|
+
annotations: {
|
|
190
|
+
readOnlyHint: true,
|
|
191
|
+
destructiveHint: false,
|
|
192
|
+
idempotentHint: true,
|
|
193
|
+
openWorldHint: false,
|
|
194
|
+
},
|
|
195
|
+
}, async (args) => {
|
|
196
|
+
try {
|
|
197
|
+
const { export: exportData, publicKeys, requireKeyId } = args;
|
|
198
|
+
if (!exportData || typeof exportData !== 'object' || !('entries' in exportData)) {
|
|
199
|
+
return errorResult('Input is not a valid audit export. Expected an object with exportMetadata and entries.', 'INVALID_EXPORT', 'Call agledger_api with method=GET and path=/v1/mandates/{id}/audit-export, then pass the response body as the `export` argument.');
|
|
200
|
+
}
|
|
201
|
+
const result = verifyExport(exportData, {
|
|
202
|
+
publicKeys,
|
|
203
|
+
requireKeyId,
|
|
204
|
+
});
|
|
205
|
+
return {
|
|
206
|
+
content: [],
|
|
207
|
+
structuredContent: result,
|
|
208
|
+
isError: !result.valid,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
return errorResult(err instanceof Error ? err.message : String(err), 'VERIFY_FAILED');
|
|
213
|
+
}
|
|
214
|
+
});
|
|
164
215
|
}
|
|
165
216
|
registerResources() {
|
|
166
217
|
const client = this.client;
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,UAAU,GAAG;IACjB,WAAW,EAAE,qEAAqE;IAClF,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,+BAA+B,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE;QACxF,EAAE,IAAI,EAAE,CAAC,E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AAC;YAC5E,CAAC;YACD,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,oBAAoB;wBACzB,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC;qBACxF;iBACF;aACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agledger/mcp-server",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "AGLedger MCP Server — Thin API pass-through for AI agents via MCP protocol",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "AGLedger LLC",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"lint": "tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"@agledger/sdk": "0.5.1",
|
|
42
43
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
43
44
|
"zod": "^4.3.6"
|
|
44
45
|
},
|
package/src/server.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import { verifyExport } from '@agledger/sdk/verify';
|
|
5
|
+
import type { MandateAuditExport } from '@agledger/sdk/types';
|
|
4
6
|
import { ApiClient } from './api-client.js';
|
|
5
7
|
|
|
6
8
|
export interface AgledgerMcpServerOptions {
|
|
@@ -54,7 +56,7 @@ export class AgledgerMcpServer {
|
|
|
54
56
|
this.client = new ApiClient(apiUrl, options.apiKey, options.timeoutMs);
|
|
55
57
|
|
|
56
58
|
this.mcp = new McpServer(
|
|
57
|
-
{ name: 'agledger-mcp-server', version: '2.1.
|
|
59
|
+
{ name: 'agledger-mcp-server', version: '2.1.1' },
|
|
58
60
|
{ capabilities: { tools: {}, resources: {} } },
|
|
59
61
|
);
|
|
60
62
|
|
|
@@ -214,6 +216,73 @@ export class AgledgerMcpServer {
|
|
|
214
216
|
}
|
|
215
217
|
},
|
|
216
218
|
);
|
|
219
|
+
|
|
220
|
+
this.mcp.registerTool(
|
|
221
|
+
'agledger_verify',
|
|
222
|
+
{
|
|
223
|
+
title: 'Verify Audit Export',
|
|
224
|
+
description:
|
|
225
|
+
'Verify an AGLedger audit export offline. Recomputes RFC 8785 canonical hashes, ' +
|
|
226
|
+
'walks the hash chain, and verifies every Ed25519 signature. ' +
|
|
227
|
+
'No network calls — trust is rooted in the export\'s embedded signing keys (and/or ' +
|
|
228
|
+
'the publicKeys override). On failure, brokenAt pinpoints the first entry that failed ' +
|
|
229
|
+
'and why (payload_hash_mismatch, chain_break, signature_invalid, unknown_key, ' +
|
|
230
|
+
'position_gap, malformed_entry, unsupported_algorithm). ' +
|
|
231
|
+
'Obtain the export via agledger_api with method=GET, path=/v1/mandates/{id}/audit-export.',
|
|
232
|
+
inputSchema: {
|
|
233
|
+
export: z
|
|
234
|
+
.record(z.string(), z.unknown())
|
|
235
|
+
.describe(
|
|
236
|
+
'The parsed audit export JSON (the response body from GET /v1/mandates/{id}/audit-export).',
|
|
237
|
+
),
|
|
238
|
+
publicKeys: z
|
|
239
|
+
.record(z.string(), z.string())
|
|
240
|
+
.optional()
|
|
241
|
+
.describe(
|
|
242
|
+
'Optional map of signingKeyId → SPKI DER base64 public key. Merged over any keys ' +
|
|
243
|
+
'embedded in the export. Use this to verify against an independently-trusted key set.',
|
|
244
|
+
),
|
|
245
|
+
requireKeyId: z
|
|
246
|
+
.string()
|
|
247
|
+
.optional()
|
|
248
|
+
.describe(
|
|
249
|
+
'If set, every entry must reference this keyId. Rejects exports signed by a ' +
|
|
250
|
+
'retired or unexpected key even if cryptographically valid.',
|
|
251
|
+
),
|
|
252
|
+
},
|
|
253
|
+
annotations: {
|
|
254
|
+
readOnlyHint: true,
|
|
255
|
+
destructiveHint: false,
|
|
256
|
+
idempotentHint: true,
|
|
257
|
+
openWorldHint: false,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
async (args) => {
|
|
261
|
+
try {
|
|
262
|
+
const { export: exportData, publicKeys, requireKeyId } = args;
|
|
263
|
+
if (!exportData || typeof exportData !== 'object' || !('entries' in exportData)) {
|
|
264
|
+
return errorResult(
|
|
265
|
+
'Input is not a valid audit export. Expected an object with exportMetadata and entries.',
|
|
266
|
+
'INVALID_EXPORT',
|
|
267
|
+
'Call agledger_api with method=GET and path=/v1/mandates/{id}/audit-export, then pass the response body as the `export` argument.',
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const result = verifyExport(exportData as unknown as MandateAuditExport, {
|
|
272
|
+
publicKeys,
|
|
273
|
+
requireKeyId,
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
content: [],
|
|
278
|
+
structuredContent: result as unknown as Record<string, unknown>,
|
|
279
|
+
isError: !result.valid,
|
|
280
|
+
};
|
|
281
|
+
} catch (err) {
|
|
282
|
+
return errorResult(err instanceof Error ? err.message : String(err), 'VERIFY_FAILED');
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
);
|
|
217
286
|
}
|
|
218
287
|
|
|
219
288
|
private registerResources(): void {
|
package/tests/server.test.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { describe, it, expect, beforeAll, afterAll, afterEach, vi } from 'vitest';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
2
5
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
6
|
import { createTestHarness, type TestHarness } from './harness.js';
|
|
4
7
|
|
|
8
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const VECTORS_DIR = join(HERE, '..', '..', '..', 'testdata', 'verifier');
|
|
10
|
+
const loadVector = (name: string) => JSON.parse(readFileSync(join(VECTORS_DIR, name), 'utf8'));
|
|
11
|
+
|
|
5
12
|
let harness: TestHarness;
|
|
6
13
|
let tools: Tool[];
|
|
7
14
|
|
|
@@ -19,8 +26,8 @@ afterEach(() => {
|
|
|
19
26
|
});
|
|
20
27
|
|
|
21
28
|
describe('tool registration', () => {
|
|
22
|
-
it('registers exactly
|
|
23
|
-
expect(tools).toHaveLength(
|
|
29
|
+
it('registers exactly 3 tools', () => {
|
|
30
|
+
expect(tools).toHaveLength(3);
|
|
24
31
|
});
|
|
25
32
|
|
|
26
33
|
it('registers agledger_discover', () => {
|
|
@@ -39,6 +46,14 @@ describe('tool registration', () => {
|
|
|
39
46
|
expect(tool!.description).toContain('/v1/schemas');
|
|
40
47
|
expect(tool!.description).toContain('/v1/mandates');
|
|
41
48
|
});
|
|
49
|
+
|
|
50
|
+
it('registers agledger_verify', () => {
|
|
51
|
+
const tool = tools.find((t) => t.name === 'agledger_verify');
|
|
52
|
+
expect(tool).toBeDefined();
|
|
53
|
+
expect(tool!.description).toContain('offline');
|
|
54
|
+
expect(tool!.description).toContain('Ed25519');
|
|
55
|
+
expect(tool!.description).toContain('audit-export');
|
|
56
|
+
});
|
|
42
57
|
});
|
|
43
58
|
|
|
44
59
|
describe('resource registration', () => {
|
|
@@ -203,7 +218,7 @@ describe('agledger_api', () => {
|
|
|
203
218
|
const errorBody = {
|
|
204
219
|
message: 'Mandate not found',
|
|
205
220
|
code: 'NOT_FOUND',
|
|
206
|
-
docUrl: 'https://
|
|
221
|
+
docUrl: 'https://www.agledger.ai/docs/errors/NOT_FOUND',
|
|
207
222
|
suggestion: 'Check the mandate ID and try again.',
|
|
208
223
|
};
|
|
209
224
|
vi.stubGlobal(
|
|
@@ -223,7 +238,7 @@ describe('agledger_api', () => {
|
|
|
223
238
|
|
|
224
239
|
expect(result.isError).toBe(true);
|
|
225
240
|
const content = result.structuredContent as Record<string, unknown>;
|
|
226
|
-
expect(content.docUrl).toBe('https://
|
|
241
|
+
expect(content.docUrl).toBe('https://www.agledger.ai/docs/errors/NOT_FOUND');
|
|
227
242
|
expect(content.suggestion).toBe('Check the mandate ID and try again.');
|
|
228
243
|
});
|
|
229
244
|
|
|
@@ -406,3 +421,80 @@ describe('agledger_api', () => {
|
|
|
406
421
|
expect(url.searchParams.get('limit')).toBe('20');
|
|
407
422
|
});
|
|
408
423
|
});
|
|
424
|
+
|
|
425
|
+
describe('agledger_verify', () => {
|
|
426
|
+
it('verifies a valid audit export offline', async () => {
|
|
427
|
+
const result = await harness.client.callTool({
|
|
428
|
+
name: 'agledger_verify',
|
|
429
|
+
arguments: { export: loadVector('valid-export.json') },
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
expect(result.isError).toBeFalsy();
|
|
433
|
+
const content = result.structuredContent as Record<string, unknown>;
|
|
434
|
+
expect(content.valid).toBe(true);
|
|
435
|
+
expect(content.verifiedEntries).toBe(3);
|
|
436
|
+
expect(content.totalEntries).toBe(3);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('returns brokenAt for tampered payload', async () => {
|
|
440
|
+
const result = await harness.client.callTool({
|
|
441
|
+
name: 'agledger_verify',
|
|
442
|
+
arguments: { export: loadVector('tampered-payload.json') },
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
expect(result.isError).toBe(true);
|
|
446
|
+
const content = result.structuredContent as Record<string, unknown>;
|
|
447
|
+
expect(content.valid).toBe(false);
|
|
448
|
+
expect((content.brokenAt as Record<string, unknown>).position).toBe(2);
|
|
449
|
+
expect((content.brokenAt as Record<string, unknown>).reason).toBe('payload_hash_mismatch');
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('returns brokenAt for broken chain', async () => {
|
|
453
|
+
const result = await harness.client.callTool({
|
|
454
|
+
name: 'agledger_verify',
|
|
455
|
+
arguments: { export: loadVector('broken-chain.json') },
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
expect(result.isError).toBe(true);
|
|
459
|
+
const content = result.structuredContent as Record<string, unknown>;
|
|
460
|
+
expect((content.brokenAt as Record<string, unknown>).reason).toBe('chain_break');
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it('makes no API calls (fully offline)', async () => {
|
|
464
|
+
const mockFetch = vi.fn();
|
|
465
|
+
vi.stubGlobal('fetch', mockFetch);
|
|
466
|
+
|
|
467
|
+
await harness.client.callTool({
|
|
468
|
+
name: 'agledger_verify',
|
|
469
|
+
arguments: { export: loadVector('valid-export.json') },
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
expect(mockFetch).not.toHaveBeenCalled();
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
it('accepts publicKeys override', async () => {
|
|
476
|
+
const keys = loadVector('public-keys.json');
|
|
477
|
+
const result = await harness.client.callTool({
|
|
478
|
+
name: 'agledger_verify',
|
|
479
|
+
arguments: {
|
|
480
|
+
export: loadVector('valid-export.json'),
|
|
481
|
+
publicKeys: keys,
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
expect(result.isError).toBeFalsy();
|
|
486
|
+
expect((result.structuredContent as Record<string, unknown>).valid).toBe(true);
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
it('rejects malformed export input', async () => {
|
|
490
|
+
const result = await harness.client.callTool({
|
|
491
|
+
name: 'agledger_verify',
|
|
492
|
+
arguments: { export: { notAnExport: true } },
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
expect(result.isError).toBe(true);
|
|
496
|
+
const content = result.structuredContent as Record<string, unknown>;
|
|
497
|
+
expect(content.code).toBe('INVALID_EXPORT');
|
|
498
|
+
expect(content.suggestion).toContain('audit-export');
|
|
499
|
+
});
|
|
500
|
+
});
|