@agledger/mcp-server 1.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.
Files changed (103) hide show
  1. package/LICENSE +34 -0
  2. package/README.md +81 -0
  3. package/dist/enums.d.ts +108 -0
  4. package/dist/enums.d.ts.map +1 -0
  5. package/dist/enums.js +42 -0
  6. package/dist/enums.js.map +1 -0
  7. package/dist/errors.d.ts +5 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +42 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +5 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +91 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/resources/contract-types.d.ts +5 -0
  16. package/dist/resources/contract-types.d.ts.map +1 -0
  17. package/dist/resources/contract-types.js +107 -0
  18. package/dist/resources/contract-types.js.map +1 -0
  19. package/dist/server.d.ts +21 -0
  20. package/dist/server.d.ts.map +1 -0
  21. package/dist/server.js +116 -0
  22. package/dist/server.js.map +1 -0
  23. package/dist/tool-scopes.d.ts +23 -0
  24. package/dist/tool-scopes.d.ts.map +1 -0
  25. package/dist/tool-scopes.js +173 -0
  26. package/dist/tool-scopes.js.map +1 -0
  27. package/dist/tools/a2a.d.ts +9 -0
  28. package/dist/tools/a2a.d.ts.map +1 -0
  29. package/dist/tools/a2a.js +492 -0
  30. package/dist/tools/a2a.js.map +1 -0
  31. package/dist/tools/agent-mandates.d.ts +5 -0
  32. package/dist/tools/agent-mandates.d.ts.map +1 -0
  33. package/dist/tools/agent-mandates.js +296 -0
  34. package/dist/tools/agent-mandates.js.map +1 -0
  35. package/dist/tools/agents-refs.d.ts +5 -0
  36. package/dist/tools/agents-refs.d.ts.map +1 -0
  37. package/dist/tools/agents-refs.js +255 -0
  38. package/dist/tools/agents-refs.js.map +1 -0
  39. package/dist/tools/capabilities.d.ts +5 -0
  40. package/dist/tools/capabilities.d.ts.map +1 -0
  41. package/dist/tools/capabilities.js +69 -0
  42. package/dist/tools/capabilities.js.map +1 -0
  43. package/dist/tools/code-mode.d.ts +5 -0
  44. package/dist/tools/code-mode.d.ts.map +1 -0
  45. package/dist/tools/code-mode.js +426 -0
  46. package/dist/tools/code-mode.js.map +1 -0
  47. package/dist/tools/compliance.d.ts +5 -0
  48. package/dist/tools/compliance.d.ts.map +1 -0
  49. package/dist/tools/compliance.js +73 -0
  50. package/dist/tools/compliance.js.map +1 -0
  51. package/dist/tools/dashboard.d.ts +5 -0
  52. package/dist/tools/dashboard.d.ts.map +1 -0
  53. package/dist/tools/dashboard.js +67 -0
  54. package/dist/tools/dashboard.js.map +1 -0
  55. package/dist/tools/disputes.d.ts +5 -0
  56. package/dist/tools/disputes.d.ts.map +1 -0
  57. package/dist/tools/disputes.js +140 -0
  58. package/dist/tools/disputes.js.map +1 -0
  59. package/dist/tools/enterprises.d.ts +5 -0
  60. package/dist/tools/enterprises.d.ts.map +1 -0
  61. package/dist/tools/enterprises.js +212 -0
  62. package/dist/tools/enterprises.js.map +1 -0
  63. package/dist/tools/events.d.ts +5 -0
  64. package/dist/tools/events.d.ts.map +1 -0
  65. package/dist/tools/events.js +48 -0
  66. package/dist/tools/events.js.map +1 -0
  67. package/dist/tools/federation-admin.d.ts +5 -0
  68. package/dist/tools/federation-admin.d.ts.map +1 -0
  69. package/dist/tools/federation-admin.js +824 -0
  70. package/dist/tools/federation-admin.js.map +1 -0
  71. package/dist/tools/federation.d.ts +5 -0
  72. package/dist/tools/federation.d.ts.map +1 -0
  73. package/dist/tools/federation.js +703 -0
  74. package/dist/tools/federation.js.map +1 -0
  75. package/dist/tools/health.d.ts +5 -0
  76. package/dist/tools/health.d.ts.map +1 -0
  77. package/dist/tools/health.js +39 -0
  78. package/dist/tools/health.js.map +1 -0
  79. package/dist/tools/mandates.d.ts +5 -0
  80. package/dist/tools/mandates.d.ts.map +1 -0
  81. package/dist/tools/mandates.js +350 -0
  82. package/dist/tools/mandates.js.map +1 -0
  83. package/dist/tools/openclaw.d.ts +9 -0
  84. package/dist/tools/openclaw.d.ts.map +1 -0
  85. package/dist/tools/openclaw.js +142 -0
  86. package/dist/tools/openclaw.js.map +1 -0
  87. package/dist/tools/receipts.d.ts +5 -0
  88. package/dist/tools/receipts.d.ts.map +1 -0
  89. package/dist/tools/receipts.js +166 -0
  90. package/dist/tools/receipts.js.map +1 -0
  91. package/dist/tools/reputation.d.ts +5 -0
  92. package/dist/tools/reputation.d.ts.map +1 -0
  93. package/dist/tools/reputation.js +72 -0
  94. package/dist/tools/reputation.js.map +1 -0
  95. package/dist/tools/schemas.d.ts +5 -0
  96. package/dist/tools/schemas.d.ts.map +1 -0
  97. package/dist/tools/schemas.js +595 -0
  98. package/dist/tools/schemas.js.map +1 -0
  99. package/dist/tools/verification.d.ts +5 -0
  100. package/dist/tools/verification.d.ts.map +1 -0
  101. package/dist/tools/verification.js +77 -0
  102. package/dist/tools/verification.js.map +1 -0
  103. package/package.json +54 -0
package/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ Copyright (c) 2026 AGLedger LLC. All rights reserved.
2
+
3
+ PROPRIETARY SOFTWARE LICENSE
4
+
5
+ This software and associated documentation files (the "Software") are the
6
+ proprietary property of AGLedger LLC. The Software is provided for use
7
+ exclusively with the AGLedger API (https://api.agledger.ai).
8
+
9
+ Permission is hereby granted to use the Software solely for the purpose of
10
+ integrating with AGLedger services via the AGLedger API, subject to the
11
+ following conditions:
12
+
13
+ 1. You may not copy, modify, merge, publish, distribute, sublicense, or sell
14
+ copies of the Software, except as required to use it with the AGLedger API.
15
+
16
+ 2. You may not use the Software to create a competing product or service.
17
+
18
+ 3. You may not reverse engineer, decompile, or disassemble the Software,
19
+ except to the extent permitted by applicable law.
20
+
21
+ Use of this software is subject to the AGLedger Terms of Service at
22
+ https://agledger.ai/terms.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27
+ AGLEDGER LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
28
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
+
31
+ ---
32
+
33
+ AGLedger™ and the Agentic Contract Specification™ are trademarks of
34
+ AGLedger LLC. Patent pending.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @agledger/mcp-server
2
+
3
+ The official [MCP](https://modelcontextprotocol.io) server for the [AGLedger](https://agledger.ai) API -- accountability and audit infrastructure for agentic systems.
4
+
5
+ Connects any MCP-compatible AI agent (Claude, Cursor, Windsurf, etc.) to the AGLedger API with profile-based tool selection. No SDK code required -- just point your agent at this server.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @agledger/mcp-server
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ Add to your MCP client configuration (e.g. `claude_desktop_config.json`):
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "agledger": {
21
+ "command": "agledger-mcp",
22
+ "args": ["--profile", "a2a"],
23
+ "env": {
24
+ "AGLEDGER_API_KEY": "your-api-key"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Or run directly:
32
+
33
+ ```bash
34
+ agledger-mcp --api-key <key> --profile a2a
35
+ ```
36
+
37
+ ## Profiles
38
+
39
+ The `--profile` flag is required. Each profile exposes a curated set of tools optimized for a specific agent persona:
40
+
41
+ | Profile | Tools | Use Case |
42
+ |---------|-------|----------|
43
+ | `a2a` | ~17 | Agent-to-agent coordination: propose, accept, reject, counter-propose mandates |
44
+ | `admin` | ~31 | Enterprise management: agents, capabilities, reputation, federation admin |
45
+ | `audit` | ~24 | Read-only compliance monitoring: events, verification, disputes, dashboard |
46
+ | `schema-dev` | ~17 | Custom contract type authoring with workflow guidance |
47
+ | `openclaw` | 5 | Lightweight notarization for agent-to-agent agreements |
48
+ | `code` | 2 | Power-user mode: execute SDK code directly via `sdk_execute` |
49
+ | `federation` | ~52 | Federation gateway operations + admin |
50
+ | `full` | ~134 | All tools (development/debugging only) |
51
+
52
+ ## Configuration
53
+
54
+ | Flag | Env Var | Description |
55
+ |------|---------|-------------|
56
+ | `--api-key` | `AGLEDGER_API_KEY` | AGLedger API key (required) |
57
+ | `--api-url` | `AGLEDGER_API_URL` | API base URL (default: `https://api.agledger.ai`) |
58
+ | `--profile` | `AGLEDGER_PROFILE` | Tool profile (required) |
59
+ | `--enterprise-id` | `AGLEDGER_ENTERPRISE_ID` | Enterprise ID for admin/enterprise tools |
60
+
61
+ ## What is AGLedger?
62
+
63
+ AGLedger is the accountability layer for automated operations. It records what was agreed to, by whom, when -- and tracks the delegation of that agreement through other systems.
64
+
65
+ - **Mandates** -- structured commitments with acceptance criteria and tolerance bands
66
+ - **Receipts** -- task attestations recording what was reported to be done
67
+ - **Verdicts** -- principal acceptance decisions (PASS/FAIL) with settlement signals
68
+ - **Audit trail** -- hash-chained, Ed25519-signed, tamper-evident record
69
+
70
+ Learn more at [agledger.ai](https://agledger.ai) | [API docs](https://docs.agledger.ai)
71
+
72
+ ## Requirements
73
+
74
+ - Node.js >= 22
75
+ - An AGLedger API key ([sign up](https://agledger.ai))
76
+
77
+ ## License
78
+
79
+ Proprietary. See [LICENSE](./LICENSE).
80
+
81
+ AGLedger™ and the Agentic Contract Specification™ are trademarks of AGLedger LLC. Patent pending.
@@ -0,0 +1,108 @@
1
+ /** AGLedger™ — Shared Zod enum schemas for MCP tool definitions. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import { z } from 'zod';
3
+ export declare const ContractTypeEnum: z.ZodEnum<{
4
+ "ACH-PROC-v1": "ACH-PROC-v1";
5
+ "ACH-DLVR-v1": "ACH-DLVR-v1";
6
+ "ACH-DATA-v1": "ACH-DATA-v1";
7
+ "ACH-TXN-v1": "ACH-TXN-v1";
8
+ "ACH-ORCH-v1": "ACH-ORCH-v1";
9
+ "ACH-COMM-v1": "ACH-COMM-v1";
10
+ "ACH-AUTH-v1": "ACH-AUTH-v1";
11
+ "ACH-INFRA-v1": "ACH-INFRA-v1";
12
+ "ACH-DEL-v1": "ACH-DEL-v1";
13
+ "ACH-ANALYZE-v1": "ACH-ANALYZE-v1";
14
+ "ACH-COORD-v1": "ACH-COORD-v1";
15
+ "ACH-MON-v1": "ACH-MON-v1";
16
+ "ACH-REVIEW-v1": "ACH-REVIEW-v1";
17
+ }>;
18
+ export declare const MandateStatusEnum: z.ZodEnum<{
19
+ CREATED: "CREATED";
20
+ PROPOSED: "PROPOSED";
21
+ ACTIVE: "ACTIVE";
22
+ PROCESSING: "PROCESSING";
23
+ REVISION_REQUESTED: "REVISION_REQUESTED";
24
+ FULFILLED: "FULFILLED";
25
+ FAILED: "FAILED";
26
+ REMEDIATED: "REMEDIATED";
27
+ EXPIRED: "EXPIRED";
28
+ CANCELLED: "CANCELLED";
29
+ REJECTED: "REJECTED";
30
+ }>;
31
+ export declare const HubStateEnum: z.ZodEnum<{
32
+ ACTIVE: "ACTIVE";
33
+ OFFERED: "OFFERED";
34
+ ACCEPTED: "ACCEPTED";
35
+ COMPLETED: "COMPLETED";
36
+ DISPUTED: "DISPUTED";
37
+ TERMINAL: "TERMINAL";
38
+ }>;
39
+ export declare const GatewayStatusEnum: z.ZodEnum<{
40
+ active: "active";
41
+ suspended: "suspended";
42
+ revoked: "revoked";
43
+ }>;
44
+ export declare const RevocationReasonEnum: z.ZodEnum<{
45
+ key_compromise: "key_compromise";
46
+ decommission: "decommission";
47
+ administrative: "administrative";
48
+ }>;
49
+ export declare const FederationSignalEnum: z.ZodEnum<{
50
+ SETTLE: "SETTLE";
51
+ HOLD: "HOLD";
52
+ RELEASE: "RELEASE";
53
+ }>;
54
+ export declare const FederationOutcomeEnum: z.ZodEnum<{
55
+ PASS: "PASS";
56
+ FAIL: "FAIL";
57
+ }>;
58
+ export declare const OperatingModeEnum: z.ZodEnum<{
59
+ cleartext: "cleartext";
60
+ encrypted: "encrypted";
61
+ }>;
62
+ export declare const RiskClassificationEnum: z.ZodEnum<{
63
+ high: "high";
64
+ limited: "limited";
65
+ minimal: "minimal";
66
+ unclassified: "unclassified";
67
+ }>;
68
+ export declare const DisputeStatusEnum: z.ZodEnum<{
69
+ OPENED: "OPENED";
70
+ TIER_1_REVIEW: "TIER_1_REVIEW";
71
+ EVIDENCE_WINDOW: "EVIDENCE_WINDOW";
72
+ TIER_2_REVIEW: "TIER_2_REVIEW";
73
+ ESCALATED: "ESCALATED";
74
+ TIER_3_ARBITRATION: "TIER_3_ARBITRATION";
75
+ RESOLVED: "RESOLVED";
76
+ WITHDRAWN: "WITHDRAWN";
77
+ }>;
78
+ export declare const ReceiptStatusEnum: z.ZodEnum<{
79
+ REJECTED: "REJECTED";
80
+ ACCEPTED: "ACCEPTED";
81
+ SUBMITTED: "SUBMITTED";
82
+ INVALID: "INVALID";
83
+ }>;
84
+ export declare const NextStepSchema: z.ZodObject<{
85
+ action: z.ZodString;
86
+ method: z.ZodEnum<{
87
+ GET: "GET";
88
+ POST: "POST";
89
+ PUT: "PUT";
90
+ PATCH: "PATCH";
91
+ DELETE: "DELETE";
92
+ }>;
93
+ href: z.ZodString;
94
+ description: z.ZodString;
95
+ }, z.core.$strip>;
96
+ export declare const NextStepsField: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
97
+ action: z.ZodString;
98
+ method: z.ZodEnum<{
99
+ GET: "GET";
100
+ POST: "POST";
101
+ PUT: "PUT";
102
+ PATCH: "PATCH";
103
+ DELETE: "DELETE";
104
+ }>;
105
+ href: z.ZodString;
106
+ description: z.ZodString;
107
+ }, z.core.$strip>>>>;
108
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,sIAAsI;AAEtI,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;EAc4B,CAAC;AAE1D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAIS,CAAC;AAExC,eAAO,MAAM,YAAY;;;;;;;EAAgI,CAAC;AAC1J,eAAO,MAAM,iBAAiB;;;;EAAgG,CAAC;AAC/H,eAAO,MAAM,oBAAoB;;;;EAAoH,CAAC;AACtJ,eAAO,MAAM,oBAAoB;;;;EAA2E,CAAC;AAC7G,eAAO,MAAM,qBAAqB;;;EAAuE,CAAC;AAE1G,eAAO,MAAM,iBAAiB;;;EAAgF,CAAC;AAC/G,eAAO,MAAM,sBAAsB;;;;;EAAmG,CAAC;AACvI,eAAO,MAAM,iBAAiB;;;;;;;;;EAGS,CAAC;AACxC,eAAO,MAAM,iBAAiB;;;;;EAAgG,CAAC;AAE/H,eAAO,MAAM,cAAc;;;;;;;;;;;iBAKW,CAAC;AAEvC,eAAO,MAAM,cAAc;;;;;;;;;;;oBAA2H,CAAC"}
package/dist/enums.js ADDED
@@ -0,0 +1,42 @@
1
+ /** AGLedger™ — Shared Zod enum schemas for MCP tool definitions. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import { z } from 'zod';
3
+ export const ContractTypeEnum = z.enum([
4
+ 'ACH-PROC-v1',
5
+ 'ACH-DLVR-v1',
6
+ 'ACH-DATA-v1',
7
+ 'ACH-TXN-v1',
8
+ 'ACH-ORCH-v1',
9
+ 'ACH-COMM-v1',
10
+ 'ACH-AUTH-v1',
11
+ 'ACH-INFRA-v1',
12
+ 'ACH-DEL-v1',
13
+ 'ACH-ANALYZE-v1',
14
+ 'ACH-COORD-v1',
15
+ 'ACH-MON-v1',
16
+ 'ACH-REVIEW-v1',
17
+ ]).describe('AGLedger standard contract type identifier');
18
+ export const MandateStatusEnum = z.enum([
19
+ 'CREATED', 'PROPOSED', 'ACTIVE', 'PROCESSING',
20
+ 'REVISION_REQUESTED', 'FULFILLED', 'FAILED',
21
+ 'REMEDIATED', 'EXPIRED', 'CANCELLED', 'REJECTED',
22
+ ]).describe('Mandate lifecycle status');
23
+ export const HubStateEnum = z.enum(['OFFERED', 'ACCEPTED', 'ACTIVE', 'COMPLETED', 'DISPUTED', 'TERMINAL']).describe('Federation hub-level mandate state');
24
+ export const GatewayStatusEnum = z.enum(['active', 'suspended', 'revoked']).describe('Federation gateway registration status');
25
+ export const RevocationReasonEnum = z.enum(['key_compromise', 'decommission', 'administrative']).describe('Reason for revoking a federation gateway');
26
+ export const FederationSignalEnum = z.enum(['SETTLE', 'HOLD', 'RELEASE']).describe('Settlement signal type');
27
+ export const FederationOutcomeEnum = z.enum(['PASS', 'FAIL']).describe('Federation verification outcome');
28
+ export const OperatingModeEnum = z.enum(['cleartext', 'encrypted']).describe('Operating mode for the mandate');
29
+ export const RiskClassificationEnum = z.enum(['high', 'limited', 'minimal', 'unclassified']).describe('EU AI Act risk classification');
30
+ export const DisputeStatusEnum = z.enum([
31
+ 'OPENED', 'TIER_1_REVIEW', 'EVIDENCE_WINDOW', 'TIER_2_REVIEW',
32
+ 'ESCALATED', 'TIER_3_ARBITRATION', 'RESOLVED', 'WITHDRAWN',
33
+ ]).describe('Dispute lifecycle status');
34
+ export const ReceiptStatusEnum = z.enum(['SUBMITTED', 'ACCEPTED', 'REJECTED', 'INVALID']).describe('Receipt lifecycle status');
35
+ export const NextStepSchema = z.object({
36
+ action: z.string().describe('What to do next'),
37
+ method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).describe('HTTP method'),
38
+ href: z.string().describe('Relative URL template'),
39
+ description: z.string().describe('Why this step matters'),
40
+ }).describe('Suggested next API call');
41
+ export const NextStepsField = z.array(NextStepSchema).nullable().optional().describe('Suggested next API calls — guides agents through the lifecycle');
42
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1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BAAuB,CAAC;IAClD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;CAC1D,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gEAAgE,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** AGLedger™ — Shared MCP error handling utilities. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ export declare function errorResult(message: string, details?: Record<string, unknown>): CallToolResult;
4
+ export declare function apiErrorResult(e: unknown): CallToolResult;
5
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,yHAAyH;AAGzH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAO9F;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,cAAc,CAsBzD"}
package/dist/errors.js ADDED
@@ -0,0 +1,42 @@
1
+ /** AGLedger™ — Shared MCP error handling utilities. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import { AgledgerApiError, PermissionError } from '@agledger/sdk';
3
+ export function errorResult(message, details) {
4
+ let text = `Error: ${message}`;
5
+ if (details)
6
+ text += `\n\nDetails: ${JSON.stringify(details)}`;
7
+ return {
8
+ content: [{ type: 'text', text }],
9
+ isError: true,
10
+ };
11
+ }
12
+ export function apiErrorResult(e) {
13
+ if (e instanceof PermissionError) {
14
+ if (e.missingScopes.length > 0) {
15
+ return errorResult(`Insufficient scopes. Missing: ${e.missingScopes.join(', ')}. Use GET /auth/me to check your key's scopes.`);
16
+ }
17
+ return errorResult('Agent not approved for this enterprise. Use approve_enterprise_agent to approve the agent, or set agentApprovalRequired=false via set_enterprise_config.');
18
+ }
19
+ if (e instanceof AgledgerApiError) {
20
+ const extra = {};
21
+ if (e.code)
22
+ extra.code = e.code;
23
+ if (e.docUrl)
24
+ extra.docUrl = e.docUrl;
25
+ if (e.details && typeof e.details === 'object' && !Array.isArray(e.details)) {
26
+ const d = e.details;
27
+ if (d.examplePayload)
28
+ extra.examplePayload = d.examplePayload;
29
+ if (d.requiredFields)
30
+ extra.requiredFields = d.requiredFields;
31
+ if (d.optionalFields)
32
+ extra.optionalFields = d.optionalFields;
33
+ }
34
+ if (e.validationErrors.length > 0)
35
+ extra.validationErrors = e.validationErrors;
36
+ if (e.suggestion)
37
+ extra.suggestion = e.suggestion;
38
+ return errorResult(e.message, Object.keys(extra).length > 0 ? extra : undefined);
39
+ }
40
+ return errorResult(e instanceof Error ? e.message : String(e));
41
+ }
42
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,yHAAyH;AAEzH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGlE,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,OAAiC;IAC5E,IAAI,IAAI,GAAG,UAAU,OAAO,EAAE,CAAC;IAC/B,IAAI,OAAO;QAAE,IAAI,IAAI,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/D,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjC,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAA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C,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,WAAW,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ /** AGLedger™ — MCP Server CLI entry point. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
3
+ export { AgledgerMcpServer } from './server.js';
4
+ export type { AgledgerMcpServerOptions } from './server.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,gHAAgH;AAmGhH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ /** AGLedger™ — MCP Server CLI entry point. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
3
+ import { parseArgs } from 'node:util';
4
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
+ import { AgledgerMcpServer } from './server.js';
6
+ function main() {
7
+ const { values } = parseArgs({
8
+ options: {
9
+ 'api-key': {
10
+ type: 'string',
11
+ short: 'k',
12
+ },
13
+ 'api-url': {
14
+ type: 'string',
15
+ short: 'u',
16
+ },
17
+ profile: {
18
+ type: 'string',
19
+ short: 'p',
20
+ },
21
+ 'enterprise-id': {
22
+ type: 'string',
23
+ short: 'e',
24
+ },
25
+ help: {
26
+ type: 'boolean',
27
+ short: 'h',
28
+ },
29
+ },
30
+ strict: true,
31
+ });
32
+ if (values.help) {
33
+ process.stderr.write(`AGLedger™ MCP Server v1.2.0
34
+
35
+ Usage: agledger-mcp --api-key <key> [--api-url <url>] [--profile <profile>]
36
+
37
+ Options:
38
+ --api-key, -k AGLedger API key (required)
39
+ --api-url, -u AGLedger API base URL (default: https://api.agledger.ai)
40
+ --profile, -p Tool profile: "full", "a2a", "openclaw", "schema-dev", "admin", or "audit"
41
+ --help, -h Show this help message
42
+
43
+ Profiles:
44
+ full All tools — use only for development/debugging (50 tools)
45
+ a2a 10 focused tools for agent-to-agent coordination with closure prompting
46
+ openclaw 5 thin notarization tools for OpenClaw agent-to-agent agreements (<500 token schema)
47
+ schema-dev Schema development tools + health check
48
+ admin Enterprise agent management, capabilities, reputation, and health (9 tools)
49
+ audit Read-only compliance monitoring: events, verification, disputes, reputation, health (8 tools)
50
+
51
+ Environment:
52
+ AGLEDGER_API_KEY API key (overridden by --api-key)
53
+ AGLEDGER_API_URL API URL (overridden by --api-url)
54
+ AGLEDGER_PROFILE Tool profile (overridden by --profile)
55
+ `);
56
+ process.exit(0);
57
+ }
58
+ const apiKey = values['api-key'] ?? process.env.AGLEDGER_API_KEY;
59
+ const apiUrl = values['api-url'] ?? process.env.AGLEDGER_API_URL;
60
+ const profileRaw = values.profile ?? process.env.AGLEDGER_PROFILE;
61
+ if (!profileRaw) {
62
+ process.stderr.write(`Error: --profile or AGLEDGER_PROFILE is required.
63
+
64
+ Choose a profile to control which tools are available:
65
+ a2a 10 tools — agent-to-agent coordination with closure prompting
66
+ admin 9 tools — enterprise agent management and capabilities
67
+ audit 8 tools — read-only compliance monitoring
68
+ schema-dev 13 tools — custom contract type authoring
69
+ openclaw 5 tools — lightweight notarization
70
+ full 50 tools — all tools (development/debugging only)
71
+
72
+ Example: agledger-mcp --api-key <key> --profile a2a
73
+ `);
74
+ process.exit(1);
75
+ }
76
+ const profile = profileRaw;
77
+ const enterpriseId = values['enterprise-id'] ?? process.env.AGLEDGER_ENTERPRISE_ID;
78
+ if (!apiKey) {
79
+ process.stderr.write('Error: --api-key or AGLEDGER_API_KEY environment variable is required.\n');
80
+ process.exit(1);
81
+ }
82
+ const server = new AgledgerMcpServer({ apiKey, apiUrl, profile, enterpriseId });
83
+ const transport = new StdioServerTransport();
84
+ server.mcp.connect(transport).catch((err) => {
85
+ process.stderr.write(`Fatal: failed to start MCP server: ${err instanceof Error ? err.message : String(err)}\n`);
86
+ process.exit(1);
87
+ });
88
+ }
89
+ main();
90
+ export { AgledgerMcpServer } from './server.js';
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,gHAAgH;AAEhH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,SAAS,IAAI;IACX,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAC3B,OAAO,EAAE;YACP,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,GAAG;aACX;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,GAAG;aACX;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,GAAG;aACX;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,GAAG;aACX;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,GAAG;aACX;SACF;QACD,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB;;;;;;;;;;;;;;;;;;;;;;CAsBL,CACI,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC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AAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC;AAEP,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** AGLedger™ — MCP Resources for contract type schemas. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import type { AgledgerClient } from '@agledger/sdk';
4
+ export declare function registerContractTypeResources(mcp: McpServer, client: AgledgerClient): void;
5
+ //# sourceMappingURL=contract-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-types.d.ts","sourceRoot":"","sources":["../../src/resources/contract-types.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAG7H,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAqBpD,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CA4G1F"}
@@ -0,0 +1,107 @@
1
+ /** AGLedger™ — MCP Resources for contract type schemas. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ const CONTRACT_TYPES = [
4
+ { type: 'ACH-PROC-v1', description: 'General procurement (goods, services, supplies)' },
5
+ { type: 'ACH-DLVR-v1', description: 'Deliverables (reports, documents, artifacts)' },
6
+ { type: 'ACH-DATA-v1', description: 'Data processing (ETL, analysis, transformation)' },
7
+ { type: 'ACH-TXN-v1', description: 'Transactions (payments, transfers, settlements)' },
8
+ { type: 'ACH-ORCH-v1', description: 'Orchestration (delegation, task coordination)' },
9
+ { type: 'ACH-COMM-v1', description: 'Communication (email, chat, webhooks, notifications)' },
10
+ { type: 'ACH-AUTH-v1', description: 'Authorization (permissions, credentials, access control)' },
11
+ { type: 'ACH-INFRA-v1', description: 'Infrastructure (DDL, cloud provisioning, config changes)' },
12
+ { type: 'ACH-DEL-v1', description: 'Destructive operations (deletions, cancellations, refunds, reversals)' },
13
+ { type: 'ACH-ANALYZE-v1', description: 'Research, analysis, and investigation tasks' },
14
+ { type: 'ACH-COORD-v1', description: 'Multi-party coordination and consensus building' },
15
+ { type: 'ACH-MON-v1', description: 'Monitoring, alerting, and observability tasks' },
16
+ { type: 'ACH-REVIEW-v1', description: 'Review, approval, and sign-off workflows' },
17
+ ];
18
+ const VALID_TYPES = new Set(CONTRACT_TYPES.map((ct) => ct.type));
19
+ export function registerContractTypeResources(mcp, client) {
20
+ // --- schema://contract-types — Lists all 13 contract types ---
21
+ mcp.registerResource('contract-types', 'schema://contract-types', {
22
+ description: 'List of all 9 AGLedger standard contract types with descriptions.',
23
+ mimeType: 'application/json',
24
+ }, async () => {
25
+ return {
26
+ contents: [
27
+ {
28
+ uri: 'schema://contract-types',
29
+ mimeType: 'application/json',
30
+ text: JSON.stringify(CONTRACT_TYPES, null, 2),
31
+ },
32
+ ],
33
+ };
34
+ });
35
+ // --- schema://contract-types/{type} — Individual contract type schema ---
36
+ const template = new ResourceTemplate('schema://contract-types/{type}', {
37
+ list: async () => {
38
+ return {
39
+ resources: CONTRACT_TYPES.map((ct) => ({
40
+ uri: `schema://contract-types/${ct.type}`,
41
+ name: ct.type,
42
+ description: ct.description,
43
+ mimeType: 'application/json',
44
+ })),
45
+ };
46
+ },
47
+ complete: {
48
+ type: async (value) => {
49
+ return CONTRACT_TYPES
50
+ .map((ct) => ct.type)
51
+ .filter((t) => t.toLowerCase().startsWith(value.toLowerCase()));
52
+ },
53
+ },
54
+ });
55
+ mcp.registerResource('contract-type-schema', template, {
56
+ description: 'Individual AGLedger contract type schema with mandate/receipt JSON Schemas and verification rules.',
57
+ mimeType: 'application/json',
58
+ }, async (_uri, variables) => {
59
+ const contractType = variables.type;
60
+ if (!VALID_TYPES.has(contractType)) {
61
+ return {
62
+ contents: [
63
+ {
64
+ uri: `schema://contract-types/${contractType}`,
65
+ mimeType: 'application/json',
66
+ text: JSON.stringify({
67
+ error: `Unknown contract type: ${contractType}. Valid types: ${[...VALID_TYPES].join(', ')}`,
68
+ }),
69
+ },
70
+ ],
71
+ };
72
+ }
73
+ try {
74
+ const schema = await client.schemas.get(contractType);
75
+ const info = CONTRACT_TYPES.find((ct) => ct.type === contractType);
76
+ return {
77
+ contents: [
78
+ {
79
+ uri: `schema://contract-types/${contractType}`,
80
+ mimeType: 'application/json',
81
+ text: JSON.stringify({
82
+ contractType: schema.contractType,
83
+ description: info?.description ?? '',
84
+ mandateSchema: schema.mandateSchema,
85
+ receiptSchema: schema.receiptSchema,
86
+ rulesConfig: schema.rulesConfig ?? null,
87
+ }, null, 2),
88
+ },
89
+ ],
90
+ };
91
+ }
92
+ catch (err) {
93
+ return {
94
+ contents: [
95
+ {
96
+ uri: `schema://contract-types/${contractType}`,
97
+ mimeType: 'application/json',
98
+ text: JSON.stringify({
99
+ error: err instanceof Error ? err.message : String(err),
100
+ }),
101
+ },
102
+ ],
103
+ };
104
+ }
105
+ });
106
+ }
107
+ //# sourceMappingURL=contract-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-types.js","sourceRoot":"","sources":["../../src/resources/contract-types.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAE7H,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAK3E,MAAM,cAAc,GAAkD;IACpE,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,iDAAiD,EAAE;IACvF,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,8CAA8C,EAAE;IACpF,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,iDAAiD,EAAE;IACvF,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,iDAAiD,EAAE;IACtF,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,+CAA+C,EAAE;IACrF,EAAE,IAAI,EAAE,aAAa,EAAE,WA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IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;YAEnE,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,2BAA2B,YAAY,EAAE;wBAC9C,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;4BACE,YAAY,EAAE,MAAM,CAAC,YAAY;4BACjC,WAAW,EAAE,IAAI,EAAE,WAAW,IAAI,EAAE;4BACpC,aAAa,EAAE,MAAM,CAAC,aAAa;4BACnC,aAAa,EAAE,MAAM,CAAC,aAAa;4BACnC,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI;yBACxC,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,2BAA2B,YAAY,EAAE;wBAC9C,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;yBACxD,CAAC;qBACH;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ /** AGLedger™ — MCP Server wrapping the AGLedger API for agent consumption. Patent Pending. Copyright 2026 AGLedger LLC. All rights reserved. */
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { AgledgerClient } from '@agledger/sdk';
4
+ export type ToolProfile = 'full' | 'code' | 'a2a' | 'openclaw' | 'schema-dev' | 'admin' | 'audit' | 'federation';
5
+ export interface AgledgerMcpServerOptions {
6
+ apiKey: string;
7
+ apiUrl?: string;
8
+ /** Tool profile: "code" (2 tools — SDK code execution + docs, replaces full), "a2a", "openclaw", "schema-dev", "admin", "audit", "federation", or "full" (legacy, all individual tools). */
9
+ profile?: ToolProfile;
10
+ /** Enterprise ID for A2A search queries. Falls back to AGLEDGER_ENTERPRISE_ID env var. */
11
+ enterpriseId?: string;
12
+ }
13
+ export declare class AgledgerMcpServer {
14
+ readonly mcp: McpServer;
15
+ readonly client: AgledgerClient;
16
+ readonly profile: ToolProfile;
17
+ private readonly enterpriseId?;
18
+ constructor(options: AgledgerMcpServerOptions);
19
+ private registerTools;
20
+ }
21
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,gJAAgJ;AAEhJ,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAuB/C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;AAEjH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4LAA4L;IAC5L,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAS;gBAE3B,OAAO,EAAE,wBAAwB;IAyB7C,OAAO,CAAC,aAAa;CA6DtB"}