@missionsquad/mcp-server-tron 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +537 -0
  3. package/bin/cli.js +51 -0
  4. package/build/core/chains.d.ts +17 -0
  5. package/build/core/chains.js +87 -0
  6. package/build/core/chains.js.map +1 -0
  7. package/build/core/prompts.d.ts +19 -0
  8. package/build/core/prompts.js +485 -0
  9. package/build/core/prompts.js.map +1 -0
  10. package/build/core/resources.d.ts +14 -0
  11. package/build/core/resources.js +42 -0
  12. package/build/core/resources.js.map +1 -0
  13. package/build/core/services/account-data.d.ts +144 -0
  14. package/build/core/services/account-data.js +228 -0
  15. package/build/core/services/account-data.js.map +1 -0
  16. package/build/core/services/account-resource.d.ts +56 -0
  17. package/build/core/services/account-resource.js +133 -0
  18. package/build/core/services/account-resource.js.map +1 -0
  19. package/build/core/services/account.d.ts +141 -0
  20. package/build/core/services/account.js +191 -0
  21. package/build/core/services/account.js.map +1 -0
  22. package/build/core/services/address.d.ts +8 -0
  23. package/build/core/services/address.js +52 -0
  24. package/build/core/services/address.js.map +1 -0
  25. package/build/core/services/agent-wallet.d.ts +62 -0
  26. package/build/core/services/agent-wallet.js +234 -0
  27. package/build/core/services/agent-wallet.js.map +1 -0
  28. package/build/core/services/balance.d.ts +26 -0
  29. package/build/core/services/balance.js +60 -0
  30. package/build/core/services/balance.js.map +1 -0
  31. package/build/core/services/blocks.d.ts +25 -0
  32. package/build/core/services/blocks.js +65 -0
  33. package/build/core/services/blocks.js.map +1 -0
  34. package/build/core/services/broadcast.d.ts +13 -0
  35. package/build/core/services/broadcast.js +24 -0
  36. package/build/core/services/broadcast.js.map +1 -0
  37. package/build/core/services/clients.d.ts +5 -0
  38. package/build/core/services/clients.js +29 -0
  39. package/build/core/services/clients.js.map +1 -0
  40. package/build/core/services/contract-data.d.ts +31 -0
  41. package/build/core/services/contract-data.js +54 -0
  42. package/build/core/services/contract-data.js.map +1 -0
  43. package/build/core/services/contracts.d.ts +108 -0
  44. package/build/core/services/contracts.js +482 -0
  45. package/build/core/services/contracts.js.map +1 -0
  46. package/build/core/services/events.d.ts +56 -0
  47. package/build/core/services/events.js +99 -0
  48. package/build/core/services/events.js.map +1 -0
  49. package/build/core/services/governance.d.ts +78 -0
  50. package/build/core/services/governance.js +207 -0
  51. package/build/core/services/governance.js.map +1 -0
  52. package/build/core/services/index.d.ts +28 -0
  53. package/build/core/services/index.js +81 -0
  54. package/build/core/services/index.js.map +1 -0
  55. package/build/core/services/mempool.d.ts +12 -0
  56. package/build/core/services/mempool.js +32 -0
  57. package/build/core/services/mempool.js.map +1 -0
  58. package/build/core/services/multicall-abi.d.ts +55 -0
  59. package/build/core/services/multicall-abi.js +61 -0
  60. package/build/core/services/multicall-abi.js.map +1 -0
  61. package/build/core/services/nodes.d.ts +8 -0
  62. package/build/core/services/nodes.js +18 -0
  63. package/build/core/services/nodes.js.map +1 -0
  64. package/build/core/services/proposals.d.ts +33 -0
  65. package/build/core/services/proposals.js +95 -0
  66. package/build/core/services/proposals.js.map +1 -0
  67. package/build/core/services/query.d.ts +34 -0
  68. package/build/core/services/query.js +60 -0
  69. package/build/core/services/query.js.map +1 -0
  70. package/build/core/services/staking.d.ts +40 -0
  71. package/build/core/services/staking.js +113 -0
  72. package/build/core/services/staking.js.map +1 -0
  73. package/build/core/services/tokens.d.ts +22 -0
  74. package/build/core/services/tokens.js +68 -0
  75. package/build/core/services/tokens.js.map +1 -0
  76. package/build/core/services/transactions.d.ts +16 -0
  77. package/build/core/services/transactions.js +42 -0
  78. package/build/core/services/transactions.js.map +1 -0
  79. package/build/core/services/transfer.d.ts +24 -0
  80. package/build/core/services/transfer.js +84 -0
  81. package/build/core/services/transfer.js.map +1 -0
  82. package/build/core/services/trongrid-client.d.ts +14 -0
  83. package/build/core/services/trongrid-client.js +19 -0
  84. package/build/core/services/trongrid-client.js.map +1 -0
  85. package/build/core/services/utils.d.ts +13 -0
  86. package/build/core/services/utils.js +39 -0
  87. package/build/core/services/utils.js.map +1 -0
  88. package/build/core/services/wallet.d.ts +13 -0
  89. package/build/core/services/wallet.js +18 -0
  90. package/build/core/services/wallet.js.map +1 -0
  91. package/build/core/tools/account-data.d.ts +2 -0
  92. package/build/core/tools/account-data.js +253 -0
  93. package/build/core/tools/account-data.js.map +1 -0
  94. package/build/core/tools/account-resource.d.ts +2 -0
  95. package/build/core/tools/account-resource.js +269 -0
  96. package/build/core/tools/account-resource.js.map +1 -0
  97. package/build/core/tools/account.d.ts +2 -0
  98. package/build/core/tools/account.js +451 -0
  99. package/build/core/tools/account.js.map +1 -0
  100. package/build/core/tools/address.d.ts +2 -0
  101. package/build/core/tools/address.js +45 -0
  102. package/build/core/tools/address.js.map +1 -0
  103. package/build/core/tools/balance.d.ts +2 -0
  104. package/build/core/tools/balance.js +94 -0
  105. package/build/core/tools/balance.js.map +1 -0
  106. package/build/core/tools/block.d.ts +2 -0
  107. package/build/core/tools/block.js +74 -0
  108. package/build/core/tools/block.js.map +1 -0
  109. package/build/core/tools/broadcast.d.ts +2 -0
  110. package/build/core/tools/broadcast.js +102 -0
  111. package/build/core/tools/broadcast.js.map +1 -0
  112. package/build/core/tools/contract-data.d.ts +2 -0
  113. package/build/core/tools/contract-data.js +159 -0
  114. package/build/core/tools/contract-data.js.map +1 -0
  115. package/build/core/tools/contract.d.ts +2 -0
  116. package/build/core/tools/contract.js +600 -0
  117. package/build/core/tools/contract.js.map +1 -0
  118. package/build/core/tools/event.d.ts +2 -0
  119. package/build/core/tools/event.js +159 -0
  120. package/build/core/tools/event.js.map +1 -0
  121. package/build/core/tools/governance.d.ts +6 -0
  122. package/build/core/tools/governance.js +424 -0
  123. package/build/core/tools/governance.js.map +1 -0
  124. package/build/core/tools/index.d.ts +15 -0
  125. package/build/core/tools/index.js +93 -0
  126. package/build/core/tools/index.js.map +1 -0
  127. package/build/core/tools/mempool.d.ts +2 -0
  128. package/build/core/tools/mempool.js +116 -0
  129. package/build/core/tools/mempool.js.map +1 -0
  130. package/build/core/tools/network.d.ts +2 -0
  131. package/build/core/tools/network.js +114 -0
  132. package/build/core/tools/network.js.map +1 -0
  133. package/build/core/tools/node.d.ts +2 -0
  134. package/build/core/tools/node.js +75 -0
  135. package/build/core/tools/node.js.map +1 -0
  136. package/build/core/tools/proposals.d.ts +6 -0
  137. package/build/core/tools/proposals.js +219 -0
  138. package/build/core/tools/proposals.js.map +1 -0
  139. package/build/core/tools/query.d.ts +2 -0
  140. package/build/core/tools/query.js +399 -0
  141. package/build/core/tools/query.js.map +1 -0
  142. package/build/core/tools/staking.d.ts +2 -0
  143. package/build/core/tools/staking.js +281 -0
  144. package/build/core/tools/staking.js.map +1 -0
  145. package/build/core/tools/transaction.d.ts +2 -0
  146. package/build/core/tools/transaction.js +65 -0
  147. package/build/core/tools/transaction.js.map +1 -0
  148. package/build/core/tools/transfer.d.ts +2 -0
  149. package/build/core/tools/transfer.js +101 -0
  150. package/build/core/tools/transfer.js.map +1 -0
  151. package/build/core/tools/types.d.ts +13 -0
  152. package/build/core/tools/types.js +2 -0
  153. package/build/core/tools/types.js.map +1 -0
  154. package/build/core/tools/wallet.d.ts +2 -0
  155. package/build/core/tools/wallet.js +172 -0
  156. package/build/core/tools/wallet.js.map +1 -0
  157. package/build/index.d.ts +1 -0
  158. package/build/index.js +21 -0
  159. package/build/index.js.map +1 -0
  160. package/build/middleware/auth.d.ts +16 -0
  161. package/build/middleware/auth.js +44 -0
  162. package/build/middleware/auth.js.map +1 -0
  163. package/build/oauth/OAuthService.d.ts +100 -0
  164. package/build/oauth/OAuthService.js +507 -0
  165. package/build/oauth/OAuthService.js.map +1 -0
  166. package/build/oauth/page.d.ts +1 -0
  167. package/build/oauth/page.js +255 -0
  168. package/build/oauth/page.js.map +1 -0
  169. package/build/oauth/types.d.ts +65 -0
  170. package/build/oauth/types.js +2 -0
  171. package/build/oauth/types.js.map +1 -0
  172. package/build/server/http-app.d.ts +9 -0
  173. package/build/server/http-app.js +128 -0
  174. package/build/server/http-app.js.map +1 -0
  175. package/build/server/http-server.d.ts +1 -0
  176. package/build/server/http-server.js +35 -0
  177. package/build/server/http-server.js.map +1 -0
  178. package/build/server/oauth-routes.d.ts +7 -0
  179. package/build/server/oauth-routes.js +157 -0
  180. package/build/server/oauth-routes.js.map +1 -0
  181. package/build/server/server.d.ts +9 -0
  182. package/build/server/server.js +54 -0
  183. package/build/server/server.js.map +1 -0
  184. package/build/tenant/TenantManager.d.ts +35 -0
  185. package/build/tenant/TenantManager.js +167 -0
  186. package/build/tenant/TenantManager.js.map +1 -0
  187. package/build/tenant/context.d.ts +11 -0
  188. package/build/tenant/context.js +23 -0
  189. package/build/tenant/context.js.map +1 -0
  190. package/build/tenant/types.d.ts +16 -0
  191. package/build/tenant/types.js +2 -0
  192. package/build/tenant/types.js.map +1 -0
  193. package/package.json +95 -0
@@ -0,0 +1,87 @@
1
+ // Tron Network Definitions
2
+ export var TronNetwork;
3
+ (function (TronNetwork) {
4
+ TronNetwork["Mainnet"] = "mainnet";
5
+ TronNetwork["Nile"] = "nile";
6
+ TronNetwork["Shasta"] = "shasta";
7
+ })(TronNetwork || (TronNetwork = {}));
8
+ const BOA_MAINNET_HOST = "https://hptg.bankofai.io";
9
+ function isTronGridApiKeyConfigured() {
10
+ const apiKey = process.env.TRONGRID_API_KEY;
11
+ return typeof apiKey === "string" && apiKey.length > 0;
12
+ }
13
+ export const NETWORKS = {
14
+ [TronNetwork.Mainnet]: {
15
+ name: "Mainnet",
16
+ fullNode: "https://api.trongrid.io",
17
+ solidityNode: "https://api.trongrid.io",
18
+ eventServer: "https://api.trongrid.io",
19
+ explorer: "https://tronscan.org",
20
+ },
21
+ [TronNetwork.Nile]: {
22
+ name: "Nile",
23
+ fullNode: "https://nile.trongrid.io",
24
+ solidityNode: "https://nile.trongrid.io",
25
+ eventServer: "https://nile.trongrid.io",
26
+ explorer: "https://nile.tronscan.org",
27
+ },
28
+ [TronNetwork.Shasta]: {
29
+ name: "Shasta",
30
+ fullNode: "https://api.shasta.trongrid.io",
31
+ solidityNode: "https://api.shasta.trongrid.io",
32
+ eventServer: "https://api.shasta.trongrid.io",
33
+ explorer: "https://shasta.tronscan.org",
34
+ },
35
+ };
36
+ export const DEFAULT_NETWORK = TronNetwork.Mainnet;
37
+ export function getNetworkConfig(network = DEFAULT_NETWORK) {
38
+ const normalizedNetwork = network.toLowerCase();
39
+ // Direct match
40
+ if (Object.values(TronNetwork).includes(normalizedNetwork)) {
41
+ const resolved = normalizedNetwork;
42
+ return applyNetworkOverrides(resolved, getBaseNetworkConfig(resolved));
43
+ }
44
+ // Aliases
45
+ if (normalizedNetwork === "tron" ||
46
+ normalizedNetwork === "trx" ||
47
+ normalizedNetwork === "mainnet") {
48
+ return applyNetworkOverrides(TronNetwork.Mainnet, getBaseNetworkConfig(TronNetwork.Mainnet));
49
+ }
50
+ if (normalizedNetwork === "testnet") {
51
+ return applyNetworkOverrides(TronNetwork.Nile, NETWORKS[TronNetwork.Nile]); // Default testnet to Nile
52
+ }
53
+ throw new Error(`Unsupported network: ${network}`);
54
+ }
55
+ export function getSupportedNetworks() {
56
+ return Object.values(TronNetwork);
57
+ }
58
+ export function getRpcUrl(network = DEFAULT_NETWORK) {
59
+ return getNetworkConfig(network).fullNode;
60
+ }
61
+ function getBaseNetworkConfig(network) {
62
+ if (network === TronNetwork.Mainnet && !isTronGridApiKeyConfigured()) {
63
+ return {
64
+ ...NETWORKS[TronNetwork.Mainnet],
65
+ fullNode: BOA_MAINNET_HOST,
66
+ solidityNode: BOA_MAINNET_HOST,
67
+ eventServer: BOA_MAINNET_HOST,
68
+ };
69
+ }
70
+ return NETWORKS[network];
71
+ }
72
+ function applyNetworkOverrides(network, config) {
73
+ const prefix = `TRON_${network.toUpperCase()}_`;
74
+ const fullNode = process.env[`${prefix}FULL_NODE`];
75
+ const solidityNode = process.env[`${prefix}SOLIDITY_NODE`];
76
+ const eventServer = process.env[`${prefix}EVENT_SERVER`];
77
+ if (!fullNode && !solidityNode && !eventServer) {
78
+ return config;
79
+ }
80
+ return {
81
+ ...config,
82
+ fullNode: fullNode || config.fullNode,
83
+ solidityNode: solidityNode || config.solidityNode,
84
+ eventServer: eventServer || config.eventServer,
85
+ };
86
+ }
87
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/core/chains.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAE3B,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAUD,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD,SAAS,0BAA0B;IACjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC5C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAuC;IAC1D,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACrB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,yBAAyB;QACnC,YAAY,EAAE,yBAAyB;QACvC,WAAW,EAAE,yBAAyB;QACtC,QAAQ,EAAE,sBAAsB;KACjC;IACD,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QAClB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,0BAA0B;QACpC,YAAY,EAAE,0BAA0B;QACxC,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,2BAA2B;KACtC;IACD,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;QACpB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,gCAAgC;QAC1C,YAAY,EAAE,gCAAgC;QAC9C,WAAW,EAAE,gCAAgC;QAC7C,QAAQ,EAAE,6BA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AQ,CAAC,WAAW,CAAC,OAAO,CAAC;YAChC,QAAQ,EAAE,gBAAgB;YAC1B,YAAY,EAAE,gBAAgB;YAC9B,WAAW,EAAE,gBAAgB;SAC9B,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAoB,EAAE,MAAqB;IACxE,MAAM,MAAM,GAAG,QAAQ,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;IAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,WAAW,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,eAAe,CAAC,CAAC;IAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,cAAc,CAAC,CAAC;IAEzD,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO;QACL,GAAG,MAAM;QACT,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ;QACrC,YAAY,EAAE,YAAY,IAAI,MAAM,CAAC,YAAY;QACjD,WAAW,EAAE,WAAW,IAAI,MAAM,CAAC,WAAW;KAC/C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ /**
3
+ * Register task-oriented prompts with the MCP server
4
+ *
5
+ * All prompts follow a consistent structure:
6
+ * - Clear objective statement
7
+ * - Step-by-step instructions
8
+ * - Expected outputs
9
+ * - Safety/security considerations
10
+ *
11
+ * Prompts guide the model through complex workflows that would otherwise
12
+ * require multiple tool calls in the correct sequence.
13
+ *
14
+ * @param server The MCP server instance
15
+ * @param options Registration options
16
+ */
17
+ export declare function registerTRONPrompts(server: McpServer, options?: {
18
+ readOnly?: boolean;
19
+ }): void;
@@ -0,0 +1,485 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Register task-oriented prompts with the MCP server
4
+ *
5
+ * All prompts follow a consistent structure:
6
+ * - Clear objective statement
7
+ * - Step-by-step instructions
8
+ * - Expected outputs
9
+ * - Safety/security considerations
10
+ *
11
+ * Prompts guide the model through complex workflows that would otherwise
12
+ * require multiple tool calls in the correct sequence.
13
+ *
14
+ * @param server The MCP server instance
15
+ * @param options Registration options
16
+ */
17
+ export function registerTRONPrompts(server, options = {}) {
18
+ /**
19
+ * Helper to register a prompt with read-only gating.
20
+ * Prompts are registered up front; write guidance is hidden only in readonly
21
+ * mode and wallet availability is checked when the underlying tools run.
22
+ */
23
+ const registerPrompt = (name, definition, handler, extra = {}) => {
24
+ // Default to true: most prompts are informational and safe in readonly mode.
25
+ // This differs from tools.ts where the default is false (write-capable) because
26
+ // unregistered tools could mutate state, while prompts only guide the LLM.
27
+ const isReadOnly = extra.isReadOnly !== false;
28
+ // 1. Skip if in read-only mode and the prompt is for write operations
29
+ if (options.readOnly && !isReadOnly) {
30
+ return;
31
+ }
32
+ server.registerPrompt(name, definition, handler);
33
+ };
34
+ // ============================================================================
35
+ // TRANSACTION PROMPTS
36
+ // ============================================================================
37
+ registerPrompt("prepare_transfer", {
38
+ description: "Safely prepare and execute a token transfer with validation checks",
39
+ argsSchema: {
40
+ tokenType: z
41
+ .enum(["trx", "trc20"])
42
+ .describe("Token type: 'trx' for native or 'trc20' for contract tokens"),
43
+ recipient: z.string().describe("Recipient address"),
44
+ amount: z.string().describe("Amount to transfer (in TRX or token units)"),
45
+ network: z.string().optional().describe("Network name (default: mainnet)"),
46
+ tokenAddress: z.string().optional().describe("Token contract address (required for TRC20)"),
47
+ },
48
+ }, ({ tokenType, recipient, amount, network = "mainnet", tokenAddress }) => ({
49
+ messages: [
50
+ {
51
+ role: "user",
52
+ content: {
53
+ type: "text",
54
+ text: `# Token Transfer Task
55
+
56
+ **Objective**: Safely transfer ${amount} ${tokenType === "trx" ? "TRX" : "TRC20 tokens"} to ${recipient} on ${network}
57
+
58
+ ## Validation & Checks
59
+ Before executing any transfer:
60
+ 1. **Wallet Verification**: Call \`get_wallet_address\` to confirm the sending wallet
61
+ 2. **Balance Check**:
62
+ ${tokenType === "trx"
63
+ ? "- Call `get_balance` to verify TRX balance"
64
+ : `- Call \`get_token_balance\` with tokenAddress=${tokenAddress} to verify balance`}
65
+ 3. **Resource Analysis**: Call \`get_chain_parameters\` to assess current network costs (Energy/Bandwidth)
66
+
67
+ ## Execution Steps
68
+ ${tokenType === "trx"
69
+ ? `
70
+ 1. Summarize: sender address, recipient, amount, and estimated cost
71
+ 2. Request confirmation from user
72
+ 3. Call \`transfer_trx\` with to="${recipient}", amount="${amount}", network="${network}"
73
+ 4. Return transaction hash to user
74
+ 5. Call \`get_transaction_info\` to confirm completion
75
+ `
76
+ : `
77
+ 1. Summarize: sender, recipient, token, amount
78
+ 2. Request confirmation
79
+ 3. Call \`transfer_trc20\` with tokenAddress, recipient, amount
80
+ 4. Wait for confirmation with \`get_transaction_info\`
81
+ `}
82
+
83
+ ## Output Format
84
+ - **Transaction Hash**: Clear hex value
85
+ - **Status**: Pending or Confirmed
86
+ - **User Confirmation**: Always ask before sending
87
+
88
+ ## Safety Considerations
89
+ - Never send more than available balance
90
+ - Double-check recipient address
91
+ - Explain any approval requirements
92
+ `,
93
+ },
94
+ },
95
+ ],
96
+ }), { isReadOnly: false });
97
+ registerPrompt("interact_with_contract", {
98
+ description: "Safely execute write operations on a smart contract with validation and confirmation",
99
+ argsSchema: {
100
+ contractAddress: z.string().describe("Contract address to interact with"),
101
+ functionName: z.string().describe("Function to call (e.g., 'mint', 'swap', 'stake')"),
102
+ args: z.string().optional().describe("Comma-separated function arguments"),
103
+ value: z.string().optional().describe("TRX value to send (for payable functions)"),
104
+ network: z.string().optional().describe("Network name (default: mainnet)"),
105
+ },
106
+ }, ({ contractAddress, functionName, args, value, network = "mainnet" }) => {
107
+ const argsList = args ? args.split(",").map((a) => a.trim()) : [];
108
+ return {
109
+ messages: [
110
+ {
111
+ role: "user",
112
+ content: {
113
+ type: "text",
114
+ text: `# Smart Contract Interaction
115
+
116
+ **Objective**: Safely execute ${functionName} on contract ${contractAddress} on ${network}
117
+
118
+ ## Prerequisites Check
119
+
120
+ ### 1. Wallet Verification
121
+ - Call \`get_wallet_address\` to confirm the wallet that will execute this transaction
122
+ - Verify this is the correct wallet for this operation
123
+
124
+ ### 2. Contract Analysis
125
+ - Use \`read_contract\` or external knowledge to understand the function parameters
126
+ - Check function type:
127
+ * **View/Pure**: Read-only (use \`read_contract\` instead)
128
+ * **Nonpayable**: State-changing, no TRX required
129
+ * **Payable**: State-changing, can accept TRX
130
+
131
+ ### 3. Function Parameter Validation
132
+ For function: **${functionName}**
133
+ ${argsList.length > 0 ? `Arguments provided: ${argsList.join(", ")}` : "No arguments provided"}
134
+
135
+ - Verify parameter types match the contract requirements
136
+ - Validate addresses are correct (Base58 or Hex)
137
+ - Check numeric values are in correct units
138
+
139
+ ### 4. Pre-execution Checks
140
+
141
+ **Balance Check**:
142
+ - Call \`get_balance\` to verify sufficient TRX balance
143
+ - Account for Energy/Bandwidth costs + value (if payable)
144
+
145
+ **Resource Estimation**:
146
+ - Call \`get_chain_parameters\` to check current unit prices
147
+ - Estimate Energy and Bandwidth usage
148
+
149
+ ## Execution Process
150
+
151
+ ### 1. Present Summary to User
152
+ Before executing, show:
153
+ - **Contract**: ${contractAddress}
154
+ - **Network**: ${network}
155
+ - **Function**: ${functionName}
156
+ - **Arguments**: ${argsList.length > 0 ? argsList.join(", ") : "None"}
157
+ ${value ? `- **Value**: ${value} TRX` : ""}
158
+ - **From**: [wallet address from step 1]
159
+ - **Estimated Resource Cost**: [Energy / Bandwidth estimation]
160
+
161
+ ### 2. Request User Confirmation
162
+ ⚠️ **IMPORTANT**: Always ask user to confirm before executing write operations
163
+ - Clearly state what will happen
164
+ - Show all costs involved
165
+ - Explain any risks or irreversible actions
166
+
167
+ ### 3. Execute Transaction
168
+ Only after user confirms:
169
+ \`\`\`
170
+ Call write_contract with:
171
+ - contractAddress: "${contractAddress}"
172
+ - functionName: "${functionName}"
173
+ ${argsList.length > 0 ? `- args: ${JSON.stringify(argsList)}` : ""}
174
+ ${value ? `- value: "${value}"` : ""}
175
+ - network: "${network}"
176
+ \`\`\`
177
+
178
+ ### 4. Monitor Transaction
179
+ After execution:
180
+ 1. Return transaction hash to user
181
+ 2. Call \`get_transaction_info\` to verify success
182
+ 3. If failed, call \`diagnose_transaction\` to understand why
183
+
184
+ ## Output Format
185
+
186
+ **Pre-Execution Summary**:
187
+ - Contract details
188
+ - Function and parameters
189
+ - Cost breakdown
190
+ - Risk assessment
191
+
192
+ **Confirmation Request**:
193
+ "Ready to execute ${functionName} on ${contractAddress}. Proceed? (yes/no)"
194
+
195
+ **Execution Result**:
196
+ - Transaction Hash: [hash]
197
+ - Status: Pending/Confirmed/Failed
198
+ - Energy Used: [actual energy used]
199
+ - Bandwidth Used: [actual bandwidth used]
200
+
201
+ ## Safety Considerations
202
+
203
+ ### Critical Checks
204
+ - ✅ Check function parameters are correct type and format
205
+ - ✅ Ensure sufficient balance for fees + value
206
+ - ✅ Validate addresses (no typos, correct network)
207
+ - ✅ Understand what the function does before calling
208
+
209
+ ### Common Risks
210
+ - **Irreversible**: Most blockchain transactions cannot be undone
211
+ - **Fee Loss**: Failed transactions still consume Energy/Bandwidth
212
+ - **Approval Risks**: Be careful with unlimited approvals
213
+ - **Access Control**: Verify you have permission to call this function
214
+ `,
215
+ },
216
+ },
217
+ ],
218
+ };
219
+ }, { isReadOnly: false });
220
+ registerPrompt("diagnose_transaction", {
221
+ description: "Analyze transaction status, failures, and provide debugging insights",
222
+ argsSchema: {
223
+ txHash: z.string().describe("Transaction hash to diagnose"),
224
+ network: z.string().optional().describe("Network name (default: mainnet)"),
225
+ },
226
+ }, ({ txHash, network = "mainnet" }) => ({
227
+ messages: [
228
+ {
229
+ role: "user",
230
+ content: {
231
+ type: "text",
232
+ text: `# Transaction Diagnosis
233
+
234
+ **Objective**: Analyze transaction ${txHash} on ${network} and identify any issues
235
+
236
+ ## Investigation Process
237
+
238
+ ### 1. Gather Transaction Data
239
+ - Call \`get_transaction\` to fetch transaction details
240
+ - Call \`get_transaction_info\` to get status and energy/bandwidth used
241
+ - Note: both calls are read-only and free
242
+
243
+ ### 2. Status Assessment
244
+ Determine transaction state:
245
+ - **Pending**: Not yet mined
246
+ - **Confirmed**: Successfully executed (contractRet='SUCCESS')
247
+ - **Failed**: Execution failed (contractRet='REVERT' or other error)
248
+
249
+ ### 3. Failure Analysis
250
+ If transaction failed, investigate:
251
+
252
+ **Out of Energy**:
253
+ - Check energy_usage vs energy_limit
254
+ - If usage >= limit, suggest increasing fee limit
255
+
256
+ **Contract Revert**:
257
+ - Check function called and parameters
258
+ - Verify sufficient balance/approvals
259
+ - Look for require/revert statements in contract
260
+
261
+ ### 4. Resource Analysis
262
+ - Calculate energy/bandwidth cost
263
+ - Compare to current chain parameters
264
+
265
+ ## Output Format
266
+
267
+ Provide structured diagnosis:
268
+ - **Status**: Pending/Confirmed/Failed with reason
269
+ - **Transaction Hash**: The hash analyzed
270
+ - **From/To**: Addresses involved
271
+ - **Resource Usage**: Energy / Bandwidth used
272
+ - **Issue (if failed)**: Root cause and explanation
273
+ - **Recommended Actions**: Next steps to resolve
274
+ `,
275
+ },
276
+ },
277
+ ],
278
+ }));
279
+ registerPrompt("explain_tron_concept", {
280
+ description: "Explain TRON and blockchain concepts with examples",
281
+ argsSchema: {
282
+ concept: z
283
+ .string()
284
+ .describe("Concept to explain (Energy, Bandwidth, Super Representative, TRC20, TRC721, etc)"),
285
+ },
286
+ }, ({ concept }) => ({
287
+ messages: [
288
+ {
289
+ role: "user",
290
+ content: {
291
+ type: "text",
292
+ text: `# Concept Explanation: ${concept}
293
+
294
+ **Objective**: Provide clear, practical explanation of "${concept}"
295
+
296
+ ## Explanation Structure
297
+
298
+ ### 1. Definition
299
+ - What is it?
300
+ - Simple one-sentence summary
301
+ - Technical name/terminology
302
+
303
+ ### 2. How It Works
304
+ - Step-by-step explanation
305
+ - Why it exists/why it's important (e.g., Resource model prevents spam)
306
+ - How it relates to TRON blockchain
307
+
308
+ ### 3. Real-World Analogy
309
+ - Compare to familiar concept (e.g., Bandwidth like internet data, Energy like CPU time)
310
+ - Make it relatable for beginners
311
+ - Highlight key differences
312
+
313
+ ### 4. Practical Examples
314
+ - Real transaction scenarios
315
+ - Numbers and metrics where applicable (e.g., Transfer costs ~300 Bandwidth)
316
+ - Common scenarios
317
+ - Edge cases or gotchas
318
+
319
+ ### 5. Relevance to Users
320
+ - Why should developers/users care?
321
+ - How does it affect transactions/costs?
322
+ - How to optimize (e.g., Staking for resources)?
323
+ - Common mistakes to avoid
324
+
325
+ ## Output Format
326
+
327
+ Provide explanation in sections:
328
+
329
+ **What is ${concept}?**
330
+ [Definition and overview]
331
+
332
+ **How Does It Work?**
333
+ [Mechanics and process]
334
+
335
+ **Example**
336
+ [Real or hypothetical scenario]
337
+
338
+ **Key Takeaways**
339
+ [Bullet points of important facts]
340
+
341
+ **Common Questions**
342
+ - Question 1? Answer
343
+ - Question 2? Answer
344
+
345
+ ## Important
346
+ - Use clear, non-technical language first
347
+ - Progress to technical details
348
+ - Include concrete numbers where helpful
349
+ - Be honest about complexity
350
+ - Suggest further learning if needed
351
+ `,
352
+ },
353
+ },
354
+ ],
355
+ }));
356
+ // ============================================================================
357
+ // WALLET ANALYSIS PROMPTS
358
+ // ============================================================================
359
+ registerPrompt("analyze_wallet", {
360
+ description: "Get comprehensive overview of wallet assets, balances, and activity",
361
+ argsSchema: {
362
+ address: z.string().describe("Wallet address to analyze"),
363
+ network: z.string().optional().describe("Network name (default: mainnet)"),
364
+ tokens: z.string().optional().describe("Comma-separated token addresses to check"),
365
+ },
366
+ }, ({ address, network = "mainnet", tokens }) => {
367
+ const tokenList = tokens ? tokens.split(",").map((t) => t.trim()) : [];
368
+ return {
369
+ messages: [
370
+ {
371
+ role: "user",
372
+ content: {
373
+ type: "text",
374
+ text: `# Wallet Analysis
375
+
376
+ **Objective**: Provide complete asset overview for ${address} on ${network}
377
+
378
+ ## Information Gathering
379
+
380
+ ### 1. Address Resolution
381
+ - Call \`convert_address\` to get both Hex and Base58 formats
382
+
383
+ ### 2. Native Token Balance
384
+ - Call \`get_balance\` to fetch TRX balance
385
+ - Report both sun and TRX formats
386
+
387
+ ### 3. Token Balances
388
+ ${tokenList.length > 0
389
+ ? `- Call \`get_token_balance\` for each token:\n${tokenList.map((t) => ` * ${t}`).join("\n")}`
390
+ : `- If specific tokens provided: call \`get_token_balance\` for each`}
391
+
392
+ ## Output Format
393
+
394
+ Provide analysis with clear sections:
395
+
396
+ **Wallet Overview**
397
+ - Address (Base58): [address]
398
+ - Address (Hex): [hex]
399
+ - Network: [network]
400
+
401
+ **TRX Balance**
402
+ - TRX: [formatted amount]
403
+ - Sun: [raw amount]
404
+
405
+ **Token Holdings** (if requested)
406
+ - Token: [address]
407
+ - Symbol: [symbol]
408
+ - Balance: [formatted]
409
+ - Decimals: [decimals]
410
+
411
+ **Summary**
412
+ - Primary holdings
413
+ - Notable observations
414
+ `,
415
+ },
416
+ },
417
+ ],
418
+ };
419
+ });
420
+ // ============================================================================
421
+ // NETWORK & EDUCATION PROMPTS
422
+ // ============================================================================
423
+ registerPrompt("check_network_status", {
424
+ description: "Check current network health and conditions",
425
+ argsSchema: {
426
+ network: z.string().optional().describe("Network name (default: mainnet)"),
427
+ },
428
+ }, ({ network = "mainnet" }) => ({
429
+ messages: [
430
+ {
431
+ role: "user",
432
+ content: {
433
+ type: "text",
434
+ text: `# Network Status Check
435
+
436
+ **Objective**: Assess health and current conditions of ${network}
437
+
438
+ ## Status Assessment
439
+
440
+ ### 1. Gather Current Data
441
+ Call these read-only tools:
442
+ - \`get_chain_info\` for chain ID and current block number
443
+ - \`get_latest_block\` for block details and timing
444
+ - \`get_chain_parameters\` for current resource costs
445
+
446
+ ### 2. Network Health Analysis
447
+
448
+ **Block Production**:
449
+ - Current block number
450
+ - Block timing (normal ~3 sec for Tron)
451
+ - Consistent vs irregular blocks
452
+
453
+ **Resource Market**:
454
+ - Energy Fee
455
+ - Bandwidth Fee
456
+
457
+ **Overall Status**:
458
+ - Operational: Yes/No
459
+ - Issues detected: Yes/No
460
+
461
+ ## Output Format
462
+
463
+ **Network Status Report: ${network}**
464
+
465
+ **Overall Status**
466
+ - Operational Status: [Online/Degraded/Offline]
467
+ - Current Block: [number]
468
+ - Network Time: [timestamp]
469
+
470
+ **Performance Metrics**
471
+ - Block Time: [seconds] (normal: 3s)
472
+ - Energy Fee: [amount]
473
+ - Bandwidth Fee: [amount]
474
+
475
+ **Recommendations**
476
+
477
+ For **sending transactions now**:
478
+ - Status is Green/Yellow/Red
479
+ `,
480
+ },
481
+ },
482
+ ],
483
+ }));
484
+ }
485
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,UAAkC,EAAE;IACzF;;;;OAIG;IACH,MAAM,cAAc,GAAG,CACrB,IAAY,EACZ,UAGC,EACD,OAA+C,EAC/C,QAAkC,EAAE,EACpC,EAAE;QACF,6EAA6E;QAC7E,gFAAgF;QAChF,2EAA2E;QAC3E,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC;QAE9C,sEAAsE;QACtE,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QAED,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAiB,EAAE,OAAc,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,+EAA+E;IAC/E,sBAAsB;IACtB,+EAA+E;IAE/E,cAAc,CACZ,kBAA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AAC,CAAC,iDAAiD,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BAChG,CAAC,CAAC,oEACN;;;;;;;;;;;;;;;;;;;;;;;;CAwBC;qBACY;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,+EAA+E;IAC/E,8BAA8B;IAC9B,+EAA+E;IAE/E,cAAc,CACZ,sBAAsB,EACtB;QACE,WAAW,EAAE,6CAA6C;QAC1D,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;SAC3E;KACF,EACD,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;yDAEuC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA2BrC,OAAO;;;;;;;;;;;;;;;;CAgBjC;iBACU;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ /**
3
+ * Register TRON-related resources with the MCP server
4
+ *
5
+ * Resources are application-driven, read-only data that clients can explicitly load.
6
+ * For an AI agent use case, most data should be exposed through tools instead,
7
+ * which allow the model to discover and autonomously fetch information.
8
+ *
9
+ * The supported_networks resource provides a static reference list that clients
10
+ * may want to browse when configuring which networks to use.
11
+ *
12
+ * @param server The MCP server instance
13
+ */
14
+ export declare function registerTRONResources(server: McpServer): void;
@@ -0,0 +1,42 @@
1
+ import { getSupportedNetworks } from "./chains.js";
2
+ /**
3
+ * Register TRON-related resources with the MCP server
4
+ *
5
+ * Resources are application-driven, read-only data that clients can explicitly load.
6
+ * For an AI agent use case, most data should be exposed through tools instead,
7
+ * which allow the model to discover and autonomously fetch information.
8
+ *
9
+ * The supported_networks resource provides a static reference list that clients
10
+ * may want to browse when configuring which networks to use.
11
+ *
12
+ * @param server The MCP server instance
13
+ */
14
+ export function registerTRONResources(server) {
15
+ server.registerResource("supported_networks", "tron://networks", {
16
+ description: "Get list of all supported TRON networks and their configuration",
17
+ mimeType: "application/json",
18
+ }, async (uri) => {
19
+ try {
20
+ const networks = getSupportedNetworks();
21
+ return {
22
+ contents: [
23
+ {
24
+ uri: uri.href,
25
+ text: JSON.stringify({ supportedNetworks: networks }, null, 2),
26
+ },
27
+ ],
28
+ };
29
+ }
30
+ catch (error) {
31
+ return {
32
+ contents: [
33
+ {
34
+ uri: uri.href,
35
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`,
36
+ },
37
+ ],
38
+ };
39
+ }
40
+ });
41
+ }
42
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/core/resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,MAAM,CAAC,gBAAgB,CACrB,oBAAoB,EACpB,iBAAiB,EACjB;QACE,WAAW,EAAE,iEAAiE;QAC9E,QAAQ,EAAE,kBAAkB;KAC7B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,oBAAoB,EAAE,CAAC;YACxC,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC/D;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,IAAI,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACzE;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}