@ton/mcp 0.1.15-alpha.2 → 0.1.15-alpha.21
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 +34 -3
- package/USAGE_EXAMPLES.md +360 -0
- package/dist/cli.d.ts +29 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +36643 -8054
- package/dist/contracts/agentic_wallet/AgenticWalletAdapter.d.ts +17 -10
- package/dist/contracts/agentic_wallet/AgenticWalletAdapter.d.ts.map +1 -1
- package/dist/factory.d.ts +5 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/index.cjs +36604 -8026
- package/dist/index.js +36569 -7995
- package/dist/registry/config.d.ts +4 -1
- package/dist/registry/config.d.ts.map +1 -1
- package/dist/registry/protected-file.d.ts +16 -0
- package/dist/registry/protected-file.d.ts.map +1 -0
- package/dist/runtime/wallet-runtime.d.ts +3 -1
- package/dist/runtime/wallet-runtime.d.ts.map +1 -1
- package/dist/serverless.cjs +36784 -8206
- package/dist/serverless.js +36749 -8175
- package/dist/services/AgenticSetupSessionManager.d.ts +8 -7
- package/dist/services/AgenticSetupSessionManager.d.ts.map +1 -1
- package/dist/services/McpWalletService.d.ts +34 -1
- package/dist/services/McpWalletService.d.ts.map +1 -1
- package/dist/services/WalletRegistryService.d.ts +3 -1
- package/dist/services/WalletRegistryService.d.ts.map +1 -1
- package/dist/suppress-punycode-deprecation.d.ts +9 -0
- package/dist/suppress-punycode-deprecation.d.ts.map +1 -0
- package/dist/tools/address-tools.d.ts +6 -6
- package/dist/tools/address-tools.d.ts.map +1 -1
- package/dist/tools/agentic-onboarding-tools.d.ts +4 -4
- package/dist/tools/balance-tools.d.ts.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/sanitize.d.ts.map +1 -1
- package/dist/tools/ton-proof-tools.d.ts +37 -0
- package/dist/tools/ton-proof-tools.d.ts.map +1 -0
- package/dist/tools/transfer-tools.d.ts +74 -0
- package/dist/tools/transfer-tools.d.ts.map +1 -1
- package/dist/tools/wallet-management-tools.d.ts +4 -4
- package/dist/utils/agentic.d.ts +1 -0
- package/dist/utils/agentic.d.ts.map +1 -1
- 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 +39 -10
- package/package.json +23 -12
- package/skills/ton-balance/SKILL.md +4 -4
- package/skills/ton-cli/SKILL.md +30 -13
- package/skills/ton-create-wallet/SKILL.md +11 -9
- package/skills/ton-manage-wallets/SKILL.md +5 -2
- package/skills/ton-nfts/SKILL.md +4 -2
- package/skills/ton-proof/SKILL.md +46 -0
- package/skills/ton-send/SKILL.md +5 -3
- package/skills/ton-swap/SKILL.md +6 -4
- package/skills/ton-xstocks/SKILL.md +111 -0
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ton/mcp",
|
|
3
|
-
"version": "0.1.15-alpha.
|
|
3
|
+
"version": "0.1.15-alpha.21",
|
|
4
4
|
"description": "TON MCP Server - Model Context Protocol server for TON blockchain wallet operations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.cjs",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
|
-
"bin": "./bin/mcp.js",
|
|
11
10
|
"exports": {
|
|
12
11
|
".": {
|
|
13
12
|
"import": {
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
"dist",
|
|
39
38
|
"skills",
|
|
40
39
|
"llms.txt",
|
|
40
|
+
"USAGE_EXAMPLES.md",
|
|
41
41
|
"README.md"
|
|
42
42
|
],
|
|
43
43
|
"keywords": [
|
|
@@ -50,29 +50,36 @@
|
|
|
50
50
|
"author": "TON Tech",
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
|
-
"url": "https://github.com/ton-
|
|
53
|
+
"url": "https://github.com/ton-org/kit"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
56
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
57
|
+
"@ston-fi/omniston-sdk": "^0.7.9",
|
|
58
|
+
"@ton/core": "^0.63.1",
|
|
59
|
+
"@ton/crypto": "^3.3.0",
|
|
60
|
+
"https-proxy-agent": "^9.0.0",
|
|
61
|
+
"undici": "8.0.2",
|
|
62
|
+
"ws": "^8.20.0",
|
|
57
63
|
"zod": "^3.25.76",
|
|
58
|
-
"@ton/walletkit": "0.0
|
|
64
|
+
"@ton/walletkit": "1.0.0"
|
|
59
65
|
},
|
|
60
66
|
"peerDependencies": {
|
|
61
67
|
"@modelcontextprotocol/sdk": "^1.25.1"
|
|
62
68
|
},
|
|
63
69
|
"devDependencies": {
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
+
"@types/node": "^25.6.0",
|
|
71
|
+
"@types/ws": "^8.18.1",
|
|
72
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
73
|
+
"rimraf": "6.1.3",
|
|
74
|
+
"rolldown": "1.0.2",
|
|
75
|
+
"typescript": "5.9.3",
|
|
76
|
+
"vitest": "^4.1.4"
|
|
70
77
|
},
|
|
71
78
|
"engines": {
|
|
72
79
|
"node": ">=18.0.0"
|
|
73
80
|
},
|
|
74
81
|
"scripts": {
|
|
75
|
-
"build": "pnpm build:clean && rolldown -c && pnpm build:types
|
|
82
|
+
"build": "pnpm build:clean && rolldown -c && pnpm build:types",
|
|
76
83
|
"build:clean": "rimraf dist",
|
|
77
84
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
78
85
|
"build:chmod": "chmod +x dist/cli.js",
|
|
@@ -82,6 +89,10 @@
|
|
|
82
89
|
"lint": "eslint src --max-warnings 0",
|
|
83
90
|
"lint:fix": "eslint src --max-warnings 0 --fix",
|
|
84
91
|
"test": "vitest run",
|
|
92
|
+
"clean": "git clean -xdf dist node_modules .turbo",
|
|
85
93
|
"typecheck": "tsc --noEmit"
|
|
94
|
+
},
|
|
95
|
+
"bin": {
|
|
96
|
+
"mcp": "./bin/mcp.js"
|
|
86
97
|
}
|
|
87
98
|
}
|
|
@@ -15,11 +15,11 @@ Read-only queries for wallet balances, token holdings, and transaction history o
|
|
|
15
15
|
| ---- | -------- | -------- |
|
|
16
16
|
| `get_wallet` | — | `walletSelector` |
|
|
17
17
|
| `get_balance` | — | `walletSelector` |
|
|
18
|
-
| `get_balance_by_address` | `address` |
|
|
18
|
+
| `get_balance_by_address` | `address` | `walletSelector` |
|
|
19
19
|
| `get_jetton_balance` | `jettonAddress` | `walletSelector` |
|
|
20
20
|
| `get_jettons` | — | `walletSelector` |
|
|
21
|
-
| `get_jettons_by_address` | `address` |
|
|
22
|
-
| `get_jetton_info` | `
|
|
21
|
+
| `get_jettons_by_address` | `address` | `limit`, `offset`, `walletSelector` |
|
|
22
|
+
| `get_jetton_info` | `jettonAddress` | `walletSelector` |
|
|
23
23
|
| `get_known_jettons` | — | — |
|
|
24
24
|
| `get_transactions` | — | `limit`, `walletSelector` |
|
|
25
25
|
| `get_transaction_status` | `normalizedHash` | `walletSelector` |
|
|
@@ -45,4 +45,4 @@ Read-only queries for wallet balances, token holdings, and transaction history o
|
|
|
45
45
|
|
|
46
46
|
- All tools are read-only — no confirmation needed
|
|
47
47
|
- In registry mode, pass `walletSelector` to query a specific wallet instead of the active one
|
|
48
|
-
-
|
|
48
|
+
- All balance responses include both `amountRaw` (raw integer string) and `amount` (human-readable decimal string, e.g. `"1.5"` for 1.5 TON). Use `amount` for display; use `amountRaw` only when a raw integer is required.
|
package/skills/ton-cli/SKILL.md
CHANGED
|
@@ -18,6 +18,8 @@ Run any TON wallet MCP tool directly from the command line. The binary invokes t
|
|
|
18
18
|
| `npx @ton/mcp@alpha --http [port]` | HTTP MCP server |
|
|
19
19
|
| `npx @ton/mcp@alpha <tool_name> [--arg value ...]` | **Raw CLI: call one tool and exit** |
|
|
20
20
|
|
|
21
|
+
Use exactly one mode for a given workflow: either MCP server mode (`stdio`/`--http`) or raw CLI. Do not combine them in the same task/session.
|
|
22
|
+
|
|
21
23
|
## Raw CLI Usage
|
|
22
24
|
|
|
23
25
|
```bash
|
|
@@ -31,6 +33,7 @@ npx @ton/mcp@alpha get_jetton_balance --jettonAddress EQAbc...
|
|
|
31
33
|
# All values are passed as plain strings; JSON objects/arrays are also accepted
|
|
32
34
|
npx @ton/mcp@alpha get_transactions --limit 10
|
|
33
35
|
npx @ton/mcp@alpha send_ton --toAddress UQA... --amount 0.1 --comment "hi"
|
|
36
|
+
npx @ton/mcp@alpha generate_ton_proof --domain getgems.io --payload getgems-llm
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
Arguments are passed as `--key value` pairs. Objects/arrays (`{...}` / `[...]`) are JSON-parsed; everything else is kept as a plain string.
|
|
@@ -68,11 +71,11 @@ Without `MNEMONIC` or `PRIVATE_KEY`, the CLI uses the local config registry at `
|
|
|
68
71
|
| ---- | ------------- | ------------- |
|
|
69
72
|
| `get_wallet` | — | `--walletSelector` |
|
|
70
73
|
| `get_balance` | — | `--walletSelector` |
|
|
71
|
-
| `get_balance_by_address` | `--address` |
|
|
74
|
+
| `get_balance_by_address` | `--address` | `--walletSelector` |
|
|
72
75
|
| `get_jetton_balance` | `--jettonAddress` | `--walletSelector` |
|
|
73
76
|
| `get_jettons` | — | `--walletSelector` |
|
|
74
|
-
| `get_jettons_by_address` | `--address` |
|
|
75
|
-
| `get_jetton_info` | `--jettonAddress` |
|
|
77
|
+
| `get_jettons_by_address` | `--address` | `--limit`, `--offset`, `--walletSelector` |
|
|
78
|
+
| `get_jetton_info` | `--jettonAddress` | `--walletSelector` |
|
|
76
79
|
| `get_transactions` | — | `--limit`, `--walletSelector` |
|
|
77
80
|
| `get_transaction_status` | `--normalizedHash` | `--walletSelector` |
|
|
78
81
|
| `get_known_jettons` | — | — |
|
|
@@ -93,28 +96,35 @@ Without `MNEMONIC` or `PRIVATE_KEY`, the CLI uses the local config registry at `
|
|
|
93
96
|
| `send_ton` | `--toAddress`, `--amount` | `--comment`, `--walletSelector` |
|
|
94
97
|
| `send_jetton` | `--toAddress`, `--jettonAddress`, `--amount` | `--comment`, `--walletSelector` |
|
|
95
98
|
| `send_nft` | `--nftAddress`, `--toAddress` | `--comment`, `--walletSelector` |
|
|
96
|
-
| `send_raw_transaction` | `--messages` | `--walletSelector` |
|
|
99
|
+
| `send_raw_transaction` | `--messages` | `--validUntil`, `--fromAddress`, `--walletSelector` |
|
|
100
|
+
| `emulate_transaction` | `--messages` | `--validUntil`, `--walletSelector` |
|
|
97
101
|
|
|
98
102
|
### Swaps
|
|
99
103
|
|
|
100
104
|
| Tool | Required args | Optional args |
|
|
101
105
|
| ---- | ------------- | ------------- |
|
|
102
|
-
| `get_swap_quote` | `--fromToken`, `--toToken`, `--amount` | `--walletSelector` |
|
|
106
|
+
| `get_swap_quote` | `--fromToken`, `--toToken`, `--amount` | `--slippageBps`, `--walletSelector` |
|
|
103
107
|
|
|
104
108
|
### NFTs
|
|
105
109
|
|
|
106
110
|
| Tool | Required args | Optional args |
|
|
107
111
|
| ---- | ------------- | ------------- |
|
|
108
112
|
| `get_nfts` | — | `--limit`, `--offset`, `--walletSelector` |
|
|
109
|
-
| `get_nfts_by_address` | `--address` | `--limit`, `--offset` |
|
|
110
|
-
| `get_nft` | `--nftAddress` |
|
|
113
|
+
| `get_nfts_by_address` | `--address` | `--limit`, `--offset`, `--walletSelector` |
|
|
114
|
+
| `get_nft` | `--nftAddress` | `--walletSelector` |
|
|
111
115
|
|
|
112
116
|
### DNS
|
|
113
117
|
|
|
114
|
-
| Tool | Required args |
|
|
115
|
-
| ---- | ------------- |
|
|
116
|
-
| `resolve_dns` | `--domain` |
|
|
117
|
-
| `back_resolve_dns` | `--address` |
|
|
118
|
+
| Tool | Required args | Optional args |
|
|
119
|
+
| ---- | ------------- | ------------- |
|
|
120
|
+
| `resolve_dns` | `--domain` | `--walletSelector` |
|
|
121
|
+
| `back_resolve_dns` | `--address` | `--walletSelector` |
|
|
122
|
+
|
|
123
|
+
### Authentication
|
|
124
|
+
|
|
125
|
+
| Tool | Required args | Optional args |
|
|
126
|
+
| ---- | ------------- | ------------- |
|
|
127
|
+
| `generate_ton_proof` | `--domain`, `--payload` | `--walletSelector` |
|
|
118
128
|
|
|
119
129
|
## Example Session
|
|
120
130
|
|
|
@@ -132,7 +142,7 @@ npx @ton/mcp@alpha get_jettons
|
|
|
132
142
|
npx @ton/mcp@alpha get_transactions --limit 10
|
|
133
143
|
|
|
134
144
|
# Get balance of a specific jetton
|
|
135
|
-
npx @ton/mcp@alpha get_jetton_balance --
|
|
145
|
+
npx @ton/mcp@alpha get_jetton_balance --jettonAddress EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs
|
|
136
146
|
|
|
137
147
|
# Resolve a .ton domain
|
|
138
148
|
npx @ton/mcp@alpha resolve_dns --domain foundation.ton
|
|
@@ -148,10 +158,17 @@ npx @ton/mcp@alpha send_ton --toAddress UQA... --amount 0.5 --comment "payment"
|
|
|
148
158
|
|
|
149
159
|
# Swap quote
|
|
150
160
|
npx @ton/mcp@alpha get_swap_quote --fromToken TON --toToken EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs --amount 1
|
|
161
|
+
|
|
162
|
+
# Generate a TonProof for a service challenge
|
|
163
|
+
npx @ton/mcp@alpha generate_ton_proof --domain getgems.io --payload getgems-llm
|
|
151
164
|
```
|
|
152
165
|
|
|
153
166
|
## Notes
|
|
154
167
|
|
|
155
|
-
-
|
|
168
|
+
- Use `emulate_transaction` to dry-run any transaction before sending — it returns expected balance changes, fees, and high-level actions
|
|
169
|
+
- Use `generate_ton_proof` only with the exact domain and payload supplied by the user or verifying service; do not alter the payload before signing
|
|
170
|
+
- `generate_ton_proof` requires signing access even though it does not broadcast a transaction
|
|
171
|
+
- Always confirm with the user before running `send_ton`, `send_jetton`, `send_nft`, or `send_raw_transaction`;
|
|
172
|
+
- For confirmations and small option sets, prefer the host client's structured confirmation/choice UI when available; otherwise use a short natural-language yes/no prompt and never require an exact magic word;
|
|
156
173
|
- After sending, poll `get_transaction_status --normalizedHash <hash>` until status is `completed` or `failed` (unless the user asks to skip).
|
|
157
174
|
- In registry mode the active wallet from `~/.config/ton/config.json` is used by default.
|
|
@@ -7,7 +7,7 @@ disable-model-invocation: false
|
|
|
7
7
|
|
|
8
8
|
# Create TON Agentic Wallet
|
|
9
9
|
|
|
10
|
-
Deploy an on-chain agentic wallet on TON. The agent generates operator keys, the
|
|
10
|
+
Deploy an on-chain agentic wallet on TON. The agent generates operator keys, opens the dashboard when local browser/shell tools are available, and uses callback-based completion only in long-lived stdio/HTTP MCP server sessions.
|
|
11
11
|
|
|
12
12
|
## MCP Tools
|
|
13
13
|
|
|
@@ -30,18 +30,19 @@ Deploy an on-chain agentic wallet on TON. The agent generates operator keys, the
|
|
|
30
30
|
|
|
31
31
|
## Workflow
|
|
32
32
|
|
|
33
|
-
1. Call `agentic_start_root_wallet_setup` — this generates an operator key pair and returns a `setupId` and `
|
|
34
|
-
2.
|
|
35
|
-
3.
|
|
36
|
-
4.
|
|
37
|
-
5.
|
|
33
|
+
1. Call `agentic_start_root_wallet_setup` — this generates an operator key pair and returns a `setupId`, `dashboardUrl`, and `callbackUrl`
|
|
34
|
+
2. If the environment exposes local browser or shell tools, open `dashboardUrl` yourself with the platform opener (`open`, `xdg-open`, `start`) or browser automation; only paste the link to the user if automatic opening is unavailable or fails
|
|
35
|
+
3. Tell the user only to approve wallet deployment from their main TON wallet; do not ask them to retype the URL or copy intermediate data
|
|
36
|
+
4. In long-lived stdio/HTTP MCP server sessions, poll `agentic_get_root_wallet_setup` or `agentic_list_pending_root_wallet_setups` and wait for `status: "callback_received"` when callback flow is available; then call `agentic_complete_root_wallet_setup` with `setupId`;
|
|
37
|
+
5. In raw one-shot CLI usage, skip callback polling and ask for `walletAddress` after the user deploys the wallet; then call `agentic_complete_root_wallet_setup` with `walletAddress`
|
|
38
|
+
6. Confirm the wallet is active with `get_current_wallet` or `list_wallets` (see `ton-manage-wallets` skill)
|
|
38
39
|
|
|
39
40
|
## How It Works
|
|
40
41
|
|
|
41
42
|
- The agent keeps the **operator private key** — it can sign transactions autonomously
|
|
42
43
|
- The user keeps the **owner key** — they can withdraw funds or revoke access at any time
|
|
43
44
|
- The wallet is an on-chain smart contract (NFT-based), not a custodial service
|
|
44
|
-
- The dashboard is at `
|
|
45
|
+
- The dashboard is at `agents.ton.org`
|
|
45
46
|
|
|
46
47
|
## Environment Variables
|
|
47
48
|
|
|
@@ -53,6 +54,7 @@ Deploy an on-chain agentic wallet on TON. The agent generates operator keys, the
|
|
|
53
54
|
|
|
54
55
|
## Notes
|
|
55
56
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
57
|
+
- Callback-driven completion is for long-lived stdio/HTTP MCP server sessions; raw CLI should use manual `walletAddress` completion
|
|
58
|
+
- If automatic dashboard opening is supported in the current environment, do it instead of asking the user to open the URL manually
|
|
59
|
+
- In raw CLI mode, ask for the wallet address after deployment because the callback server is not available long enough to complete the flow
|
|
58
60
|
- After wallet creation, fund the wallet with TON before using transfer or swap skills
|
|
@@ -44,13 +44,16 @@ Manage the local wallet registry and perform advanced agentic wallet operations
|
|
|
44
44
|
|
|
45
45
|
### Rotate Operator Key
|
|
46
46
|
1. Call `agentic_rotate_operator_key` — generates a new key pair and returns a dashboard URL for the user to apply the change on-chain
|
|
47
|
-
2.
|
|
48
|
-
3.
|
|
47
|
+
2. If local browser or shell tools are available, open the dashboard URL yourself; only send the raw link when automatic opening is unavailable or fails
|
|
48
|
+
3. Ask the user only to approve the on-chain key change in their wallet; do not require them to re-paste the URL or type a fixed confirmation phrase
|
|
49
|
+
4. Call `agentic_complete_rotate_operator_key` with the `rotationId`; if the chain state has not updated yet, wait briefly and retry instead of forcing extra user input
|
|
49
50
|
|
|
50
51
|
## Notes
|
|
51
52
|
|
|
52
53
|
- `walletSelector` accepts wallet id, name, or address
|
|
53
54
|
- For one-off queries, pass `walletSelector` directly to wallet-scoped tools instead of changing the active wallet
|
|
55
|
+
- Use available shell/browser tools to open dashboard URLs for the user whenever possible
|
|
56
|
+
- For confirmations and small option sets, prefer the host client's structured confirmation/choice UI when available; otherwise use a short natural-language yes/no prompt and never require an exact magic word
|
|
54
57
|
- Registry data is stored in `~/.config/ton/config.json` (or `TON_CONFIG_PATH`)
|
|
55
58
|
- Read tools work with imported agentic wallets that don't yet have an `operator_private_key`; write tools require it
|
|
56
59
|
- Management tool responses never expose private keys, mnemonics, or API keys
|
package/skills/ton-nfts/SKILL.md
CHANGED
|
@@ -17,6 +17,7 @@ View and transfer NFTs on the TON blockchain.
|
|
|
17
17
|
| `get_nfts_by_address` | `address` | `limit`, `offset` |
|
|
18
18
|
| `get_nft` | `nftAddress` | — |
|
|
19
19
|
| `send_nft` | `nftAddress`, `toAddress` | `comment`, `walletSelector` |
|
|
20
|
+
| `emulate_transaction` | `messages` | `validUntil` |
|
|
20
21
|
|
|
21
22
|
## Workflows
|
|
22
23
|
|
|
@@ -29,11 +30,12 @@ View and transfer NFTs on the TON blockchain.
|
|
|
29
30
|
|
|
30
31
|
### Send an NFT
|
|
31
32
|
1. Call `get_nfts` to find the NFT address if the user doesn't have it
|
|
32
|
-
2.
|
|
33
|
+
2. Ask one short yes/no confirmation before transferring the NFT
|
|
33
34
|
3. Call `send_nft` with `nftAddress` and `toAddress`
|
|
34
35
|
4. Poll `get_transaction_status` with the returned `normalizedHash` until status is `completed` or `failed` (see `ton-balance` skill)
|
|
35
36
|
|
|
36
37
|
## Notes
|
|
37
38
|
|
|
38
|
-
-
|
|
39
|
+
- Use `emulate_transaction` to dry-run any transaction before sending — it returns expected balance changes, fees, and high-level actions so you can verify the outcome
|
|
40
|
+
- Always confirm with the user before transferring an NFT; prefer the host client's structured confirmation UI when available, otherwise accept natural-language yes/no and do not require a fixed confirmation phrase
|
|
39
41
|
- If no wallet is configured, use the `ton-create-wallet` skill first
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ton-proof
|
|
3
|
+
description: Generate TonConnect TonProof signatures for third-party authentication. Use when the user wants to log in with a TON wallet, prove wallet ownership, authenticate to an API such as GetGems, or generate a TonProof for a domain and challenge payload.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# TON Proof Authentication
|
|
9
|
+
|
|
10
|
+
Generate a signed TonConnect proof-of-ownership payload for a domain and challenge string. This proves control of the active wallet without sending a transaction.
|
|
11
|
+
|
|
12
|
+
## MCP Tools
|
|
13
|
+
|
|
14
|
+
| Tool | Required | Optional |
|
|
15
|
+
| ---- | -------- | -------- |
|
|
16
|
+
| `generate_ton_proof` | `domain`, `payload` | `walletSelector` |
|
|
17
|
+
| `get_wallet` | — | `walletSelector` |
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. Get the exact `domain` and `payload` from the user or the verifying service
|
|
22
|
+
2. Do not edit, normalize, decode, or invent the payload; it is part of the signed proof
|
|
23
|
+
3. Ask one short yes/no confirmation before sending; If there are tools for dialogs/confirmation available, use them instead of a free-text prompt.
|
|
24
|
+
4. Call `generate_ton_proof` with the domain and payload
|
|
25
|
+
5. Return the proof JSON to the user, or submit it to the service only when the user explicitly asked for that integration step
|
|
26
|
+
|
|
27
|
+
## Output
|
|
28
|
+
|
|
29
|
+
The proof includes:
|
|
30
|
+
|
|
31
|
+
- `address`: active wallet address in raw format
|
|
32
|
+
- `chain`: TON Connect chain id (`-239` for mainnet, `-3` for testnet)
|
|
33
|
+
- `walletStateInit`: wallet state init in base64
|
|
34
|
+
- `publicKey`: wallet public key
|
|
35
|
+
- `timestamp`: Unix timestamp used in the proof
|
|
36
|
+
- `domainLengthBytes` and `domainValue`: signed domain metadata
|
|
37
|
+
- `signature`: base64 TonProof signature
|
|
38
|
+
- `payload`: original challenge payload
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- TonProof is for authentication and proof of wallet ownership; it does not transfer funds
|
|
43
|
+
- TonProof still requires signing access. Imported read-only agentic wallets need operator key rotation completed before this tool can generate a proof
|
|
44
|
+
- Only generate a proof for domains and payloads the user intentionally provided or that came directly from the verifying service
|
|
45
|
+
- If multiple wallets are configured, pass `walletSelector` instead of changing the active wallet for a one-off proof
|
|
46
|
+
- If no wallet is configured, use the `ton-create-wallet` skill first
|
package/skills/ton-send/SKILL.md
CHANGED
|
@@ -15,6 +15,7 @@ Transfer TON or jettons to any address. Supports TON DNS resolution for `.ton` a
|
|
|
15
15
|
| ---- | -------- | -------- |
|
|
16
16
|
| `send_ton` | `toAddress`, `amount` | `comment`, `walletSelector` |
|
|
17
17
|
| `send_jetton` | `toAddress`, `jettonAddress`, `amount` | `comment`, `walletSelector` |
|
|
18
|
+
| `emulate_transaction` | `messages` | `validUntil` |
|
|
18
19
|
| `resolve_dns` | `domain` | — |
|
|
19
20
|
| `back_resolve_dns` | `address` | — |
|
|
20
21
|
|
|
@@ -22,20 +23,21 @@ Transfer TON or jettons to any address. Supports TON DNS resolution for `.ton` a
|
|
|
22
23
|
|
|
23
24
|
### Send TON
|
|
24
25
|
1. If the user provides a DNS name (e.g., `foundation.ton`, `user.t.me`) instead of a raw address, call `resolve_dns` first
|
|
25
|
-
2.
|
|
26
|
+
2. Ask one short yes/no confirmation that restates the amount and recipient
|
|
26
27
|
3. Call `send_ton` with address and amount
|
|
27
28
|
4. Poll `get_transaction_status` with the returned `normalizedHash` until status is `completed` or `failed` (see `ton-balance` skill). User can ask to skip polling.
|
|
28
29
|
|
|
29
30
|
### Send Jetton (Token)
|
|
30
31
|
1. If user mentions a token by name, call `get_known_jettons` (see `ton-balance` skill) to find the `jettonAddress`
|
|
31
32
|
2. Call `get_jetton_balance` to verify sufficient balance
|
|
32
|
-
3.
|
|
33
|
+
3. Ask one short yes/no confirmation before sending
|
|
33
34
|
4. Call `send_jetton` with the `jettonAddress`, `toAddress`, and `amount`
|
|
34
35
|
5. Poll `get_transaction_status` until completed or failed
|
|
35
36
|
|
|
36
37
|
## Notes
|
|
37
38
|
|
|
38
39
|
- Amounts are human-readable (e.g., `"1.5"` = 1.5 TON, `"100"` = 100 tokens)
|
|
39
|
-
-
|
|
40
|
+
- Use `emulate_transaction` to dry-run any transaction before sending — it returns expected balance changes (TON and jetton), fees, and high-level actions so you can verify the outcome
|
|
41
|
+
- Always confirm with the user before executing a transfer; prefer the host client's structured confirmation UI when available, otherwise accept natural-language yes/no and do not require a fixed confirmation phrase
|
|
40
42
|
- After sending, poll `get_transaction_status` by default. User can specify whether to check status.
|
|
41
43
|
- If no wallet is configured, use the `ton-create-wallet` skill first
|
package/skills/ton-swap/SKILL.md
CHANGED
|
@@ -14,6 +14,7 @@ Swap tokens on TON via DEX aggregator. Two-step flow: get a quote, confirm with
|
|
|
14
14
|
| Tool | Required | Optional |
|
|
15
15
|
| ---- | -------- | -------- |
|
|
16
16
|
| `get_swap_quote` | `fromToken`, `toToken`, `amount` | `walletSelector` |
|
|
17
|
+
| `emulate_transaction` | `messages` | `validUntil` |
|
|
17
18
|
| `send_raw_transaction` | `messages` | `walletSelector` |
|
|
18
19
|
| `get_known_jettons` | — | — |
|
|
19
20
|
|
|
@@ -23,13 +24,14 @@ Swap tokens on TON via DEX aggregator. Two-step flow: get a quote, confirm with
|
|
|
23
24
|
2. Call `get_swap_quote` with `fromToken`, `toToken`, and `amount`
|
|
24
25
|
- Use `"TON"` for native TON, or the jetton master contract address for tokens
|
|
25
26
|
- Amount is human-readable (e.g., `"1.5"` = 1.5 TON)
|
|
26
|
-
3.
|
|
27
|
-
4.
|
|
28
|
-
5.
|
|
27
|
+
3. Call `emulate_transaction` with the quote's `transaction.messages` to dry-run the swap — verify the expected money flow (TON/jetton balance changes) before sending
|
|
28
|
+
4. Show the quote details and emulation results to the user and ask one short yes/no confirmation
|
|
29
|
+
5. Call `send_raw_transaction` with the transaction params returned by the quote
|
|
30
|
+
6. Poll `get_transaction_status` with the returned `normalizedHash` until status is `completed` or `failed` (see `ton-balance` skill). User can ask to skip polling.
|
|
29
31
|
|
|
30
32
|
## Notes
|
|
31
33
|
|
|
32
|
-
- Always confirm the swap with the user before executing
|
|
34
|
+
- Always confirm the swap with the user before executing; prefer the host client's structured confirmation UI when available, otherwise accept natural-language yes/no and do not require a fixed confirmation phrase
|
|
33
35
|
- The quote returns transaction messages ready for `send_raw_transaction`
|
|
34
36
|
- After execution, poll `get_transaction_status` by default. User can specify whether to check status.
|
|
35
37
|
- If no wallet is configured, use the `ton-create-wallet` skill first
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ton-xstocks
|
|
3
|
+
description: Buy or sell Backed xStocks (tokenized equities, e.g. TSLAx) on TON using jetton addresses from the xStocks API and TON MCP swap tools. Use when the user asks for xStocks, xStock, TSLAx, stock tokens on TON, or buying/selling equity jettons via Omniston.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# xStocks on TON (buy / sell)
|
|
9
|
+
|
|
10
|
+
Backed **xStocks** are jettons on TON. Resolve the **jetton master** from the public xStocks API, then use the same **quote → execute** flow as `ton-swap`, with routing preferences learned from real Omniston behavior.
|
|
11
|
+
|
|
12
|
+
> **Critical: USDT is the only working swap pair.**
|
|
13
|
+
> Omniston consistently returns **no quote** for TON → xStock and xStock → TON routes.
|
|
14
|
+
> All xStock buys and sells **must** go through USDT. If the user lacks sufficient USDT, buy USDT with TON first (see §Pre-fund USDT below).
|
|
15
|
+
|
|
16
|
+
## Key addresses
|
|
17
|
+
|
|
18
|
+
| Token | Jetton master |
|
|
19
|
+
| ----- | ------------- |
|
|
20
|
+
| USDT (TON) | `EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs` |
|
|
21
|
+
|
|
22
|
+
## Resolve the TON jetton master for an xStock
|
|
23
|
+
|
|
24
|
+
1. **By symbol** (e.g. `TSLAx`): fetch via **`curl`** (not WebFetch — the xStocks API returns 403 for non-standard user-agents):
|
|
25
|
+
```bash
|
|
26
|
+
curl -s "https://api.xstocks.fi/api/v2/public/assets/{symbol}"
|
|
27
|
+
```
|
|
28
|
+
(production base: `https://api.xstocks.fi/api/v2` — see [xStocks API](https://docs.xstocks.fi/apis/openapi)).
|
|
29
|
+
|
|
30
|
+
2. In the JSON, find `deployments[]` where **`network` is `"Ton"`**. Use that object's **`address`** as the jetton master for MCP (`fromToken` / `toToken`).
|
|
31
|
+
|
|
32
|
+
3. Optional: `curl -s "https://api.xstocks.fi/api/v2/public/assets"` returns all assets with the same `deployments` shape.
|
|
33
|
+
|
|
34
|
+
4. Call `get_jetton_info` with `--jettonAddress <jetton_master>` to confirm **name / symbol / decimals** before swapping.
|
|
35
|
+
|
|
36
|
+
## MCP tools
|
|
37
|
+
|
|
38
|
+
| Action | Tools |
|
|
39
|
+
| ------ | ----- |
|
|
40
|
+
| Pre-fund USDT | `get_jetton_balance` (USDT) → `get_swap_quote` (TON → USDT) → `emulate_transaction` → `send_raw_transaction` |
|
|
41
|
+
| Buy xStock | `get_swap_quote` (USDT → xStock) → `emulate_transaction` → `send_raw_transaction` |
|
|
42
|
+
| Sell xStock | `get_jetton_balance` (xStock) → `get_swap_quote` (xStock → USDT) → `emulate_transaction` → `send_raw_transaction` |
|
|
43
|
+
| Verify | `get_jetton_info`, `get_transaction_status`, `get_jetton_balance` |
|
|
44
|
+
|
|
45
|
+
Amounts for `get_swap_quote` are **human-readable** strings (respect jetton decimals from `get_jetton_info`).
|
|
46
|
+
|
|
47
|
+
## CLI argument names (exact)
|
|
48
|
+
|
|
49
|
+
| Tool | Arg | CLI flag |
|
|
50
|
+
| ---- | --- | -------- |
|
|
51
|
+
| `get_jetton_info` | jettonAddress | `--jettonAddress` |
|
|
52
|
+
| `get_jetton_balance` | jettonAddress | `--jettonAddress` |
|
|
53
|
+
| `get_swap_quote` | fromToken | `--fromToken` (use `"TON"` for native TON, jetton master address for tokens) |
|
|
54
|
+
| `get_swap_quote` | toToken | `--toToken` |
|
|
55
|
+
| `get_swap_quote` | amount | `--amount` (human-readable) |
|
|
56
|
+
| `get_swap_quote` | slippageBps | `--slippageBps` (default 100 = 1%) |
|
|
57
|
+
| `emulate_transaction` | messages | `--messages` (JSON array from quote's `transaction.messages`) |
|
|
58
|
+
| `send_raw_transaction` | messages | `--messages` (same JSON array) |
|
|
59
|
+
| `get_transaction_status` | normalizedHash | `--normalizedHash` |
|
|
60
|
+
|
|
61
|
+
## Pre-fund USDT (auto, when needed)
|
|
62
|
+
|
|
63
|
+
Before any xStock trade, check the user's USDT balance:
|
|
64
|
+
|
|
65
|
+
1. `get_jetton_balance` for the USDT master address — use the `amount` field for comparison.
|
|
66
|
+
2. If `amount` **< required amount** for the planned buy:
|
|
67
|
+
a. Calculate the shortfall (include a small buffer for price movement).
|
|
68
|
+
b. `get_swap_quote` with `fromToken` = `"TON"` (the literal string, not an address), `toToken` = USDT master, `amount` = shortfall.
|
|
69
|
+
c. Confirm with the user: *"You need ~X USDT but only have Y. Swap Z TON → X USDT first?"*
|
|
70
|
+
d. On approval, `send_raw_transaction` → poll `get_transaction_status` until `completed`.
|
|
71
|
+
e. Re-check USDT balance before proceeding to the xStock buy.
|
|
72
|
+
|
|
73
|
+
## Buy workflow
|
|
74
|
+
|
|
75
|
+
1. Resolve the **Ton** jetton master for the xStock symbol (API above).
|
|
76
|
+
2. Check USDT balance — run **Pre-fund USDT** if insufficient.
|
|
77
|
+
3. `get_swap_quote`: `fromToken` = USDT master, `toToken` = xStock master, `amount` = USDT to spend, `slippageBps` = 100 (1 %).
|
|
78
|
+
4. `emulate_transaction` with the quote's `transaction.messages` — verify expected balance changes before sending.
|
|
79
|
+
5. Show the user: **fromAmount**, **toAmount**, **minReceived**, **expiresAt**, emulation results, and note the forward **TON** on router messages (gas).
|
|
80
|
+
6. Confirm once, then `send_raw_transaction` with the returned `transaction.messages`.
|
|
81
|
+
7. Poll `get_transaction_status` on `normalizedHash` until `completed` or `failed`.
|
|
82
|
+
|
|
83
|
+
> **Do not attempt TON → xStock directly.** It will return no quote. Always route through USDT.
|
|
84
|
+
|
|
85
|
+
## Sell workflow ("sell all" or fixed amount)
|
|
86
|
+
|
|
87
|
+
1. `get_jetton_balance` for the xStock master → use the returned `amount` field (already a human-readable decimal string, e.g. `"12.5"`). Use `amountRaw` only if a raw integer is needed elsewhere.
|
|
88
|
+
2. Pass `amount` directly as the `amount` parameter for `get_swap_quote` — no manual conversion needed.
|
|
89
|
+
3. `get_swap_quote`: `fromToken` = xStock master, `toToken` = USDT master.
|
|
90
|
+
4. `emulate_transaction` with the quote's `transaction.messages` — verify expected balance changes.
|
|
91
|
+
5. Show the user the quote details and emulation results, then confirm.
|
|
92
|
+
6. `send_raw_transaction`, then poll `get_transaction_status` until `completed` or `failed`.
|
|
93
|
+
|
|
94
|
+
> **Do not attempt xStock → TON directly.** Always sell into USDT.
|
|
95
|
+
|
|
96
|
+
## Post-trade checks
|
|
97
|
+
|
|
98
|
+
- If balance reads **0** immediately after a buy, wait a few seconds and re-query; indexers can lag.
|
|
99
|
+
- After a sell, confirm USDT balance increased as expected.
|
|
100
|
+
|
|
101
|
+
## Omniston quirks
|
|
102
|
+
|
|
103
|
+
- **"No quote available"** — no route at that size / time. Retry after a short wait, or adjust amount / slippage slightly. Do **not** switch to TON pairing; it won't help.
|
|
104
|
+
- Occasional WebSocket errors (e.g. quote ack) — **retry** `get_swap_quote`.
|
|
105
|
+
- Quotes **expire**; if the user waited before confirming, fetch a fresh quote before executing.
|
|
106
|
+
|
|
107
|
+
## Relations
|
|
108
|
+
|
|
109
|
+
- Execution and confirmation rules: **`ton-swap`** skill.
|
|
110
|
+
- Wallet funding and status polling: **`ton-balance`** skill.
|
|
111
|
+
- Issuance / redemption outside DEX: xStocks product docs / dashboard — not covered by MCP swap alone.
|