Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .changeset/rename-ton-to-gram.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ All widgets and components now present the native asset as GRAM instead of TON:

**@ton/mcp**

- Tool descriptions and output labels now read GRAM (e.g. "Send GRAM", "Get GRAM balance", amounts rendered as "1.5 GRAM"); raw-unit wording now reads "nano units" instead of "nanoTON".
- Tool descriptions, docs (README, llms.txt, USAGE_EXAMPLES), and skills now present the native asset as "GRAM (ex. TON)" (e.g. "Send GRAM (ex. TON)", "Get GRAM (ex. TON) balance", amounts rendered as "1.5 GRAM"); raw-unit wording now reads "nano units" instead of "nanoTON".
- Only the coin is renamed: TON Blockchain / network / DNS / TonProof / config references stay "TON".
- The tool API is unchanged: the `"TON"` token selector, returned token symbols, and the `nanoTon` output field stay the same.
28 changes: 14 additions & 14 deletions packages/mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ A Model Context Protocol (MCP) server for TON blockchain wallet operations. Buil

## Features

- **Balance Queries**: Check TON and Jetton balances, view transaction history.
- **Transfers**: Send TON, Jettons, and NFTs to any address.
- **Balance Queries**: Check GRAM (ex. TON) and Jetton balances, view transaction history.
- **Transfers**: Send GRAM (ex. TON), Jettons, and NFTs to any address.
- **Swaps**: Get quotes for token swaps via DEX aggregators.
- **NFTs**: List, inspect, and transfer NFTs.
- **DNS**: Resolve TON DNS-compatible domains and reverse-lookup addresses.
Expand Down Expand Up @@ -166,17 +166,17 @@ Soft-delete a stored wallet from the local registry. Removed wallets remain in t
### Balance & History

#### `get_balance`
Get the TON balance of the wallet.
Get the GRAM (ex. TON) balance of the wallet.

**Returns:** Balance in TON and nanoTON
**Returns:** Balance in GRAM (ex. TON) and nanoTON

#### `get_balance_by_address`
Get the TON balance of any address.
Get the GRAM (ex. TON) balance of any address.

**Parameters:**
- `address` (required): TON wallet address

**Returns:** Address balance in TON and nanoTON
**Returns:** Address balance in GRAM (ex. TON) and nanoTON

#### `get_jetton_balance`
Get the balance of a specific Jetton in the wallet.
Expand All @@ -202,7 +202,7 @@ Get metadata for a Jetton master contract.
- `jettonAddress` (required): Jetton master contract address

#### `get_transactions`
Get recent transaction history for the wallet (TON transfers, Jetton transfers, swaps, etc.).
Get recent transaction history for the wallet (GRAM (ex. TON) transfers, Jetton transfers, swaps, etc.).

**Parameters:**
- `limit` (optional): Maximum number of transactions to return (default: 20, max: 100)
Expand All @@ -220,11 +220,11 @@ Get the status of a transaction by its normalized hash to know if it is pending,
`build_ton_transfer`, `build_jetton_transfer`, and `build_nft_transfer` do **not** broadcast. They build a transaction and return ready-to-send `messages` (the `transaction` field). Preview them with `emulate_transaction`, then broadcast with `send_raw_transaction` — the same pipeline used by `get_swap_quote`. Only `send_raw_transaction` signs and sends. When broadcasting, pass the returned `transaction.fromAddress` along with the messages: jetton and NFT transfers are bound to the wallet they were built for.

#### `build_ton_transfer`
Build a TON transfer to an address. Amount is in human-readable format (e.g., `"1.5"` means 1.5 TON). Returns `transaction: { messages, validUntil, fromAddress }`. Preview with `emulate_transaction`, then broadcast with `send_raw_transaction`.
Build a GRAM (ex. TON) transfer to an address. Amount is in human-readable format (e.g., `"1.5"` means 1.5 GRAM). Returns `transaction: { messages, validUntil, fromAddress }`. Preview with `emulate_transaction`, then broadcast with `send_raw_transaction`.

**Parameters:**
- `toAddress` (required): Recipient TON address
- `amount` (required): Amount in TON (e.g., `"1.5"`)
- `amount` (required): Amount in GRAM (ex. TON) (e.g., `"1.5"`)
- `comment` (optional): Transaction comment/memo

#### `build_jetton_transfer`
Expand All @@ -249,7 +249,7 @@ Sign and broadcast a raw transaction with full control over messages. Supports m
- `fromAddress` (optional): Sender wallet address; when broadcasting a prepared transaction, pass its `transaction.fromAddress`

#### `emulate_transaction`
Dry-run a raw transaction without broadcasting it. Accepts the same `messages` format as `send_raw_transaction` and returns the expected TON and Jetton balance changes, fees, and high-level actions so agents can verify a transaction before sending.
Dry-run a raw transaction without broadcasting it. Accepts the same `messages` format as `send_raw_transaction` and returns the expected GRAM (ex. TON) and Jetton balance changes, fees, and high-level actions so agents can verify a transaction before sending.

**Parameters:**
- `messages` (required): Array of messages, each with `address`, `amount` in nanotons, and optional `stateInit` / `payload`
Expand All @@ -261,9 +261,9 @@ Dry-run a raw transaction without broadcasting it. Accepts the same `messages` f
Get a quote for swapping tokens. Returns quote details and transaction params that can be executed via `send_raw_transaction`.

**Parameters:**
- `fromToken` (required): Token to swap from (`"TON"` or jetton address)
- `toToken` (required): Token to swap to (`"TON"` or jetton address)
- `amount` (required): Amount in human-readable format (e.g., `"1.5"` for 1.5 TON)
- `fromToken` (required): Token to swap from (`"TON"` for native GRAM (ex. TON), or jetton address)
- `toToken` (required): Token to swap to (`"TON"` for native GRAM (ex. TON), or jetton address)
- `amount` (required): Amount in human-readable format (e.g., `"1.5"` for 1.5 GRAM (ex. TON))
- `slippageBps` (optional): Slippage tolerance in basis points (default: 100 = 1%)

### NFTs
Expand Down Expand Up @@ -361,7 +361,7 @@ Start first-root-agent setup: generate operator keys, persist a pending draft, a
- `name` (optional): Agent display name
- `source` (optional): Source or description
- `collectionAddress` (optional): Collection address override
- `tonDeposit` (optional): TON deposit hint for the dashboard
- `tonDeposit` (optional): GRAM (ex. TON) deposit hint for the dashboard

Pending onboarding callback state is persisted in the local config, so the setup can be resumed after MCP transport restarts. In HTTP mode, callback URLs are stable on the MCP server base URL. In stdio mode, use `AGENTIC_CALLBACK_BASE_URL` and/or `AGENTIC_CALLBACK_PORT` if you need a fixed callback endpoint across restarts.

Expand Down
26 changes: 13 additions & 13 deletions packages/mcp/USAGE_EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ npx @ton/mcp@alpha get_current_wallet

**User request**

`Show my balance in TON and jettons`
`Show my balance in GRAM (ex. TON) and jettons`

**Approximate command list**

Expand All @@ -129,7 +129,7 @@ npx @ton/mcp@alpha get_jettons

**Approximate agent response**

> Active wallet balance: `12.84 TON`. Jetton balances include `USDT 53.2`, `NOT 1400`, and `STON 18.05`.
> Active wallet balance: `12.84 GRAM (ex. TON)`. Jetton balances include `USDT 53.2`, `NOT 1400`, and `STON 18.05`.

### Show the balance of any address

Expand All @@ -146,7 +146,7 @@ npx @ton/mcp@alpha get_jettons_by_address --address EQ...

**Approximate agent response**

> Address `EQ...` has a balance of `3.21 TON`. No jettons were found for that address.
> Address `EQ...` has a balance of `3.21 GRAM (ex. TON)`. No jettons were found for that address.

### Find a known jetton address

Expand Down Expand Up @@ -184,11 +184,11 @@ npx @ton/mcp@alpha generate_ton_proof --domain getgems.io --payload getgems-llm

## Transfers and Swaps

### Send TON to a TON DNS name
### Send GRAM (ex. TON) to a TON DNS name

**User request**

`Send 1 TON to foundation.ton`
`Send 1 GRAM (ex. TON) to foundation.ton`

**Approximate command list**

Expand All @@ -202,13 +202,13 @@ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>

**Approximate agent response**

> `foundation.ton` was resolved to TON address `EQ...`. The `1 TON` transfer was sent with `normalizedHash: <NORMALIZED_HASH>`. Transaction status: `completed`.
> `foundation.ton` was resolved to TON address `EQ...`. The `1 GRAM (ex. TON)` transfer was sent with `normalizedHash: <NORMALIZED_HASH>`. Transaction status: `completed`.

### Preview a TON transfer before sending
### Preview a GRAM (ex. TON) transfer before sending

**User request**

`Prepare a 0.5 TON payment to UQAbc... and show me what happens before sending`
`Prepare a 0.5 GRAM (ex. TON) payment to UQAbc... and show me what happens before sending`

**Approximate command list**

Expand All @@ -219,7 +219,7 @@ npx @ton/mcp@alpha emulate_transaction --messages '<transaction.messages>'

**Approximate agent response**

> Prepared the `0.5 TON` transfer (it was not sent). Emulation shows the expected balance changes and fees. Confirm to broadcast it with `send_raw_transaction`.
> Prepared the `0.5 GRAM (ex. TON)` transfer (it was not sent). Emulation shows the expected balance changes and fees. Confirm to broadcast it with `send_raw_transaction`.

### Send a jetton

Expand All @@ -241,11 +241,11 @@ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>

> `USDT` was found in the wallet. I prepared the `25 USDT` transfer to `UQAbc...`, previewed it, then broadcast it with `send_raw_transaction`. `normalizedHash: <NORMALIZED_HASH>`. Current status: `completed`.

### Swap TON for a jetton
### Swap GRAM (ex. TON) for a jetton

**User request**

`Swap 2 TON to USDT`
`Swap 2 GRAM (ex. TON) to USDT`

**Approximate command list**

Expand All @@ -261,7 +261,7 @@ npx @ton/mcp@alpha get_transaction_status --normalizedHash <NORMALIZED_HASH>

**Approximate agent response**

> 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>`.
> A quote was received for swapping `2 GRAM (ex. TON)` to `USDT`. After confirmation, the swap was executed with an expected output of about `X USDT` after slippage. `normalizedHash: <NORMALIZED_HASH>`.

### Show recent transactions

Expand All @@ -277,7 +277,7 @@ npx @ton/mcp@alpha get_transactions --limit 5

**Approximate agent response**

> 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.
> The last 5 operations were shown, including incoming and outgoing GRAM (ex. TON) transfers, jetton transfers, and swaps. For each transaction, the agent typically shows the time, action type, amount, and final status.

## TON DNS

Expand Down
26 changes: 13 additions & 13 deletions packages/mcp/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

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, TonProof authentication, local multi-wallet registry management, and agentic wallet onboarding.
This MCP server provides tools for managing TON blockchain wallets. It supports wallet info, balance queries, transfers (GRAM (ex. TON), Jettons, NFTs), token swaps, transaction history, DNS resolution, TonProof authentication, local multi-wallet registry management, and agentic wallet onboarding.

It has two runtime modes:
- 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`)
Expand Down Expand Up @@ -38,14 +38,14 @@ Parameters:
- walletSelector (required): wallet id, name, or address

### get_balance
Get TON balance of the wallet.
Returns: address, balance in TON and nanoTON
Get GRAM (ex. TON) balance of the wallet.
Returns: address, balance in GRAM (ex. TON) and nanoTON

### get_balance_by_address
Get TON balance for any address.
Get GRAM (ex. TON) balance for any address.
Parameters:
- address (required): TON wallet address
Returns: address, balance in TON and nanoTON
Returns: address, balance in GRAM (ex. TON) and nanoTON

### get_jetton_balance
Get balance of a specific Jetton token.
Expand Down Expand Up @@ -87,10 +87,10 @@ Get list of known/popular Jettons on TON.
Returns: array with symbol, name, address, decimals

### build_ton_transfer
Build a TON transfer to an address. Does NOT broadcast.
Build a GRAM (ex. TON) transfer to an address. Does NOT broadcast.
Parameters:
- toAddress (required): recipient address
- amount (required): amount in TON (e.g., "1.5")
- amount (required): amount in GRAM (ex. TON) (e.g., "1.5")
- comment (optional): transaction memo
Returns: transaction {messages, validUntil, fromAddress} ready for emulate_transaction (preview) then send_raw_transaction (broadcast)

Expand All @@ -116,14 +116,14 @@ Dry-run a raw transaction without broadcasting it.
Parameters:
- messages (required): array of {address, amount (nanoTON), stateInit?, payload?}
- validUntil (optional): expiry timestamp
Returns: expected TON and Jetton balance changes, fees, and high-level actions
Returns: expected GRAM (ex. TON) and Jetton balance changes, fees, and high-level actions

### get_swap_quote
Get quote for token swap.
Parameters:
- fromToken (required): "TON" or jetton address
- toToken (required): "TON" or jetton address
- amount (required): human-readable amount (e.g., "1.5" for 1.5 TON)
- fromToken (required): "TON" (native GRAM (ex. TON)) or jetton address
- toToken (required): "TON" (native GRAM (ex. TON)) or jetton address
- amount (required): human-readable amount (e.g., "1.5" for 1.5 GRAM (ex. TON))
- slippageBps (optional): slippage in basis points (100 = 1%)
Returns: quote details + transaction params for send_raw_transaction

Expand Down Expand Up @@ -219,7 +219,7 @@ Parameters:
- name (optional): display name
- source (optional): source or description
- collectionAddress (optional): collection override
- tonDeposit (optional): TON deposit hint
- tonDeposit (optional): GRAM (ex. TON) deposit hint

### agentic_list_pending_root_wallet_setups
Registry mode only. List pending root-agent onboarding drafts.
Expand Down Expand Up @@ -249,7 +249,7 @@ Parameters:
3. set_active_wallet if the user wants to switch
4. For one-off calls, pass walletSelector directly to wallet-scoped tools instead of changing the active wallet

### Sending TON
### Sending GRAM (ex. TON)
1. If recipient is a DNS name rather than a raw address: resolve_dns first
2. build_ton_transfer with resolved address (builds only — does NOT broadcast)
3. emulate_transaction with the returned transaction.messages to preview balance changes and fees (recommended before sending)
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ton/mcp",
"version": "0.1.15-alpha.22",
"version": "0.1.15-alpha.23",
"description": "TON MCP Server - Model Context Protocol server for TON blockchain wallet operations",
"license": "MIT",
"type": "module",
Expand Down
8 changes: 4 additions & 4 deletions packages/mcp/skills/ton-balance/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: ton-balance
description: Check TON wallet balances, token holdings, and transaction history. Use when the user wants to check their balance, see how much TON they have, list tokens, view jettons, check transaction history, look up a token, or verify a transaction status.
description: Check TON wallet balances, token holdings, and transaction history. Use when the user wants to check their balance, see how much GRAM (ex. TON) they have, list tokens, view jettons, check transaction history, look up a token, or verify a transaction status.
user-invocable: true
disable-model-invocation: false
---

# TON Balance & Transaction Queries
# GRAM (ex. TON) Balance & Transaction Queries

Read-only queries for wallet balances, token holdings, and transaction history on TON.

Expand All @@ -28,7 +28,7 @@ Read-only queries for wallet balances, token holdings, and transaction history o

### Check Balance
1. Call `get_wallet` for address and network info
2. Call `get_balance` for TON balance
2. Call `get_balance` for GRAM (ex. TON) balance
3. Call `get_jettons` for all token holdings

### Check Specific Token
Expand All @@ -45,4 +45,4 @@ Read-only queries for wallet balances, token holdings, and transaction history o

- All tools are read-only — no confirmation needed
- In registry mode, pass `walletSelector` to query a specific wallet instead of the active one
- 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.
- All balance responses include both `amountRaw` (raw integer string) and `amount` (human-readable decimal string, e.g. `"1.5"` for 1.5 GRAM (ex. TON)). Use `amount` for display; use `amountRaw` only when a raw integer is required.
4 changes: 2 additions & 2 deletions packages/mcp/skills/ton-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Without `MNEMONIC` or `PRIVATE_KEY`, the CLI uses the local config registry at `
# Check wallet address and network
npx @ton/mcp@alpha get_wallet

# Check TON balance
# Check GRAM (ex. TON) balance
npx @ton/mcp@alpha get_balance

# List all tokens
Expand All @@ -155,7 +155,7 @@ npx @ton/mcp@alpha get_balance --walletSelector "my-hot-wallet"
# In registry mode: list all registered wallets
npx @ton/mcp@alpha list_wallets

# Send TON — build, preview, then broadcast (confirm with user before the broadcast step)
# Send GRAM (ex. TON) — build, preview, then broadcast (confirm with user before the broadcast step)
npx @ton/mcp@alpha build_ton_transfer --toAddress UQA... --amount 0.5 --comment "payment"
npx @ton/mcp@alpha emulate_transaction --messages '<transaction.messages>' # recommended preview
npx @ton/mcp@alpha send_raw_transaction --messages '<transaction.messages>' --fromAddress '<transaction.fromAddress>'
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/skills/ton-create-wallet/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Deploy an on-chain agentic wallet on TON. The agent generates operator keys, ope
- Callback-driven completion is for long-lived stdio/HTTP MCP server sessions; raw CLI should use manual `walletAddress` completion
- If automatic dashboard opening is supported in the current environment, do it instead of asking the user to open the URL manually
- In raw CLI mode, ask for the wallet address after deployment because the callback server is not available long enough to complete the flow
- After wallet creation, fund the wallet with TON before using transfer or swap skills
- After wallet creation, fund the wallet with GRAM (ex. TON) before using transfer or swap skills
10 changes: 5 additions & 5 deletions packages/mcp/skills/ton-send/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: ton-send
description: Send TON or jettons (tokens) to an address or TON DNS domain. Use when the user wants to send TON, transfer tokens, send jettons, pay someone, send funds to a .ton or .t.me domain, or transfer assets on the TON blockchain.
description: Send GRAM (ex. TON) or jettons (tokens) to an address or TON DNS domain. Use when the user wants to send GRAM (ex. TON), transfer tokens, send jettons, pay someone, send funds to a .ton or .t.me domain, or transfer assets on the TON blockchain.
user-invocable: true
disable-model-invocation: false
---

# Send TON & Tokens
# Send GRAM (ex. TON) & Tokens

Transfer TON or jettons to any address. Supports TON DNS resolution for `.ton` and `.t.me` domains.
Transfer GRAM (ex. TON) or jettons to any address. Supports TON DNS resolution for `.ton` and `.t.me` domains.

## MCP Tools

Expand All @@ -24,7 +24,7 @@ Transfer TON or jettons to any address. Supports TON DNS resolution for `.ton` a

## Workflows

### Send TON
### Send GRAM (ex. TON)
1. If the user provides a DNS name (e.g., `foundation.ton`, `user.t.me`) instead of a raw address, call `resolve_dns` first
2. Call `build_ton_transfer` with address and amount to build the transaction (it is NOT sent)
3. Preview it with `emulate_transaction` using the returned `transaction.messages` (recommended before broadcasting)
Expand All @@ -43,7 +43,7 @@ Transfer TON or jettons to any address. Supports TON DNS resolution for `.ton` a

## Notes

- Amounts are human-readable (e.g., `"1.5"` = 1.5 TON, `"100"` = 100 tokens)
- Amounts are human-readable (e.g., `"1.5"` = 1.5 GRAM (ex. TON), `"100"` = 100 tokens)
- `build_ton_transfer`/`build_jetton_transfer` build the transaction only; `send_raw_transaction` is the tool that actually signs and broadcasts
- Use `emulate_transaction` to preview expected balance changes before broadcasting (fake signature)
- Always confirm with the user before broadcasting 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
Expand Down
Loading
Loading