@t402/mcp 2.5.0 → 2.6.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.
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { S as SupportedNetwork, C as ChainBalance, b as PaymentResult, G as GaslessPaymentResult, B as BridgeFeeQuote, a as BridgeResult } from '../types-CwwW_c2B.mjs';
2
+ import { S as SupportedNetwork, C as ChainBalance, b as PaymentResult, G as GaslessPaymentResult, B as BridgeFeeQuote, a as BridgeResult } from '../ton-bridge-BN3RKhNy.mjs';
3
+ export { d as TON_BRIDGE_TOOLS, e as TonMcpBridgeConfig, f as createTonBridgeToolSet, g as executeTonBridgeTool } from '../ton-bridge-BN3RKhNy.mjs';
3
4
  import { T402WDK } from '@t402/wdk';
4
5
  import 'viem';
5
6
 
@@ -535,6 +536,222 @@ declare function executeAutoPayDemo(input: AutoPayInput): AutoPayResult;
535
536
  */
536
537
  declare function formatAutoPayResult(result: AutoPayResult): string;
537
538
 
539
+ /**
540
+ * Unified MCP Toolkit - Combines WDK wallet tools with t402 payment tools.
541
+ *
542
+ * Agent workflow: check price -> check balance -> bridge if needed -> pay
543
+ * All in one MCP session with a single server.
544
+ */
545
+
546
+ /**
547
+ * Configuration for unified MCP mode
548
+ */
549
+ interface UnifiedMcpConfig {
550
+ /** WDK seed phrase for wallet management */
551
+ wdkSeedPhrase?: string;
552
+ /** Chain RPC configurations */
553
+ chains?: Record<string, string | string[]>;
554
+ /** Enable auto-pay mode (automatic balance check + bridge + pay) */
555
+ autoPayEnabled?: boolean;
556
+ }
557
+ /**
558
+ * SmartPay input schema
559
+ */
560
+ declare const smartPayInputSchema: z.ZodObject<{
561
+ url: z.ZodString;
562
+ maxBridgeFee: z.ZodOptional<z.ZodString>;
563
+ preferredNetwork: z.ZodOptional<z.ZodString>;
564
+ }, "strip", z.ZodTypeAny, {
565
+ url: string;
566
+ maxBridgeFee?: string | undefined;
567
+ preferredNetwork?: string | undefined;
568
+ }, {
569
+ url: string;
570
+ maxBridgeFee?: string | undefined;
571
+ preferredNetwork?: string | undefined;
572
+ }>;
573
+ type SmartPayInput = z.infer<typeof smartPayInputSchema>;
574
+ /**
575
+ * SmartPay result
576
+ */
577
+ interface SmartPayResult {
578
+ /** Whether the resource was successfully accessed */
579
+ success: boolean;
580
+ /** HTTP status code */
581
+ statusCode: number;
582
+ /** Response body (truncated if large) */
583
+ body: string;
584
+ /** Content type of the response */
585
+ contentType?: string;
586
+ /** Steps taken during smart payment */
587
+ steps: SmartPayStep[];
588
+ /** Payment details (if payment was made) */
589
+ payment?: {
590
+ network: string;
591
+ scheme: string;
592
+ amount: string;
593
+ payTo: string;
594
+ };
595
+ /** Error message (if failed) */
596
+ error?: string;
597
+ }
598
+ /**
599
+ * A step in the smart payment flow
600
+ */
601
+ interface SmartPayStep {
602
+ action: 'check_price' | 'check_balance' | 'bridge' | 'pay' | 'fetch';
603
+ status: 'success' | 'skipped' | 'failed';
604
+ detail: string;
605
+ }
606
+ /**
607
+ * PaymentPlan input schema
608
+ */
609
+ declare const paymentPlanInputSchema: z.ZodObject<{
610
+ paymentRequired: z.ZodObject<{
611
+ scheme: z.ZodOptional<z.ZodString>;
612
+ network: z.ZodOptional<z.ZodString>;
613
+ maxAmountRequired: z.ZodOptional<z.ZodString>;
614
+ resource: z.ZodOptional<z.ZodString>;
615
+ description: z.ZodOptional<z.ZodString>;
616
+ payTo: z.ZodOptional<z.ZodString>;
617
+ maxDeadline: z.ZodOptional<z.ZodNumber>;
618
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
619
+ scheme: z.ZodOptional<z.ZodString>;
620
+ network: z.ZodOptional<z.ZodString>;
621
+ maxAmountRequired: z.ZodOptional<z.ZodString>;
622
+ resource: z.ZodOptional<z.ZodString>;
623
+ description: z.ZodOptional<z.ZodString>;
624
+ payTo: z.ZodOptional<z.ZodString>;
625
+ maxDeadline: z.ZodOptional<z.ZodNumber>;
626
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
627
+ scheme: z.ZodOptional<z.ZodString>;
628
+ network: z.ZodOptional<z.ZodString>;
629
+ maxAmountRequired: z.ZodOptional<z.ZodString>;
630
+ resource: z.ZodOptional<z.ZodString>;
631
+ description: z.ZodOptional<z.ZodString>;
632
+ payTo: z.ZodOptional<z.ZodString>;
633
+ maxDeadline: z.ZodOptional<z.ZodNumber>;
634
+ }, z.ZodTypeAny, "passthrough">>;
635
+ }, "strip", z.ZodTypeAny, {
636
+ paymentRequired: {
637
+ network?: string | undefined;
638
+ description?: string | undefined;
639
+ scheme?: string | undefined;
640
+ payTo?: string | undefined;
641
+ maxAmountRequired?: string | undefined;
642
+ resource?: string | undefined;
643
+ maxDeadline?: number | undefined;
644
+ } & {
645
+ [k: string]: unknown;
646
+ };
647
+ }, {
648
+ paymentRequired: {
649
+ network?: string | undefined;
650
+ description?: string | undefined;
651
+ scheme?: string | undefined;
652
+ payTo?: string | undefined;
653
+ maxAmountRequired?: string | undefined;
654
+ resource?: string | undefined;
655
+ maxDeadline?: number | undefined;
656
+ } & {
657
+ [k: string]: unknown;
658
+ };
659
+ }>;
660
+ type PaymentPlanInput = z.infer<typeof paymentPlanInputSchema>;
661
+ /**
662
+ * Payment plan result
663
+ */
664
+ interface PaymentPlanResult {
665
+ /** Whether a viable plan was found */
666
+ viable: boolean;
667
+ /** Recommended network to pay on */
668
+ recommendedNetwork?: string;
669
+ /** Available balance on that network */
670
+ availableBalance?: string;
671
+ /** Whether bridging is needed */
672
+ bridgeRequired: boolean;
673
+ /** Bridge details if needed */
674
+ bridgeDetails?: {
675
+ fromChain: string;
676
+ toChain: string;
677
+ amount: string;
678
+ estimatedFee: string;
679
+ };
680
+ /** Balances across all chains */
681
+ balances: Array<{
682
+ chain: string;
683
+ usdt0: string;
684
+ usdc: string;
685
+ }>;
686
+ /** Reason if not viable */
687
+ reason?: string;
688
+ }
689
+ /**
690
+ * Unified tool definitions (additional tools beyond base + WDK)
691
+ */
692
+ declare const UNIFIED_TOOL_DEFINITIONS: {
693
+ readonly 't402/smartPay': {
694
+ readonly name: "t402/smartPay";
695
+ readonly description: "Intelligent payment that automatically checks balance, bridges if needed, and pays. Handles the entire payment flow for 402-protected resources.";
696
+ readonly inputSchema: {
697
+ readonly type: "object";
698
+ readonly properties: {
699
+ readonly url: {
700
+ readonly type: "string";
701
+ readonly description: "URL of the 402-protected resource";
702
+ };
703
+ readonly maxBridgeFee: {
704
+ readonly type: "string";
705
+ readonly description: "Maximum acceptable bridge fee in native token (optional)";
706
+ };
707
+ readonly preferredNetwork: {
708
+ readonly type: "string";
709
+ readonly description: "Preferred network for payment (optional)";
710
+ };
711
+ };
712
+ readonly required: readonly ["url"];
713
+ };
714
+ };
715
+ readonly 't402/paymentPlan': {
716
+ readonly name: "t402/paymentPlan";
717
+ readonly description: "Analyze a 402 response and create an optimal payment plan considering balances across all chains. Returns recommended network, bridge requirements, and balance overview.";
718
+ readonly inputSchema: {
719
+ readonly type: "object";
720
+ readonly properties: {
721
+ readonly paymentRequired: {
722
+ readonly type: "object";
723
+ readonly description: "The 402 PaymentRequired response";
724
+ };
725
+ };
726
+ readonly required: readonly ["paymentRequired"];
727
+ };
728
+ };
729
+ };
730
+ /**
731
+ * Execute t402/smartPay tool
732
+ */
733
+ declare function executeSmartPay(input: SmartPayInput, wdk: T402WDK): Promise<SmartPayResult>;
734
+ /**
735
+ * Execute t402/smartPay in demo mode
736
+ */
737
+ declare function executeSmartPayDemo(input: SmartPayInput): SmartPayResult;
738
+ /**
739
+ * Execute t402/paymentPlan tool
740
+ */
741
+ declare function executePaymentPlan(input: PaymentPlanInput, wdk: T402WDK): Promise<PaymentPlanResult>;
742
+ /**
743
+ * Execute t402/paymentPlan in demo mode
744
+ */
745
+ declare function executePaymentPlanDemo(_input: PaymentPlanInput): PaymentPlanResult;
746
+ /**
747
+ * Format smartPay result for display
748
+ */
749
+ declare function formatSmartPayResult(result: SmartPayResult): string;
750
+ /**
751
+ * Format paymentPlan result for display
752
+ */
753
+ declare function formatPaymentPlanResult(result: PaymentPlanResult): string;
754
+
538
755
  /**
539
756
  * t402 MCP Tools - Export all payment tools
540
757
  */
@@ -821,4 +1038,4 @@ declare const WDK_TOOL_DEFINITIONS: {
821
1038
  };
822
1039
  };
823
1040
 
824
- export { type AllBalancesResult, type AutoPayInput, type AutoPayResult, type BridgeInput, type BridgeOptions, GASLESS_SUPPORTED_NETWORKS, type GetAllBalancesInput, type GetBalanceInput, type GetBridgeFeeInput, type PayGaslessInput, type PayGaslessOptions, type PayInput, type PayOptions, TOOL_DEFINITIONS, WDK_TOOL_DEFINITIONS, type WdkBalancesResult, type WdkGetBalancesInput, type WdkGetWalletInput, type WdkSwapInput, type WdkSwapResult, type WdkTransferInput, type WdkTransferResult, type WdkWalletInfo, autoPayInputSchema, bridgeInputSchema, executeAutoPay, executeAutoPayDemo, executeBridge, executeGetAllBalances, executeGetBalance, executeGetBridgeFee, executePay, executePayGasless, executeWdkGetBalances, executeWdkGetBalancesDemo, executeWdkGetWallet, executeWdkGetWalletDemo, executeWdkSwap, executeWdkSwapDemo, executeWdkTransfer, executeWdkTransferDemo, formatAllBalancesResult, formatAutoPayResult, formatBalanceResult, formatBridgeFeeResult, formatBridgeResult, formatGaslessPaymentResult, formatPaymentResult, formatWdkBalancesResult, formatWdkSwapResult, formatWdkTransferResult, formatWdkWalletResult, getAllBalancesInputSchema, getBalanceInputSchema, getBridgeFeeInputSchema, payGaslessInputSchema, payInputSchema, wdkGetBalancesInputSchema, wdkGetWalletInputSchema, wdkSwapInputSchema, wdkTransferInputSchema };
1041
+ export { type AllBalancesResult, type AutoPayInput, type AutoPayResult, type BridgeInput, type BridgeOptions, GASLESS_SUPPORTED_NETWORKS, type GetAllBalancesInput, type GetBalanceInput, type GetBridgeFeeInput, type PayGaslessInput, type PayGaslessOptions, type PayInput, type PayOptions, type PaymentPlanInput, type PaymentPlanResult, type SmartPayInput, type SmartPayResult, type SmartPayStep, TOOL_DEFINITIONS, UNIFIED_TOOL_DEFINITIONS, type UnifiedMcpConfig, WDK_TOOL_DEFINITIONS, type WdkBalancesResult, type WdkGetBalancesInput, type WdkGetWalletInput, type WdkSwapInput, type WdkSwapResult, type WdkTransferInput, type WdkTransferResult, type WdkWalletInfo, autoPayInputSchema, bridgeInputSchema, executeAutoPay, executeAutoPayDemo, executeBridge, executeGetAllBalances, executeGetBalance, executeGetBridgeFee, executePay, executePayGasless, executePaymentPlan, executePaymentPlanDemo, executeSmartPay, executeSmartPayDemo, executeWdkGetBalances, executeWdkGetBalancesDemo, executeWdkGetWallet, executeWdkGetWalletDemo, executeWdkSwap, executeWdkSwapDemo, executeWdkTransfer, executeWdkTransferDemo, formatAllBalancesResult, formatAutoPayResult, formatBalanceResult, formatBridgeFeeResult, formatBridgeResult, formatGaslessPaymentResult, formatPaymentPlanResult, formatPaymentResult, formatSmartPayResult, formatWdkBalancesResult, formatWdkSwapResult, formatWdkTransferResult, formatWdkWalletResult, getAllBalancesInputSchema, getBalanceInputSchema, getBridgeFeeInputSchema, payGaslessInputSchema, payInputSchema, paymentPlanInputSchema, smartPayInputSchema, wdkGetBalancesInputSchema, wdkGetWalletInputSchema, wdkSwapInputSchema, wdkTransferInputSchema };
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  GASLESS_SUPPORTED_NETWORKS,
3
+ TON_BRIDGE_TOOLS,
3
4
  TOOL_DEFINITIONS,
5
+ UNIFIED_TOOL_DEFINITIONS,
4
6
  WDK_TOOL_DEFINITIONS,
5
7
  autoPayInputSchema,
6
8
  bridgeInputSchema,
9
+ createTonBridgeToolSet,
7
10
  executeAutoPay,
8
11
  executeAutoPayDemo,
9
12
  executeBridge,
@@ -12,6 +15,11 @@ import {
12
15
  executeGetBridgeFee,
13
16
  executePay,
14
17
  executePayGasless,
18
+ executePaymentPlan,
19
+ executePaymentPlanDemo,
20
+ executeSmartPay,
21
+ executeSmartPayDemo,
22
+ executeTonBridgeTool,
15
23
  executeWdkGetBalances,
16
24
  executeWdkGetBalancesDemo,
17
25
  executeWdkGetWallet,
@@ -26,7 +34,9 @@ import {
26
34
  formatBridgeFeeResult,
27
35
  formatBridgeResult,
28
36
  formatGaslessPaymentResult,
37
+ formatPaymentPlanResult,
29
38
  formatPaymentResult,
39
+ formatSmartPayResult,
30
40
  formatWdkBalancesResult,
31
41
  formatWdkSwapResult,
32
42
  formatWdkTransferResult,
@@ -36,17 +46,22 @@ import {
36
46
  getBridgeFeeInputSchema,
37
47
  payGaslessInputSchema,
38
48
  payInputSchema,
49
+ paymentPlanInputSchema,
50
+ smartPayInputSchema,
39
51
  wdkGetBalancesInputSchema,
40
52
  wdkGetWalletInputSchema,
41
53
  wdkSwapInputSchema,
42
54
  wdkTransferInputSchema
43
- } from "../chunk-5UOBQKXW.mjs";
55
+ } from "../chunk-RDQ7AMR4.mjs";
44
56
  export {
45
57
  GASLESS_SUPPORTED_NETWORKS,
58
+ TON_BRIDGE_TOOLS,
46
59
  TOOL_DEFINITIONS,
60
+ UNIFIED_TOOL_DEFINITIONS,
47
61
  WDK_TOOL_DEFINITIONS,
48
62
  autoPayInputSchema,
49
63
  bridgeInputSchema,
64
+ createTonBridgeToolSet,
50
65
  executeAutoPay,
51
66
  executeAutoPayDemo,
52
67
  executeBridge,
@@ -55,6 +70,11 @@ export {
55
70
  executeGetBridgeFee,
56
71
  executePay,
57
72
  executePayGasless,
73
+ executePaymentPlan,
74
+ executePaymentPlanDemo,
75
+ executeSmartPay,
76
+ executeSmartPayDemo,
77
+ executeTonBridgeTool,
58
78
  executeWdkGetBalances,
59
79
  executeWdkGetBalancesDemo,
60
80
  executeWdkGetWallet,
@@ -69,7 +89,9 @@ export {
69
89
  formatBridgeFeeResult,
70
90
  formatBridgeResult,
71
91
  formatGaslessPaymentResult,
92
+ formatPaymentPlanResult,
72
93
  formatPaymentResult,
94
+ formatSmartPayResult,
73
95
  formatWdkBalancesResult,
74
96
  formatWdkSwapResult,
75
97
  formatWdkTransferResult,
@@ -79,6 +101,8 @@ export {
79
101
  getBridgeFeeInputSchema,
80
102
  payGaslessInputSchema,
81
103
  payInputSchema,
104
+ paymentPlanInputSchema,
105
+ smartPayInputSchema,
82
106
  wdkGetBalancesInputSchema,
83
107
  wdkGetWalletInputSchema,
84
108
  wdkSwapInputSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t402/mcp",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "t402 Payment Protocol MCP Server for AI Agents",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -19,32 +19,36 @@
19
19
  ],
20
20
  "license": "Apache-2.0",
21
21
  "author": "T402 Team",
22
- "repository": "https://github.com/t402-io/t402",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/t402-io/t402.git",
25
+ "directory": "sdks/typescript/packages/mcp"
26
+ },
23
27
  "devDependencies": {
24
28
  "@eslint/js": "^9.39.2",
25
- "@types/node": "^25.2.2",
26
- "@typescript-eslint/eslint-plugin": "^8.55.0",
27
- "@typescript-eslint/parser": "^8.55.0",
29
+ "@types/node": "^25.2.3",
30
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
31
+ "@typescript-eslint/parser": "^8.56.0",
28
32
  "eslint": "^9.24.0",
29
33
  "eslint-plugin-import": "^2.31.0",
30
- "eslint-plugin-jsdoc": "^62.5.4",
34
+ "eslint-plugin-jsdoc": "^62.6.0",
31
35
  "eslint-plugin-prettier": "^5.5.5",
32
- "glob": "^13.0.0",
36
+ "glob": "^13.0.5",
33
37
  "prettier": "3.8.1",
34
38
  "tsup": "^8.5.1",
35
39
  "tsx": "^4.21.0",
36
40
  "typescript": "^5.9.3",
37
41
  "vite": "^7.3.1",
38
- "vite-tsconfig-paths": "^6.1.0",
42
+ "vite-tsconfig-paths": "^6.1.1",
39
43
  "vitest": "^3.2.4"
40
44
  },
41
45
  "dependencies": {
42
46
  "@modelcontextprotocol/sdk": "^1.26.0",
43
47
  "zod": "^3.24.2",
44
- "@t402/core": "2.5.0",
45
- "@t402/wdk-protocol": "2.5.0",
46
- "@t402/wdk": "2.5.0",
47
- "@t402/evm": "2.5.0"
48
+ "@t402/core": "2.6.0",
49
+ "@t402/evm": "2.6.0",
50
+ "@t402/wdk-protocol": "2.6.0",
51
+ "@t402/wdk": "2.6.0"
48
52
  },
49
53
  "peerDependencies": {
50
54
  "viem": "^2.0.0"
@@ -85,6 +89,10 @@
85
89
  "dist",
86
90
  "bin"
87
91
  ],
92
+ "homepage": "https://t402.io",
93
+ "publishConfig": {
94
+ "access": "public"
95
+ },
88
96
  "scripts": {
89
97
  "start": "node ./bin/t402-mcp.js",
90
98
  "build": "tsup",