@gala-chain/launchpad-mcp-server 1.23.1 → 1.24.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/CHANGELOG.md +11 -0
- package/README.md +34 -6
- package/dist/constants/mcpToolNames.d.ts +6 -2
- package/dist/constants/mcpToolNames.d.ts.map +1 -1
- package/dist/constants/mcpToolNames.js +4 -2
- package/dist/constants/mcpToolNames.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/prompts/explore-dex-pools.d.ts +20 -0
- package/dist/prompts/explore-dex-pools.d.ts.map +1 -0
- package/dist/prompts/explore-dex-pools.js +132 -0
- package/dist/prompts/explore-dex-pools.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +6 -3
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/pools.js.map +1 -1
- package/dist/tools/dex/fetchAllDexPools.d.ts +9 -0
- package/dist/tools/dex/fetchAllDexPools.d.ts.map +1 -0
- package/dist/tools/dex/fetchAllDexPools.js +45 -0
- package/dist/tools/dex/fetchAllDexPools.js.map +1 -0
- package/dist/tools/dex/fetchDexPools.d.ts +9 -0
- package/dist/tools/dex/fetchDexPools.d.ts.map +1 -0
- package/dist/tools/dex/fetchDexPools.js +58 -0
- package/dist/tools/dex/fetchDexPools.js.map +1 -0
- package/dist/tools/dex/index.d.ts +4 -3
- package/dist/tools/dex/index.d.ts.map +1 -1
- package/dist/tools/dex/index.js +9 -4
- package/dist/tools/dex/index.js.map +1 -1
- package/docs/AI-AGENT-PATTERNS.md +555 -0
- package/docs/CONSTRAINTS-REFERENCE.md +454 -0
- package/docs/PROMPT-TOOL-MAPPING.md +352 -0
- package/docs/examples/default-values-pattern.md +240 -0
- package/docs/examples/tool-factory-pattern.md +217 -0
- package/jest.config.js +94 -0
- package/package.json +3 -3
- package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +258 -0
- package/src/__tests__/integration/poolTools.integration.test.ts +185 -0
- package/src/__tests__/server.test.ts +255 -0
- package/src/constants/mcpToolNames.ts +183 -0
- package/src/index.ts +19 -0
- package/src/prompts/__tests__/promptStructure.test.ts +187 -0
- package/src/prompts/__tests__/registry.test.ts +349 -0
- package/src/prompts/analysis.ts +380 -0
- package/src/prompts/balances.ts +182 -0
- package/src/prompts/create-token.ts +123 -0
- package/src/prompts/creation-utils.ts +103 -0
- package/src/prompts/dex-trading.ts +86 -0
- package/src/prompts/discover-tokens.ts +86 -0
- package/src/prompts/explore-dex-pools.ts +138 -0
- package/src/prompts/index.ts +178 -0
- package/src/prompts/liquidity-positions.ts +237 -0
- package/src/prompts/pools.ts +496 -0
- package/src/prompts/portfolio.ts +208 -0
- package/src/prompts/social.ts +94 -0
- package/src/prompts/trading-calculations.ts +414 -0
- package/src/prompts/trading.ts +160 -0
- package/src/prompts/transfers.ts +97 -0
- package/src/prompts/utility-tools.ts +266 -0
- package/src/prompts/utility.ts +77 -0
- package/src/prompts/utils/handlerHelpers.ts +55 -0
- package/src/prompts/utils/textTemplates.ts +73 -0
- package/src/prompts/utils/workflowTemplates.ts +511 -0
- package/src/schemas/common-schemas.ts +393 -0
- package/src/scripts/test-all-prompts.ts +184 -0
- package/src/server.ts +367 -0
- package/src/tools/__tests__/dex-tools.test.ts +562 -0
- package/src/tools/__tests__/liquidity-positions.test.ts +673 -0
- package/src/tools/balance/index.ts +174 -0
- package/src/tools/creation/index.ts +182 -0
- package/src/tools/dex/fetchAllDexPools.ts +45 -0
- package/src/tools/dex/fetchDexPools.ts +58 -0
- package/src/tools/dex/index.ts +231 -0
- package/src/tools/dex/liquidity-positions.ts +547 -0
- package/src/tools/index.ts +94 -0
- package/src/tools/pools/fetchAllPools.ts +47 -0
- package/src/tools/pools/fetchAllPriceHistory.ts +119 -0
- package/src/tools/pools/fetchPoolDetails.ts +27 -0
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +22 -0
- package/src/tools/pools/fetchPools.ts +47 -0
- package/src/tools/pools/fetchPriceHistory.ts +124 -0
- package/src/tools/pools/fetchTokenDetails.ts +77 -0
- package/src/tools/pools/index.ts +284 -0
- package/src/tools/social/index.ts +64 -0
- package/src/tools/trading/index.ts +605 -0
- package/src/tools/transfers/index.ts +75 -0
- package/src/tools/utils/clearCache.ts +36 -0
- package/src/tools/utils/createWallet.ts +19 -0
- package/src/tools/utils/explainSdkUsage.ts +1446 -0
- package/src/tools/utils/getAddress.ts +12 -0
- package/src/tools/utils/getCacheInfo.ts +14 -0
- package/src/tools/utils/getConfig.ts +21 -0
- package/src/tools/utils/getEnvironment.ts +17 -0
- package/src/tools/utils/getEthereumAddress.ts +12 -0
- package/src/tools/utils/getUrlByTokenName.ts +12 -0
- package/src/tools/utils/getVersion.ts +25 -0
- package/src/tools/utils/getWallet.ts +25 -0
- package/src/tools/utils/hasWallet.ts +15 -0
- package/src/tools/utils/index.ts +37 -0
- package/src/tools/utils/isTokenGraduated.ts +16 -0
- package/src/tools/utils/setWallet.ts +41 -0
- package/src/tools/utils/switchEnvironment.ts +28 -0
- package/src/types/mcp.ts +72 -0
- package/src/utils/__tests__/validation.test.ts +147 -0
- package/src/utils/constraints.ts +155 -0
- package/src/utils/default-values.ts +208 -0
- package/src/utils/error-handler.ts +69 -0
- package/src/utils/error-templates.ts +273 -0
- package/src/utils/response-formatter.ts +51 -0
- package/src/utils/tool-factory.ts +303 -0
- package/src/utils/tool-registry.ts +296 -0
- package/src/utils/validation.ts +429 -0
- package/tests/wallet-management-integration.test.ts +284 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEX Liquidity Position Prompts
|
|
3
|
+
*
|
|
4
|
+
* Slash commands for managing liquidity positions on GalaSwap DEX
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { MCPPrompt } from '../types/mcp.js';
|
|
8
|
+
import { validateNumericAmount } from '../utils/validation.js';
|
|
9
|
+
import { createPromptResponse } from './utils/handlerHelpers.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* View My Liquidity Positions - List all open LP positions
|
|
13
|
+
*
|
|
14
|
+
* This prompt shows all open liquidity positions for the authenticated wallet.
|
|
15
|
+
*/
|
|
16
|
+
export const myPositionsPrompt: MCPPrompt = {
|
|
17
|
+
name: 'galachain-launchpad:my-positions',
|
|
18
|
+
description:
|
|
19
|
+
'View all your open liquidity positions on GalaSwap DEX with details about each position',
|
|
20
|
+
arguments: [],
|
|
21
|
+
handler: () =>
|
|
22
|
+
createPromptResponse(`I want to view all my open liquidity positions on GalaSwap DEX.
|
|
23
|
+
|
|
24
|
+
**Action:**
|
|
25
|
+
Show me all my liquidity positions with the following information for each:
|
|
26
|
+
- Position ID
|
|
27
|
+
- Token pair (token0/token1)
|
|
28
|
+
- Fee tier
|
|
29
|
+
- Current liquidity amount
|
|
30
|
+
- Token amounts locked
|
|
31
|
+
- Accumulated trading fees
|
|
32
|
+
|
|
33
|
+
**Workflow:**
|
|
34
|
+
1. Fetch all my open positions using gala_launchpad_get_user_liquidity_positions
|
|
35
|
+
2. Display each position with key details
|
|
36
|
+
3. Show total summary (number of positions, total accumulated fees)
|
|
37
|
+
|
|
38
|
+
Please use the following MCP tools:
|
|
39
|
+
- gala_launchpad_get_user_liquidity_positions: Retrieve all open positions for my wallet
|
|
40
|
+
|
|
41
|
+
Proceed with fetching my positions.`),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Add Liquidity - Create new LP position with guided workflow
|
|
46
|
+
*
|
|
47
|
+
* Guides through adding liquidity to a pool with price range selection
|
|
48
|
+
*/
|
|
49
|
+
export const addLiquidityPrompt: MCPPrompt = {
|
|
50
|
+
name: 'galachain-launchpad:add-liquidity',
|
|
51
|
+
description:
|
|
52
|
+
'Add liquidity to a GalaSwap DEX pool. Guides through selecting token pair, price range, and amounts.',
|
|
53
|
+
arguments: [
|
|
54
|
+
{
|
|
55
|
+
name: 'token0',
|
|
56
|
+
description: 'First token symbol (e.g., GALA)',
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'token1',
|
|
61
|
+
description: 'Second token symbol (e.g., GUSDC)',
|
|
62
|
+
required: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'amount0',
|
|
66
|
+
description: 'Amount of token0 to provide (e.g., 1000)',
|
|
67
|
+
required: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'amount1',
|
|
71
|
+
description: 'Amount of token1 to provide (e.g., 1000)',
|
|
72
|
+
required: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'minPrice',
|
|
76
|
+
description: 'Minimum price boundary for LP range (e.g., 0.90)',
|
|
77
|
+
required: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'maxPrice',
|
|
81
|
+
description: 'Maximum price boundary for LP range (e.g., 1.10)',
|
|
82
|
+
required: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'feeTier',
|
|
86
|
+
description: 'Fee tier in basis points: 500, 3000, or 10000 (default: 3000)',
|
|
87
|
+
required: false,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
handler: (args) => {
|
|
91
|
+
// Validate amounts
|
|
92
|
+
validateNumericAmount(args.amount0, 'amount0');
|
|
93
|
+
validateNumericAmount(args.amount1, 'amount1');
|
|
94
|
+
|
|
95
|
+
const minPrice = args.minPrice || '0.95';
|
|
96
|
+
const maxPrice = args.maxPrice || '1.05';
|
|
97
|
+
const feeTier = args.feeTier || '3000';
|
|
98
|
+
|
|
99
|
+
return createPromptResponse(`I want to add liquidity to the ${args.token0}/${args.token1} pool on GalaSwap DEX.
|
|
100
|
+
|
|
101
|
+
**Liquidity Details:**
|
|
102
|
+
- Token Pair: ${args.token0} / ${args.token1}
|
|
103
|
+
- Amount of ${args.token0}: ${args.amount0}
|
|
104
|
+
- Amount of ${args.token1}: ${args.amount1}
|
|
105
|
+
- Price Range: ${minPrice} - ${maxPrice}
|
|
106
|
+
- Fee Tier: ${feeTier} basis points (${parseInt(feeTier) / 100}%)
|
|
107
|
+
|
|
108
|
+
**Workflow:**
|
|
109
|
+
1. Check my wallet balances to ensure I have sufficient tokens
|
|
110
|
+
2. Get pool information for the ${args.token0}/${args.token1} pair
|
|
111
|
+
3. Add liquidity by price range with the specified amounts and price boundaries
|
|
112
|
+
4. Confirm the position was created successfully
|
|
113
|
+
|
|
114
|
+
**Important:**
|
|
115
|
+
- Price range ${minPrice}-${maxPrice} means liquidity is only provided when the price is in this range
|
|
116
|
+
- Lower fee tiers (500 bps) for stablecoins, higher fees (3000-10000 bps) for volatile pairs
|
|
117
|
+
- I accept the estimated slippage shown in the quote
|
|
118
|
+
|
|
119
|
+
Please use the following MCP tools:
|
|
120
|
+
- gala_launchpad_get_swap_user_assets: Check my token balances
|
|
121
|
+
- gala_launchpad_get_swap_pool_info: Get ${args.token0}/${args.token1} pool details
|
|
122
|
+
- gala_launchpad_add_liquidity_by_price: Add liquidity with price range
|
|
123
|
+
|
|
124
|
+
Proceed with adding liquidity.`);
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Remove Liquidity - Close or reduce LP position
|
|
130
|
+
*
|
|
131
|
+
* Guides through removing liquidity from an existing position
|
|
132
|
+
*/
|
|
133
|
+
export const removeLiquidityPrompt: MCPPrompt = {
|
|
134
|
+
name: 'galachain-launchpad:remove-liquidity',
|
|
135
|
+
description:
|
|
136
|
+
'Remove liquidity from an existing position. Shows estimated tokens and fees to receive.',
|
|
137
|
+
arguments: [
|
|
138
|
+
{
|
|
139
|
+
name: 'positionId',
|
|
140
|
+
description: 'Position ID to remove liquidity from',
|
|
141
|
+
required: true,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'percentage',
|
|
145
|
+
description: 'Percentage of liquidity to remove (0-100, default: 100 to close position)',
|
|
146
|
+
required: false,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
handler: (args) => {
|
|
150
|
+
const percentage = args.percentage || '100';
|
|
151
|
+
|
|
152
|
+
return createPromptResponse(`I want to remove ${percentage}% of liquidity from position ${args.positionId}.
|
|
153
|
+
|
|
154
|
+
**Removal Details:**
|
|
155
|
+
- Position ID: ${args.positionId}
|
|
156
|
+
- Removal Amount: ${percentage}% of liquidity
|
|
157
|
+
${percentage === '100' ? '- Action: Close position completely' : '- Action: Reduce position by ' + percentage + '%'}
|
|
158
|
+
|
|
159
|
+
**Workflow:**
|
|
160
|
+
1. Get position details (token pair, current liquidity, accumulated fees)
|
|
161
|
+
2. Estimate tokens and fees that will be received when removing
|
|
162
|
+
3. Show the breakdown of what I'll receive
|
|
163
|
+
4. Execute the removal with slippage protection
|
|
164
|
+
5. Verify the position was updated/closed
|
|
165
|
+
|
|
166
|
+
**Important:**
|
|
167
|
+
- Removing 100% closes the position
|
|
168
|
+
- Removing less keeps the position open with reduced liquidity
|
|
169
|
+
- Accumulated fees can be collected separately if desired
|
|
170
|
+
- Slippage protection ensures I receive acceptable amounts
|
|
171
|
+
|
|
172
|
+
Please use the following MCP tools:
|
|
173
|
+
- gala_launchpad_get_liquidity_position_by_id: Get position details
|
|
174
|
+
- gala_launchpad_estimate_remove_liquidity: Preview what I'll receive
|
|
175
|
+
- gala_launchpad_remove_liquidity: Execute the removal
|
|
176
|
+
|
|
177
|
+
Proceed with removing liquidity.`);
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Collect Fees - Harvest accumulated trading fees
|
|
183
|
+
*
|
|
184
|
+
* Guides through collecting accumulated fees from a position
|
|
185
|
+
*/
|
|
186
|
+
export const collectFeesPrompt: MCPPrompt = {
|
|
187
|
+
name: 'galachain-launchpad:collect-fees',
|
|
188
|
+
description:
|
|
189
|
+
'Collect accumulated trading fees from a liquidity position without modifying the position.',
|
|
190
|
+
arguments: [
|
|
191
|
+
{
|
|
192
|
+
name: 'positionId',
|
|
193
|
+
description: 'Position ID to collect fees from',
|
|
194
|
+
required: true,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
handler: (args) =>
|
|
198
|
+
createPromptResponse(`I want to collect accumulated trading fees from position ${args.positionId}.
|
|
199
|
+
|
|
200
|
+
**Fee Collection Details:**
|
|
201
|
+
- Position ID: ${args.positionId}
|
|
202
|
+
- Action: Harvest accumulated trading fees
|
|
203
|
+
- Position Impact: Liquidity remains unchanged, only fees collected
|
|
204
|
+
|
|
205
|
+
**Workflow:**
|
|
206
|
+
1. Get position details to show accumulated fees
|
|
207
|
+
2. Show how much in fees is available to collect (in both tokens)
|
|
208
|
+
3. Execute fee collection transaction
|
|
209
|
+
4. Confirm fees were successfully collected
|
|
210
|
+
|
|
211
|
+
**Benefits:**
|
|
212
|
+
- Passive income from liquidity provision
|
|
213
|
+
- Fees accumulate continuously as trades happen
|
|
214
|
+
- Can be collected without closing the position
|
|
215
|
+
- Frees up rewards to reinvest or use elsewhere
|
|
216
|
+
|
|
217
|
+
**Important:**
|
|
218
|
+
- Fee collection doesn't affect your liquidity position
|
|
219
|
+
- Fees are only earned on trades within your price range
|
|
220
|
+
- Fee amounts depend on trading volume and your fee tier
|
|
221
|
+
|
|
222
|
+
Please use the following MCP tools:
|
|
223
|
+
- gala_launchpad_get_liquidity_position_by_id: Get position details and fee amounts
|
|
224
|
+
- gala_launchpad_collect_position_fees: Collect the accumulated fees
|
|
225
|
+
|
|
226
|
+
Proceed with collecting fees.`),
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Export all liquidity position prompts
|
|
231
|
+
*/
|
|
232
|
+
export const liquidityPositionPrompts: MCPPrompt[] = [
|
|
233
|
+
myPositionsPrompt,
|
|
234
|
+
addLiquidityPrompt,
|
|
235
|
+
removeLiquidityPrompt,
|
|
236
|
+
collectFeesPrompt,
|
|
237
|
+
];
|