@gala-chain/launchpad-mcp-server 1.0.0
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/.env.example +13 -0
- package/.eslintrc.json +20 -0
- package/README.md +178 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +151 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/balance/index.d.ts +12 -0
- package/dist/tools/balance/index.d.ts.map +1 -0
- package/dist/tools/balance/index.js +182 -0
- package/dist/tools/balance/index.js.map +1 -0
- package/dist/tools/creation/index.d.ts +9 -0
- package/dist/tools/creation/index.d.ts.map +1 -0
- package/dist/tools/creation/index.js +154 -0
- package/dist/tools/creation/index.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/pools/fetchPoolDetails.d.ts +6 -0
- package/dist/tools/pools/fetchPoolDetails.d.ts.map +1 -0
- package/dist/tools/pools/fetchPoolDetails.js +25 -0
- package/dist/tools/pools/fetchPoolDetails.js.map +1 -0
- package/dist/tools/pools/fetchPools.d.ts +6 -0
- package/dist/tools/pools/fetchPools.d.ts.map +1 -0
- package/dist/tools/pools/fetchPools.js +44 -0
- package/dist/tools/pools/fetchPools.js.map +1 -0
- package/dist/tools/pools/index.d.ts +14 -0
- package/dist/tools/pools/index.d.ts.map +1 -0
- package/dist/tools/pools/index.js +215 -0
- package/dist/tools/pools/index.js.map +1 -0
- package/dist/tools/social/index.d.ts +8 -0
- package/dist/tools/social/index.d.ts.map +1 -0
- package/dist/tools/social/index.js +70 -0
- package/dist/tools/social/index.js.map +1 -0
- package/dist/tools/trading/index.d.ts +12 -0
- package/dist/tools/trading/index.d.ts.map +1 -0
- package/dist/tools/trading/index.js +270 -0
- package/dist/tools/trading/index.js.map +1 -0
- package/dist/tools/transfers/index.d.ts +8 -0
- package/dist/tools/transfers/index.d.ts.map +1 -0
- package/dist/tools/transfers/index.js +81 -0
- package/dist/tools/transfers/index.js.map +1 -0
- package/dist/types/mcp.d.ts +37 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +5 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/utils/error-handler.d.ts +15 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +50 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +19 -0
- package/dist/utils/response-formatter.d.ts.map +1 -0
- package/dist/utils/response-formatter.js +46 -0
- package/dist/utils/response-formatter.js.map +1 -0
- package/package.json +73 -0
- package/test-mcp.js +89 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/trading/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAKlD,eAAO,MAAM,sBAAsB,EAAE,OAgCpC,CAAC;AAGF,eAAO,MAAM,uBAAuB,EAAE,OAgCrC,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,OA6C3B,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,OA6C5B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,OA8D7B,CAAC;AAGF,eAAO,MAAM,uBAAuB,EAAE,OA4BrC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAAO,EAOjC,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trading Operations Tools
|
|
3
|
+
*/
|
|
4
|
+
import { formatSuccess } from '../../utils/response-formatter.js';
|
|
5
|
+
import { withErrorHandling } from '../../utils/error-handler.js';
|
|
6
|
+
// 1. Calculate Buy Amount
|
|
7
|
+
export const calculateBuyAmountTool = {
|
|
8
|
+
name: 'gala_launchpad_calculate_buy_amount',
|
|
9
|
+
description: 'Calculate token amounts for buying with fee breakdown',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
tokenName: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
16
|
+
description: 'Token name',
|
|
17
|
+
},
|
|
18
|
+
amount: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
pattern: '^[0-9.]+$',
|
|
21
|
+
description: 'Amount in standard decimal format (e.g., "1" for 1 GALA)',
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['native', 'token'],
|
|
26
|
+
description: 'native = spending GALA, token = buying exact tokens',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: ['tokenName', 'amount', 'type'],
|
|
30
|
+
},
|
|
31
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
32
|
+
const result = await sdk.calculateBuyAmount({
|
|
33
|
+
tokenName: args.tokenName,
|
|
34
|
+
amount: args.amount,
|
|
35
|
+
type: args.type,
|
|
36
|
+
});
|
|
37
|
+
return formatSuccess(result);
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
// 2. Calculate Sell Amount
|
|
41
|
+
export const calculateSellAmountTool = {
|
|
42
|
+
name: 'gala_launchpad_calculate_sell_amount',
|
|
43
|
+
description: 'Calculate GALA amounts for selling tokens',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
tokenName: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
50
|
+
description: 'Token name',
|
|
51
|
+
},
|
|
52
|
+
amount: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
pattern: '^[0-9.]+$',
|
|
55
|
+
description: 'Amount in standard decimal format',
|
|
56
|
+
},
|
|
57
|
+
type: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
enum: ['native', 'token'],
|
|
60
|
+
description: 'native = receiving GALA, token = selling exact tokens',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
required: ['tokenName', 'amount', 'type'],
|
|
64
|
+
},
|
|
65
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
66
|
+
const result = await sdk.calculateSellAmount({
|
|
67
|
+
tokenName: args.tokenName,
|
|
68
|
+
amount: args.amount,
|
|
69
|
+
type: args.type,
|
|
70
|
+
});
|
|
71
|
+
return formatSuccess(result);
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
// 3. Buy Tokens
|
|
75
|
+
export const buyTokensTool = {
|
|
76
|
+
name: 'gala_launchpad_buy_tokens',
|
|
77
|
+
description: 'Execute token purchase with slippage protection',
|
|
78
|
+
inputSchema: {
|
|
79
|
+
type: 'object',
|
|
80
|
+
properties: {
|
|
81
|
+
tokenName: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
84
|
+
description: 'Token name',
|
|
85
|
+
},
|
|
86
|
+
amount: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
pattern: '^[0-9.]+$',
|
|
89
|
+
description: 'Amount to spend/buy',
|
|
90
|
+
},
|
|
91
|
+
type: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
enum: ['native', 'token'],
|
|
94
|
+
description: 'Trade type',
|
|
95
|
+
},
|
|
96
|
+
expectedAmount: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
pattern: '^[0-9.]+$',
|
|
99
|
+
description: 'Expected output from calculateBuyAmount (REQUIRED)',
|
|
100
|
+
},
|
|
101
|
+
slippageToleranceFactor: {
|
|
102
|
+
type: 'number',
|
|
103
|
+
minimum: 0,
|
|
104
|
+
maximum: 1,
|
|
105
|
+
description: 'Decimal format (0.05 = 5% slippage)',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
required: ['tokenName', 'amount', 'type', 'expectedAmount', 'slippageToleranceFactor'],
|
|
109
|
+
},
|
|
110
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
111
|
+
const result = await sdk.buy({
|
|
112
|
+
tokenName: args.tokenName,
|
|
113
|
+
amount: args.amount,
|
|
114
|
+
type: args.type,
|
|
115
|
+
expectedAmount: args.expectedAmount,
|
|
116
|
+
slippageToleranceFactor: args.slippageToleranceFactor,
|
|
117
|
+
});
|
|
118
|
+
return formatSuccess(result);
|
|
119
|
+
}),
|
|
120
|
+
};
|
|
121
|
+
// 4. Sell Tokens
|
|
122
|
+
export const sellTokensTool = {
|
|
123
|
+
name: 'gala_launchpad_sell_tokens',
|
|
124
|
+
description: 'Execute token sale with slippage protection',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
tokenName: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
131
|
+
description: 'Token name',
|
|
132
|
+
},
|
|
133
|
+
amount: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
pattern: '^[0-9.]+$',
|
|
136
|
+
description: 'Amount to sell/receive',
|
|
137
|
+
},
|
|
138
|
+
type: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
enum: ['native', 'token'],
|
|
141
|
+
description: 'Trade type',
|
|
142
|
+
},
|
|
143
|
+
expectedAmount: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
pattern: '^[0-9.]+$',
|
|
146
|
+
description: 'Expected output from calculateSellAmount (REQUIRED)',
|
|
147
|
+
},
|
|
148
|
+
slippageToleranceFactor: {
|
|
149
|
+
type: 'number',
|
|
150
|
+
minimum: 0,
|
|
151
|
+
maximum: 1,
|
|
152
|
+
description: 'Decimal format (0.05 = 5% slippage)',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
required: ['tokenName', 'amount', 'type', 'expectedAmount', 'slippageToleranceFactor'],
|
|
156
|
+
},
|
|
157
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
158
|
+
const result = await sdk.sell({
|
|
159
|
+
tokenName: args.tokenName,
|
|
160
|
+
amount: args.amount,
|
|
161
|
+
type: args.type,
|
|
162
|
+
expectedAmount: args.expectedAmount,
|
|
163
|
+
slippageToleranceFactor: args.slippageToleranceFactor,
|
|
164
|
+
});
|
|
165
|
+
return formatSuccess(result);
|
|
166
|
+
}),
|
|
167
|
+
};
|
|
168
|
+
// 5. Fetch Trades
|
|
169
|
+
export const fetchTradesTool = {
|
|
170
|
+
name: 'gala_launchpad_fetch_trades',
|
|
171
|
+
description: 'Get trade history with filtering',
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
tokenName: {
|
|
176
|
+
type: 'string',
|
|
177
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
178
|
+
description: 'Token name',
|
|
179
|
+
},
|
|
180
|
+
tradeType: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
enum: ['BUY', 'SELL'],
|
|
183
|
+
description: 'Filter by trade type',
|
|
184
|
+
},
|
|
185
|
+
userAddress: {
|
|
186
|
+
type: 'string',
|
|
187
|
+
pattern: '^(0x[a-fA-F0-9]{40}|eth\\|[a-fA-F0-9]{40})$',
|
|
188
|
+
description: 'Filter by user address',
|
|
189
|
+
},
|
|
190
|
+
page: {
|
|
191
|
+
type: 'number',
|
|
192
|
+
minimum: 1,
|
|
193
|
+
description: 'Page number (default: 1)',
|
|
194
|
+
},
|
|
195
|
+
limit: {
|
|
196
|
+
type: 'number',
|
|
197
|
+
minimum: 1,
|
|
198
|
+
maximum: 100,
|
|
199
|
+
description: 'Results per page (default: 20)',
|
|
200
|
+
},
|
|
201
|
+
startDate: {
|
|
202
|
+
type: 'string',
|
|
203
|
+
format: 'date-time',
|
|
204
|
+
description: 'Filter by start date',
|
|
205
|
+
},
|
|
206
|
+
endDate: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
format: 'date-time',
|
|
209
|
+
description: 'Filter by end date',
|
|
210
|
+
},
|
|
211
|
+
sortOrder: {
|
|
212
|
+
type: 'string',
|
|
213
|
+
enum: ['ASC', 'DESC'],
|
|
214
|
+
description: 'Sort order (default: DESC)',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
219
|
+
const result = await sdk.fetchTrades({
|
|
220
|
+
tokenName: args.tokenName,
|
|
221
|
+
tradeType: args.tradeType,
|
|
222
|
+
userAddress: args.userAddress,
|
|
223
|
+
page: args.page || 1,
|
|
224
|
+
limit: args.limit || 20,
|
|
225
|
+
startDate: args.startDate,
|
|
226
|
+
endDate: args.endDate,
|
|
227
|
+
sortOrder: args.sortOrder || 'DESC',
|
|
228
|
+
});
|
|
229
|
+
return formatSuccess(result);
|
|
230
|
+
}),
|
|
231
|
+
};
|
|
232
|
+
// 6. Calculate Initial Buy
|
|
233
|
+
export const calculateInitialBuyTool = {
|
|
234
|
+
name: 'gala_launchpad_calculate_initial_buy',
|
|
235
|
+
description: 'Calculate amounts for initial token purchase during creation',
|
|
236
|
+
inputSchema: {
|
|
237
|
+
type: 'object',
|
|
238
|
+
properties: {
|
|
239
|
+
tokenName: {
|
|
240
|
+
type: 'string',
|
|
241
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
242
|
+
description: 'Token name',
|
|
243
|
+
},
|
|
244
|
+
amount: {
|
|
245
|
+
type: 'string',
|
|
246
|
+
pattern: '^[0-9.]+$',
|
|
247
|
+
description: 'Amount for initial buy',
|
|
248
|
+
},
|
|
249
|
+
type: {
|
|
250
|
+
type: 'string',
|
|
251
|
+
enum: ['native', 'token'],
|
|
252
|
+
description: 'Trade type',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
required: ['tokenName', 'amount', 'type'],
|
|
256
|
+
},
|
|
257
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
258
|
+
const result = await sdk.calculateInitialBuyAmount(args.amount);
|
|
259
|
+
return formatSuccess(result);
|
|
260
|
+
}),
|
|
261
|
+
};
|
|
262
|
+
export const tradingTools = [
|
|
263
|
+
calculateBuyAmountTool,
|
|
264
|
+
calculateSellAmountTool,
|
|
265
|
+
buyTokensTool,
|
|
266
|
+
sellTokensTool,
|
|
267
|
+
fetchTradesTool,
|
|
268
|
+
calculateInitialBuyTool,
|
|
269
|
+
];
|
|
270
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/trading/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,0BAA0B;AAC1B,MAAM,CAAC,MAAM,sBAAsB,GAAY;IAC7C,IAAI,EAAE,qCAAqC;IAC3C,WAAW,EAAE,uDAAuD;IACpE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oBAAoB;gBAC7B,WAAW,EAAE,YAAY;aAC1B;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE,0DAA0D;aACxE;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;gBACzB,WAAW,EAAE,qDAAqD;aACnE;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;KAC1C;IACD,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC7C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,kBAAkB,CAAC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+
import type { MCPTool } from '../../types/mcp.js';
|
|
5
|
+
export declare const transferGalaTool: MCPTool;
|
|
6
|
+
export declare const transferTokenTool: MCPTool;
|
|
7
|
+
export declare const transferTools: MCPTool[];
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/transfers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAKlD,eAAO,MAAM,gBAAgB,EAAE,OAgC9B,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAsC/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,EAA0C,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Transfer Tools
|
|
3
|
+
*/
|
|
4
|
+
import { formatSuccess } from '../../utils/response-formatter.js';
|
|
5
|
+
import { withErrorHandling } from '../../utils/error-handler.js';
|
|
6
|
+
// 1. Transfer GALA
|
|
7
|
+
export const transferGalaTool = {
|
|
8
|
+
name: 'gala_launchpad_transfer_gala',
|
|
9
|
+
description: 'Transfer GALA tokens via GalaChain',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
recipientAddress: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
pattern: '^(0x[a-fA-F0-9]{40}|eth\\|[a-fA-F0-9]{40})$',
|
|
16
|
+
description: 'Recipient wallet address',
|
|
17
|
+
},
|
|
18
|
+
amount: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
pattern: '^[0-9.]+$',
|
|
21
|
+
description: 'Amount in standard decimal format',
|
|
22
|
+
},
|
|
23
|
+
uniqueKey: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
pattern: '^galaconnect-operation-[a-z0-9-]+$',
|
|
26
|
+
description: 'Optional idempotency key',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: ['recipientAddress', 'amount'],
|
|
30
|
+
},
|
|
31
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
32
|
+
const result = await sdk.transferGala({
|
|
33
|
+
recipientAddress: args.recipientAddress,
|
|
34
|
+
amount: args.amount,
|
|
35
|
+
uniqueKey: args.uniqueKey,
|
|
36
|
+
});
|
|
37
|
+
return formatSuccess(result);
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
// 2. Transfer Token
|
|
41
|
+
export const transferTokenTool = {
|
|
42
|
+
name: 'gala_launchpad_transfer_token',
|
|
43
|
+
description: 'Transfer launchpad tokens via GalaChain',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
to: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
pattern: '^(0x[a-fA-F0-9]{40}|eth\\|[a-fA-F0-9]{40})$',
|
|
50
|
+
description: 'Recipient wallet address',
|
|
51
|
+
},
|
|
52
|
+
tokenName: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
pattern: '^[a-z0-9_-]{2,20}$',
|
|
55
|
+
description: 'Token name',
|
|
56
|
+
},
|
|
57
|
+
amount: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
pattern: '^[0-9]+$',
|
|
60
|
+
description: 'Token amount',
|
|
61
|
+
},
|
|
62
|
+
uniqueKey: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
pattern: '^galaconnect-operation-[a-z0-9-]+$',
|
|
65
|
+
description: 'Optional idempotency key',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
required: ['to', 'tokenName', 'amount'],
|
|
69
|
+
},
|
|
70
|
+
handler: withErrorHandling(async (sdk, args) => {
|
|
71
|
+
const result = await sdk.transferToken({
|
|
72
|
+
to: args.to,
|
|
73
|
+
tokenName: args.tokenName,
|
|
74
|
+
amount: args.amount,
|
|
75
|
+
uniqueKey: args.uniqueKey,
|
|
76
|
+
});
|
|
77
|
+
return formatSuccess(result);
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
export const transferTools = [transferGalaTool, transferTokenTool];
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/transfers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,mBAAmB;AACnB,MAAM,CAAC,MAAM,gBAAgB,GAAY;IACvC,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,gBAAgB,EAAE;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;gBACtD,WAAW,EAAE,0BAA0B;aACxC;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE,mCAAmC;aACjD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oCAAoC;gBAC7C,WAAW,EAAE,0BAA0B;aACxC;SACF;QACD,QAAQ,EAAE,CAAC,kBAAkB,EAAE,QAAQ,CAAC;KACzC;IACD,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC7C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC;YACpC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;QACH,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,CAAC;CACH,CAA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
/**
|
|
6
|
+
* MCP Tool Definition
|
|
7
|
+
*/
|
|
8
|
+
export interface MCPTool {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object';
|
|
13
|
+
properties: Record<string, any>;
|
|
14
|
+
required?: string[];
|
|
15
|
+
};
|
|
16
|
+
handler: (sdk: LaunchpadSDK, args: any) => Promise<MCPToolResponse>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* MCP Tool Response
|
|
20
|
+
*/
|
|
21
|
+
export interface MCPToolResponse {
|
|
22
|
+
content: Array<{
|
|
23
|
+
type: 'text' | 'image' | 'resource';
|
|
24
|
+
text?: string;
|
|
25
|
+
data?: string;
|
|
26
|
+
mimeType?: string;
|
|
27
|
+
}>;
|
|
28
|
+
isError?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tool execution context
|
|
32
|
+
*/
|
|
33
|
+
export interface ToolContext {
|
|
34
|
+
sdk: LaunchpadSDK;
|
|
35
|
+
debug: boolean;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;QACpC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,YAAY,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handler Utility
|
|
3
|
+
*
|
|
4
|
+
* Formats errors for MCP protocol responses
|
|
5
|
+
*/
|
|
6
|
+
import type { MCPToolResponse } from '../types/mcp.js';
|
|
7
|
+
/**
|
|
8
|
+
* Format error for MCP response
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatError(error: unknown): MCPToolResponse;
|
|
11
|
+
/**
|
|
12
|
+
* Wrap handler with error handling
|
|
13
|
+
*/
|
|
14
|
+
export declare function withErrorHandling<T extends (...args: any[]) => Promise<MCPToolResponse>>(handler: T): T;
|
|
15
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAiB3D;AAkBD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,eAAe,CAAC,EACtF,OAAO,EAAE,CAAC,GACT,CAAC,CAQH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handler Utility
|
|
3
|
+
*
|
|
4
|
+
* Formats errors for MCP protocol responses
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format error for MCP response
|
|
8
|
+
*/
|
|
9
|
+
export function formatError(error) {
|
|
10
|
+
const errorMessage = error instanceof Error
|
|
11
|
+
? error.message
|
|
12
|
+
: String(error);
|
|
13
|
+
// Sanitize sensitive information from error messages
|
|
14
|
+
const sanitized = sanitizeError(errorMessage);
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: `Error: ${sanitized}`,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
isError: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sanitize error messages to remove sensitive information
|
|
27
|
+
*/
|
|
28
|
+
function sanitizeError(message) {
|
|
29
|
+
// Remove private keys
|
|
30
|
+
let sanitized = message.replace(/0x[a-fA-F0-9]{64}/g, '0x***');
|
|
31
|
+
// Remove eth| addresses but keep format visible
|
|
32
|
+
sanitized = sanitized.replace(/(eth\|)[a-fA-F0-9]{40}/g, '$1***');
|
|
33
|
+
// Remove 0x addresses but keep format visible
|
|
34
|
+
sanitized = sanitized.replace(/(0x)[a-fA-F0-9]{40}/g, '$1***');
|
|
35
|
+
return sanitized;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Wrap handler with error handling
|
|
39
|
+
*/
|
|
40
|
+
export function withErrorHandling(handler) {
|
|
41
|
+
return (async (...args) => {
|
|
42
|
+
try {
|
|
43
|
+
return await handler(...args);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
return formatError(error);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK;QACzC,CAAC,CAAC,KAAK,CAAC,OAAO;QACf,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAElB,qDAAqD;IACrD,MAAM,SAAS,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAE9C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,UAAU,SAAS,EAAE;aAC5B;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,sBAAsB;IACtB,IAAI,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAE/D,gDAAgD;IAChD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAElE,8CAA8C;IAC9C,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IAE/D,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAU;IAEV,OAAO,CAAC,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;QAC/B,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CAAM,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response Formatter Utility
|
|
3
|
+
*
|
|
4
|
+
* Formats SDK responses for MCP protocol
|
|
5
|
+
*/
|
|
6
|
+
import type { MCPToolResponse } from '../types/mcp.js';
|
|
7
|
+
/**
|
|
8
|
+
* Format successful response
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatSuccess(data: any): MCPToolResponse;
|
|
11
|
+
/**
|
|
12
|
+
* Format boolean response
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatBoolean(result: boolean, message?: string): MCPToolResponse;
|
|
15
|
+
/**
|
|
16
|
+
* Format simple text response
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatText(text: string): MCPToolResponse;
|
|
19
|
+
//# sourceMappingURL=response-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-formatter.d.ts","sourceRoot":"","sources":["../../src/utils/response-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,eAAe,CASxD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAWhF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CASxD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response Formatter Utility
|
|
3
|
+
*
|
|
4
|
+
* Formats SDK responses for MCP protocol
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format successful response
|
|
8
|
+
*/
|
|
9
|
+
export function formatSuccess(data) {
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
text: JSON.stringify(data, null, 2),
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Format boolean response
|
|
21
|
+
*/
|
|
22
|
+
export function formatBoolean(result, message) {
|
|
23
|
+
const text = message || `Result: ${result}`;
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: JSON.stringify({ success: result, message: text }, null, 2),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Format simple text response
|
|
35
|
+
*/
|
|
36
|
+
export function formatText(text) {
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: 'text',
|
|
41
|
+
text,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=response-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-formatter.js","sourceRoot":"","sources":["../../src/utils/response-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAS;IACrC,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;aACpC;SACF;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe,EAAE,OAAgB;IAC7D,MAAM,IAAI,GAAG,OAAO,IAAI,WAAW,MAAM,EAAE,CAAC;IAE5C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;aAClE;SACF;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI;aACL;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gala-chain/launchpad-mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for Gala Launchpad SDK with 27 tools - AI agents can interact with Gala Launchpad",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"gala-launchpad-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc && chmod +x dist/index.js",
|
|
12
|
+
"dev": "tsx src/index.ts",
|
|
13
|
+
"watch": "tsc --watch",
|
|
14
|
+
"test": "jest --passWithNoTests",
|
|
15
|
+
"test:watch": "jest --watch",
|
|
16
|
+
"test:coverage": "jest --coverage",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"lint": "eslint src --ext .ts",
|
|
19
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"gala",
|
|
26
|
+
"galachain",
|
|
27
|
+
"launchpad",
|
|
28
|
+
"ai",
|
|
29
|
+
"agent",
|
|
30
|
+
"blockchain",
|
|
31
|
+
"defi",
|
|
32
|
+
"trading",
|
|
33
|
+
"claude",
|
|
34
|
+
"ai-tools"
|
|
35
|
+
],
|
|
36
|
+
"author": {
|
|
37
|
+
"name": "Gala Launchpad Team",
|
|
38
|
+
"email": "dev@gala-launchpad.com",
|
|
39
|
+
"url": "https://gala-launchpad.com"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://gitlab.com/gala-games/defi/launchpad/sdk.git",
|
|
45
|
+
"directory": "packages/mcp-server"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://gitlab.com/gala-games/defi/launchpad/sdk/-/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://gitlab.com/gala-games/defi/launchpad/sdk/tree/main/packages/mcp-server#readme",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0",
|
|
53
|
+
"npm": ">=10.0.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"registry": "https://registry.npmjs.org/"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@gala-chain/launchpad-sdk": "^3.0.2",
|
|
61
|
+
"@modelcontextprotocol/sdk": "^0.5.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@types/node": "^20.0.0",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
66
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
67
|
+
"eslint": "^8.0.0",
|
|
68
|
+
"jest": "^29.0.0",
|
|
69
|
+
"ts-jest": "^29.0.0",
|
|
70
|
+
"tsx": "^4.0.0",
|
|
71
|
+
"typescript": "^5.3.0"
|
|
72
|
+
}
|
|
73
|
+
}
|