@ton/mcp 0.1.15-alpha.4 → 0.1.15-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/USAGE_EXAMPLES.md +342 -0
- package/dist/cli.d.ts +29 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +26205 -1926
- package/dist/index.cjs +26149 -1850
- package/dist/index.js +26129 -1830
- package/dist/serverless.cjs +26152 -1853
- package/dist/serverless.js +26132 -1833
- package/dist/suppress-punycode-deprecation.d.ts +9 -0
- package/dist/suppress-punycode-deprecation.d.ts.map +1 -0
- package/dist/tools/agentic-onboarding-tools.d.ts +4 -4
- package/dist/tools/wallet-management-tools.d.ts +4 -4
- package/dist/utils/proxy.d.ts +9 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/ton-client.d.ts.map +1 -1
- package/llms.txt +14 -8
- package/package.json +8 -3
- package/skills/ton-cli/SKILL.md +4 -1
- package/skills/ton-create-wallet/SKILL.md +10 -8
- package/skills/ton-manage-wallets/SKILL.md +5 -2
- package/skills/ton-nfts/SKILL.md +2 -2
- package/skills/ton-send/SKILL.md +3 -3
- package/skills/ton-swap/SKILL.md +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ A Model Context Protocol (MCP) server for TON blockchain wallet operations. Buil
|
|
|
20
20
|
- **Agentic Wallets mode**: Server starts from local config registry at `~/.config/ton/config.json` or `TON_CONFIG_PATH`
|
|
21
21
|
- **Single-wallet mode**: if `MNEMONIC` or `PRIVATE_KEY` is set, the server starts with one in-memory wallet
|
|
22
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
|
+
|
|
23
25
|
### Agentic Wallets mode
|
|
24
26
|
|
|
25
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.
|
|
@@ -106,6 +108,10 @@ npx @ton/mcp@alpha --http 3000
|
|
|
106
108
|
|
|
107
109
|
HTTP mode keeps a separate MCP session/transport per client session id, so multiple clients can initialize and reconnect independently.
|
|
108
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
|
+
|
|
109
115
|
## Environment Variables
|
|
110
116
|
|
|
111
117
|
| Variable | Default | Description |
|
|
@@ -321,7 +327,7 @@ Import an existing agentic wallet into the local TON config registry, recovering
|
|
|
321
327
|
- `name` (optional): Wallet display name
|
|
322
328
|
|
|
323
329
|
#### `agentic_start_root_wallet_setup` (registry mode only)
|
|
324
|
-
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.
|
|
325
331
|
|
|
326
332
|
**Parameters:**
|
|
327
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/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
|
-
|
|
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"}
|