@sardis/mcp-server 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.
- package/CHANGELOG.md +69 -0
- package/CLAUDE_DESKTOP_CONFIG.md +180 -0
- package/LICENSE +21 -0
- package/README.md +375 -0
- package/dist/api.d.ts +25 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +70 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +274 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +47 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +82 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +255 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/agents.d.ts +7 -0
- package/dist/tools/agents.d.ts.map +1 -0
- package/dist/tools/agents.js +219 -0
- package/dist/tools/agents.js.map +1 -0
- package/dist/tools/approvals.d.ts +9 -0
- package/dist/tools/approvals.d.ts.map +1 -0
- package/dist/tools/approvals.js +308 -0
- package/dist/tools/approvals.js.map +1 -0
- package/dist/tools/cards.d.ts +9 -0
- package/dist/tools/cards.d.ts.map +1 -0
- package/dist/tools/cards.js +415 -0
- package/dist/tools/cards.js.map +1 -0
- package/dist/tools/fiat.d.ts +9 -0
- package/dist/tools/fiat.d.ts.map +1 -0
- package/dist/tools/fiat.js +394 -0
- package/dist/tools/fiat.js.map +1 -0
- package/dist/tools/holds.d.ts +7 -0
- package/dist/tools/holds.d.ts.map +1 -0
- package/dist/tools/holds.js +403 -0
- package/dist/tools/holds.js.map +1 -0
- package/dist/tools/index.d.ts +70 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +152 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/payments.d.ts +47 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +447 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/policy.d.ts +41 -0
- package/dist/tools/policy.d.ts.map +1 -0
- package/dist/tools/policy.js +450 -0
- package/dist/tools/policy.js.map +1 -0
- package/dist/tools/spending.d.ts +9 -0
- package/dist/tools/spending.d.ts.map +1 -0
- package/dist/tools/spending.js +324 -0
- package/dist/tools/spending.js.map +1 -0
- package/dist/tools/types.d.ts +247 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +71 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/wallet-management.d.ts +9 -0
- package/dist/tools/wallet-management.d.ts.map +1 -0
- package/dist/tools/wallet-management.js +222 -0
- package/dist/tools/wallet-management.js.map +1 -0
- package/dist/tools/wallets.d.ts +15 -0
- package/dist/tools/wallets.d.ts.map +1 -0
- package/dist/tools/wallets.js +112 -0
- package/dist/tools/wallets.js.map +1 -0
- package/mcp.json +283 -0
- package/package.json +145 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spending Reports tools for MCP server
|
|
3
|
+
*
|
|
4
|
+
* Tools for getting spending analytics and reports.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { getConfig } from '../config.js';
|
|
8
|
+
import { apiRequest } from '../api.js';
|
|
9
|
+
// Schemas
|
|
10
|
+
const SpendingSummarySchema = z.object({
|
|
11
|
+
wallet_id: z.string().optional().describe('Wallet ID (defaults to configured wallet)'),
|
|
12
|
+
period: z.enum(['day', 'week', 'month', 'year', 'daily', 'weekly', 'monthly']).optional().describe('Time period'),
|
|
13
|
+
});
|
|
14
|
+
const SpendingByVendorSchema = z.object({
|
|
15
|
+
wallet_id: z.string().optional().describe('Wallet ID'),
|
|
16
|
+
vendor: z.string().optional().describe('Specific vendor to query'),
|
|
17
|
+
period: z.enum(['day', 'week', 'month', 'year', 'daily', 'weekly', 'monthly']).optional().describe('Time period'),
|
|
18
|
+
limit: z.number().optional().describe('Number of vendors to return'),
|
|
19
|
+
});
|
|
20
|
+
const SpendingByCategorySchema = z.object({
|
|
21
|
+
wallet_id: z.string().optional().describe('Wallet ID'),
|
|
22
|
+
category: z.string().optional().describe('Specific category to query'),
|
|
23
|
+
period: z.enum(['day', 'week', 'month', 'year', 'daily', 'weekly', 'monthly']).optional().describe('Time period'),
|
|
24
|
+
});
|
|
25
|
+
const SpendingTrendsSchema = z.object({
|
|
26
|
+
wallet_id: z.string().optional().describe('Wallet ID'),
|
|
27
|
+
granularity: z.enum(['hourly', 'daily', 'weekly', 'monthly']).optional().describe('Time granularity'),
|
|
28
|
+
lookback: z.number().optional().describe('Number of periods to look back'),
|
|
29
|
+
});
|
|
30
|
+
// Tool definitions
|
|
31
|
+
export const spendingToolDefinitions = [
|
|
32
|
+
{
|
|
33
|
+
name: 'sardis_get_spending_summary',
|
|
34
|
+
description: 'Get a summary of spending activity including totals, limits, and top vendors.',
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
wallet_id: { type: 'string', description: 'Wallet ID (defaults to configured wallet)' },
|
|
39
|
+
period: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
enum: ['day', 'week', 'month', 'year', 'daily', 'weekly', 'monthly'],
|
|
42
|
+
description: 'Time period for summary',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: [],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'sardis_get_spending',
|
|
50
|
+
description: 'Get spending summary (alias for sardis_get_spending_summary).',
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
wallet_id: { type: 'string', description: 'Wallet ID' },
|
|
55
|
+
period: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
enum: ['day', 'week', 'month', 'year', 'daily', 'weekly', 'monthly'],
|
|
58
|
+
description: 'Time period',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: [],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'sardis_get_spending_by_vendor',
|
|
66
|
+
description: 'Get spending breakdown by vendor, sorted by total amount.',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
wallet_id: { type: 'string', description: 'Wallet ID' },
|
|
71
|
+
period: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
enum: ['day', 'week', 'month', 'year'],
|
|
74
|
+
description: 'Time period',
|
|
75
|
+
},
|
|
76
|
+
limit: { type: 'number', description: 'Number of vendors to return (default: 10)' },
|
|
77
|
+
},
|
|
78
|
+
required: [],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'sardis_get_spending_by_category',
|
|
83
|
+
description: 'Get spending breakdown by merchant category.',
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: 'object',
|
|
86
|
+
properties: {
|
|
87
|
+
wallet_id: { type: 'string', description: 'Wallet ID' },
|
|
88
|
+
category: { type: 'string', description: 'Specific category to query' },
|
|
89
|
+
period: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
enum: ['day', 'week', 'month', 'year', 'daily', 'weekly', 'monthly'],
|
|
92
|
+
description: 'Time period',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
required: [],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'sardis_get_spending_trends',
|
|
100
|
+
description: 'Get spending trends over time with configurable granularity.',
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
wallet_id: { type: 'string', description: 'Wallet ID' },
|
|
105
|
+
granularity: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
enum: ['hourly', 'daily', 'weekly', 'monthly'],
|
|
108
|
+
description: 'Time granularity for trends',
|
|
109
|
+
},
|
|
110
|
+
lookback: { type: 'number', description: 'Number of periods to look back' },
|
|
111
|
+
},
|
|
112
|
+
required: [],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
// Tool handlers
|
|
117
|
+
export const spendingToolHandlers = {
|
|
118
|
+
sardis_get_spending_summary: async (args) => {
|
|
119
|
+
const parsed = SpendingSummarySchema.safeParse(args);
|
|
120
|
+
const config = getConfig();
|
|
121
|
+
const walletId = (parsed.success && parsed.data.wallet_id) || config.walletId || 'wallet_default';
|
|
122
|
+
let period = (parsed.success && parsed.data.period) || 'month';
|
|
123
|
+
// Normalize period names
|
|
124
|
+
if (period === 'daily')
|
|
125
|
+
period = 'day';
|
|
126
|
+
if (period === 'weekly')
|
|
127
|
+
period = 'week';
|
|
128
|
+
if (period === 'monthly')
|
|
129
|
+
period = 'month';
|
|
130
|
+
if (!config.apiKey || config.mode === 'simulated') {
|
|
131
|
+
return {
|
|
132
|
+
content: [{
|
|
133
|
+
type: 'text',
|
|
134
|
+
text: JSON.stringify({
|
|
135
|
+
wallet_id: walletId,
|
|
136
|
+
period,
|
|
137
|
+
total: '450.00',
|
|
138
|
+
total_spent: '450.00',
|
|
139
|
+
transaction_count: 12,
|
|
140
|
+
average_transaction: '37.50',
|
|
141
|
+
remaining_daily_limit: '50.00',
|
|
142
|
+
remaining_monthly_limit: '550.00',
|
|
143
|
+
top_vendor: 'OpenAI',
|
|
144
|
+
top_category: 'AI Services',
|
|
145
|
+
period_start: new Date(Date.now() - 30 * 24 * 3600000).toISOString().split('T')[0],
|
|
146
|
+
period_end: new Date().toISOString().split('T')[0],
|
|
147
|
+
}, null, 2),
|
|
148
|
+
}],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const result = await apiRequest('GET', `/api/v2/spending/summary?wallet_id=${walletId}&period=${period}`);
|
|
153
|
+
return {
|
|
154
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return {
|
|
159
|
+
content: [{
|
|
160
|
+
type: 'text',
|
|
161
|
+
text: `Failed to get spending summary: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
162
|
+
}],
|
|
163
|
+
isError: true,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
sardis_get_spending_by_vendor: async (args) => {
|
|
168
|
+
const parsed = SpendingByVendorSchema.safeParse(args);
|
|
169
|
+
const config = getConfig();
|
|
170
|
+
const walletId = (parsed.success && parsed.data.wallet_id) || config.walletId || 'wallet_default';
|
|
171
|
+
const period = (parsed.success && parsed.data.period) || 'month';
|
|
172
|
+
const limit = (parsed.success && parsed.data.limit) || 10;
|
|
173
|
+
const vendorFilter = parsed.success && parsed.data.vendor;
|
|
174
|
+
if (!config.apiKey || config.mode === 'simulated') {
|
|
175
|
+
const vendors = [
|
|
176
|
+
{ vendor: 'OpenAI', total_spent: '150.00', total: '150.00', transaction_count: 5, percentage: 33.3 },
|
|
177
|
+
{ vendor: 'Anthropic', total_spent: '100.00', total: '100.00', transaction_count: 3, percentage: 22.2 },
|
|
178
|
+
{ vendor: 'AWS', total_spent: '80.00', total: '80.00', transaction_count: 2, percentage: 17.8 },
|
|
179
|
+
{ vendor: 'Vercel', total_spent: '70.00', total: '70.00', transaction_count: 1, percentage: 15.6 },
|
|
180
|
+
{ vendor: 'GitHub', total_spent: '50.00', total: '50.00', transaction_count: 1, percentage: 11.1 },
|
|
181
|
+
];
|
|
182
|
+
if (vendorFilter) {
|
|
183
|
+
const singleVendor = vendors.find(v => v.vendor === vendorFilter) || vendors[0];
|
|
184
|
+
return {
|
|
185
|
+
content: [{
|
|
186
|
+
type: 'text',
|
|
187
|
+
text: JSON.stringify(singleVendor, null, 2),
|
|
188
|
+
}],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
content: [{
|
|
193
|
+
type: 'text',
|
|
194
|
+
text: JSON.stringify({
|
|
195
|
+
wallet_id: walletId,
|
|
196
|
+
period,
|
|
197
|
+
vendors: vendors.slice(0, limit),
|
|
198
|
+
total_vendors: 5,
|
|
199
|
+
}, null, 2),
|
|
200
|
+
}],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const result = await apiRequest('GET', `/api/v2/spending/by-vendor?wallet_id=${walletId}&period=${period}&limit=${limit}`);
|
|
205
|
+
return {
|
|
206
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
return {
|
|
211
|
+
content: [{
|
|
212
|
+
type: 'text',
|
|
213
|
+
text: `Failed to get vendor spending: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
214
|
+
}],
|
|
215
|
+
isError: true,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
sardis_get_spending_by_category: async (args) => {
|
|
220
|
+
const parsed = SpendingByCategorySchema.safeParse(args);
|
|
221
|
+
const config = getConfig();
|
|
222
|
+
const walletId = (parsed.success && parsed.data.wallet_id) || config.walletId || 'wallet_default';
|
|
223
|
+
const period = (parsed.success && parsed.data.period) || 'month';
|
|
224
|
+
const categoryFilter = parsed.success && parsed.data.category;
|
|
225
|
+
if (!config.apiKey || config.mode === 'simulated') {
|
|
226
|
+
const categories = [
|
|
227
|
+
{ category: 'AI Services', total_spent: '250.00', total: '250.00', transaction_count: 8, percentage: 55.6 },
|
|
228
|
+
{ category: 'Cloud Infrastructure', total_spent: '100.00', total: '100.00', transaction_count: 2, percentage: 22.2 },
|
|
229
|
+
{ category: 'Developer Tools', total_spent: '70.00', total: '70.00', transaction_count: 1, percentage: 15.6 },
|
|
230
|
+
{ category: 'SaaS', total_spent: '30.00', total: '30.00', transaction_count: 1, percentage: 6.6 },
|
|
231
|
+
];
|
|
232
|
+
if (categoryFilter) {
|
|
233
|
+
const singleCategory = categories.find(c => c.category.toLowerCase() === categoryFilter.toLowerCase()) || categories[0];
|
|
234
|
+
return {
|
|
235
|
+
content: [{
|
|
236
|
+
type: 'text',
|
|
237
|
+
text: JSON.stringify(singleCategory, null, 2),
|
|
238
|
+
}],
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
content: [{
|
|
243
|
+
type: 'text',
|
|
244
|
+
text: JSON.stringify({
|
|
245
|
+
wallet_id: walletId,
|
|
246
|
+
period,
|
|
247
|
+
categories,
|
|
248
|
+
}, null, 2),
|
|
249
|
+
}],
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
const result = await apiRequest('GET', `/api/v2/spending/by-category?wallet_id=${walletId}&period=${period}`);
|
|
254
|
+
return {
|
|
255
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
return {
|
|
260
|
+
content: [{
|
|
261
|
+
type: 'text',
|
|
262
|
+
text: `Failed to get category spending: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
263
|
+
}],
|
|
264
|
+
isError: true,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
sardis_get_spending: async (args) => {
|
|
269
|
+
// Alias for sardis_get_spending_summary
|
|
270
|
+
const handler = spendingToolHandlers['sardis_get_spending_summary'];
|
|
271
|
+
if (!handler) {
|
|
272
|
+
return {
|
|
273
|
+
content: [{ type: 'text', text: 'Handler not found' }],
|
|
274
|
+
isError: true,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return handler(args);
|
|
278
|
+
},
|
|
279
|
+
sardis_get_spending_trends: async (args) => {
|
|
280
|
+
const parsed = SpendingTrendsSchema.safeParse(args);
|
|
281
|
+
const config = getConfig();
|
|
282
|
+
const walletId = (parsed.success && parsed.data.wallet_id) || config.walletId || 'wallet_default';
|
|
283
|
+
const granularity = (parsed.success && parsed.data.granularity) || 'daily';
|
|
284
|
+
const lookback = (parsed.success && parsed.data.lookback) || 7;
|
|
285
|
+
if (!config.apiKey || config.mode === 'simulated') {
|
|
286
|
+
const trends = [];
|
|
287
|
+
for (let i = lookback - 1; i >= 0; i--) {
|
|
288
|
+
const date = new Date(Date.now() - i * 24 * 3600000);
|
|
289
|
+
trends.push({
|
|
290
|
+
period: date.toISOString().split('T')[0],
|
|
291
|
+
total_spent: (Math.random() * 100 + 50).toFixed(2),
|
|
292
|
+
transaction_count: Math.floor(Math.random() * 5 + 1),
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
content: [{
|
|
297
|
+
type: 'text',
|
|
298
|
+
text: JSON.stringify({
|
|
299
|
+
wallet_id: walletId,
|
|
300
|
+
granularity,
|
|
301
|
+
lookback,
|
|
302
|
+
trends,
|
|
303
|
+
}, null, 2),
|
|
304
|
+
}],
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
const result = await apiRequest('GET', `/api/v2/spending/trends?wallet_id=${walletId}&granularity=${granularity}&lookback=${lookback}`);
|
|
309
|
+
return {
|
|
310
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
return {
|
|
315
|
+
content: [{
|
|
316
|
+
type: 'text',
|
|
317
|
+
text: `Failed to get spending trends: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
318
|
+
}],
|
|
319
|
+
isError: true,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
//# sourceMappingURL=spending.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spending.js","sourceRoot":"","sources":["../../src/tools/spending.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAA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,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for MCP tools
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export interface ToolResult {
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface ToolDefinition {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object';
|
|
18
|
+
properties: Record<string, unknown>;
|
|
19
|
+
required: string[];
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type ToolHandler = (args: unknown) => Promise<ToolResult>;
|
|
23
|
+
export interface WalletInfo {
|
|
24
|
+
id: string;
|
|
25
|
+
limit_per_tx: string;
|
|
26
|
+
limit_total: string;
|
|
27
|
+
is_active: boolean;
|
|
28
|
+
currency: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WalletBalance {
|
|
31
|
+
wallet_id: string;
|
|
32
|
+
balance: string;
|
|
33
|
+
token: string;
|
|
34
|
+
chain: string;
|
|
35
|
+
address: string;
|
|
36
|
+
}
|
|
37
|
+
export interface PaymentResult {
|
|
38
|
+
payment_id: string;
|
|
39
|
+
status: string;
|
|
40
|
+
tx_hash?: string;
|
|
41
|
+
chain: string;
|
|
42
|
+
ledger_tx_id?: string;
|
|
43
|
+
audit_anchor?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PolicyResult {
|
|
46
|
+
allowed: boolean;
|
|
47
|
+
reason?: string;
|
|
48
|
+
risk_score?: number;
|
|
49
|
+
checks?: Array<{
|
|
50
|
+
name: string;
|
|
51
|
+
passed: boolean;
|
|
52
|
+
reason?: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export interface Hold {
|
|
56
|
+
id: string;
|
|
57
|
+
wallet_id: string;
|
|
58
|
+
merchant_id?: string;
|
|
59
|
+
amount: string;
|
|
60
|
+
token: string;
|
|
61
|
+
status: 'active' | 'captured' | 'voided' | 'expired';
|
|
62
|
+
purpose?: string;
|
|
63
|
+
expires_at: string;
|
|
64
|
+
captured_amount?: string;
|
|
65
|
+
created_at: string;
|
|
66
|
+
}
|
|
67
|
+
export interface CreateHoldResult {
|
|
68
|
+
hold_id: string;
|
|
69
|
+
status: string;
|
|
70
|
+
expires_at: string;
|
|
71
|
+
}
|
|
72
|
+
export interface Agent {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
wallet_id?: string;
|
|
77
|
+
is_active: boolean;
|
|
78
|
+
created_at: string;
|
|
79
|
+
}
|
|
80
|
+
export declare const PaymentRequestSchema: z.ZodObject<{
|
|
81
|
+
vendor: z.ZodString;
|
|
82
|
+
amount: z.ZodNumber;
|
|
83
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
84
|
+
category: z.ZodOptional<z.ZodString>;
|
|
85
|
+
vendorAddress: z.ZodOptional<z.ZodString>;
|
|
86
|
+
token: z.ZodOptional<z.ZodEnum<["USDC", "USDT", "PYUSD", "EURC"]>>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
vendor: string;
|
|
89
|
+
amount: number;
|
|
90
|
+
purpose?: string | undefined;
|
|
91
|
+
category?: string | undefined;
|
|
92
|
+
vendorAddress?: string | undefined;
|
|
93
|
+
token?: "USDC" | "USDT" | "PYUSD" | "EURC" | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
vendor: string;
|
|
96
|
+
amount: number;
|
|
97
|
+
purpose?: string | undefined;
|
|
98
|
+
category?: string | undefined;
|
|
99
|
+
vendorAddress?: string | undefined;
|
|
100
|
+
token?: "USDC" | "USDT" | "PYUSD" | "EURC" | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
export declare const PolicyCheckSchema: z.ZodObject<{
|
|
103
|
+
vendor: z.ZodString;
|
|
104
|
+
amount: z.ZodNumber;
|
|
105
|
+
category: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
vendor: string;
|
|
108
|
+
amount: number;
|
|
109
|
+
category?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
vendor: string;
|
|
112
|
+
amount: number;
|
|
113
|
+
category?: string | undefined;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const ComplianceCheckSchema: z.ZodObject<{
|
|
116
|
+
address: z.ZodString;
|
|
117
|
+
amount: z.ZodNumber;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
amount: number;
|
|
120
|
+
address: string;
|
|
121
|
+
}, {
|
|
122
|
+
amount: number;
|
|
123
|
+
address: string;
|
|
124
|
+
}>;
|
|
125
|
+
export declare const TransactionQuerySchema: z.ZodObject<{
|
|
126
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
127
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
128
|
+
status: z.ZodOptional<z.ZodEnum<["pending", "completed", "failed"]>>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
limit: number;
|
|
131
|
+
offset: number;
|
|
132
|
+
status?: "pending" | "completed" | "failed" | undefined;
|
|
133
|
+
}, {
|
|
134
|
+
status?: "pending" | "completed" | "failed" | undefined;
|
|
135
|
+
limit?: number | undefined;
|
|
136
|
+
offset?: number | undefined;
|
|
137
|
+
}>;
|
|
138
|
+
export declare const BalanceCheckSchema: z.ZodObject<{
|
|
139
|
+
token: z.ZodOptional<z.ZodEnum<["USDC", "USDT", "PYUSD", "EURC"]>>;
|
|
140
|
+
chain: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
token?: "USDC" | "USDT" | "PYUSD" | "EURC" | undefined;
|
|
143
|
+
chain?: string | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
token?: "USDC" | "USDT" | "PYUSD" | "EURC" | undefined;
|
|
146
|
+
chain?: string | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
export declare const CreateHoldSchema: z.ZodObject<{
|
|
149
|
+
wallet_id: z.ZodOptional<z.ZodString>;
|
|
150
|
+
amount: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
151
|
+
token: z.ZodDefault<z.ZodOptional<z.ZodEnum<["USDC", "USDT", "PYUSD", "EURC"]>>>;
|
|
152
|
+
merchant_id: z.ZodOptional<z.ZodString>;
|
|
153
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
154
|
+
expires_in: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
duration_hours: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
amount: string | number;
|
|
158
|
+
token: "USDC" | "USDT" | "PYUSD" | "EURC";
|
|
159
|
+
duration_hours: number;
|
|
160
|
+
purpose?: string | undefined;
|
|
161
|
+
wallet_id?: string | undefined;
|
|
162
|
+
merchant_id?: string | undefined;
|
|
163
|
+
expires_in?: number | undefined;
|
|
164
|
+
}, {
|
|
165
|
+
amount: string | number;
|
|
166
|
+
purpose?: string | undefined;
|
|
167
|
+
token?: "USDC" | "USDT" | "PYUSD" | "EURC" | undefined;
|
|
168
|
+
wallet_id?: string | undefined;
|
|
169
|
+
merchant_id?: string | undefined;
|
|
170
|
+
expires_in?: number | undefined;
|
|
171
|
+
duration_hours?: number | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
export declare const CaptureHoldSchema: z.ZodObject<{
|
|
174
|
+
hold_id: z.ZodString;
|
|
175
|
+
amount: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
hold_id: string;
|
|
178
|
+
amount?: string | number | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
hold_id: string;
|
|
181
|
+
amount?: string | number | undefined;
|
|
182
|
+
}>;
|
|
183
|
+
export declare const VoidHoldSchema: z.ZodObject<{
|
|
184
|
+
hold_id: z.ZodString;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
hold_id: string;
|
|
187
|
+
}, {
|
|
188
|
+
hold_id: string;
|
|
189
|
+
}>;
|
|
190
|
+
export declare const GetHoldSchema: z.ZodObject<{
|
|
191
|
+
hold_id: z.ZodString;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
hold_id: string;
|
|
194
|
+
}, {
|
|
195
|
+
hold_id: string;
|
|
196
|
+
}>;
|
|
197
|
+
export declare const ListHoldsSchema: z.ZodObject<{
|
|
198
|
+
wallet_id: z.ZodOptional<z.ZodString>;
|
|
199
|
+
status: z.ZodOptional<z.ZodEnum<["active", "captured", "voided", "expired"]>>;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
status?: "active" | "captured" | "voided" | "expired" | undefined;
|
|
202
|
+
wallet_id?: string | undefined;
|
|
203
|
+
}, {
|
|
204
|
+
status?: "active" | "captured" | "voided" | "expired" | undefined;
|
|
205
|
+
wallet_id?: string | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
export declare const CreateAgentSchema: z.ZodObject<{
|
|
208
|
+
name: z.ZodString;
|
|
209
|
+
description: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
|
211
|
+
name: string;
|
|
212
|
+
description?: string | undefined;
|
|
213
|
+
}, {
|
|
214
|
+
name: string;
|
|
215
|
+
description?: string | undefined;
|
|
216
|
+
}>;
|
|
217
|
+
export declare const GetAgentSchema: z.ZodObject<{
|
|
218
|
+
agent_id: z.ZodString;
|
|
219
|
+
}, "strip", z.ZodTypeAny, {
|
|
220
|
+
agent_id: string;
|
|
221
|
+
}, {
|
|
222
|
+
agent_id: string;
|
|
223
|
+
}>;
|
|
224
|
+
export declare const ListAgentsSchema: z.ZodObject<{
|
|
225
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
226
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
limit: number;
|
|
229
|
+
offset: number;
|
|
230
|
+
}, {
|
|
231
|
+
limit?: number | undefined;
|
|
232
|
+
offset?: number | undefined;
|
|
233
|
+
}>;
|
|
234
|
+
export declare const UpdateAgentSchema: z.ZodObject<{
|
|
235
|
+
agent_id: z.ZodString;
|
|
236
|
+
name: z.ZodOptional<z.ZodString>;
|
|
237
|
+
is_active: z.ZodOptional<z.ZodBoolean>;
|
|
238
|
+
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
agent_id: string;
|
|
240
|
+
name?: string | undefined;
|
|
241
|
+
is_active?: boolean | undefined;
|
|
242
|
+
}, {
|
|
243
|
+
agent_id: string;
|
|
244
|
+
name?: string | undefined;
|
|
245
|
+
is_active?: boolean | undefined;
|
|
246
|
+
}>;
|
|
247
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAA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@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for MCP tools
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// Zod schemas for input validation
|
|
6
|
+
export const PaymentRequestSchema = z.object({
|
|
7
|
+
vendor: z.string().describe('The merchant or service to pay'),
|
|
8
|
+
amount: z.number().positive().describe('Payment amount in USD'),
|
|
9
|
+
purpose: z.string().optional().describe('Reason for the payment'),
|
|
10
|
+
category: z.string().optional().describe('Merchant category'),
|
|
11
|
+
vendorAddress: z.string().optional().describe('Wallet address of the vendor (0x...)'),
|
|
12
|
+
token: z.enum(['USDC', 'USDT', 'PYUSD', 'EURC']).optional().describe('Token to use'),
|
|
13
|
+
});
|
|
14
|
+
export const PolicyCheckSchema = z.object({
|
|
15
|
+
vendor: z.string().describe('The merchant to check'),
|
|
16
|
+
amount: z.number().positive().describe('Payment amount to validate'),
|
|
17
|
+
category: z.string().optional().describe('Merchant category'),
|
|
18
|
+
});
|
|
19
|
+
export const ComplianceCheckSchema = z.object({
|
|
20
|
+
address: z.string().describe('Wallet address to check (0x...)'),
|
|
21
|
+
amount: z.number().positive().describe('Transaction amount for risk assessment'),
|
|
22
|
+
});
|
|
23
|
+
export const TransactionQuerySchema = z.object({
|
|
24
|
+
limit: z.number().optional().default(20).describe('Maximum transactions to return'),
|
|
25
|
+
offset: z.number().optional().default(0).describe('Pagination offset'),
|
|
26
|
+
status: z.enum(['pending', 'completed', 'failed']).optional().describe('Filter by status'),
|
|
27
|
+
});
|
|
28
|
+
export const BalanceCheckSchema = z.object({
|
|
29
|
+
token: z.enum(['USDC', 'USDT', 'PYUSD', 'EURC']).optional().describe('Token to check'),
|
|
30
|
+
chain: z.string().optional().describe('Chain to check balance on'),
|
|
31
|
+
});
|
|
32
|
+
export const CreateHoldSchema = z.object({
|
|
33
|
+
wallet_id: z.string().optional().describe('Wallet ID to create hold on'),
|
|
34
|
+
amount: z.union([z.string(), z.number()]).describe('Amount to hold'),
|
|
35
|
+
token: z.enum(['USDC', 'USDT', 'PYUSD', 'EURC']).optional().default('USDC'),
|
|
36
|
+
merchant_id: z.string().optional().describe('Merchant identifier'),
|
|
37
|
+
purpose: z.string().optional().describe('Purpose of the hold'),
|
|
38
|
+
expires_in: z.number().optional().describe('Hold duration in seconds'),
|
|
39
|
+
duration_hours: z.number().optional().default(168).describe('Hold duration in hours'),
|
|
40
|
+
});
|
|
41
|
+
export const CaptureHoldSchema = z.object({
|
|
42
|
+
hold_id: z.string().describe('Hold ID to capture'),
|
|
43
|
+
amount: z.union([z.string(), z.number()]).optional().describe('Amount to capture (defaults to full amount)'),
|
|
44
|
+
});
|
|
45
|
+
export const VoidHoldSchema = z.object({
|
|
46
|
+
hold_id: z.string().describe('Hold ID to void'),
|
|
47
|
+
});
|
|
48
|
+
export const GetHoldSchema = z.object({
|
|
49
|
+
hold_id: z.string().describe('Hold ID to retrieve'),
|
|
50
|
+
});
|
|
51
|
+
export const ListHoldsSchema = z.object({
|
|
52
|
+
wallet_id: z.string().optional().describe('Wallet ID to list holds for'),
|
|
53
|
+
status: z.enum(['active', 'captured', 'voided', 'expired']).optional(),
|
|
54
|
+
});
|
|
55
|
+
export const CreateAgentSchema = z.object({
|
|
56
|
+
name: z.string().describe('Agent display name'),
|
|
57
|
+
description: z.string().optional().describe('Agent description'),
|
|
58
|
+
});
|
|
59
|
+
export const GetAgentSchema = z.object({
|
|
60
|
+
agent_id: z.string().describe('Agent ID to retrieve'),
|
|
61
|
+
});
|
|
62
|
+
export const ListAgentsSchema = z.object({
|
|
63
|
+
limit: z.number().optional().default(100),
|
|
64
|
+
offset: z.number().optional().default(0),
|
|
65
|
+
});
|
|
66
|
+
export const UpdateAgentSchema = z.object({
|
|
67
|
+
agent_id: z.string().describe('Agent ID to update'),
|
|
68
|
+
name: z.string().optional().describe('New name'),
|
|
69
|
+
is_active: z.boolean().optional().describe('Active status'),
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=types.js.map
|