@ton/mcp 0.1.12 → 0.1.15-alpha.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 (79) hide show
  1. package/README.md +214 -21
  2. package/dist/cli.js +25578 -29501
  3. package/dist/contracts/agentic_wallet/AgenticWallet.source.d.ts +11 -0
  4. package/dist/contracts/agentic_wallet/AgenticWallet.source.d.ts.map +1 -0
  5. package/dist/contracts/agentic_wallet/AgenticWalletAdapter.d.ts +62 -0
  6. package/dist/contracts/agentic_wallet/AgenticWalletAdapter.d.ts.map +1 -0
  7. package/dist/contracts/agentic_wallet/actions.d.ts.map +1 -0
  8. package/dist/contracts/agentic_wallet/index.d.ts +10 -0
  9. package/dist/contracts/agentic_wallet/index.d.ts.map +1 -0
  10. package/dist/factory.d.ts +13 -34
  11. package/dist/factory.d.ts.map +1 -1
  12. package/dist/http-mode.d.ts +25 -0
  13. package/dist/http-mode.d.ts.map +1 -0
  14. package/dist/index.cjs +99349 -103146
  15. package/dist/index.d.ts +8 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +99346 -103147
  18. package/dist/registry/config.d.ts +202 -0
  19. package/dist/registry/config.d.ts.map +1 -0
  20. package/dist/runtime/wallet-runtime.d.ts +35 -0
  21. package/dist/runtime/wallet-runtime.d.ts.map +1 -0
  22. package/dist/serverless.cjs +18653 -22450
  23. package/dist/serverless.d.ts.map +1 -1
  24. package/dist/serverless.js +18654 -22451
  25. package/dist/services/AgenticOnboardingService.d.ts +51 -0
  26. package/dist/services/AgenticOnboardingService.d.ts.map +1 -0
  27. package/dist/services/AgenticSetupSessionManager.d.ts +82 -0
  28. package/dist/services/AgenticSetupSessionManager.d.ts.map +1 -0
  29. package/dist/services/KeyManager.d.ts +4 -3
  30. package/dist/services/KeyManager.d.ts.map +1 -1
  31. package/dist/services/McpWalletService.d.ts +75 -2
  32. package/dist/services/McpWalletService.d.ts.map +1 -1
  33. package/dist/services/WalletRegistryService.d.ts +99 -0
  34. package/dist/services/WalletRegistryService.d.ts.map +1 -0
  35. package/dist/tools/address-tools.d.ts +119 -0
  36. package/dist/tools/address-tools.d.ts.map +1 -0
  37. package/dist/tools/agentic-onboarding-tools.d.ts +120 -0
  38. package/dist/tools/agentic-onboarding-tools.d.ts.map +1 -0
  39. package/dist/tools/agentic-tools.d.ts +71 -0
  40. package/dist/tools/agentic-tools.d.ts.map +1 -0
  41. package/dist/tools/dns-tools.d.ts.map +1 -1
  42. package/dist/tools/index.d.ts +5 -0
  43. package/dist/tools/index.d.ts.map +1 -1
  44. package/dist/tools/nft-tools.d.ts.map +1 -1
  45. package/dist/tools/sanitize.d.ts +44 -0
  46. package/dist/tools/sanitize.d.ts.map +1 -0
  47. package/dist/tools/transaction-tools.d.ts +31 -0
  48. package/dist/tools/transaction-tools.d.ts.map +1 -0
  49. package/dist/tools/transfer-tools.d.ts +8 -8
  50. package/dist/tools/transfer-tools.d.ts.map +1 -1
  51. package/dist/tools/wallet-management-tools.d.ts +249 -0
  52. package/dist/tools/wallet-management-tools.d.ts.map +1 -0
  53. package/dist/types/config.d.ts +4 -3
  54. package/dist/types/config.d.ts.map +1 -1
  55. package/dist/types/contacts.d.ts +2 -1
  56. package/dist/types/contacts.d.ts.map +1 -1
  57. package/dist/utils/address.d.ts +15 -0
  58. package/dist/utils/address.d.ts.map +1 -0
  59. package/dist/utils/agentic.d.ts +61 -0
  60. package/dist/utils/agentic.d.ts.map +1 -0
  61. package/dist/utils/math.d.ts +9 -0
  62. package/dist/utils/math.d.ts.map +1 -0
  63. package/dist/utils/private-key.d.ts +14 -0
  64. package/dist/utils/private-key.d.ts.map +1 -0
  65. package/dist/utils/ton-client.d.ts +14 -0
  66. package/dist/utils/ton-client.d.ts.map +1 -0
  67. package/llms.txt +151 -6
  68. package/package.json +3 -3
  69. package/skills/SKILL.md +63 -8
  70. package/dist/contracts/w5_ownable/WalletOwnable.d.ts +0 -87
  71. package/dist/contracts/w5_ownable/WalletOwnable.d.ts.map +0 -1
  72. package/dist/contracts/w5_ownable/WalletOwnable.source.d.ts +0 -11
  73. package/dist/contracts/w5_ownable/WalletOwnable.source.d.ts.map +0 -1
  74. package/dist/contracts/w5_ownable/WalletOwnableAdapter.d.ts +0 -111
  75. package/dist/contracts/w5_ownable/WalletOwnableAdapter.d.ts.map +0 -1
  76. package/dist/contracts/w5_ownable/actions.d.ts.map +0 -1
  77. package/dist/contracts/w5_ownable/index.d.ts +0 -12
  78. package/dist/contracts/w5_ownable/index.d.ts.map +0 -1
  79. /package/dist/contracts/{w5_ownable → agentic_wallet}/actions.d.ts +0 -0
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { Wallet } from '@ton/walletkit';
12
12
  import type { IContactResolver } from './contacts.js';
13
+ export type NetworkType = 'mainnet' | 'testnet' | 'tetra';
13
14
  /**
14
15
  * Network-specific configuration
15
16
  */
@@ -22,10 +23,10 @@ export interface NetworkConfig {
22
23
  */
23
24
  export interface TonMcpConfig {
24
25
  /**
25
- * Wallet instance to use for operations.
26
- * Required.
26
+ * Optional fixed wallet instance for backward-compatible single-wallet mode.
27
+ * If omitted, the server can run against the local config registry.
27
28
  */
28
- wallet: Wallet;
29
+ wallet?: Wallet;
29
30
  /**
30
31
  * Optional contact resolver for name-to-address resolution.
31
32
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,OAAO,CAAC,EAAE,aAAa,CAAC;KAC3B,CAAC;CACL"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,OAAO,CAAC,EAAE,aAAa,CAAC;KAC3B,CAAC;CACL"}
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ import type { NetworkType } from './config.js';
8
9
  /**
9
10
  * IContactResolver - Optional interface for resolving friend names to TON addresses
10
11
  *
@@ -20,7 +21,7 @@ export interface Contact {
20
21
  /** TON address */
21
22
  address: string;
22
23
  /** Optional network specification (defaults to any) */
23
- network?: 'mainnet' | 'testnet';
24
+ network?: NetworkType;
24
25
  }
25
26
  /**
26
27
  * Interface for contact resolution.
@@ -1 +1 @@
1
- {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/types/contacts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;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M,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { Address } from '@ton/core';
9
+ export type McpAddressNetwork = 'mainnet' | 'testnet';
10
+ export declare function formatWalletAddress(address: string | Address, network: McpAddressNetwork): string;
11
+ export declare function formatWalletAddressSafe(address: string | null | undefined, network: McpAddressNetwork): string | undefined;
12
+ export declare function formatAssetAddress(address: string | Address, network: McpAddressNetwork): string;
13
+ export declare function formatAssetAddressSafe(address: string | null | undefined, network: McpAddressNetwork): string | undefined;
14
+ export declare function normalizeAddressForComparison(address: string): string | null;
15
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/utils/address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAGjG;AAED,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,OAAO,EAAE,iBAAiB,GAC3B,MAAM,GAAG,SAAS,CAUpB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAGhG;AAED,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,OAAO,EAAE,iBAAiB,GAC3B,MAAM,GAAG,SAAS,CAUpB;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5E"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { ApiClient } from '@ton/walletkit';
9
+ import type { TonNetwork } from '../registry/config.js';
10
+ export interface AgenticImportCandidate {
11
+ address: string;
12
+ balanceNano: string;
13
+ balanceTon: string;
14
+ ownerAddress: string;
15
+ operatorPublicKey?: string;
16
+ originOperatorPublicKey?: string;
17
+ collectionAddress: string;
18
+ deployedByUser?: boolean;
19
+ name?: string;
20
+ }
21
+ type AgenticWalletValidationErrorCode = 'inactive_contract' | 'wrong_contract_type' | 'uninitialized_agentic_wallet' | 'unsupported_agentic_wallet_layout';
22
+ export declare class AgenticWalletValidationError extends Error {
23
+ readonly code: AgenticWalletValidationErrorCode;
24
+ constructor(code: AgenticWalletValidationErrorCode, message: string);
25
+ }
26
+ export declare function generateOperatorKeyPair(): Promise<{
27
+ privateKey: string;
28
+ publicKey: string;
29
+ }>;
30
+ export declare function resolveOperatorCredentials(privateKey: string, expectedPublicKey?: string, deps?: {
31
+ createSigner?: (seed: Uint8Array) => Promise<{
32
+ publicKey: string;
33
+ }>;
34
+ }): Promise<{
35
+ privateKey: string;
36
+ publicKey: string;
37
+ }>;
38
+ export declare function buildAgenticCreateDeepLink(input: {
39
+ operatorPublicKey: string;
40
+ callbackUrl: string;
41
+ agentName?: string;
42
+ source?: string;
43
+ tonDeposit?: string;
44
+ }): string;
45
+ export declare function buildAgenticDashboardLink(address: string): string;
46
+ export declare function buildAgenticChangeKeyDeepLink(address: string, nextOperatorPublicKey: string): string;
47
+ export declare function listAgenticWalletsByOwner(input: {
48
+ client: ApiClient;
49
+ ownerAddress: string;
50
+ collectionAddress: string;
51
+ network: TonNetwork;
52
+ }): Promise<AgenticImportCandidate[]>;
53
+ export declare function validateAgenticWalletAddress(input: {
54
+ client: ApiClient;
55
+ address: string;
56
+ collectionAddress?: string;
57
+ ownerAddress?: string;
58
+ network: TonNetwork;
59
+ }): Promise<AgenticImportCandidate>;
60
+ export {};
61
+ //# sourceMappingURL=agentic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentic.d.ts","sourceRoot":"","sources":["../../src/utils/agentic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAGlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAsBxD,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,gCAAgC,GAC/B,mBAAmB,GACnB,qBAAqB,GACrB,8BAA8B,GAC9B,mCAAmC,CAAC;AAE1C,qBAAa,4BAA6B,SAAQ,KAAK;aAE/B,IAAI,EAAE,gCAAgC;gBAAtC,IAAI,EAAE,gCAAgC,EACtD,OAAO,EAAE,MAAM;CAKtB;AAgGD,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,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 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ export declare const UINT_256_MAX: bigint;
9
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY,QAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ export interface ParsedPrivateKeyInput {
9
+ normalizedHex: string;
10
+ seed: Buffer;
11
+ wasCombinedKeypair: boolean;
12
+ }
13
+ export declare function parsePrivateKeyInput(privateKey: string): ParsedPrivateKeyInput;
14
+ //# sourceMappingURL=private-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-key.d.ts","sourceRoot":"","sources":["../../src/utils/private-key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,qBAAqB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAoB9E"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) TonTech.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { ApiClient } from '@ton/walletkit';
9
+ import type { TonNetwork } from '../registry/config.js';
10
+ export declare function getApiClientRequestIntervalMs(apiKey?: string): number;
11
+ export declare function resolveToncenterApiKey(network: TonNetwork, apiKey?: string): string;
12
+ export declare function createRateLimitedFetch(delayMs: number, fetchImpl?: typeof fetch): typeof fetch;
13
+ export declare function createApiClient(network: TonNetwork, apiKey?: string): ApiClient;
14
+ //# sourceMappingURL=ton-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ton-client.d.ts","sourceRoot":"","sources":["../../src/utils/ton-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAiBxD,wBAAgB,6BAA6B,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,KAAa,GAAG,OAAO,KAAK,CAuBrG;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAU/E"}
package/llms.txt CHANGED
@@ -4,7 +4,14 @@
4
4
 
5
5
  ## Overview
6
6
 
7
- This MCP server provides tools for managing TON blockchain wallets. It supports wallet info, balance queries, transfers (TON, Jettons, NFTs), token swaps, transaction history, and DNS resolution.
7
+ This MCP server provides tools for managing TON blockchain wallets. It supports wallet info, balance queries, transfers (TON, Jettons, NFTs), token swaps, transaction history, DNS resolution, local multi-wallet registry management, and agentic wallet onboarding.
8
+
9
+ It has two runtime modes:
10
+ - Registry mode: if `MNEMONIC` and `PRIVATE_KEY` are not set, wallets are loaded from the local TON config registry (`~/.config/ton/config.json` or `TON_CONFIG_PATH`)
11
+ - Single-wallet mode: if `MNEMONIC` or `PRIVATE_KEY` is set, the server runs with one in-memory wallet
12
+
13
+ In registry mode, wallet-scoped tools can also accept optional `walletSelector`. If omitted, the active wallet is used.
14
+ HTTP mode is multi-session: each MCP client session gets its own server transport instead of sharing a process-wide singleton.
8
15
 
9
16
  ## Available Tools
10
17
 
@@ -12,10 +19,34 @@ This MCP server provides tools for managing TON blockchain wallets. It supports
12
19
  Get current wallet address and network info.
13
20
  Returns: address, network (mainnet or testnet)
14
21
 
22
+ ### list_wallets
23
+ Registry mode only. List wallets stored in the local config registry.
24
+ Returns: sanitized wallet list, count, active wallet id
25
+
26
+ ### get_current_wallet
27
+ Registry mode only. Get the active wallet from the local config registry.
28
+ Returns: sanitized wallet record
29
+
30
+ ### set_active_wallet
31
+ Registry mode only. Switch active wallet.
32
+ Parameters:
33
+ - walletSelector (required): wallet id, name, or address
34
+
35
+ ### remove_wallet
36
+ Registry mode only. Soft-delete a wallet from the local config registry. Removed wallets remain in config but are hidden from MCP lookups and lists.
37
+ Parameters:
38
+ - walletSelector (required): wallet id, name, or address
39
+
15
40
  ### get_balance
16
41
  Get TON balance of the wallet.
17
42
  Returns: address, balance in TON and nanoTON
18
43
 
44
+ ### get_balance_by_address
45
+ Get TON balance for any address.
46
+ Parameters:
47
+ - address (required): TON wallet address
48
+ Returns: address, balance in TON and nanoTON
49
+
19
50
  ### get_jetton_balance
20
51
  Get balance of a specific Jetton token.
21
52
  Parameters:
@@ -25,12 +56,32 @@ Parameters:
25
56
  List all Jettons in the wallet with balances and metadata.
26
57
  Returns: array of tokens with address, symbol, name, balance, decimals
27
58
 
59
+ ### get_jettons_by_address
60
+ List all Jettons for any owner address.
61
+ Parameters:
62
+ - address (required): owner wallet address
63
+ - limit (optional): 1-100, default 20
64
+ - offset (optional): pagination offset
65
+ Returns: array of tokens with address, symbol, name, balance, decimals
66
+
67
+ ### get_jetton_info
68
+ Get Jetton master metadata.
69
+ Parameters:
70
+ - address (required): Jetton master contract address
71
+ Returns: Jetton metadata (address, name, symbol, decimals, description, image, uri)
72
+
28
73
  ### get_transactions
29
74
  Get recent transaction history.
30
75
  Parameters:
31
76
  - limit (optional): 1-100, default 20
32
77
  Returns: transactions with type (TonTransfer, JettonTransfer, JettonSwap), amounts, addresses
33
78
 
79
+ ### get_transaction_status
80
+ Get the status of a transaction by its normalized hash to know if it is pending, completed, or failed.
81
+ Parameters:
82
+ - normalizedHash (required): Normalized hash of the external-in transaction (Hex string)
83
+ Returns: Transaction status (pending, completed, failed) and trace details
84
+
34
85
  ### get_known_jettons
35
86
  Get list of known/popular Jettons on TON.
36
87
  Returns: array with symbol, name, address, decimals
@@ -41,6 +92,7 @@ Parameters:
41
92
  - toAddress (required): recipient address
42
93
  - amount (required): amount in TON (e.g., "1.5")
43
94
  - comment (optional): transaction memo
95
+ Returns: top-level normalizedHash plus details
44
96
 
45
97
  ### send_jetton
46
98
  Send Jettons to an address.
@@ -49,6 +101,7 @@ Parameters:
49
101
  - jettonAddress (required): token contract address
50
102
  - amount (required): human-readable amount
51
103
  - comment (optional): transaction memo
104
+ Returns: top-level normalizedHash plus details
52
105
 
53
106
  ### send_raw_transaction
54
107
  Send raw transaction with full control.
@@ -56,6 +109,15 @@ Parameters:
56
109
  - messages (required): array of {address, amount (nanoTON), stateInit?, payload?}
57
110
  - validUntil (optional): expiry timestamp
58
111
  - fromAddress (optional): sender address
112
+ Returns: top-level normalizedHash plus details
113
+
114
+ ### agentic_deploy_subwallet
115
+ Deploy a new Agentic sub-wallet from a user-root Agentic wallet.
116
+ Parameters:
117
+ - operatorPublicKey (required): new sub-wallet operator public key (`uint256`, decimal or `0x`-hex)
118
+ - metadata (required): onchain NFT metadata in TEP-64 format with mandatory `name`
119
+ - amountTon (optional): attached TON amount, default `"0.05"`
120
+ Returns: normalizedHash, deployed sub-wallet address, sub-wallet NFT index
59
121
 
60
122
  ### get_swap_quote
61
123
  Get quote for token swap.
@@ -72,6 +134,13 @@ Parameters:
72
134
  - limit (optional): 1-100, default 20
73
135
  - offset (optional): pagination offset
74
136
 
137
+ ### get_nfts_by_address
138
+ List NFTs for any owner address.
139
+ Parameters:
140
+ - address (required): owner wallet address
141
+ - limit (optional): 1-100, default 20
142
+ - offset (optional): pagination offset
143
+
75
144
  ### get_nft
76
145
  Get NFT details.
77
146
  Parameters:
@@ -85,33 +154,109 @@ Parameters:
85
154
  - comment (optional): transaction memo
86
155
 
87
156
  ### resolve_dns
88
- Resolve .ton domain to wallet address.
157
+ Resolve TON DNS-compatible domain to wallet address.
89
158
  Parameters:
90
- - domain (required): e.g., "foundation.ton"
159
+ - domain (required): e.g., "foundation.ton" or "viqex.t.me"
91
160
 
92
161
  ### back_resolve_dns
93
- Find .ton domain for a wallet address.
162
+ Find the associated DNS domain for a wallet address when available.
94
163
  Parameters:
95
164
  - address (required): TON wallet address
96
165
 
166
+ ### agentic_validate_wallet
167
+ Registry mode only. Validate an agentic wallet against network/collection and optional owner.
168
+ Parameters:
169
+ - address (required): agentic wallet address
170
+ - network (optional): mainnet or testnet
171
+ - collectionAddress (optional): collection override
172
+ - ownerAddress (optional): expected owner address
173
+
174
+ ### agentic_list_wallets_by_owner
175
+ Registry mode only. Find agentic wallets owned by a main wallet.
176
+ Parameters:
177
+ - ownerAddress (required): owner wallet address
178
+ - network (optional): mainnet or testnet
179
+
180
+ ### agentic_import_wallet
181
+ Registry mode only. Import an existing agentic wallet into the local registry. If no matching pending draft exists, the wallet remains read-only until agentic_rotate_operator_key is completed.
182
+ Parameters:
183
+ - address (required): agentic wallet address
184
+ - network (optional): mainnet or testnet
185
+ - name (optional): wallet display name
186
+
187
+ ### agentic_start_root_wallet_setup
188
+ Registry mode only. Start first root-agent setup, generate operator keys, persist a pending draft, and return a dashboard URL.
189
+ Parameters:
190
+ - network (optional): mainnet or testnet
191
+ - name (optional): display name
192
+ - source (optional): source or description
193
+ - collectionAddress (optional): collection override
194
+ - tonDeposit (optional): TON deposit hint
195
+
196
+ ### agentic_list_pending_root_wallet_setups
197
+ Registry mode only. List pending root-agent onboarding drafts.
198
+
199
+ ### agentic_get_root_wallet_setup
200
+ Registry mode only. Read one pending setup.
201
+ Parameters:
202
+ - setupId (required): pending setup identifier
203
+
204
+ ### agentic_complete_root_wallet_setup
205
+ Registry mode only. Complete onboarding from callback state or a manual wallet address, then import the wallet and make it active.
206
+ Parameters:
207
+ - setupId (required): pending setup identifier
208
+ - walletAddress (optional): manual wallet address if no callback was received
209
+ - ownerAddress (optional): owner address hint for validation
210
+
211
+ ### agentic_cancel_root_wallet_setup
212
+ Registry mode only. Cancel a pending setup.
213
+ Parameters:
214
+ - setupId (required): pending setup identifier
215
+
97
216
  ## Usage Patterns
98
217
 
218
+ ### Working With Multiple Wallets
219
+ 1. list_wallets to inspect stored wallets
220
+ 2. get_current_wallet to confirm the active wallet
221
+ 3. set_active_wallet if the user wants to switch
222
+ 4. For one-off calls, pass walletSelector directly to wallet-scoped tools instead of changing the active wallet
223
+
99
224
  ### Sending TON
100
- 1. If recipient is .ton domain: resolve_dns first
225
+ 1. If recipient is a DNS name rather than a raw address: resolve_dns first
101
226
  2. send_ton with resolved address
227
+ 3. Default: poll get_transaction_status until completed or failed. User can ask to skip.
102
228
 
103
229
  ### Sending Tokens
104
230
  1. get_jettons to find token address
105
231
  2. send_jetton with token details
232
+ 3. Default: poll get_transaction_status until completed or failed. User can ask to skip.
106
233
 
107
234
  ### Swapping Tokens
108
235
  1. get_known_jettons if needed for addresses
109
236
  2. get_swap_quote for quote
110
237
  3. Confirm with user
111
238
  4. send_raw_transaction with quote's transaction params
239
+ 5. Default: poll get_transaction_status until completed or failed. User can ask to skip.
240
+
241
+ ### Importing an Existing Agentic Wallet
242
+ 1. agentic_validate_wallet if the wallet only exists as an address
243
+ 2. agentic_import_wallet to import it into the local registry
244
+ 3. If the wallet needs write access and no pending draft was recovered, use agentic_rotate_operator_key and then agentic_complete_rotate_operator_key
245
+ 4. Only then use write tools for that wallet
246
+
247
+ ### Setting Up the First Agentic Root Wallet
248
+ 1. agentic_start_root_wallet_setup
249
+ 2. Tell the user to open the returned dashboard URL and create the wallet from their main wallet
250
+ 3. Inspect agentic_get_root_wallet_setup or agentic_list_pending_root_wallet_setups
251
+ 4. If completion is manual, use agentic_validate_wallet
252
+ 5. agentic_complete_root_wallet_setup when callback data is available or when the user provides the created wallet address
112
253
 
113
254
  ## Important Notes
114
255
 
115
256
  - Always confirm transfers/swaps with user before executing
116
257
  - send_ton/send_jetton/get_swap_quote use human-readable amounts
117
- - Check transaction success in response
258
+ - Registry mode uses the local TON config file from `~/.config/ton/config.json` or `TON_CONFIG_PATH`
259
+ - Agentic onboarding callback state is persisted in the local config; in stdio mode use `AGENTIC_CALLBACK_BASE_URL` and/or `AGENTIC_CALLBACK_PORT` when you need a stable callback endpoint across restarts
260
+ - Registry management responses are sanitized and do not expose mnemonic, private keys, operator private keys, or Toncenter API keys
261
+ - Read tools can work with imported agentic wallets without `operator_private_key`; write tools cannot
262
+ - **Default flow:** After any send, poll get_transaction_status until completed or failed. User can specify whether to check status.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/mcp",
3
- "version": "0.1.12",
3
+ "version": "0.1.15-alpha.0",
4
4
  "description": "TON MCP Server - Model Context Protocol server for TON blockchain wallet operations",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@modelcontextprotocol/sdk": "^1.25.1",
56
56
  "zod": "^3.25.76",
57
- "@ton/walletkit": "0.0.8"
57
+ "@ton/walletkit": "0.0.10"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@modelcontextprotocol/sdk": "^1.25.1"
@@ -75,7 +75,7 @@
75
75
  "build:clean": "rimraf dist",
76
76
  "build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
77
77
  "build:chmod": "chmod +x dist/cli.js",
78
- "dev": "rolldown -c --watch",
78
+ "dev": "rolldown --watch -c",
79
79
  "dev:cli": "node --import tsx/esm src/cli.ts",
80
80
  "dev:cli:http": "node --import tsx/esm src/cli.ts --http",
81
81
  "lint": "eslint src --max-warnings 0",
package/skills/SKILL.md CHANGED
@@ -1,31 +1,57 @@
1
1
  # TON Blockchain Wallet
2
2
 
3
- Manage TON blockchain wallet operations including balance queries, transfers, swaps, NFTs, and DNS resolution.
3
+ Manage TON blockchain wallet operations including registry-backed wallet selection, balance queries, transfers, swaps, NFTs, DNS resolution, and agentic wallet onboarding.
4
4
 
5
5
  ## When to Use
6
6
 
7
7
  Use this skill when the user wants to:
8
8
  - Check wallet info, TON or token balances
9
+ - Work with multiple stored wallets or switch the active wallet
10
+ - Configure network settings for MCP registry mode
9
11
  - Send TON, Jettons (tokens), or NFTs
10
12
  - Swap tokens on DEX
11
13
  - View transaction history
12
- - Resolve .ton domains
14
+ - Resolve TON DNS-compatible domains
15
+ - Import, validate, or finish setup of an agentic wallet
13
16
 
14
17
  ## Tools Available
15
18
 
16
19
  ### Wallet & Balance
17
20
  - `get_wallet` - Get wallet address and network info
18
21
  - `get_balance` - Get TON balance
22
+ - `get_balance_by_address` - Get TON balance for any address
19
23
  - `get_jetton_balance` - Get specific token balance (needs `jettonAddress`)
20
24
  - `get_jettons` - List all tokens in wallet
25
+ - `get_jettons_by_address` - List all tokens for any owner address
26
+ - `get_jetton_info` - Get jetton metadata by master contract address
21
27
  - `get_transactions` - View recent transactions (optional `limit`)
28
+ - `get_transaction_status` - Check completion status of a sent transaction by normalized hash
22
29
  - `get_known_jettons` - Get list of popular tokens with addresses
23
30
 
31
+ ### Wallet Registry Management
32
+ - `list_wallets` - List wallets stored in the local config registry
33
+ - `get_current_wallet` - Get the active wallet from the local registry
34
+ - `set_active_wallet` - Switch active wallet by id, name, or address
35
+ - `remove_wallet` - Soft-delete a stored wallet from the registry
36
+
37
+ ### Agentic Wallet Management
38
+ - `agentic_validate_wallet` - Validate an agentic wallet against network/collection and optional owner
39
+ - `agentic_list_wallets_by_owner` - Find agentic wallets owned by a given main wallet
40
+ - `agentic_import_wallet` - Import an existing agentic wallet into the registry
41
+ - `agentic_rotate_operator_key` - Start operator-key rotation for an imported agentic wallet
42
+ - `agentic_complete_rotate_operator_key` - Finalize operator-key rotation after the on-chain change lands
43
+ ### Agentic Onboarding
44
+ - `agentic_start_root_wallet_setup` - Create pending setup, generate operator keys, and return a dashboard URL
45
+ - `agentic_list_pending_root_wallet_setups` - List pending root-agent setup drafts
46
+ - `agentic_get_root_wallet_setup` - Read one pending setup by `setupId`
47
+ - `agentic_complete_root_wallet_setup` - Finish onboarding from callback state or manual wallet address
48
+ - `agentic_cancel_root_wallet_setup` - Cancel a pending setup
49
+
24
50
  ### Transfers
25
- - `send_ton` - Send TON (`toAddress`, `amount` in TON like "1.5", optional `comment`)
26
- - `send_jetton` - Send tokens (`toAddress`, `jettonAddress`, `amount`, optional `comment`)
51
+ - `send_ton` - Send TON (`toAddress`, `amount` in TON like "1.5", optional `comment`); returns top-level `normalizedHash`
52
+ - `send_jetton` - Send tokens (`toAddress`, `jettonAddress`, `amount`, optional `comment`); returns top-level `normalizedHash`
27
53
  - `send_nft` - Transfer NFT (`nftAddress`, `toAddress`, optional `comment`)
28
- - `send_raw_transaction` - Advanced: send raw transaction with multiple messages
54
+ - `send_raw_transaction` - Advanced: send raw transaction with multiple messages; returns top-level `normalizedHash`
29
55
 
30
56
  ### Swaps
31
57
  - `get_swap_quote` - Get swap quote (`fromToken`, `toToken`, `amount` in human-readable format)
@@ -34,10 +60,11 @@ Use this skill when the user wants to:
34
60
 
35
61
  ### NFTs
36
62
  - `get_nfts` - List wallet NFTs (optional `limit`, `offset`)
63
+ - `get_nfts_by_address` - List NFTs for any owner address
37
64
  - `get_nft` - Get NFT details (`nftAddress`)
38
65
 
39
66
  ### DNS
40
- - `resolve_dns` - Resolve .ton domain to address (`domain` like "foundation.ton")
67
+ - `resolve_dns` - Resolve TON DNS-compatible domain to address (`domain` like "foundation.ton" or "viqex.t.me")
41
68
  - `back_resolve_dns` - Find domain for address (`address`)
42
69
 
43
70
  ## Common Workflows
@@ -47,22 +74,50 @@ Use this skill when the user wants to:
47
74
  2. Call `get_balance` for TON
48
75
  3. Call `get_jettons` for all tokens
49
76
 
77
+ ### Work With Multiple Wallets
78
+ 1. Call `list_wallets` to inspect stored wallets
79
+ 2. Call `get_current_wallet` to confirm the active wallet
80
+ 3. If needed, call `set_active_wallet`
81
+ 4. For one-off calls, pass `walletSelector` directly to wallet-scoped tools instead of changing active wallet
82
+
50
83
  ### Send TON
51
- 1. If user provides .ton domain, call `resolve_dns` first
84
+ 1. If user provides a DNS name instead of a raw address, call `resolve_dns` first
52
85
  2. Call `send_ton` with address and amount
86
+ 3. By default, poll `get_transaction_status` until status is completed or failed. User can ask to skip.
53
87
 
54
88
  ### Send Token
55
89
  1. Call `get_jettons` to find token address and verify balance
56
90
  2. Call `send_jetton` with token address and amount
91
+ 3. By default, poll `get_transaction_status` until status is completed or failed. User can ask to skip.
57
92
 
58
93
  ### Swap Tokens
59
94
  1. Call `get_known_jettons` if user mentions token by name
60
95
  2. Call `get_swap_quote` to get quote and transaction params
61
96
  3. Show quote to user and ask for confirmation
62
97
  4. Call `send_raw_transaction` with the transaction params
98
+ 5. By default, poll `get_transaction_status` until status is completed or failed. User can ask to skip.
99
+
100
+ ### Import Existing Agentic Wallet
101
+ 1. Call `agentic_validate_wallet` if the user only has an address and you need full validation
102
+ 2. Call `agentic_import_wallet` to import it into the registry
103
+ 3. If the wallet must sign and no pending draft was recovered, call `agentic_rotate_operator_key` and then `agentic_complete_rotate_operator_key`
104
+ 4. Only after that use write tools such as `send_ton`, `send_nft`, or `agentic_deploy_subwallet`
105
+
106
+ ### Set Up First Agentic Root Wallet
107
+ 1. Call `agentic_start_root_wallet_setup`
108
+ 2. Tell the user to open the returned dashboard URL and create the wallet from their main wallet
109
+ 3. Poll `agentic_get_root_wallet_setup` or inspect `agentic_list_pending_root_wallet_setups`
110
+ 4. If completion is manual, use `agentic_validate_wallet`
111
+ 5. Call `agentic_complete_root_wallet_setup` when callback data is available or when the user provides the created wallet address
112
+ 6. Confirm the imported wallet with `get_current_wallet` or `list_wallets`
63
113
 
64
114
  ## Notes
65
115
 
66
116
  - Amounts for `send_ton`, `send_jetton`, and `get_swap_quote` are human-readable (e.g., "1.5" = 1.5 TON)
117
+ - In registry mode, wallet-scoped tools can accept optional `walletSelector`; otherwise they use the active wallet
118
+ - Registry mode uses the local TON config file from `~/.config/ton/config.json` or `TON_CONFIG_PATH`
119
+ - Agentic onboarding callback state is persisted in the local config; in stdio mode use `AGENTIC_CALLBACK_BASE_URL` and/or `AGENTIC_CALLBACK_PORT` when you need a stable callback endpoint across restarts
120
+ - Management tool responses are sanitized and do not expose mnemonic, private keys, operator private keys, or Toncenter API keys
121
+ - Read tools can work with imported agentic wallets that do not yet have `operator_private_key`; write tools cannot
67
122
  - Always confirm with user before executing transfers or swaps
68
- - Transaction results include success status and details
123
+ - **Default flow:** After sending, poll `get_transaction_status` until completed or failed. User can specify whether to check status.