@ton/mcp 0.1.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.
- package/LICENSE +21 -0
- package/README.md +282 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +89425 -0
- package/dist/contracts/w5_ownable/WalletOwnable.d.ts +87 -0
- package/dist/contracts/w5_ownable/WalletOwnable.d.ts.map +1 -0
- package/dist/contracts/w5_ownable/WalletOwnable.source.d.ts +11 -0
- package/dist/contracts/w5_ownable/WalletOwnable.source.d.ts.map +1 -0
- package/dist/contracts/w5_ownable/WalletOwnableAdapter.d.ts +111 -0
- package/dist/contracts/w5_ownable/WalletOwnableAdapter.d.ts.map +1 -0
- package/dist/contracts/w5_ownable/actions.d.ts +43 -0
- package/dist/contracts/w5_ownable/actions.d.ts.map +1 -0
- package/dist/contracts/w5_ownable/index.d.ts +12 -0
- package/dist/contracts/w5_ownable/index.d.ts.map +1 -0
- package/dist/factory.d.ts +67 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.cjs +89134 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89131 -0
- package/dist/serverless.cjs +108356 -0
- package/dist/serverless.d.ts +38 -0
- package/dist/serverless.d.ts.map +1 -0
- package/dist/serverless.js +108355 -0
- package/dist/services/KeyManager.d.ts +57 -0
- package/dist/services/KeyManager.d.ts.map +1 -0
- package/dist/services/McpWalletService.d.ts +202 -0
- package/dist/services/McpWalletService.d.ts.map +1 -0
- package/dist/tools/balance-tools.d.ts +61 -0
- package/dist/tools/balance-tools.d.ts.map +1 -0
- package/dist/tools/dns-tools.d.ts +49 -0
- package/dist/tools/dns-tools.d.ts.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/known-jettons-tools.d.ts +44 -0
- package/dist/tools/known-jettons-tools.d.ts.map +1 -0
- package/dist/tools/nft-tools.d.ts +85 -0
- package/dist/tools/nft-tools.d.ts.map +1 -0
- package/dist/tools/swap-tools.d.ts +49 -0
- package/dist/tools/swap-tools.d.ts.map +1 -0
- package/dist/tools/transfer-tools.d.ts +159 -0
- package/dist/tools/transfer-tools.d.ts.map +1 -0
- package/dist/tools/types.d.ts +21 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/types/config.d.ts +41 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/contacts.d.ts +61 -0
- package/dist/types/contacts.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/llms.txt +114 -0
- package/package.json +86 -0
- package/skills/SKILL.md +67 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import type { McpWalletService } from '../services/McpWalletService.js';
|
|
10
|
+
import type { ToolResponse } from './types.js';
|
|
11
|
+
export declare const sendTonSchema: z.ZodObject<{
|
|
12
|
+
toAddress: z.ZodString;
|
|
13
|
+
amount: z.ZodString;
|
|
14
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
toAddress: string;
|
|
17
|
+
amount: string;
|
|
18
|
+
comment?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
toAddress: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
comment?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const sendJettonSchema: z.ZodObject<{
|
|
25
|
+
toAddress: z.ZodString;
|
|
26
|
+
jettonAddress: z.ZodString;
|
|
27
|
+
amount: z.ZodString;
|
|
28
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
jettonAddress: string;
|
|
31
|
+
toAddress: string;
|
|
32
|
+
amount: string;
|
|
33
|
+
comment?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
jettonAddress: string;
|
|
36
|
+
toAddress: string;
|
|
37
|
+
amount: string;
|
|
38
|
+
comment?: string | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const sendRawTransactionSchema: z.ZodObject<{
|
|
41
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
42
|
+
address: z.ZodString;
|
|
43
|
+
amount: z.ZodString;
|
|
44
|
+
stateInit: z.ZodOptional<z.ZodString>;
|
|
45
|
+
payload: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
address: string;
|
|
48
|
+
amount: string;
|
|
49
|
+
stateInit?: string | undefined;
|
|
50
|
+
payload?: string | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
address: string;
|
|
53
|
+
amount: string;
|
|
54
|
+
stateInit?: string | undefined;
|
|
55
|
+
payload?: string | undefined;
|
|
56
|
+
}>, "many">;
|
|
57
|
+
validUntil: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
fromAddress: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
messages: {
|
|
61
|
+
address: string;
|
|
62
|
+
amount: string;
|
|
63
|
+
stateInit?: string | undefined;
|
|
64
|
+
payload?: string | undefined;
|
|
65
|
+
}[];
|
|
66
|
+
validUntil?: number | undefined;
|
|
67
|
+
fromAddress?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
messages: {
|
|
70
|
+
address: string;
|
|
71
|
+
amount: string;
|
|
72
|
+
stateInit?: string | undefined;
|
|
73
|
+
payload?: string | undefined;
|
|
74
|
+
}[];
|
|
75
|
+
validUntil?: number | undefined;
|
|
76
|
+
fromAddress?: string | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
export declare function createMcpTransferTools(service: McpWalletService): {
|
|
79
|
+
send_ton: {
|
|
80
|
+
description: string;
|
|
81
|
+
inputSchema: z.ZodObject<{
|
|
82
|
+
toAddress: z.ZodString;
|
|
83
|
+
amount: z.ZodString;
|
|
84
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
toAddress: string;
|
|
87
|
+
amount: string;
|
|
88
|
+
comment?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
toAddress: string;
|
|
91
|
+
amount: string;
|
|
92
|
+
comment?: string | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
handler: (args: z.infer<typeof sendTonSchema>) => Promise<ToolResponse>;
|
|
95
|
+
};
|
|
96
|
+
send_jetton: {
|
|
97
|
+
description: string;
|
|
98
|
+
inputSchema: z.ZodObject<{
|
|
99
|
+
toAddress: z.ZodString;
|
|
100
|
+
jettonAddress: z.ZodString;
|
|
101
|
+
amount: z.ZodString;
|
|
102
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
jettonAddress: string;
|
|
105
|
+
toAddress: string;
|
|
106
|
+
amount: string;
|
|
107
|
+
comment?: string | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
jettonAddress: string;
|
|
110
|
+
toAddress: string;
|
|
111
|
+
amount: string;
|
|
112
|
+
comment?: string | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
handler: (args: z.infer<typeof sendJettonSchema>) => Promise<ToolResponse>;
|
|
115
|
+
};
|
|
116
|
+
send_raw_transaction: {
|
|
117
|
+
description: string;
|
|
118
|
+
inputSchema: z.ZodObject<{
|
|
119
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
120
|
+
address: z.ZodString;
|
|
121
|
+
amount: z.ZodString;
|
|
122
|
+
stateInit: z.ZodOptional<z.ZodString>;
|
|
123
|
+
payload: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
address: string;
|
|
126
|
+
amount: string;
|
|
127
|
+
stateInit?: string | undefined;
|
|
128
|
+
payload?: string | undefined;
|
|
129
|
+
}, {
|
|
130
|
+
address: string;
|
|
131
|
+
amount: string;
|
|
132
|
+
stateInit?: string | undefined;
|
|
133
|
+
payload?: string | undefined;
|
|
134
|
+
}>, "many">;
|
|
135
|
+
validUntil: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
fromAddress: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
|
138
|
+
messages: {
|
|
139
|
+
address: string;
|
|
140
|
+
amount: string;
|
|
141
|
+
stateInit?: string | undefined;
|
|
142
|
+
payload?: string | undefined;
|
|
143
|
+
}[];
|
|
144
|
+
validUntil?: number | undefined;
|
|
145
|
+
fromAddress?: string | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
messages: {
|
|
148
|
+
address: string;
|
|
149
|
+
amount: string;
|
|
150
|
+
stateInit?: string | undefined;
|
|
151
|
+
payload?: string | undefined;
|
|
152
|
+
}[];
|
|
153
|
+
validUntil?: number | undefined;
|
|
154
|
+
fromAddress?: string | undefined;
|
|
155
|
+
}>;
|
|
156
|
+
handler: (args: z.infer<typeof sendRawTransactionSchema>) => Promise<ToolResponse>;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=transfer-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-tools.d.ts","sourceRoot":"","sources":["../../src/tools/transfer-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,aAAa;;;;;;;;;;;;EAIxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAK3B,CAAC;AASH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInC,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB;;;;;;;;;;;;;;;;wBAK9B,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,KAAG,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;wBA8CrD,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,KAAG,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyFxD,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,KAAG,OAAO,CAAC,YAAY,CAAC;;EA+CjG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolResponse {
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
content: Array<{
|
|
11
|
+
type: 'text';
|
|
12
|
+
text: string;
|
|
13
|
+
}>;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Converts a human-readable amount to raw units.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toRawAmount(amount: string, decimals: number): string;
|
|
20
|
+
export declare const TON_DECIMALS = 9;
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,MAAM,WAAW,YAAY;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED,eAAO,MAAM,YAAY,IAAI,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Configuration types for createTonWalletMCP factory
|
|
10
|
+
*/
|
|
11
|
+
import type { Wallet } from '@ton/walletkit';
|
|
12
|
+
import type { IContactResolver } from './contacts.js';
|
|
13
|
+
/**
|
|
14
|
+
* Network-specific configuration
|
|
15
|
+
*/
|
|
16
|
+
export interface NetworkConfig {
|
|
17
|
+
/** TonCenter API key for this network */
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for createTonWalletMCP factory
|
|
22
|
+
*/
|
|
23
|
+
export interface TonMcpConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Wallet instance to use for operations.
|
|
26
|
+
* Required.
|
|
27
|
+
*/
|
|
28
|
+
wallet: Wallet;
|
|
29
|
+
/**
|
|
30
|
+
* Optional contact resolver for name-to-address resolution.
|
|
31
|
+
*/
|
|
32
|
+
contacts?: IContactResolver;
|
|
33
|
+
/**
|
|
34
|
+
* Network-specific configuration (API keys).
|
|
35
|
+
*/
|
|
36
|
+
networks?: {
|
|
37
|
+
mainnet?: NetworkConfig;
|
|
38
|
+
testnet?: NetworkConfig;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,OAAO,CAAC,EAAE,aAAa,CAAC;KAC3B,CAAC;CACL"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* IContactResolver - Optional interface for resolving friend names to TON addresses
|
|
10
|
+
*
|
|
11
|
+
* Purpose: Allow users to send to "Alice" instead of raw addresses.
|
|
12
|
+
* Contacts are scoped to the user who created them.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Contact information
|
|
16
|
+
*/
|
|
17
|
+
export interface Contact {
|
|
18
|
+
/** Human-readable name for the contact */
|
|
19
|
+
name: string;
|
|
20
|
+
/** TON address */
|
|
21
|
+
address: string;
|
|
22
|
+
/** Optional network specification (defaults to any) */
|
|
23
|
+
network?: 'mainnet' | 'testnet';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface for contact resolution.
|
|
27
|
+
* All operations are scoped to a specific user.
|
|
28
|
+
*/
|
|
29
|
+
export interface IContactResolver {
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a contact name to an address.
|
|
32
|
+
*
|
|
33
|
+
* @param userId - The user's ID
|
|
34
|
+
* @param name - The contact name to resolve
|
|
35
|
+
* @returns The TON address or null if not found
|
|
36
|
+
*/
|
|
37
|
+
resolve(userId: string, name: string): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Add a new contact for a user.
|
|
40
|
+
*
|
|
41
|
+
* @param userId - The user's ID
|
|
42
|
+
* @param contact - The contact to add
|
|
43
|
+
*/
|
|
44
|
+
addContact(userId: string, contact: Contact): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* List all contacts for a user.
|
|
47
|
+
*
|
|
48
|
+
* @param userId - The user's ID
|
|
49
|
+
* @returns Array of contacts
|
|
50
|
+
*/
|
|
51
|
+
listContacts(userId: string): Promise<Contact[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Remove a contact by name.
|
|
54
|
+
*
|
|
55
|
+
* @param userId - The user's ID
|
|
56
|
+
* @param name - The contact name to remove
|
|
57
|
+
* @returns true if removed, false if not found
|
|
58
|
+
*/
|
|
59
|
+
removeContact(userId: string, name: string): Promise<boolean>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=contacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/types/contacts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Type exports for @ton/mcp package
|
|
10
|
+
*/
|
|
11
|
+
export type { IContactResolver, Contact } from './contacts.js';
|
|
12
|
+
export type { TonMcpConfig, NetworkConfig } from './config.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AAGH,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG/D,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# TON MCP Server
|
|
2
|
+
|
|
3
|
+
> TON blockchain wallet operations via Model Context Protocol
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This MCP server provides tools for managing TON blockchain wallets. It supports balance queries, transfers (TON, Jettons, NFTs), token swaps, transaction history, and DNS resolution.
|
|
8
|
+
|
|
9
|
+
## Available Tools
|
|
10
|
+
|
|
11
|
+
### get_balance
|
|
12
|
+
Get TON balance of the wallet.
|
|
13
|
+
Returns: address, balance in TON and nanoTON
|
|
14
|
+
|
|
15
|
+
### get_jetton_balance
|
|
16
|
+
Get balance of a specific Jetton token.
|
|
17
|
+
Parameters:
|
|
18
|
+
- jettonAddress (required): Jetton master contract address
|
|
19
|
+
|
|
20
|
+
### get_jettons
|
|
21
|
+
List all Jettons in the wallet with balances and metadata.
|
|
22
|
+
Returns: array of tokens with address, symbol, name, balance, decimals
|
|
23
|
+
|
|
24
|
+
### get_transactions
|
|
25
|
+
Get recent transaction history.
|
|
26
|
+
Parameters:
|
|
27
|
+
- limit (optional): 1-100, default 20
|
|
28
|
+
Returns: transactions with type (TonTransfer, JettonTransfer, JettonSwap), amounts, addresses
|
|
29
|
+
|
|
30
|
+
### get_known_jettons
|
|
31
|
+
Get list of known/popular Jettons on TON.
|
|
32
|
+
Returns: array with symbol, name, address, decimals
|
|
33
|
+
|
|
34
|
+
### send_ton
|
|
35
|
+
Send TON to an address.
|
|
36
|
+
Parameters:
|
|
37
|
+
- toAddress (required): recipient address
|
|
38
|
+
- amount (required): amount in TON (e.g., "1.5")
|
|
39
|
+
- comment (optional): transaction memo
|
|
40
|
+
|
|
41
|
+
### send_jetton
|
|
42
|
+
Send Jettons to an address.
|
|
43
|
+
Parameters:
|
|
44
|
+
- toAddress (required): recipient address
|
|
45
|
+
- jettonAddress (required): token contract address
|
|
46
|
+
- amount (required): human-readable amount
|
|
47
|
+
- comment (optional): transaction memo
|
|
48
|
+
|
|
49
|
+
### send_raw_transaction
|
|
50
|
+
Send raw transaction with full control.
|
|
51
|
+
Parameters:
|
|
52
|
+
- messages (required): array of {address, amount (nanoTON), stateInit?, payload?}
|
|
53
|
+
- validUntil (optional): expiry timestamp
|
|
54
|
+
- fromAddress (optional): sender address
|
|
55
|
+
|
|
56
|
+
### get_swap_quote
|
|
57
|
+
Get quote for token swap.
|
|
58
|
+
Parameters:
|
|
59
|
+
- fromToken (required): "TON" or jetton address
|
|
60
|
+
- toToken (required): "TON" or jetton address
|
|
61
|
+
- amount (required): amount in raw units
|
|
62
|
+
- slippageBps (optional): slippage in basis points (100 = 1%)
|
|
63
|
+
Returns: quote details + transaction params for send_raw_transaction
|
|
64
|
+
|
|
65
|
+
### get_nfts
|
|
66
|
+
List NFTs in the wallet.
|
|
67
|
+
Parameters:
|
|
68
|
+
- limit (optional): 1-100, default 20
|
|
69
|
+
- offset (optional): pagination offset
|
|
70
|
+
|
|
71
|
+
### get_nft
|
|
72
|
+
Get NFT details.
|
|
73
|
+
Parameters:
|
|
74
|
+
- nftAddress (required): NFT item contract address
|
|
75
|
+
|
|
76
|
+
### send_nft
|
|
77
|
+
Transfer NFT to another address.
|
|
78
|
+
Parameters:
|
|
79
|
+
- nftAddress (required): NFT to transfer
|
|
80
|
+
- toAddress (required): recipient address
|
|
81
|
+
- comment (optional): transaction memo
|
|
82
|
+
|
|
83
|
+
### resolve_dns
|
|
84
|
+
Resolve .ton domain to wallet address.
|
|
85
|
+
Parameters:
|
|
86
|
+
- domain (required): e.g., "foundation.ton"
|
|
87
|
+
|
|
88
|
+
### back_resolve_dns
|
|
89
|
+
Find .ton domain for a wallet address.
|
|
90
|
+
Parameters:
|
|
91
|
+
- address (required): TON wallet address
|
|
92
|
+
|
|
93
|
+
## Usage Patterns
|
|
94
|
+
|
|
95
|
+
### Sending TON
|
|
96
|
+
1. If recipient is .ton domain: resolve_dns first
|
|
97
|
+
2. send_ton with resolved address
|
|
98
|
+
|
|
99
|
+
### Sending Tokens
|
|
100
|
+
1. get_jettons to find token address
|
|
101
|
+
2. send_jetton with token details
|
|
102
|
+
|
|
103
|
+
### Swapping Tokens
|
|
104
|
+
1. get_known_jettons if needed for addresses
|
|
105
|
+
2. get_swap_quote for quote
|
|
106
|
+
3. Confirm with user
|
|
107
|
+
4. send_raw_transaction with quote's transaction params
|
|
108
|
+
|
|
109
|
+
## Important Notes
|
|
110
|
+
|
|
111
|
+
- Always confirm transfers/swaps with user before executing
|
|
112
|
+
- send_ton/send_jetton use human-readable amounts
|
|
113
|
+
- get_swap_quote uses raw amounts (with decimals applied)
|
|
114
|
+
- Check transaction success in response
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ton/mcp",
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"description": "TON MCP Server - Model Context Protocol server for TON blockchain wallet operations",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"bin": "./dist/cli.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"./serverless": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/serverless.d.ts",
|
|
25
|
+
"default": "./dist/serverless.js"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/serverless.d.ts",
|
|
29
|
+
"default": "./dist/serverless.cjs"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"skills",
|
|
39
|
+
"llms.txt",
|
|
40
|
+
"README.md"
|
|
41
|
+
],
|
|
42
|
+
"keywords": [
|
|
43
|
+
"ton",
|
|
44
|
+
"mcp",
|
|
45
|
+
"wallet",
|
|
46
|
+
"model-context-protocol",
|
|
47
|
+
"blockchain"
|
|
48
|
+
],
|
|
49
|
+
"author": "TON Tech",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "https://github.com/ton-connect/kit"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
56
|
+
"zod": "^3.25.76",
|
|
57
|
+
"@ton/walletkit": "0.0.6"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@modelcontextprotocol/sdk": "^1.25.1"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/node": "^22.15.29",
|
|
64
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
65
|
+
"rimraf": "^6.1.0",
|
|
66
|
+
"rolldown": "1.0.0-rc.2",
|
|
67
|
+
"typescript": "~5.9.3",
|
|
68
|
+
"vitest": "^4.0.17"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=18.0.0"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "pnpm build:clean && rolldown -c && pnpm build:types && pnpm build:chmod",
|
|
75
|
+
"build:clean": "rimraf dist",
|
|
76
|
+
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
77
|
+
"build:chmod": "chmod +x dist/cli.js",
|
|
78
|
+
"dev": "rolldown -c --watch",
|
|
79
|
+
"dev:cli": "node --import tsx/esm src/cli.ts",
|
|
80
|
+
"dev:cli:http": "node --import tsx/esm src/cli.ts --http",
|
|
81
|
+
"lint": "eslint src --max-warnings 0",
|
|
82
|
+
"lint:fix": "eslint src --max-warnings 0 --fix",
|
|
83
|
+
"test": "vitest run",
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
|
+
}
|
|
86
|
+
}
|
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# TON Blockchain Wallet
|
|
2
|
+
|
|
3
|
+
Manage TON blockchain wallet operations including balance queries, transfers, swaps, NFTs, and DNS resolution.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this skill when the user wants to:
|
|
8
|
+
- Check TON or token balances
|
|
9
|
+
- Send TON, Jettons (tokens), or NFTs
|
|
10
|
+
- Swap tokens on DEX
|
|
11
|
+
- View transaction history
|
|
12
|
+
- Resolve .ton domains
|
|
13
|
+
|
|
14
|
+
## Tools Available
|
|
15
|
+
|
|
16
|
+
### Balance & Info
|
|
17
|
+
- `get_balance` - Get TON balance
|
|
18
|
+
- `get_jetton_balance` - Get specific token balance (needs `jettonAddress`)
|
|
19
|
+
- `get_jettons` - List all tokens in wallet
|
|
20
|
+
- `get_transactions` - View recent transactions (optional `limit`)
|
|
21
|
+
- `get_known_jettons` - Get list of popular tokens with addresses
|
|
22
|
+
|
|
23
|
+
### Transfers
|
|
24
|
+
- `send_ton` - Send TON (`toAddress`, `amount` in TON like "1.5", optional `comment`)
|
|
25
|
+
- `send_jetton` - Send tokens (`toAddress`, `jettonAddress`, `amount`, optional `comment`)
|
|
26
|
+
- `send_nft` - Transfer NFT (`nftAddress`, `toAddress`, optional `comment`)
|
|
27
|
+
- `send_raw_transaction` - Advanced: send raw transaction with multiple messages
|
|
28
|
+
|
|
29
|
+
### Swaps
|
|
30
|
+
- `get_swap_quote` - Get swap quote (`fromToken`, `toToken`, `amount` in raw units)
|
|
31
|
+
- Use "TON" or jetton address for tokens
|
|
32
|
+
- Returns transaction params for `send_raw_transaction`
|
|
33
|
+
|
|
34
|
+
### NFTs
|
|
35
|
+
- `get_nfts` - List wallet NFTs (optional `limit`, `offset`)
|
|
36
|
+
- `get_nft` - Get NFT details (`nftAddress`)
|
|
37
|
+
|
|
38
|
+
### DNS
|
|
39
|
+
- `resolve_dns` - Resolve .ton domain to address (`domain` like "foundation.ton")
|
|
40
|
+
- `back_resolve_dns` - Find domain for address (`address`)
|
|
41
|
+
|
|
42
|
+
## Common Workflows
|
|
43
|
+
|
|
44
|
+
### Check Balance
|
|
45
|
+
1. Call `get_balance` for TON
|
|
46
|
+
2. Call `get_jettons` for all tokens
|
|
47
|
+
|
|
48
|
+
### Send TON
|
|
49
|
+
1. If user provides .ton domain, call `resolve_dns` first
|
|
50
|
+
2. Call `send_ton` with address and amount
|
|
51
|
+
|
|
52
|
+
### Send Token
|
|
53
|
+
1. Call `get_jettons` to find token address and verify balance
|
|
54
|
+
2. Call `send_jetton` with token address and amount
|
|
55
|
+
|
|
56
|
+
### Swap Tokens
|
|
57
|
+
1. Call `get_known_jettons` if user mentions token by name
|
|
58
|
+
2. Call `get_swap_quote` to get quote and transaction params
|
|
59
|
+
3. Show quote to user and ask for confirmation
|
|
60
|
+
4. Call `send_raw_transaction` with the transaction params
|
|
61
|
+
|
|
62
|
+
## Notes
|
|
63
|
+
|
|
64
|
+
- Amounts for `send_ton` and `send_jetton` are human-readable (e.g., "1.5" = 1.5 TON)
|
|
65
|
+
- Amounts for `get_swap_quote` are in raw units (apply decimals)
|
|
66
|
+
- Always confirm with user before executing transfers or swaps
|
|
67
|
+
- Transaction results include success status and details
|