@t402/mcp 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +286 -58
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/index.d.ts +5 -0
- package/dist/cjs/server/index.js +286 -58
- package/dist/cjs/server/index.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +322 -1
- package/dist/cjs/tools/index.js +606 -58
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/esm/{chunk-XOPD7VTU.mjs → chunk-4DCBAKH2.mjs} +25 -2
- package/dist/esm/chunk-4DCBAKH2.mjs.map +1 -0
- package/dist/esm/{chunk-SUDCVXHQ.mjs → chunk-OSPCSAZF.mjs} +591 -55
- package/dist/esm/chunk-OSPCSAZF.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/server/index.d.mts +5 -0
- package/dist/esm/server/index.mjs +2 -2
- package/dist/esm/tools/index.d.mts +322 -1
- package/dist/esm/tools/index.mjs +25 -1
- package/package.json +11 -11
- package/dist/esm/chunk-SUDCVXHQ.mjs.map +0 -1
- package/dist/esm/chunk-XOPD7VTU.mjs.map +0 -1
|
@@ -20,6 +20,11 @@ declare class T402McpServer {
|
|
|
20
20
|
* Initialize the WDK instance from seed phrase
|
|
21
21
|
*/
|
|
22
22
|
initWdk(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Clear sensitive data from memory.
|
|
25
|
+
* Should be called on server shutdown to minimize key exposure window.
|
|
26
|
+
*/
|
|
27
|
+
cleanup(): void;
|
|
23
28
|
/** TON MCP bridge configuration */
|
|
24
29
|
private tonBridgeConfig;
|
|
25
30
|
/**
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -1180,10 +1180,10 @@ var import_zod7 = require("zod");
|
|
|
1180
1180
|
var wdkGetWalletInputSchema = import_zod7.z.object({});
|
|
1181
1181
|
async function executeWdkGetWallet(_input, wdk) {
|
|
1182
1182
|
const signer = await wdk.getSigner("ethereum");
|
|
1183
|
-
const
|
|
1183
|
+
const chains10 = wdk.getConfiguredChains();
|
|
1184
1184
|
return {
|
|
1185
1185
|
evmAddress: signer.address,
|
|
1186
|
-
chains:
|
|
1186
|
+
chains: chains10.length > 0 ? chains10 : ["ethereum"]
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
1189
1189
|
function executeWdkGetWalletDemo() {
|
|
@@ -1215,14 +1215,14 @@ function findTokenFormatted(tokens, symbol) {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
async function executeWdkGetBalances(input, wdk) {
|
|
1217
1217
|
const balances = await wdk.getAggregatedBalances();
|
|
1218
|
-
const
|
|
1218
|
+
const chains10 = balances.chains.filter((c) => !input.chains || input.chains.includes(c.chain)).map((c) => ({
|
|
1219
1219
|
chain: c.chain,
|
|
1220
1220
|
usdt0: findTokenFormatted(c.tokens, "USDT0"),
|
|
1221
1221
|
usdc: findTokenFormatted(c.tokens, "USDC"),
|
|
1222
1222
|
native: (0, import_viem6.formatUnits)(c.native, 18)
|
|
1223
1223
|
}));
|
|
1224
1224
|
return {
|
|
1225
|
-
chains:
|
|
1225
|
+
chains: chains10,
|
|
1226
1226
|
totalUsdt0: (0, import_viem6.formatUnits)(balances.totalUsdt0, 6),
|
|
1227
1227
|
totalUsdc: (0, import_viem6.formatUnits)(balances.totalUsdc, 6)
|
|
1228
1228
|
};
|
|
@@ -1422,22 +1422,37 @@ async function executeAutoPay(input, wdk) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
};
|
|
1424
1424
|
}
|
|
1425
|
-
const
|
|
1425
|
+
const chains10 = input.preferredChain ? [input.preferredChain] : ["ethereum", "arbitrum", "base"];
|
|
1426
1426
|
const { T402Protocol } = await import("@t402/wdk-protocol");
|
|
1427
|
-
const protocol = await T402Protocol.create(wdk, { chains:
|
|
1428
|
-
|
|
1429
|
-
if (receipt && input.maxAmount) {
|
|
1430
|
-
const paidAmount = parseFloat(receipt.amount) / 1e6;
|
|
1427
|
+
const protocol = await T402Protocol.create(wdk, { chains: chains10 });
|
|
1428
|
+
if (input.maxAmount) {
|
|
1431
1429
|
const maxAmount = parseFloat(input.maxAmount);
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1430
|
+
const preflightResponse = await fetch(input.url);
|
|
1431
|
+
if (preflightResponse.status === 402) {
|
|
1432
|
+
const requirementsHeader = preflightResponse.headers.get("x-payment") || preflightResponse.headers.get("x-payment-requirements");
|
|
1433
|
+
if (requirementsHeader) {
|
|
1434
|
+
try {
|
|
1435
|
+
const requirements = JSON.parse(requirementsHeader);
|
|
1436
|
+
const reqArray = Array.isArray(requirements) ? requirements : [requirements];
|
|
1437
|
+
for (const req of reqArray) {
|
|
1438
|
+
if (req.amount) {
|
|
1439
|
+
const reqAmount = parseFloat(req.amount) / 1e6;
|
|
1440
|
+
if (reqAmount > maxAmount) {
|
|
1441
|
+
return {
|
|
1442
|
+
success: false,
|
|
1443
|
+
statusCode: 402,
|
|
1444
|
+
body: "",
|
|
1445
|
+
error: `Required payment amount (${reqAmount}) exceeds max allowed (${maxAmount})`
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
} catch {
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1439
1453
|
}
|
|
1440
1454
|
}
|
|
1455
|
+
const { response, receipt } = await protocol.fetch(input.url);
|
|
1441
1456
|
const contentType = response.headers.get("content-type") ?? void 0;
|
|
1442
1457
|
let body = "";
|
|
1443
1458
|
try {
|
|
@@ -2290,6 +2305,71 @@ function formatNetworkFeeComparison(result) {
|
|
|
2290
2305
|
return lines.join("\n");
|
|
2291
2306
|
}
|
|
2292
2307
|
|
|
2308
|
+
// src/tools/signMessage.ts
|
|
2309
|
+
var import_zod19 = require("zod");
|
|
2310
|
+
var signMessageInputSchema = import_zod19.z.object({
|
|
2311
|
+
chain: import_zod19.z.enum([
|
|
2312
|
+
"ethereum",
|
|
2313
|
+
"base",
|
|
2314
|
+
"arbitrum",
|
|
2315
|
+
"optimism",
|
|
2316
|
+
"polygon",
|
|
2317
|
+
"avalanche",
|
|
2318
|
+
"ink",
|
|
2319
|
+
"berachain",
|
|
2320
|
+
"unichain"
|
|
2321
|
+
]).describe("Blockchain network context for signing"),
|
|
2322
|
+
message: import_zod19.z.string().min(1).describe("Message to sign")
|
|
2323
|
+
});
|
|
2324
|
+
|
|
2325
|
+
// src/tools/verifySignature.ts
|
|
2326
|
+
var import_zod20 = require("zod");
|
|
2327
|
+
var import_viem11 = require("viem");
|
|
2328
|
+
var verifySignatureInputSchema = import_zod20.z.object({
|
|
2329
|
+
chain: import_zod20.z.enum([
|
|
2330
|
+
"ethereum",
|
|
2331
|
+
"base",
|
|
2332
|
+
"arbitrum",
|
|
2333
|
+
"optimism",
|
|
2334
|
+
"polygon",
|
|
2335
|
+
"avalanche",
|
|
2336
|
+
"ink",
|
|
2337
|
+
"berachain",
|
|
2338
|
+
"unichain"
|
|
2339
|
+
]).describe("Blockchain network context for verification"),
|
|
2340
|
+
message: import_zod20.z.string().min(1).describe("The original message that was signed"),
|
|
2341
|
+
signature: import_zod20.z.string().regex(/^0x[a-fA-F0-9]+$/).describe("The signature to verify (hex string)"),
|
|
2342
|
+
address: import_zod20.z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("The expected signer address")
|
|
2343
|
+
});
|
|
2344
|
+
|
|
2345
|
+
// src/tools/getTransferHistory.ts
|
|
2346
|
+
var import_zod21 = require("zod");
|
|
2347
|
+
var import_viem12 = require("viem");
|
|
2348
|
+
var chains9 = __toESM(require("viem/chains"));
|
|
2349
|
+
var getTransferHistoryInputSchema = import_zod21.z.object({
|
|
2350
|
+
network: import_zod21.z.enum([
|
|
2351
|
+
"ethereum",
|
|
2352
|
+
"base",
|
|
2353
|
+
"arbitrum",
|
|
2354
|
+
"optimism",
|
|
2355
|
+
"polygon",
|
|
2356
|
+
"avalanche",
|
|
2357
|
+
"ink",
|
|
2358
|
+
"berachain",
|
|
2359
|
+
"unichain"
|
|
2360
|
+
]).describe("Blockchain network to query"),
|
|
2361
|
+
address: import_zod21.z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Wallet address to get transfer history for"),
|
|
2362
|
+
token: import_zod21.z.enum(["USDC", "USDT", "USDT0"]).optional().describe("Filter by specific token. If not provided, queries all supported stablecoins."),
|
|
2363
|
+
limit: import_zod21.z.number().int().min(1).max(100).optional().describe("Maximum number of transfers to return (default: 10, max: 100)")
|
|
2364
|
+
});
|
|
2365
|
+
|
|
2366
|
+
// src/tools/getHistoricalPrice.ts
|
|
2367
|
+
var import_zod22 = require("zod");
|
|
2368
|
+
var getHistoricalPriceInputSchema = import_zod22.z.object({
|
|
2369
|
+
token: import_zod22.z.string().min(1).describe('Token symbol (e.g., "ETH", "USDC", "USDT", "MATIC", "AVAX")'),
|
|
2370
|
+
days: import_zod22.z.number().int().min(1).max(365).optional().describe("Number of days of history to retrieve (default: 7, max: 365)")
|
|
2371
|
+
});
|
|
2372
|
+
|
|
2293
2373
|
// src/tools/quoteStore.ts
|
|
2294
2374
|
var import_crypto = require("crypto");
|
|
2295
2375
|
var DEFAULT_TTL_MS = 5 * 60 * 1e3;
|
|
@@ -2336,17 +2416,17 @@ function deleteQuote(quoteId) {
|
|
|
2336
2416
|
}
|
|
2337
2417
|
|
|
2338
2418
|
// src/tools/wdkQuoteSwap.ts
|
|
2339
|
-
var
|
|
2340
|
-
var
|
|
2341
|
-
var wdkQuoteSwapInputSchema =
|
|
2342
|
-
fromToken:
|
|
2343
|
-
toToken:
|
|
2344
|
-
amount:
|
|
2345
|
-
chain:
|
|
2419
|
+
var import_zod23 = require("zod");
|
|
2420
|
+
var import_viem13 = require("viem");
|
|
2421
|
+
var wdkQuoteSwapInputSchema = import_zod23.z.object({
|
|
2422
|
+
fromToken: import_zod23.z.string().describe('Token to swap from (e.g., "ETH", "USDC")'),
|
|
2423
|
+
toToken: import_zod23.z.string().describe('Token to swap to (e.g., "USDT0", "USDC")'),
|
|
2424
|
+
amount: import_zod23.z.string().regex(/^\d+(\.\d+)?$/).describe("Amount to swap (e.g., '1.0')"),
|
|
2425
|
+
chain: import_zod23.z.string().describe('Chain to execute swap on (e.g., "ethereum", "arbitrum")')
|
|
2346
2426
|
});
|
|
2347
2427
|
async function executeWdkQuoteSwap(input, wdk) {
|
|
2348
2428
|
const decimals = ["USDC", "USDT", "USDT0"].includes(input.fromToken.toUpperCase()) ? 6 : 18;
|
|
2349
|
-
const amountBigInt = (0,
|
|
2429
|
+
const amountBigInt = (0, import_viem13.parseUnits)(input.amount, decimals);
|
|
2350
2430
|
const quote = await wdk.getSwapQuote(input.chain, input.fromToken, amountBigInt);
|
|
2351
2431
|
const outputDecimals = ["USDC", "USDT", "USDT0"].includes(input.toToken.toUpperCase()) ? 6 : 18;
|
|
2352
2432
|
const outputDivisor = 10 ** outputDecimals;
|
|
@@ -2420,11 +2500,11 @@ function formatSwapQuoteResult(result) {
|
|
|
2420
2500
|
}
|
|
2421
2501
|
|
|
2422
2502
|
// src/tools/wdkExecuteSwap.ts
|
|
2423
|
-
var
|
|
2424
|
-
var
|
|
2425
|
-
var wdkExecuteSwapInputSchema =
|
|
2426
|
-
quoteId:
|
|
2427
|
-
confirmed:
|
|
2503
|
+
var import_zod24 = require("zod");
|
|
2504
|
+
var import_viem14 = require("viem");
|
|
2505
|
+
var wdkExecuteSwapInputSchema = import_zod24.z.object({
|
|
2506
|
+
quoteId: import_zod24.z.string().uuid().describe("Quote ID from wdk/quoteSwap"),
|
|
2507
|
+
confirmed: import_zod24.z.boolean().optional().describe("Set to true to confirm and execute this swap")
|
|
2428
2508
|
});
|
|
2429
2509
|
async function executeWdkExecuteSwap(input, wdk) {
|
|
2430
2510
|
const quote = getQuote(input.quoteId);
|
|
@@ -2443,7 +2523,7 @@ async function executeWdkExecuteSwap(input, wdk) {
|
|
|
2443
2523
|
};
|
|
2444
2524
|
}
|
|
2445
2525
|
const decimals = ["USDC", "USDT", "USDT0"].includes(fromToken.toUpperCase()) ? 6 : 18;
|
|
2446
|
-
const amountBigInt = (0,
|
|
2526
|
+
const amountBigInt = (0, import_viem14.parseUnits)(fromAmount, decimals);
|
|
2447
2527
|
const result = await wdk.swapAndPay({
|
|
2448
2528
|
chain,
|
|
2449
2529
|
fromToken,
|
|
@@ -2497,12 +2577,12 @@ function formatExecuteSwapResult(result) {
|
|
|
2497
2577
|
}
|
|
2498
2578
|
|
|
2499
2579
|
// src/tools/quoteBridge.ts
|
|
2500
|
-
var
|
|
2501
|
-
var quoteBridgeInputSchema =
|
|
2502
|
-
fromChain:
|
|
2503
|
-
toChain:
|
|
2504
|
-
amount:
|
|
2505
|
-
recipient:
|
|
2580
|
+
var import_zod25 = require("zod");
|
|
2581
|
+
var quoteBridgeInputSchema = import_zod25.z.object({
|
|
2582
|
+
fromChain: import_zod25.z.enum(["ethereum", "arbitrum", "ink", "berachain", "unichain"]).describe("Source chain to bridge from"),
|
|
2583
|
+
toChain: import_zod25.z.enum(["ethereum", "arbitrum", "ink", "berachain", "unichain"]).describe("Destination chain to bridge to"),
|
|
2584
|
+
amount: import_zod25.z.string().regex(/^\d+(\.\d+)?$/).describe("Amount of USDT0 to bridge (e.g., '100' for 100 USDT0)"),
|
|
2585
|
+
recipient: import_zod25.z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Recipient address on destination chain")
|
|
2506
2586
|
});
|
|
2507
2587
|
async function executeQuoteBridge(input, rpcUrls) {
|
|
2508
2588
|
const feeResult = await executeGetBridgeFee(input, rpcUrls);
|
|
@@ -2570,10 +2650,10 @@ function formatBridgeQuoteResult(result) {
|
|
|
2570
2650
|
}
|
|
2571
2651
|
|
|
2572
2652
|
// src/tools/executeBridgeFromQuote.ts
|
|
2573
|
-
var
|
|
2574
|
-
var executeBridgeFromQuoteInputSchema =
|
|
2575
|
-
quoteId:
|
|
2576
|
-
confirmed:
|
|
2653
|
+
var import_zod26 = require("zod");
|
|
2654
|
+
var executeBridgeFromQuoteInputSchema = import_zod26.z.object({
|
|
2655
|
+
quoteId: import_zod26.z.string().uuid().describe("Quote ID from t402/quoteBridge"),
|
|
2656
|
+
confirmed: import_zod26.z.boolean().optional().describe("Set to true to confirm and execute this bridge")
|
|
2577
2657
|
});
|
|
2578
2658
|
async function executeExecuteBridgeFromQuote(input, options) {
|
|
2579
2659
|
const quote = getQuote(input.quoteId);
|
|
@@ -2632,22 +2712,22 @@ function executeExecuteBridgeFromQuoteDemo(input) {
|
|
|
2632
2712
|
}
|
|
2633
2713
|
|
|
2634
2714
|
// src/tools/unified.ts
|
|
2635
|
-
var
|
|
2636
|
-
var smartPayInputSchema =
|
|
2637
|
-
url:
|
|
2638
|
-
maxBridgeFee:
|
|
2639
|
-
preferredNetwork:
|
|
2640
|
-
confirmed:
|
|
2715
|
+
var import_zod27 = require("zod");
|
|
2716
|
+
var smartPayInputSchema = import_zod27.z.object({
|
|
2717
|
+
url: import_zod27.z.string().url().describe("URL of the 402-protected resource"),
|
|
2718
|
+
maxBridgeFee: import_zod27.z.string().regex(/^\d+(\.\d+)?$/).optional().describe("Maximum acceptable bridge fee in native token (optional)"),
|
|
2719
|
+
preferredNetwork: import_zod27.z.string().optional().describe("Preferred network for payment (optional)"),
|
|
2720
|
+
confirmed: import_zod27.z.boolean().optional().describe("Set to true to confirm and execute this payment")
|
|
2641
2721
|
});
|
|
2642
|
-
var paymentPlanInputSchema =
|
|
2643
|
-
paymentRequired:
|
|
2644
|
-
scheme:
|
|
2645
|
-
network:
|
|
2646
|
-
maxAmountRequired:
|
|
2647
|
-
resource:
|
|
2648
|
-
description:
|
|
2649
|
-
payTo:
|
|
2650
|
-
maxDeadline:
|
|
2722
|
+
var paymentPlanInputSchema = import_zod27.z.object({
|
|
2723
|
+
paymentRequired: import_zod27.z.object({
|
|
2724
|
+
scheme: import_zod27.z.string().optional(),
|
|
2725
|
+
network: import_zod27.z.string().optional(),
|
|
2726
|
+
maxAmountRequired: import_zod27.z.string().optional(),
|
|
2727
|
+
resource: import_zod27.z.string().optional(),
|
|
2728
|
+
description: import_zod27.z.string().optional(),
|
|
2729
|
+
payTo: import_zod27.z.string().optional(),
|
|
2730
|
+
maxDeadline: import_zod27.z.number().optional()
|
|
2651
2731
|
}).passthrough().describe("The 402 PaymentRequired response")
|
|
2652
2732
|
});
|
|
2653
2733
|
var UNIFIED_TOOL_DEFINITIONS = {
|
|
@@ -2702,14 +2782,14 @@ async function executeSmartPay(input, wdk) {
|
|
|
2702
2782
|
};
|
|
2703
2783
|
}
|
|
2704
2784
|
const steps = [];
|
|
2705
|
-
const
|
|
2785
|
+
const chains10 = input.preferredNetwork ? [input.preferredNetwork] : ["ethereum", "arbitrum", "base"];
|
|
2706
2786
|
steps.push({
|
|
2707
2787
|
action: "check_balance",
|
|
2708
2788
|
status: "success",
|
|
2709
|
-
detail: `Checking balances on ${
|
|
2789
|
+
detail: `Checking balances on ${chains10.join(", ")}`
|
|
2710
2790
|
});
|
|
2711
2791
|
const { T402Protocol } = await import("@t402/wdk-protocol");
|
|
2712
|
-
const protocol = await T402Protocol.create(wdk, { chains:
|
|
2792
|
+
const protocol = await T402Protocol.create(wdk, { chains: chains10 });
|
|
2713
2793
|
steps.push({
|
|
2714
2794
|
action: "fetch",
|
|
2715
2795
|
status: "success",
|
|
@@ -3270,6 +3350,131 @@ var TOOL_DEFINITIONS = {
|
|
|
3270
3350
|
},
|
|
3271
3351
|
required: ["quoteId"]
|
|
3272
3352
|
}
|
|
3353
|
+
},
|
|
3354
|
+
"t402/signMessage": {
|
|
3355
|
+
name: "t402/signMessage",
|
|
3356
|
+
description: "Sign a message using the configured wallet. Returns an EIP-191 personal signature. Requires a configured private key.",
|
|
3357
|
+
inputSchema: {
|
|
3358
|
+
type: "object",
|
|
3359
|
+
properties: {
|
|
3360
|
+
chain: {
|
|
3361
|
+
type: "string",
|
|
3362
|
+
enum: [
|
|
3363
|
+
"ethereum",
|
|
3364
|
+
"base",
|
|
3365
|
+
"arbitrum",
|
|
3366
|
+
"optimism",
|
|
3367
|
+
"polygon",
|
|
3368
|
+
"avalanche",
|
|
3369
|
+
"ink",
|
|
3370
|
+
"berachain",
|
|
3371
|
+
"unichain"
|
|
3372
|
+
],
|
|
3373
|
+
description: "Blockchain network context for signing"
|
|
3374
|
+
},
|
|
3375
|
+
message: {
|
|
3376
|
+
type: "string",
|
|
3377
|
+
description: "Message to sign"
|
|
3378
|
+
}
|
|
3379
|
+
},
|
|
3380
|
+
required: ["chain", "message"]
|
|
3381
|
+
}
|
|
3382
|
+
},
|
|
3383
|
+
"t402/verifySignature": {
|
|
3384
|
+
name: "t402/verifySignature",
|
|
3385
|
+
description: "Verify an EIP-191 signed message. Checks whether a signature was produced by the claimed address. No wallet configuration needed \u2014 this is a read-only verification.",
|
|
3386
|
+
inputSchema: {
|
|
3387
|
+
type: "object",
|
|
3388
|
+
properties: {
|
|
3389
|
+
chain: {
|
|
3390
|
+
type: "string",
|
|
3391
|
+
enum: [
|
|
3392
|
+
"ethereum",
|
|
3393
|
+
"base",
|
|
3394
|
+
"arbitrum",
|
|
3395
|
+
"optimism",
|
|
3396
|
+
"polygon",
|
|
3397
|
+
"avalanche",
|
|
3398
|
+
"ink",
|
|
3399
|
+
"berachain",
|
|
3400
|
+
"unichain"
|
|
3401
|
+
],
|
|
3402
|
+
description: "Blockchain network context for verification"
|
|
3403
|
+
},
|
|
3404
|
+
message: {
|
|
3405
|
+
type: "string",
|
|
3406
|
+
description: "The original message that was signed"
|
|
3407
|
+
},
|
|
3408
|
+
signature: {
|
|
3409
|
+
type: "string",
|
|
3410
|
+
pattern: "^0x[a-fA-F0-9]+$",
|
|
3411
|
+
description: "The signature to verify (hex string)"
|
|
3412
|
+
},
|
|
3413
|
+
address: {
|
|
3414
|
+
type: "string",
|
|
3415
|
+
pattern: "^0x[a-fA-F0-9]{40}$",
|
|
3416
|
+
description: "The expected signer address"
|
|
3417
|
+
}
|
|
3418
|
+
},
|
|
3419
|
+
required: ["chain", "message", "signature", "address"]
|
|
3420
|
+
}
|
|
3421
|
+
},
|
|
3422
|
+
"t402/getTransferHistory": {
|
|
3423
|
+
name: "t402/getTransferHistory",
|
|
3424
|
+
description: "Get recent ERC-20 stablecoin transfer history for a wallet address. Queries on-chain Transfer events for USDC, USDT, and USDT0. Returns sent and received transfers sorted by most recent.",
|
|
3425
|
+
inputSchema: {
|
|
3426
|
+
type: "object",
|
|
3427
|
+
properties: {
|
|
3428
|
+
network: {
|
|
3429
|
+
type: "string",
|
|
3430
|
+
enum: [
|
|
3431
|
+
"ethereum",
|
|
3432
|
+
"base",
|
|
3433
|
+
"arbitrum",
|
|
3434
|
+
"optimism",
|
|
3435
|
+
"polygon",
|
|
3436
|
+
"avalanche",
|
|
3437
|
+
"ink",
|
|
3438
|
+
"berachain",
|
|
3439
|
+
"unichain"
|
|
3440
|
+
],
|
|
3441
|
+
description: "Blockchain network to query"
|
|
3442
|
+
},
|
|
3443
|
+
address: {
|
|
3444
|
+
type: "string",
|
|
3445
|
+
pattern: "^0x[a-fA-F0-9]{40}$",
|
|
3446
|
+
description: "Wallet address to get transfer history for"
|
|
3447
|
+
},
|
|
3448
|
+
token: {
|
|
3449
|
+
type: "string",
|
|
3450
|
+
enum: ["USDC", "USDT", "USDT0"],
|
|
3451
|
+
description: "Filter by specific token. If not provided, queries all supported stablecoins."
|
|
3452
|
+
},
|
|
3453
|
+
limit: {
|
|
3454
|
+
type: "number",
|
|
3455
|
+
description: "Maximum number of transfers to return (default: 10, max: 100)"
|
|
3456
|
+
}
|
|
3457
|
+
},
|
|
3458
|
+
required: ["network", "address"]
|
|
3459
|
+
}
|
|
3460
|
+
},
|
|
3461
|
+
"t402/getHistoricalPrice": {
|
|
3462
|
+
name: "t402/getHistoricalPrice",
|
|
3463
|
+
description: "Get historical price data for a token over a specified period via CoinGecko. Returns price data points, high/low, and percentage change. Useful for trend analysis.",
|
|
3464
|
+
inputSchema: {
|
|
3465
|
+
type: "object",
|
|
3466
|
+
properties: {
|
|
3467
|
+
token: {
|
|
3468
|
+
type: "string",
|
|
3469
|
+
description: 'Token symbol (e.g., "ETH", "USDC", "USDT", "MATIC", "AVAX", "BTC", "SOL")'
|
|
3470
|
+
},
|
|
3471
|
+
days: {
|
|
3472
|
+
type: "number",
|
|
3473
|
+
description: "Number of days of history to retrieve (default: 7, max: 365)"
|
|
3474
|
+
}
|
|
3475
|
+
},
|
|
3476
|
+
required: ["token"]
|
|
3477
|
+
}
|
|
3273
3478
|
}
|
|
3274
3479
|
};
|
|
3275
3480
|
var WDK_TOOL_DEFINITIONS = {
|
|
@@ -3549,6 +3754,19 @@ var T402McpServer = class {
|
|
|
3549
3754
|
console.error("Warning: Failed to initialize WDK. WDK tools will not be available.");
|
|
3550
3755
|
}
|
|
3551
3756
|
}
|
|
3757
|
+
/**
|
|
3758
|
+
* Clear sensitive data from memory.
|
|
3759
|
+
* Should be called on server shutdown to minimize key exposure window.
|
|
3760
|
+
*/
|
|
3761
|
+
cleanup() {
|
|
3762
|
+
if (this.config.privateKey) {
|
|
3763
|
+
this.config.privateKey = "";
|
|
3764
|
+
}
|
|
3765
|
+
if (this.config.seedPhrase) {
|
|
3766
|
+
this.config.seedPhrase = "";
|
|
3767
|
+
}
|
|
3768
|
+
this.wdk = null;
|
|
3769
|
+
}
|
|
3552
3770
|
/**
|
|
3553
3771
|
* Register TON bridge tools
|
|
3554
3772
|
*
|
|
@@ -4058,6 +4276,16 @@ var T402McpServer = class {
|
|
|
4058
4276
|
*/
|
|
4059
4277
|
async run() {
|
|
4060
4278
|
await this.initWdk();
|
|
4279
|
+
const onExit = () => this.cleanup();
|
|
4280
|
+
process.on("exit", onExit);
|
|
4281
|
+
process.on("SIGINT", () => {
|
|
4282
|
+
onExit();
|
|
4283
|
+
process.exit(0);
|
|
4284
|
+
});
|
|
4285
|
+
process.on("SIGTERM", () => {
|
|
4286
|
+
onExit();
|
|
4287
|
+
process.exit(0);
|
|
4288
|
+
});
|
|
4061
4289
|
const transport = new import_stdio.StdioServerTransport();
|
|
4062
4290
|
await this.server.connect(transport);
|
|
4063
4291
|
console.error("t402 MCP Server running on stdio");
|