@ton/mcp 0.1.15-alpha.0 → 0.1.15-alpha.10

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 (38) hide show
  1. package/README.md +50 -41
  2. package/USAGE_EXAMPLES.md +342 -0
  3. package/bin/mcp.js +17 -0
  4. package/dist/cli.d.ts +29 -1
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +128559 -103346
  7. package/dist/factory.d.ts.map +1 -1
  8. package/dist/index.cjs +26415 -1992
  9. package/dist/index.js +26395 -1972
  10. package/dist/serverless.cjs +26420 -1997
  11. package/dist/serverless.js +26400 -1977
  12. package/dist/services/McpWalletService.d.ts +13 -0
  13. package/dist/services/McpWalletService.d.ts.map +1 -1
  14. package/dist/suppress-punycode-deprecation.d.ts +9 -0
  15. package/dist/suppress-punycode-deprecation.d.ts.map +1 -0
  16. package/dist/tools/address-tools.d.ts.map +1 -1
  17. package/dist/tools/agentic-onboarding-tools.d.ts +4 -4
  18. package/dist/tools/balance-tools.d.ts.map +1 -1
  19. package/dist/tools/transfer-tools.d.ts +74 -0
  20. package/dist/tools/transfer-tools.d.ts.map +1 -1
  21. package/dist/tools/wallet-management-tools.d.ts +4 -4
  22. package/dist/utils/agentic.d.ts.map +1 -1
  23. package/dist/utils/cli-args.d.ts +19 -0
  24. package/dist/utils/cli-args.d.ts.map +1 -0
  25. package/dist/utils/proxy.d.ts +9 -0
  26. package/dist/utils/proxy.d.ts.map +1 -0
  27. package/dist/utils/ton-client.d.ts.map +1 -1
  28. package/llms.txt +37 -13
  29. package/package.json +10 -4
  30. package/skills/ton-balance/SKILL.md +48 -0
  31. package/skills/ton-cli/SKILL.md +162 -0
  32. package/skills/ton-create-wallet/SKILL.md +60 -0
  33. package/skills/ton-manage-wallets/SKILL.md +60 -0
  34. package/skills/ton-nfts/SKILL.md +41 -0
  35. package/skills/ton-send/SKILL.md +43 -0
  36. package/skills/ton-swap/SKILL.md +37 -0
  37. package/skills/ton-xstocks/SKILL.md +95 -0
  38. package/skills/SKILL.md +0 -123
package/README.md CHANGED
@@ -4,60 +4,75 @@ A Model Context Protocol (MCP) server for TON blockchain wallet operations. Buil
4
4
 
5
5
  ## Features
6
6
 
7
- - **Balance Queries**: Check TON and Jetton balances, view transaction history
8
- - **Transfers**: Send TON, Jettons, and NFTs to any address
9
- - **Agentic Sub-wallet Deploy**: Deploy additional Agentic wallets from a root Agentic wallet
10
- - **Swaps**: Get quotes for token swaps via DEX aggregators
11
- - **NFTs**: List, inspect, and transfer NFTs
12
- - **DNS**: Resolve TON DNS-compatible domains and reverse-lookup addresses
13
- - **Known Jettons**: Built-in directory of popular tokens
14
- - **Wallet Registry Mode**: Work with multiple stored wallets, active wallet selection, and local config-backed management tools
15
- - **Agentic Onboarding**: Start and complete first root-agent wallet setup from MCP
16
- - **Multiple Transports**: Stdio (default), multi-session HTTP server, and serverless modes
7
+ - **Balance Queries**: Check TON and Jetton balances, view transaction history.
8
+ - **Transfers**: Send TON, Jettons, and NFTs to any address.
9
+ - **Swaps**: Get quotes for token swaps via DEX aggregators.
10
+ - **NFTs**: List, inspect, and transfer NFTs.
11
+ - **DNS**: Resolve TON DNS-compatible domains and reverse-lookup addresses.
12
+ - **Known Jettons**: Built-in directory of popular tokens.
13
+ - **Agentic Wallets**: Manage agentic wallets. Create, import, or manage your agentic wallets.
14
+ - **Multiple Transports**: Stdio (default), multi-session HTTP server, and serverless modes.
17
15
 
18
16
  ## Quick Start
19
17
 
20
18
  `@ton/mcp` supports two runtime modes.
21
19
 
22
- - **Registry mode**: if `MNEMONIC` and `PRIVATE_KEY` are not set, the server starts from local config registry at `~/.config/ton/config.json` or `TON_CONFIG_PATH`
20
+ - **Agentic Wallets mode**: Server starts from local config registry at `~/.config/ton/config.json` or `TON_CONFIG_PATH`
23
21
  - **Single-wallet mode**: if `MNEMONIC` or `PRIVATE_KEY` is set, the server starts with one in-memory wallet
24
22
 
23
+ Choose one control path per task: either run `@ton/mcp` as an MCP server (stdio or HTTP) or call tools through raw CLI. Agents must not mix MCP server mode and raw CLI against the same workflow/session, because that creates competing control paths over the same wallet/config state.
24
+
25
+ ### Agentic Wallets mode
26
+
27
+ Self-custody wallets for autonomous agents. Your AI agent gets TON wallet capabilities — transfers, swaps, NFTs. User keeps the master key, agent keeps the operator key.
28
+
29
+ **Learn more about [Agentic Wallets](https://agentic-wallets-dashboard.vercel.app/).**
30
+
31
+ Agentic Wallets mode is the default mode that allows you to manage agentic wallets. To create your first agentic wallet, ask your agent to `create agentic wallet` and follow the instructions.
32
+
25
33
  ```bash
26
- # Run as stdio MCP server in registry mode
27
- npx @ton/mcp
34
+ # Install skills (recommended)
35
+ npx skills add ton-connect/kit/packages/mcp
36
+
37
+ # Run as stdio MCP server in agentic mode
38
+ npx @ton/mcp@alpha
39
+
40
+ # Run as HTTP server in agentic mode
41
+ npx @ton/mcp@alpha --http
28
42
 
29
43
  # Run in registry mode with a custom config path
30
- TON_CONFIG_PATH=/path/to/config.json npx @ton/mcp
44
+ TON_CONFIG_PATH=/path/to/config.json npx @ton/mcp@alpha
45
+ ```
46
+
47
+ ### Single-wallet mode
31
48
 
49
+ Single-wallet mode is a mode where the server starts with one in-memory wallet. This mode is useful when you want to manage a single wallet or when you want to use the server for a one-off task.
50
+
51
+ ```bash
32
52
  # Run as stdio MCP server with mnemonic
33
- MNEMONIC="word1 word2 ..." npx @ton/mcp
53
+ MNEMONIC="word1 word2 ..." npx @ton/mcp@alpha
34
54
 
35
55
  # Run as HTTP server (port 3000)
36
- npx @ton/mcp --http
37
-
38
- # Run as HTTP server on custom port
39
- npx @ton/mcp --http 8080
56
+ MNEMONIC="word1 word2 ..." npx @ton/mcp@alpha --http
40
57
 
41
- # Run with custom agentic wallet contract
42
- PRIVATE_KEY="0xyour_private_key" \
43
- WALLET_VERSION="agentic" \
44
- AGENTIC_WALLET_ADDRESS="EQ..." \
45
- npx @ton/mcp
58
+ # Run as HTTP server on custom port and private key
59
+ PRIVATE_KEY="0xyour_private_key" npx @ton/mcp@alpha --http 8080
46
60
  ```
47
61
 
48
62
  ## Usage with MCP Clients
49
63
 
50
64
  ### Claude Desktop / Cursor
51
65
 
52
- Registry mode:
66
+ Agentic Wallets mode:
53
67
 
54
68
  ```json
55
69
  {
56
70
  "mcpServers": {
57
71
  "ton": {
58
72
  "command": "npx",
59
- "args": ["-y", "@ton/mcp"],
73
+ "args": ["-y", "@ton/mcp@alpha"],
60
74
  "env": {
75
+ "// optional config path": "",
61
76
  "TON_CONFIG_PATH": "/absolute/path/to/config.json"
62
77
  }
63
78
  }
@@ -72,7 +87,7 @@ Single-wallet mode:
72
87
  "mcpServers": {
73
88
  "ton": {
74
89
  "command": "npx",
75
- "args": ["-y", "@ton/mcp"],
90
+ "args": ["-y", "@ton/mcp@alpha"],
76
91
  "env": {
77
92
  "MNEMONIC": "word1 word2 word3 ...",
78
93
  "PRIVATE_KEY": "0xyour_private_key_here (optional, alternative to MNEMONIC)"
@@ -87,22 +102,26 @@ Single-wallet mode:
87
102
  Start the server and point your MCP client to the endpoint:
88
103
 
89
104
  ```bash
90
- npx @ton/mcp --http 3000
105
+ npx @ton/mcp@alpha --http 3000
91
106
  # MCP endpoint: http://localhost:3000/mcp
92
107
  ```
93
108
 
94
109
  HTTP mode keeps a separate MCP session/transport per client session id, so multiple clients can initialize and reconnect independently.
95
110
 
111
+ ## Usage Examples
112
+
113
+ Examples of user requests, approximate corresponding raw CLI commands via `npx @ton/mcp@alpha`, and expected agent responses are collected in [USAGE_EXAMPLES.md](./USAGE_EXAMPLES.md).
114
+
96
115
  ## Environment Variables
97
116
 
98
117
  | Variable | Default | Description |
99
118
  |-------------------|-----------|-------------------------------------------------------|
100
119
  | `NETWORK` | `mainnet` | TON network (`mainnet` / `testnet`) and default env override target for `TONCENTER_API_KEY` |
101
120
  | `MNEMONIC` | | Space-separated 24-word mnemonic phrase for single-wallet mode |
102
- | `PRIVATE_KEY` | | Hex-encoded private key: 32-byte seed or 64-byte `private||public` (alternative to mnemonic) |
121
+ | `PRIVATE_KEY` | | Hex-encoded private key: 32-byte or 64-byte (alternative to mnemonic) |
103
122
  | `WALLET_VERSION` | `v5r1` | Wallet version to use in single-wallet mode (`v5r1`, `v4r2`, or `agentic`) |
104
123
  | `AGENTIC_WALLET_ADDRESS` | | Agentic wallet address (required for `WALLET_VERSION=agentic`, unless derived from init params) |
105
- | `AGENTIC_WALLET_NFT_INDEX` | | Agentic wallet NFT index / subwallet id (`uint256`, optional) |
124
+ | `AGENTIC_WALLET_NFT_INDEX` | | Agentic wallet NFT index (`uint256`, optional) |
106
125
  | `AGENTIC_COLLECTION_ADDRESS` | `EQByQ19qvWxW7VibSbGEgZiYMqilHY5y1a_eeSL2VaXhfy07` | Agentic collection address override for single-wallet mode |
107
126
  | `TONCENTER_API_KEY` | | API key for Toncenter (optional, for higher rate limits) |
108
127
  | `TON_CONFIG_PATH` | `~/.config/ton/config.json` | Config path for registry mode |
@@ -222,16 +241,6 @@ Send a raw transaction with full control over messages. Supports multiple messag
222
241
  - `validUntil` (optional): Unix timestamp after which the transaction becomes invalid
223
242
  - `fromAddress` (optional): Sender wallet address
224
243
 
225
- #### `agentic_deploy_subwallet`
226
- Deploy a new Agentic sub-wallet from the current wallet. Works only with an agentic root wallet that can sign and only when the current wallet is a user-root wallet (`deployedByUser=true`). Returns `normalizedHash`, deployed sub-wallet address, and computed sub-wallet NFT index. NFT metadata is written in onchain TEP-64 format.
227
-
228
- **Default flow:** Poll `get_transaction_status` with the returned `normalizedHash` until completion.
229
-
230
- **Parameters:**
231
- - `operatorPublicKey` (required): New sub-wallet operator public key (`uint256`, decimal or `0x`-prefixed hex)
232
- - `metadata` (required): Onchain TEP-64 metadata object. Must include at least `name` (non-empty string).
233
- - `amountTon` (optional): TON amount to attach for deployment in TON units (default: `"0.05"`)
234
-
235
244
  ### Swaps
236
245
 
237
246
  #### `get_swap_quote`
@@ -318,7 +327,7 @@ Import an existing agentic wallet into the local TON config registry, recovering
318
327
  - `name` (optional): Wallet display name
319
328
 
320
329
  #### `agentic_start_root_wallet_setup` (registry mode only)
321
- Start first-root-agent setup: generate operator keys, persist a pending draft, and return a dashboard URL for the user to create the wallet from their main wallet.
330
+ Start first-root-agent setup: generate operator keys, persist a pending draft, and return a dashboard URL for the user to create the wallet from their main wallet. Agents with local shell/browser access should open the dashboard URL for the user. Callback-based completion is for long-lived stdio/HTTP server sessions; raw CLI should use manual completion.
322
331
 
323
332
  **Parameters:**
324
333
  - `network` (optional): Network for the new root wallet
@@ -0,0 +1,342 @@
1
+ # Usage Examples
2
+
3
+ These examples show how `@ton/mcp` can be used in raw CLI mode. They are illustrative rather than literal agent logs: each example includes a representative user request, the `npx @ton/mcp@alpha` commands an agent would typically run, and the kind of response it would usually return.
4
+
5
+ ## Agentic Wallets
6
+
7
+ ### Create an agentic wallet
8
+
9
+ **User request**
10
+
11
+ `Create an agentic wallet`
12
+
13
+ **Approximate command list**
14
+
15
+ ```bash
16
+ npx @ton/mcp@alpha agentic_start_root_wallet_setup --name "My Agent" --network mainnet
17
+ open <DASHBOARD_URL>
18
+ npx @ton/mcp@alpha agentic_complete_root_wallet_setup --setupId <SETUP_ID> --walletAddress <WALLET_ADDRESS>
19
+ npx @ton/mcp@alpha get_current_wallet
20
+ ```
21
+
22
+ **Approximate agent response**
23
+
24
+ > A new agentic wallet setup was started, and the dashboard link was opened. After the dashboard step was completed, wallet `EQ...` was added and set as the active wallet.
25
+
26
+ ### Import an existing agentic wallet
27
+
28
+ **User request**
29
+
30
+ `Import my existing agentic wallet EQ...`
31
+
32
+ **Approximate command list**
33
+
34
+ ```bash
35
+ npx @ton/mcp@alpha agentic_validate_wallet --address EQ...
36
+ npx @ton/mcp@alpha agentic_import_wallet --address EQ... --name "Imported wallet"
37
+ npx @ton/mcp@alpha agentic_rotate_operator_key --walletSelector "Imported wallet"
38
+ open <DASHBOARD_URL>
39
+ npx @ton/mcp@alpha list_wallets
40
+ ```
41
+
42
+ **Approximate agent response**
43
+
44
+ > Wallet `EQ...` was validated and imported into the local registry under the name `Imported wallet`. The dashboard link for the `Public Key` update was opened. Until that on-chain confirmation is completed, the wallet is available in read-only mode.
45
+
46
+ ### Rotate the operator key
47
+
48
+ **User request**
49
+
50
+ `Rotate the operator key for the active agentic wallet`
51
+
52
+ **Approximate command list**
53
+
54
+ ```bash
55
+ npx @ton/mcp@alpha agentic_rotate_operator_key
56
+ open <DASHBOARD_URL>
57
+ npx @ton/mcp@alpha agentic_get_pending_operator_key_rotation --rotationId <ROTATION_ID>
58
+ npx @ton/mcp@alpha agentic_complete_rotate_operator_key --rotationId <ROTATION_ID>
59
+ ```
60
+
61
+ **Approximate agent response**
62
+
63
+ > The dashboard link for the `Public Key` update was opened. After the main wallet confirms the change, write access is restored.
64
+
65
+ ### List agentic wallets by owner
66
+
67
+ **User request**
68
+
69
+ `Which agentic wallets belong to owner address EQ...?`
70
+
71
+ **Approximate command list**
72
+
73
+ ```bash
74
+ npx @ton/mcp@alpha agentic_list_wallets_by_owner --ownerAddress EQ...
75
+ ```
76
+
77
+ **Approximate agent response**
78
+
79
+ > Several agentic wallets were found for owner address `EQ...`. For each wallet, the agent typically shows the wallet address and basic metadata.
80
+
81
+ ## Wallet Registry and Balances
82
+
83
+ ### List wallets in the registry
84
+
85
+ **User request**
86
+
87
+ `Which wallets do I have?`
88
+
89
+ **Approximate command list**
90
+
91
+ ```bash
92
+ npx @ton/mcp@alpha list_wallets
93
+ npx @ton/mcp@alpha get_current_wallet
94
+ ```
95
+
96
+ **Approximate agent response**
97
+
98
+ > Several wallets were found. The active wallet is `EQ...`. The others can be selected by `id`, name, or address via `set_active_wallet`.
99
+
100
+ ### Switch the active wallet
101
+
102
+ **User request**
103
+
104
+ `Make wallet "treasury" active`
105
+
106
+ **Approximate command list**
107
+
108
+ ```bash
109
+ npx @ton/mcp@alpha set_active_wallet --walletSelector treasury
110
+ npx @ton/mcp@alpha get_current_wallet
111
+ ```
112
+
113
+ **Approximate agent response**
114
+
115
+ > The active wallet was switched to `treasury`. Current address: `UQ...`. Network: `mainnet`.
116
+
117
+ ### Show the active wallet balance
118
+
119
+ **User request**
120
+
121
+ `Show my balance in TON and jettons`
122
+
123
+ **Approximate command list**
124
+
125
+ ```bash
126
+ npx @ton/mcp@alpha get_balance
127
+ npx @ton/mcp@alpha get_jettons
128
+ ```
129
+
130
+ **Approximate agent response**
131
+
132
+ > Active wallet balance: `12.84 TON`. Jetton balances include `USDT 53.2`, `NOT 1400`, and `STON 18.05`.
133
+
134
+ ### Show the balance of any address
135
+
136
+ **User request**
137
+
138
+ `Show the balance of address EQ...`
139
+
140
+ **Approximate command list**
141
+
142
+ ```bash
143
+ npx @ton/mcp@alpha get_balance_by_address --address EQ...
144
+ npx @ton/mcp@alpha get_jettons_by_address --address EQ...
145
+ ```
146
+
147
+ **Approximate agent response**
148
+
149
+ > Address `EQ...` has a balance of `3.21 TON`. No jettons were found for that address.
150
+
151
+ ### Find a known jetton address
152
+
153
+ **User request**
154
+
155
+ `Show the address of USDT`
156
+
157
+ **Approximate command list**
158
+
159
+ ```bash
160
+ npx @ton/mcp@alpha get_known_jettons
161
+ ```
162
+
163
+ **Approximate agent response**
164
+
165
+ > `USDT` was found in the list of known jettons with master contract address `EQ...`. That address can be used with `send_jetton` or `get_swap_quote`.
166
+
167
+ ## Transfers and Swaps
168
+
169
+ ### Send TON to a TON DNS name
170
+
171
+ **User request**
172
+
173
+ `Send 1 TON to foundation.ton`
174
+
175
+ **Approximate command list**
176
+
177
+ ```bash
178
+ npx @ton/mcp@alpha resolve_dns --domain foundation.ton
179
+ npx @ton/mcp@alpha send_ton --toAddress EQ... --amount 1
180
+ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>
181
+ ```
182
+
183
+ **Approximate agent response**
184
+
185
+ > `foundation.ton` was resolved to TON address `EQ...`. The `1 TON` transfer was sent with `normalizedHash: <NORMALIZED_HASH>`. Transaction status: `completed`.
186
+
187
+ ### Send a jetton
188
+
189
+ **User request**
190
+
191
+ `Send 25 USDT to UQAbc...`
192
+
193
+ **Approximate command list**
194
+
195
+ ```bash
196
+ npx @ton/mcp@alpha get_jettons
197
+ npx @ton/mcp@alpha send_jetton --jettonAddress EQ... --toAddress UQAbc... --amount 25
198
+ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>
199
+ ```
200
+
201
+ **Approximate agent response**
202
+
203
+ > `USDT` was found in the wallet, and the `25 USDT` transfer to `UQAbc...` was sent. `normalizedHash: <NORMALIZED_HASH>`. Current status: `completed`.
204
+
205
+ ### Swap TON for a jetton
206
+
207
+ **User request**
208
+
209
+ `Swap 2 TON to USDT`
210
+
211
+ **Approximate command list**
212
+
213
+ ```bash
214
+ npx @ton/mcp@alpha get_known_jettons
215
+ # quote
216
+ npx @ton/mcp@alpha get_swap_quote --fromToken TON --toToken EQ... --amount 2 --slippageBps 100
217
+ # pass messages from quote if user approved
218
+ npx @ton/mcp@alpha send_raw_transaction --messages '<quote.transaction.messages>'
219
+ # If the quote includes transaction.validUntil, add --validUntil to the send_raw_transaction invocation above
220
+ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>
221
+ ```
222
+
223
+ **Approximate agent response**
224
+
225
+ > A quote was received for swapping `2 TON` to `USDT`. After confirmation, the swap was executed with an expected output of about `X USDT` after slippage. `normalizedHash: <NORMALIZED_HASH>`.
226
+
227
+ ### Show recent transactions
228
+
229
+ **User request**
230
+
231
+ `Show my last 5 transactions`
232
+
233
+ **Approximate command list**
234
+
235
+ ```bash
236
+ npx @ton/mcp@alpha get_transactions --limit 5
237
+ ```
238
+
239
+ **Approximate agent response**
240
+
241
+ > The last 5 operations were shown, including incoming and outgoing TON transfers, jetton transfers, and swaps. For each transaction, the agent typically shows the time, action type, amount, and final status.
242
+
243
+ ## TON DNS
244
+
245
+ ### Resolve a TON DNS name
246
+
247
+ **User request**
248
+
249
+ `What does foundation.ton resolve to?`
250
+
251
+ **Approximate command list**
252
+
253
+ ```bash
254
+ npx @ton/mcp@alpha resolve_dns --domain foundation.ton
255
+ ```
256
+
257
+ **Approximate agent response**
258
+
259
+ > Domain `foundation.ton` resolves to address `EQ...`.
260
+
261
+ ### Reverse-resolve an address
262
+
263
+ **User request**
264
+
265
+ `Does address EQ... have a TON DNS name?`
266
+
267
+ **Approximate command list**
268
+
269
+ ```bash
270
+ npx @ton/mcp@alpha back_resolve_dns --address EQ...
271
+ ```
272
+
273
+ **Approximate agent response**
274
+
275
+ > If reverse resolution succeeds, address `EQ...` maps to a DNS name such as `foundation.ton`. Otherwise, the agent reports that no DNS name was found.
276
+
277
+ ## NFTs
278
+
279
+ ### List NFTs in the active wallet
280
+
281
+ **User request**
282
+
283
+ `Show my NFTs`
284
+
285
+ **Approximate command list**
286
+
287
+ ```bash
288
+ npx @ton/mcp@alpha get_nfts --limit 20
289
+ ```
290
+
291
+ **Approximate agent response**
292
+
293
+ > A list of NFTs from the active wallet was shown, including addresses, collection names, preview metadata, and key attributes.
294
+
295
+ ### Show NFT details
296
+
297
+ **User request**
298
+
299
+ `Show details for NFT EQ...`
300
+
301
+ **Approximate command list**
302
+
303
+ ```bash
304
+ npx @ton/mcp@alpha get_nft --nftAddress EQ...
305
+ ```
306
+
307
+ **Approximate agent response**
308
+
309
+ > For NFT `EQ...`, the agent shows metadata, collection information, owner, content URI, and attributes.
310
+
311
+ ### Send an NFT
312
+
313
+ **User request**
314
+
315
+ `Send NFT EQ... to UQReceiver...`
316
+
317
+ **Approximate command list**
318
+
319
+ ```bash
320
+ npx @ton/mcp@alpha send_nft --nftAddress EQ... --toAddress UQReceiver...
321
+ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>
322
+ ```
323
+
324
+ **Approximate agent response**
325
+
326
+ > NFT `EQ...` was sent to `UQReceiver...`. `normalizedHash: <NORMALIZED_HASH>`. Transaction status: `completed`.
327
+
328
+ ### Show NFTs owned by any address
329
+
330
+ **User request**
331
+
332
+ `Show NFTs owned by address EQ...`
333
+
334
+ **Approximate command list**
335
+
336
+ ```bash
337
+ npx @ton/mcp@alpha get_nfts_by_address --address EQ... --limit 10
338
+ ```
339
+
340
+ **Approximate agent response**
341
+
342
+ > NFTs owned by address `EQ...` were shown, even though that address is not one of the saved wallets.
package/bin/mcp.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync } from 'node:fs';
4
+ import path from 'node:path';
5
+ import { fileURLToPath, pathToFileURL } from 'node:url';
6
+
7
+ const binDir = path.dirname(fileURLToPath(import.meta.url));
8
+ const cliEntrypoint = path.resolve(binDir, '../dist/cli.js');
9
+
10
+ if (!existsSync(cliEntrypoint)) {
11
+ process.stderr.write(
12
+ 'The @ton/mcp CLI has not been built yet. Run `pnpm --filter @ton/mcp build` from the workspace root and retry.\n',
13
+ );
14
+ process.exit(1);
15
+ }
16
+
17
+ await import(pathToFileURL(cliEntrypoint).href);
package/dist/cli.d.ts CHANGED
@@ -5,5 +5,33 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export {};
8
+ /**
9
+ * TON MCP CLI - Command-line MCP server for TON wallet management
10
+ *
11
+ * This CLI runs a Model Context Protocol server that provides
12
+ * TON wallet management tools for use with Claude Desktop or other MCP clients.
13
+ *
14
+ * Usage:
15
+ * npx @ton/mcp@alpha # stdio mode (default)
16
+ * npx @ton/mcp@alpha --http # HTTP server on 0.0.0.0:3000
17
+ * npx @ton/mcp@alpha --http 8080 # HTTP server on custom port
18
+ * npx @ton/mcp@alpha --http --host 127.0.0.1 # HTTP server on custom host
19
+ * npx @ton/mcp@alpha get_balance # raw CLI: call tool and exit
20
+ * npx @ton/mcp@alpha get_transactions --limit 5
21
+ * npx @ton/mcp@alpha get_jetton_balance --jettonAddress EQAbc...
22
+ *
23
+ * Environment variables:
24
+ * NETWORK - Network to use (mainnet or testnet, default: mainnet)
25
+ * MNEMONIC - 24-word mnemonic phrase for wallet
26
+ * PRIVATE_KEY - Hex-encoded private key (alternative to MNEMONIC)
27
+ * WALLET_VERSION - Wallet version (v5r1, v4r2, or agentic; default: v5r1)
28
+ * AGENTIC_WALLET_ADDRESS - Agentic wallet address (required for WALLET_VERSION=agentic unless derived from init params)
29
+ * AGENTIC_WALLET_NFT_INDEX - walletNftIndex / subwallet id for agentic wallet (uint256, optional)
30
+ * AGENTIC_COLLECTION_ADDRESS - collection address for agentic wallet state init derivation (optional)
31
+ * TONCENTER_API_KEY - API key for Toncenter (optional, for higher rate limits)
32
+ * AGENTIC_CALLBACK_BASE_URL - optional public callback base URL for agentic onboarding
33
+ * AGENTIC_CALLBACK_HOST - host for local callback server in stdio mode (default: 127.0.0.1)
34
+ * AGENTIC_CALLBACK_PORT - port for local callback server in stdio mode (default: random free port)
35
+ */
36
+ import './suppress-punycode-deprecation.js';
9
37
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,oCAAoC,CAAC"}