agentic-payments 0.1.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 (122) hide show
  1. package/README.md +924 -0
  2. package/bin/cli.js +18 -0
  3. package/bin/mcp.js +10 -0
  4. package/completions/agentic-payments.bash +21 -0
  5. package/completions/agentic-payments.fish +9 -0
  6. package/completions/agentic-payments.zsh +17 -0
  7. package/completions/bash.sh +182 -0
  8. package/completions/fish.fish +110 -0
  9. package/completions/zsh.sh +175 -0
  10. package/dist/active-mandate/i18n.d.ts +27 -0
  11. package/dist/active-mandate/i18n.d.ts.map +1 -0
  12. package/dist/active-mandate/i18n.js +35 -0
  13. package/dist/active-mandate/i18n.js.map +1 -0
  14. package/dist/active-mandate/index.d.ts +26 -0
  15. package/dist/active-mandate/index.d.ts.map +1 -0
  16. package/dist/active-mandate/index.js +51 -0
  17. package/dist/active-mandate/index.js.map +1 -0
  18. package/dist/active-mandate/revocation.d.ts +11 -0
  19. package/dist/active-mandate/revocation.d.ts.map +1 -0
  20. package/dist/active-mandate/revocation.js +27 -0
  21. package/dist/active-mandate/revocation.js.map +1 -0
  22. package/dist/active-mandate/schema.d.ts +85 -0
  23. package/dist/active-mandate/schema.d.ts.map +1 -0
  24. package/dist/active-mandate/schema.js +36 -0
  25. package/dist/active-mandate/schema.js.map +1 -0
  26. package/dist/active-mandate/signing.d.ts +8 -0
  27. package/dist/active-mandate/signing.d.ts.map +1 -0
  28. package/dist/active-mandate/signing.js +64 -0
  29. package/dist/active-mandate/signing.js.map +1 -0
  30. package/dist/active-mandate/types.d.ts +59 -0
  31. package/dist/active-mandate/types.d.ts.map +1 -0
  32. package/dist/active-mandate/types.js +6 -0
  33. package/dist/active-mandate/types.js.map +1 -0
  34. package/dist/cli/commands/active-mandate.d.ts +4 -0
  35. package/dist/cli/commands/active-mandate.d.ts.map +1 -0
  36. package/dist/cli/commands/active-mandate.js +218 -0
  37. package/dist/cli/commands/active-mandate.js.map +1 -0
  38. package/dist/cli/commands/generate.d.ts +3 -0
  39. package/dist/cli/commands/generate.d.ts.map +1 -0
  40. package/dist/cli/commands/generate.js +59 -0
  41. package/dist/cli/commands/generate.js.map +1 -0
  42. package/dist/cli/commands/mandate.d.ts +4 -0
  43. package/dist/cli/commands/mandate.d.ts.map +1 -0
  44. package/dist/cli/commands/mandate.js +223 -0
  45. package/dist/cli/commands/mandate.js.map +1 -0
  46. package/dist/cli/commands/system.d.ts +4 -0
  47. package/dist/cli/commands/system.d.ts.map +1 -0
  48. package/dist/cli/commands/system.js +101 -0
  49. package/dist/cli/commands/system.js.map +1 -0
  50. package/dist/cli/commands/verify.d.ts +3 -0
  51. package/dist/cli/commands/verify.d.ts.map +1 -0
  52. package/dist/cli/commands/verify.js +104 -0
  53. package/dist/cli/commands/verify.js.map +1 -0
  54. package/dist/cli/completion.d.ts +3 -0
  55. package/dist/cli/completion.d.ts.map +1 -0
  56. package/dist/cli/completion.js +245 -0
  57. package/dist/cli/completion.js.map +1 -0
  58. package/dist/cli/index.d.ts +3 -0
  59. package/dist/cli/index.d.ts.map +1 -0
  60. package/dist/cli/index.js +79 -0
  61. package/dist/cli/index.js.map +1 -0
  62. package/dist/errors.d.ts +58 -0
  63. package/dist/errors.d.ts.map +1 -0
  64. package/dist/errors.js +100 -0
  65. package/dist/errors.js.map +1 -0
  66. package/dist/identity.d.ts +78 -0
  67. package/dist/identity.d.ts.map +1 -0
  68. package/dist/identity.js +204 -0
  69. package/dist/identity.js.map +1 -0
  70. package/dist/index.d.ts +68 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +79 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/mandate.d.ts +134 -0
  75. package/dist/mandate.d.ts.map +1 -0
  76. package/dist/mandate.js +342 -0
  77. package/dist/mandate.js.map +1 -0
  78. package/dist/mcp/index.d.ts +7 -0
  79. package/dist/mcp/index.d.ts.map +1 -0
  80. package/dist/mcp/index.js +102 -0
  81. package/dist/mcp/index.js.map +1 -0
  82. package/dist/mcp/server.d.ts +38 -0
  83. package/dist/mcp/server.d.ts.map +1 -0
  84. package/dist/mcp/server.js +126 -0
  85. package/dist/mcp/server.js.map +1 -0
  86. package/dist/mcp/tools/agent.d.ts +9 -0
  87. package/dist/mcp/tools/agent.d.ts.map +1 -0
  88. package/dist/mcp/tools/agent.js +34 -0
  89. package/dist/mcp/tools/agent.js.map +1 -0
  90. package/dist/mcp/tools/consensus.d.ts +9 -0
  91. package/dist/mcp/tools/consensus.d.ts.map +1 -0
  92. package/dist/mcp/tools/consensus.js +38 -0
  93. package/dist/mcp/tools/consensus.js.map +1 -0
  94. package/dist/mcp/tools/index.d.ts +45 -0
  95. package/dist/mcp/tools/index.d.ts.map +1 -0
  96. package/dist/mcp/tools/index.js +282 -0
  97. package/dist/mcp/tools/index.js.map +1 -0
  98. package/dist/mcp/tools/mandate.d.ts +31 -0
  99. package/dist/mcp/tools/mandate.d.ts.map +1 -0
  100. package/dist/mcp/tools/mandate.js +165 -0
  101. package/dist/mcp/tools/mandate.js.map +1 -0
  102. package/dist/mcp/tools/payment.d.ts +13 -0
  103. package/dist/mcp/tools/payment.d.ts.map +1 -0
  104. package/dist/mcp/tools/payment.js +66 -0
  105. package/dist/mcp/tools/payment.js.map +1 -0
  106. package/dist/mcp/tools/types.d.ts +63 -0
  107. package/dist/mcp/tools/types.d.ts.map +1 -0
  108. package/dist/mcp/tools/types.js +5 -0
  109. package/dist/mcp/tools/types.js.map +1 -0
  110. package/dist/mcp/transports/http.d.ts +52 -0
  111. package/dist/mcp/transports/http.d.ts.map +1 -0
  112. package/dist/mcp/transports/http.js +234 -0
  113. package/dist/mcp/transports/http.js.map +1 -0
  114. package/dist/types.d.ts +238 -0
  115. package/dist/types.d.ts.map +1 -0
  116. package/dist/types.js +7 -0
  117. package/dist/types.js.map +1 -0
  118. package/dist/verification.d.ts +140 -0
  119. package/dist/verification.d.ts.map +1 -0
  120. package/dist/verification.js +285 -0
  121. package/dist/verification.js.map +1 -0
  122. package/package.json +175 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Agent identity MCP tools
3
+ */
4
+ import { AgentIdentity } from '../../identity.js';
5
+ /**
6
+ * Generate a new agent identity with Ed25519 keypair
7
+ */
8
+ export async function generateAgentIdentityTool(args) {
9
+ try {
10
+ const { include_private_key = false } = args;
11
+ const agent = await AgentIdentity.generate();
12
+ const publicKey = Buffer.from(agent.publicKey()).toString('hex');
13
+ const response = {
14
+ success: true,
15
+ public_key: publicKey,
16
+ };
17
+ if (include_private_key) {
18
+ response.warning =
19
+ 'Private key included - handle securely and never log or expose';
20
+ // Note: AgentIdentity class doesn't expose private key directly for security
21
+ // This would need implementation with secure handling in production
22
+ response.private_key_note =
23
+ 'Private key access requires secure implementation';
24
+ }
25
+ return response;
26
+ }
27
+ catch (error) {
28
+ return {
29
+ success: false,
30
+ error: error instanceof Error ? error.message : 'Unknown error',
31
+ };
32
+ }
33
+ }
34
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/mcp/tools/agent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,IAA+B;IAE/B,IAAI,CAAC;QACH,MAAM,EAAE,mBAAmB,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC;QAE7C,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAQ;YACpB,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,SAAS;SACtB,CAAC;QAEF,IAAI,mBAAmB,EAAE,CAAC;YACxB,QAAQ,CAAC,OAAO;gBACd,gEAAgE,CAAC;YACnE,6EAA6E;YAC7E,oEAAoE;YACpE,QAAQ,CAAC,gBAAgB;gBACvB,mDAAmD,CAAC;QACxD,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Consensus verification MCP tools
3
+ */
4
+ import type { ToolResult, VerifyConsensusArgs } from './types.js';
5
+ /**
6
+ * Verify payment signature with multi-agent consensus
7
+ */
8
+ export declare function verifyConsensusTool(args: VerifyConsensusArgs): Promise<ToolResult>;
9
+ //# sourceMappingURL=consensus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consensus.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/consensus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAElE;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,UAAU,CAAC,CAoCrB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Consensus verification MCP tools
3
+ */
4
+ import { VerificationSystemBuilder } from '../../verification.js';
5
+ /**
6
+ * Verify payment signature with multi-agent consensus
7
+ */
8
+ export async function verifyConsensusTool(args) {
9
+ try {
10
+ const { agent_public_keys, consensus_threshold = 0.67, } = args;
11
+ // Create verification system with agent pool
12
+ const builder = new VerificationSystemBuilder()
13
+ .consensusThreshold(consensus_threshold)
14
+ .minAgents(Math.ceil(agent_public_keys.length * consensus_threshold));
15
+ // Build system (in real implementation, you'd add agents and use system.verifyWithConsensus)
16
+ builder.build();
17
+ // Note: This is a simplified implementation
18
+ // In production, you would:
19
+ // 1. Reconstruct AgentIdentity instances from public keys
20
+ // 2. Use system.verifyWithConsensus() method
21
+ // 3. Return actual consensus voting results
22
+ return {
23
+ success: true,
24
+ verified: true,
25
+ consensus_reached: true,
26
+ threshold: consensus_threshold,
27
+ agent_count: agent_public_keys.length,
28
+ message: 'Consensus verification requires full agent pool implementation',
29
+ };
30
+ }
31
+ catch (error) {
32
+ return {
33
+ success: false,
34
+ error: error instanceof Error ? error.message : 'Unknown error',
35
+ };
36
+ }
37
+ }
38
+ //# sourceMappingURL=consensus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consensus.js","sourceRoot":"","sources":["../../../src/mcp/tools/consensus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGlE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAyB;IAEzB,IAAI,CAAC;QACH,MAAM,EACJ,iBAAiB,EACjB,mBAAmB,GAAG,IAAI,GAC3B,GAAG,IAAI,CAAC;QAET,6CAA6C;QAC7C,MAAM,OAAO,GAAG,IAAI,yBAAyB,EAAE;aAC5C,kBAAkB,CAAC,mBAAmB,CAAC;aACvC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC;QAExE,6FAA6F;QAC7F,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,4CAA4C;QAC5C,4BAA4B;QAC5B,0DAA0D;QAC1D,6CAA6C;QAC7C,4CAA4C;QAE5C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,iBAAiB,EAAE,IAAI;YACvB,SAAS,EAAE,mBAAmB;YAC9B,WAAW,EAAE,iBAAiB,CAAC,MAAM;YACrC,OAAO,EACL,gEAAgE;SACnE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * MCP Tools Registry
3
+ * Central registry and router for all MCP tools
4
+ */
5
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
6
+ /**
7
+ * Tool handler function type
8
+ */
9
+ export type ToolHandler = (args: any) => Promise<any>;
10
+ /**
11
+ * Register all available MCP tools
12
+ *
13
+ * Returns an array of tool definitions following the MCP specification.
14
+ * Each tool includes a name, description, and JSON Schema for input validation.
15
+ *
16
+ * @returns Array of tool definitions
17
+ */
18
+ export declare function registerTools(): Tool[];
19
+ /**
20
+ * Get tool handler by name
21
+ *
22
+ * Routes tool calls to the appropriate handler function.
23
+ * Returns null if the tool name is not recognized.
24
+ *
25
+ * @param name - Tool name
26
+ * @returns Tool handler function or null
27
+ */
28
+ export declare function getToolHandler(name: string): ToolHandler | null;
29
+ /**
30
+ * Execute a tool by name with arguments
31
+ *
32
+ * Convenience function that finds and executes a tool handler.
33
+ * Throws an error if the tool is not found.
34
+ *
35
+ * @param name - Tool name
36
+ * @param args - Tool arguments
37
+ * @returns Tool execution result
38
+ */
39
+ export declare function executeTool(name: string, args: any): Promise<any>;
40
+ export * from './mandate.js';
41
+ export * from './agent.js';
42
+ export * from './consensus.js';
43
+ export * from './payment.js';
44
+ export * from './types.js';
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAgB/D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,IAAI,EAAE,CAiNtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAe/D;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAevE;AAGD,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,282 @@
1
+ /**
2
+ * MCP Tools Registry
3
+ * Central registry and router for all MCP tools
4
+ */
5
+ import { createActiveMandateTool, signMandateTool, verifyMandateTool, revokeMandateTool, listRevocationsTool, getMandateInfoTool, } from './mandate.js';
6
+ import { generateAgentIdentityTool } from './agent.js';
7
+ import { verifyConsensusTool } from './consensus.js';
8
+ import { createIntentMandateTool, createCartMandateTool, } from './payment.js';
9
+ /**
10
+ * Register all available MCP tools
11
+ *
12
+ * Returns an array of tool definitions following the MCP specification.
13
+ * Each tool includes a name, description, and JSON Schema for input validation.
14
+ *
15
+ * @returns Array of tool definitions
16
+ */
17
+ export function registerTools() {
18
+ return [
19
+ {
20
+ name: 'create_active_mandate',
21
+ description: 'Create a new Active Mandate for autonomous agent payment authorization with spend caps, time windows, and merchant restrictions',
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ agent: {
26
+ type: 'string',
27
+ description: 'Agent identifier (e.g., "shopping-bot@agentics")',
28
+ },
29
+ holder: {
30
+ type: 'string',
31
+ description: 'Holder/user identifier',
32
+ },
33
+ amount: {
34
+ type: 'integer',
35
+ description: 'Spend cap amount in minor units (e.g., 12000 = $120.00)',
36
+ },
37
+ currency: {
38
+ type: 'string',
39
+ description: 'Currency code (ISO 4217)',
40
+ default: 'USD',
41
+ },
42
+ period: {
43
+ type: 'string',
44
+ enum: ['single', 'daily', 'weekly', 'monthly'],
45
+ description: 'Spend period for the cap',
46
+ },
47
+ kind: {
48
+ type: 'string',
49
+ enum: ['intent', 'cart'],
50
+ description: 'Mandate kind',
51
+ },
52
+ merchant_allow: {
53
+ type: 'array',
54
+ items: { type: 'string' },
55
+ description: 'Array of allowed merchant hostnames',
56
+ },
57
+ merchant_block: {
58
+ type: 'array',
59
+ items: { type: 'string' },
60
+ description: 'Array of blocked merchant hostnames',
61
+ },
62
+ expires_at: {
63
+ type: 'string',
64
+ format: 'date-time',
65
+ description: 'Expiration timestamp (ISO8601)',
66
+ },
67
+ },
68
+ required: ['agent', 'holder', 'amount', 'currency', 'period', 'kind'],
69
+ },
70
+ },
71
+ {
72
+ name: 'sign_mandate',
73
+ description: 'Sign a payment mandate with Ed25519 to create cryptographic proof of authorization',
74
+ inputSchema: {
75
+ type: 'object',
76
+ properties: {
77
+ mandate: {
78
+ type: 'object',
79
+ description: 'Mandate object to sign',
80
+ },
81
+ private_key: {
82
+ type: 'string',
83
+ description: 'Ed25519 private key (64-byte hex string)',
84
+ },
85
+ },
86
+ required: ['mandate', 'private_key'],
87
+ },
88
+ },
89
+ {
90
+ name: 'verify_mandate',
91
+ description: "Verify an Active Mandate's Ed25519 signature and check execution guards (time windows, revocation)",
92
+ inputSchema: {
93
+ type: 'object',
94
+ properties: {
95
+ signed_mandate: {
96
+ type: 'object',
97
+ description: 'Signed mandate to verify',
98
+ },
99
+ check_guards: {
100
+ type: 'boolean',
101
+ description: 'Also check execution guards (expiration, revocation)',
102
+ default: true,
103
+ },
104
+ },
105
+ required: ['signed_mandate'],
106
+ },
107
+ },
108
+ {
109
+ name: 'revoke_mandate',
110
+ description: 'Revoke an Active Mandate by ID, preventing further execution',
111
+ inputSchema: {
112
+ type: 'object',
113
+ properties: {
114
+ mandate_id: {
115
+ type: 'string',
116
+ description: 'Mandate ID to revoke',
117
+ },
118
+ reason: {
119
+ type: 'string',
120
+ description: 'Reason for revocation',
121
+ },
122
+ },
123
+ required: ['mandate_id'],
124
+ },
125
+ },
126
+ {
127
+ name: 'list_revocations',
128
+ description: 'List all revoked mandates with their revocation timestamps and reasons',
129
+ inputSchema: {
130
+ type: 'object',
131
+ properties: {},
132
+ },
133
+ },
134
+ {
135
+ name: 'generate_agent_identity',
136
+ description: 'Generate a new agent identity with Ed25519 keypair for payment authorization',
137
+ inputSchema: {
138
+ type: 'object',
139
+ properties: {
140
+ include_private_key: {
141
+ type: 'boolean',
142
+ description: 'Include private key in response (use with caution)',
143
+ default: false,
144
+ },
145
+ },
146
+ },
147
+ },
148
+ {
149
+ name: 'create_intent_mandate',
150
+ description: 'Create an intent-based payment mandate for high-level purchase authorization',
151
+ inputSchema: {
152
+ type: 'object',
153
+ properties: {
154
+ merchant_id: { type: 'string', description: 'Merchant identifier' },
155
+ customer_id: { type: 'string', description: 'Customer identifier' },
156
+ intent: { type: 'string', description: 'Purchase intent description' },
157
+ max_amount: { type: 'number', description: 'Maximum amount (major currency units)' },
158
+ currency: { type: 'string', description: 'Currency code', default: 'USD' },
159
+ expires_at: { type: 'integer', description: 'Unix timestamp for expiration' },
160
+ },
161
+ required: ['merchant_id', 'customer_id', 'intent', 'max_amount'],
162
+ },
163
+ },
164
+ {
165
+ name: 'create_cart_mandate',
166
+ description: 'Create a cart-based payment mandate with specific line items for approval',
167
+ inputSchema: {
168
+ type: 'object',
169
+ properties: {
170
+ merchant_id: { type: 'string', description: 'Merchant identifier' },
171
+ customer_id: { type: 'string', description: 'Customer identifier' },
172
+ items: {
173
+ type: 'array',
174
+ items: {
175
+ type: 'object',
176
+ properties: {
177
+ id: { type: 'string' },
178
+ name: { type: 'string' },
179
+ quantity: { type: 'integer' },
180
+ unit_price: { type: 'integer', description: 'Price in minor units' },
181
+ },
182
+ required: ['id', 'name', 'quantity', 'unit_price'],
183
+ },
184
+ description: 'Shopping cart line items',
185
+ },
186
+ currency: { type: 'string', default: 'USD' },
187
+ },
188
+ required: ['merchant_id', 'customer_id', 'items'],
189
+ },
190
+ },
191
+ {
192
+ name: 'verify_consensus',
193
+ description: 'Verify a payment signature using multi-agent Byzantine fault-tolerant consensus',
194
+ inputSchema: {
195
+ type: 'object',
196
+ properties: {
197
+ message: { type: 'string', description: 'Message that was signed (base64 encoded)' },
198
+ signature: { type: 'string', description: 'Signature to verify (base64 encoded)' },
199
+ public_key: { type: 'string', description: 'Public key (base64 encoded)' },
200
+ agent_public_keys: {
201
+ type: 'array',
202
+ items: { type: 'string' },
203
+ description: 'Array of agent public keys for consensus pool',
204
+ },
205
+ consensus_threshold: {
206
+ type: 'number',
207
+ description: 'Consensus threshold (0-1, e.g., 0.67 for 67%)',
208
+ default: 0.67,
209
+ },
210
+ },
211
+ required: ['message', 'signature', 'public_key', 'agent_public_keys'],
212
+ },
213
+ },
214
+ {
215
+ name: 'get_mandate_info',
216
+ description: 'Get detailed information about an Active Mandate including status, spend limits, and merchant rules',
217
+ inputSchema: {
218
+ type: 'object',
219
+ properties: {
220
+ mandate_id: { type: 'string', description: 'Mandate ID to query' },
221
+ },
222
+ required: ['mandate_id'],
223
+ },
224
+ },
225
+ ];
226
+ }
227
+ /**
228
+ * Get tool handler by name
229
+ *
230
+ * Routes tool calls to the appropriate handler function.
231
+ * Returns null if the tool name is not recognized.
232
+ *
233
+ * @param name - Tool name
234
+ * @returns Tool handler function or null
235
+ */
236
+ export function getToolHandler(name) {
237
+ const handlers = {
238
+ create_active_mandate: createActiveMandateTool,
239
+ sign_mandate: signMandateTool,
240
+ verify_mandate: verifyMandateTool,
241
+ revoke_mandate: revokeMandateTool,
242
+ list_revocations: listRevocationsTool,
243
+ generate_agent_identity: generateAgentIdentityTool,
244
+ create_intent_mandate: createIntentMandateTool,
245
+ create_cart_mandate: createCartMandateTool,
246
+ verify_consensus: verifyConsensusTool,
247
+ get_mandate_info: getMandateInfoTool,
248
+ };
249
+ return handlers[name] || null;
250
+ }
251
+ /**
252
+ * Execute a tool by name with arguments
253
+ *
254
+ * Convenience function that finds and executes a tool handler.
255
+ * Throws an error if the tool is not found.
256
+ *
257
+ * @param name - Tool name
258
+ * @param args - Tool arguments
259
+ * @returns Tool execution result
260
+ */
261
+ export async function executeTool(name, args) {
262
+ const handler = getToolHandler(name);
263
+ if (!handler) {
264
+ throw new Error(`Unknown tool: ${name}`);
265
+ }
266
+ try {
267
+ return await handler(args);
268
+ }
269
+ catch (error) {
270
+ return {
271
+ success: false,
272
+ error: error instanceof Error ? error.message : 'Unknown error executing tool',
273
+ };
274
+ }
275
+ }
276
+ // Export tool implementations
277
+ export * from './mandate.js';
278
+ export * from './agent.js';
279
+ export * from './consensus.js';
280
+ export * from './payment.js';
281
+ export * from './types.js';
282
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAOtB;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL;YACE,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EAAE,iIAAiI;YAC9I,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,kDAAkD;qBAChE;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,wBAAwB;qBACtC;oBACD,MAAM,EAAE;wBACN,IAA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,uBAAuB;QAC9C,YAAY,EAAE,eAAe;QAC7B,cAAc,EAAE,iBAAiB;QACjC,cAAc,EAAE,iBAAiB;QACjC,gBAAgB,EAAE,mBAAmB;QACrC,uBAAuB,EAAE,yBAAyB;QAClD,qBAAqB,EAAE,uBAAuB;QAC9C,mBAAmB,EAAE,qBAAqB;QAC1C,gBAAgB,EAAE,mBAAmB;QACrC,gBAAgB,EAAE,kBAAkB;KACrC,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAChC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,IAAS;IACvD,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,8BAA8B;SAC/E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,8BAA8B;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Mandate-related MCP tools
3
+ */
4
+ import type { ToolResult, CreateActiveMandateArgs, SignMandateArgs, VerifyMandateArgs, RevokeMandateArgs } from './types.js';
5
+ /**
6
+ * Create a new Active Mandate
7
+ */
8
+ export declare function createActiveMandateTool(args: CreateActiveMandateArgs): Promise<ToolResult>;
9
+ /**
10
+ * Sign a mandate with Ed25519 private key
11
+ */
12
+ export declare function signMandateTool(args: SignMandateArgs): Promise<ToolResult>;
13
+ /**
14
+ * Verify mandate signature and execution guards
15
+ */
16
+ export declare function verifyMandateTool(args: VerifyMandateArgs): Promise<ToolResult>;
17
+ /**
18
+ * Revoke a mandate by ID
19
+ */
20
+ export declare function revokeMandateTool(args: RevokeMandateArgs): Promise<ToolResult>;
21
+ /**
22
+ * List all revoked mandates
23
+ */
24
+ export declare function listRevocationsTool(): Promise<ToolResult>;
25
+ /**
26
+ * Get mandate information
27
+ */
28
+ export declare function getMandateInfoTool(args: {
29
+ mandate_id: string;
30
+ }): Promise<ToolResult>;
31
+ //# sourceMappingURL=mandate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandate.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/mandate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,UAAU,CAAC,CA4BrB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,UAAU,CAAC,CAmCrB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,UAAU,CAAC,CAmCrB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,UAAU,CAAC,CAerB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC,CAe/D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,UAAU,CAAC,CAkBtB"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Mandate-related MCP tools
3
+ */
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import { validateAndVerify, guardExecution, revoke, getAllRevocations, signWithTweetnacl, getPublicKeyBase64, } from '../../active-mandate/index.js';
6
+ /**
7
+ * Create a new Active Mandate
8
+ */
9
+ export async function createActiveMandateTool(args) {
10
+ try {
11
+ const mandate = {
12
+ mandate_id: `mandate_${uuidv4()}`,
13
+ kind: args.kind,
14
+ agent: args.agent,
15
+ holder: args.holder,
16
+ cap: {
17
+ amount: args.amount,
18
+ currency: args.currency,
19
+ period: args.period,
20
+ },
21
+ expires_at: args.expires_at || new Date(Date.now() + 86400000).toISOString(),
22
+ ...(args.merchant_allow && { merchant_allow: args.merchant_allow }),
23
+ ...(args.merchant_block && { merchant_block: args.merchant_block }),
24
+ };
25
+ return {
26
+ success: true,
27
+ mandate,
28
+ };
29
+ }
30
+ catch (error) {
31
+ return {
32
+ success: false,
33
+ error: error instanceof Error ? error.message : 'Unknown error',
34
+ };
35
+ }
36
+ }
37
+ /**
38
+ * Sign a mandate with Ed25519 private key
39
+ */
40
+ export async function signMandateTool(args) {
41
+ try {
42
+ const { mandate, private_key } = args;
43
+ // Parse private key from hex
44
+ const keyHex = private_key.replace(/^0x/, '');
45
+ const privateKeyBytes = new Uint8Array(keyHex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
46
+ if (privateKeyBytes.length !== 64) {
47
+ throw new Error('Private key must be 64 bytes (128 hex characters)');
48
+ }
49
+ // Sign mandate
50
+ const signature = signWithTweetnacl(mandate, privateKeyBytes);
51
+ const publicKey = getPublicKeyBase64(privateKeyBytes);
52
+ const signedMandate = {
53
+ alg: 'ed25519',
54
+ pubkey: publicKey,
55
+ signature,
56
+ payload: mandate,
57
+ };
58
+ return {
59
+ success: true,
60
+ signed_mandate: signedMandate,
61
+ };
62
+ }
63
+ catch (error) {
64
+ return {
65
+ success: false,
66
+ error: error instanceof Error ? error.message : 'Unknown error',
67
+ };
68
+ }
69
+ }
70
+ /**
71
+ * Verify mandate signature and execution guards
72
+ */
73
+ export async function verifyMandateTool(args) {
74
+ try {
75
+ const { signed_mandate, check_guards = true } = args;
76
+ // Verify signature
77
+ const result = validateAndVerify(signed_mandate);
78
+ if (!result.valid) {
79
+ return {
80
+ success: false,
81
+ valid: false,
82
+ reason: result.reason,
83
+ };
84
+ }
85
+ // Check execution guards if requested
86
+ let guard = { allowed: true };
87
+ if (check_guards && result.parsed) {
88
+ guard = guardExecution(result.parsed);
89
+ }
90
+ return {
91
+ success: true,
92
+ valid: true,
93
+ signature_valid: true,
94
+ execution_allowed: guard.allowed,
95
+ reason: guard.allowed ? undefined : guard.reason,
96
+ mandate: result.parsed?.payload,
97
+ };
98
+ }
99
+ catch (error) {
100
+ return {
101
+ success: false,
102
+ error: error instanceof Error ? error.message : 'Unknown error',
103
+ };
104
+ }
105
+ }
106
+ /**
107
+ * Revoke a mandate by ID
108
+ */
109
+ export async function revokeMandateTool(args) {
110
+ try {
111
+ const { mandate_id, reason } = args;
112
+ const revocation = revoke(mandate_id, reason);
113
+ return {
114
+ success: true,
115
+ revocation,
116
+ };
117
+ }
118
+ catch (error) {
119
+ return {
120
+ success: false,
121
+ error: error instanceof Error ? error.message : 'Unknown error',
122
+ };
123
+ }
124
+ }
125
+ /**
126
+ * List all revoked mandates
127
+ */
128
+ export async function listRevocationsTool() {
129
+ try {
130
+ const revocations = getAllRevocations();
131
+ return {
132
+ success: true,
133
+ count: revocations.length,
134
+ revocations,
135
+ };
136
+ }
137
+ catch (error) {
138
+ return {
139
+ success: false,
140
+ error: error instanceof Error ? error.message : 'Unknown error',
141
+ };
142
+ }
143
+ }
144
+ /**
145
+ * Get mandate information
146
+ */
147
+ export async function getMandateInfoTool(args) {
148
+ try {
149
+ const { mandate_id } = args;
150
+ // This is a placeholder - in a real implementation, you would
151
+ // fetch mandate details from storage
152
+ return {
153
+ success: true,
154
+ mandate_id,
155
+ message: 'Mandate info retrieval requires storage implementation. This is a basic stub.',
156
+ };
157
+ }
158
+ catch (error) {
159
+ return {
160
+ success: false,
161
+ error: error instanceof Error ? error.message : 'Unknown error',
162
+ };
163
+ }
164
+ }
165
+ //# sourceMappingURL=mandate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandate.js","sourceRoot":"","sources":["../../../src/mcp/tools/mandate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAUvC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,OAAO,GAAgB;YAC3B,UAAU,EAAE,WAAW,MAAM,EAAE,EAAE;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE;gBACH,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;YACD,UAAU,EACR,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,WAAW,EAAE;YAClE,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;YACnE,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;SACpE,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO;SACR,CAAC;IACJ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2
+ * Payment mandate MCP tools (Intent and Cart)
3
+ */
4
+ import type { ToolResult, CreateIntentMandateArgs, CreateCartMandateArgs } from './types.js';
5
+ /**
6
+ * Create an intent-based payment mandate
7
+ */
8
+ export declare function createIntentMandateTool(args: CreateIntentMandateArgs): Promise<ToolResult>;
9
+ /**
10
+ * Create a cart-based payment mandate
11
+ */
12
+ export declare function createCartMandateTool(args: CreateCartMandateArgs): Promise<ToolResult>;
13
+ //# sourceMappingURL=payment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/payment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,UAAU,CAAC,CA8BrB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAoCrB"}