@gala-chain/launchpad-mcp-server 1.22.3 → 1.23.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.
Files changed (153) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/README.md +83 -8
  3. package/dist/constants/mcpToolNames.d.ts +69 -11
  4. package/dist/constants/mcpToolNames.d.ts.map +1 -1
  5. package/dist/constants/mcpToolNames.js +47 -9
  6. package/dist/constants/mcpToolNames.js.map +1 -1
  7. package/dist/generated/version.d.ts +1 -1
  8. package/dist/generated/version.js +1 -1
  9. package/dist/prompts/balances.d.ts +24 -0
  10. package/dist/prompts/balances.d.ts.map +1 -0
  11. package/dist/prompts/balances.js +191 -0
  12. package/dist/prompts/balances.js.map +1 -0
  13. package/dist/prompts/creation-utils.d.ts +20 -0
  14. package/dist/prompts/creation-utils.d.ts.map +1 -0
  15. package/dist/prompts/creation-utils.js +115 -0
  16. package/dist/prompts/creation-utils.js.map +1 -0
  17. package/dist/prompts/index.d.ts +9 -2
  18. package/dist/prompts/index.d.ts.map +1 -1
  19. package/dist/prompts/index.js +23 -2
  20. package/dist/prompts/index.js.map +1 -1
  21. package/dist/prompts/pools.d.ts +64 -0
  22. package/dist/prompts/pools.d.ts.map +1 -0
  23. package/dist/prompts/pools.js +548 -0
  24. package/dist/prompts/pools.js.map +1 -0
  25. package/dist/prompts/social.d.ts +16 -0
  26. package/dist/prompts/social.d.ts.map +1 -0
  27. package/dist/prompts/social.js +97 -0
  28. package/dist/prompts/social.js.map +1 -0
  29. package/dist/prompts/trading-calculations.d.ts +52 -0
  30. package/dist/prompts/trading-calculations.d.ts.map +1 -0
  31. package/dist/prompts/trading-calculations.js +479 -0
  32. package/dist/prompts/trading-calculations.js.map +1 -0
  33. package/dist/prompts/transfers.d.ts +16 -0
  34. package/dist/prompts/transfers.d.ts.map +1 -0
  35. package/dist/prompts/transfers.js +100 -0
  36. package/dist/prompts/transfers.js.map +1 -0
  37. package/dist/prompts/utility-tools.d.ts +56 -0
  38. package/dist/prompts/utility-tools.d.ts.map +1 -0
  39. package/dist/prompts/utility-tools.js +338 -0
  40. package/dist/prompts/utility-tools.js.map +1 -0
  41. package/dist/prompts/utility.d.ts +8 -0
  42. package/dist/prompts/utility.d.ts.map +1 -1
  43. package/dist/prompts/utility.js +49 -2
  44. package/dist/prompts/utility.js.map +1 -1
  45. package/dist/server.d.ts +17 -0
  46. package/dist/server.d.ts.map +1 -1
  47. package/dist/server.js +81 -3
  48. package/dist/server.js.map +1 -1
  49. package/dist/tools/index.d.ts +9 -1
  50. package/dist/tools/index.d.ts.map +1 -1
  51. package/dist/tools/index.js +10 -2
  52. package/dist/tools/index.js.map +1 -1
  53. package/dist/tools/utils/getConfig.d.ts +2 -0
  54. package/dist/tools/utils/getConfig.d.ts.map +1 -1
  55. package/dist/tools/utils/getConfig.js +12 -3
  56. package/dist/tools/utils/getConfig.js.map +1 -1
  57. package/dist/tools/utils/getEnvironment.d.ts +8 -0
  58. package/dist/tools/utils/getEnvironment.d.ts.map +1 -0
  59. package/dist/tools/utils/getEnvironment.js +19 -0
  60. package/dist/tools/utils/getEnvironment.js.map +1 -0
  61. package/dist/tools/utils/index.d.ts.map +1 -1
  62. package/dist/tools/utils/index.js +4 -0
  63. package/dist/tools/utils/index.js.map +1 -1
  64. package/dist/tools/utils/switchEnvironment.d.ts +8 -0
  65. package/dist/tools/utils/switchEnvironment.d.ts.map +1 -0
  66. package/dist/tools/utils/switchEnvironment.js +30 -0
  67. package/dist/tools/utils/switchEnvironment.js.map +1 -0
  68. package/dist/types/mcp.d.ts +1 -1
  69. package/dist/types/mcp.d.ts.map +1 -1
  70. package/dist/utils/tool-factory.d.ts +30 -0
  71. package/dist/utils/tool-factory.d.ts.map +1 -1
  72. package/dist/utils/tool-factory.js +31 -0
  73. package/dist/utils/tool-factory.js.map +1 -1
  74. package/docs/AI-AGENT-PATTERNS.md +555 -0
  75. package/docs/CONSTRAINTS-REFERENCE.md +454 -0
  76. package/docs/PROMPT-TOOL-MAPPING.md +352 -0
  77. package/docs/examples/default-values-pattern.md +240 -0
  78. package/docs/examples/tool-factory-pattern.md +217 -0
  79. package/jest.config.js +94 -0
  80. package/package.json +1 -1
  81. package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +258 -0
  82. package/src/__tests__/integration/poolTools.integration.test.ts +185 -0
  83. package/src/__tests__/server.test.ts +256 -0
  84. package/src/constants/mcpToolNames.ts +181 -0
  85. package/src/index.ts +19 -0
  86. package/src/prompts/__tests__/promptStructure.test.ts +137 -0
  87. package/src/prompts/__tests__/registry.test.ts +359 -0
  88. package/src/prompts/analysis.ts +429 -0
  89. package/src/prompts/balances.ts +198 -0
  90. package/src/prompts/create-token.ts +123 -0
  91. package/src/prompts/creation-utils.ts +118 -0
  92. package/src/prompts/dex-trading.ts +86 -0
  93. package/src/prompts/discover-tokens.ts +86 -0
  94. package/src/prompts/index.ts +175 -0
  95. package/src/prompts/liquidity-positions.ts +270 -0
  96. package/src/prompts/pools.ts +571 -0
  97. package/src/prompts/portfolio.ts +242 -0
  98. package/src/prompts/social.ts +100 -0
  99. package/src/prompts/trading-calculations.ts +499 -0
  100. package/src/prompts/trading.ts +191 -0
  101. package/src/prompts/transfers.ts +103 -0
  102. package/src/prompts/utility-tools.ts +349 -0
  103. package/src/prompts/utility.ts +92 -0
  104. package/src/prompts/utils/workflowTemplates.ts +511 -0
  105. package/src/schemas/common-schemas.ts +393 -0
  106. package/src/scripts/test-all-prompts.ts +184 -0
  107. package/src/server.ts +367 -0
  108. package/src/tools/__tests__/dex-tools.test.ts +562 -0
  109. package/src/tools/__tests__/liquidity-positions.test.ts +673 -0
  110. package/src/tools/balance/index.ts +174 -0
  111. package/src/tools/creation/index.ts +182 -0
  112. package/src/tools/dex/index.ts +226 -0
  113. package/src/tools/dex/liquidity-positions.ts +547 -0
  114. package/src/tools/index.ts +94 -0
  115. package/src/tools/pools/fetchAllPools.ts +47 -0
  116. package/src/tools/pools/fetchAllPriceHistory.ts +119 -0
  117. package/src/tools/pools/fetchPoolDetails.ts +27 -0
  118. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +22 -0
  119. package/src/tools/pools/fetchPools.ts +47 -0
  120. package/src/tools/pools/fetchPriceHistory.ts +124 -0
  121. package/src/tools/pools/fetchTokenDetails.ts +77 -0
  122. package/src/tools/pools/index.ts +284 -0
  123. package/src/tools/social/index.ts +64 -0
  124. package/src/tools/trading/index.ts +605 -0
  125. package/src/tools/transfers/index.ts +75 -0
  126. package/src/tools/utils/clearCache.ts +36 -0
  127. package/src/tools/utils/createWallet.ts +19 -0
  128. package/src/tools/utils/explainSdkUsage.ts +1446 -0
  129. package/src/tools/utils/getAddress.ts +12 -0
  130. package/src/tools/utils/getCacheInfo.ts +14 -0
  131. package/src/tools/utils/getConfig.ts +21 -0
  132. package/src/tools/utils/getEnvironment.ts +17 -0
  133. package/src/tools/utils/getEthereumAddress.ts +12 -0
  134. package/src/tools/utils/getUrlByTokenName.ts +12 -0
  135. package/src/tools/utils/getVersion.ts +25 -0
  136. package/src/tools/utils/getWallet.ts +25 -0
  137. package/src/tools/utils/hasWallet.ts +15 -0
  138. package/src/tools/utils/index.ts +37 -0
  139. package/src/tools/utils/isTokenGraduated.ts +16 -0
  140. package/src/tools/utils/setWallet.ts +41 -0
  141. package/src/tools/utils/switchEnvironment.ts +28 -0
  142. package/src/types/mcp.ts +72 -0
  143. package/src/utils/__tests__/validation.test.ts +147 -0
  144. package/src/utils/constraints.ts +155 -0
  145. package/src/utils/default-values.ts +208 -0
  146. package/src/utils/error-handler.ts +69 -0
  147. package/src/utils/error-templates.ts +273 -0
  148. package/src/utils/response-formatter.ts +51 -0
  149. package/src/utils/tool-factory.ts +303 -0
  150. package/src/utils/tool-registry.ts +296 -0
  151. package/src/utils/validation.ts +371 -0
  152. package/tests/wallet-management-integration.test.ts +284 -0
  153. package/tsconfig.json +23 -0
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Portfolio Prompts
3
+ *
4
+ * Slash commands for portfolio management on Gala Launchpad
5
+ */
6
+
7
+ import type { MCPPrompt } from '../types/mcp.js';
8
+ import { MCP_TOOLS } from '../constants/mcpToolNames.js';
9
+ import { createPortfolioWorkflow } from './utils/workflowTemplates.js';
10
+ import { validateTokenName, validatePaginationLimit } from '../utils/validation.js';
11
+
12
+ /**
13
+ * Portfolio - Complete portfolio analysis
14
+ */
15
+ export const portfolioPrompt: MCPPrompt = {
16
+ name: 'galachain-launchpad:portfolio',
17
+ description: 'Analyze complete portfolio with GALA balance, token holdings, and total USD value',
18
+ handler: () => [
19
+ {
20
+ role: 'user',
21
+ content: {
22
+ type: 'text',
23
+ text: createPortfolioWorkflow(),
24
+ },
25
+ },
26
+ ],
27
+ };
28
+
29
+ /**
30
+ * Tokens Held - List all token holdings
31
+ */
32
+ export const tokensHeldPrompt: MCPPrompt = {
33
+ name: 'galachain-launchpad:tokens-held',
34
+ description: 'List all Launchpad tokens currently held with balances',
35
+ arguments: [
36
+ {
37
+ name: 'search',
38
+ description: 'Optional search filter for token names (fuzzy match)',
39
+ required: false,
40
+ },
41
+ {
42
+ name: 'limit',
43
+ description: 'Number of tokens to show (default: 20)',
44
+ required: false,
45
+ },
46
+ ],
47
+ handler: (args) => {
48
+ // Validate inputs
49
+ if (args.limit) {
50
+ validatePaginationLimit(args.limit, 100);
51
+ }
52
+
53
+ const limit = args.limit || '20';
54
+ const searchFilter = args.search
55
+ ? `- search: "${args.search}" (fuzzy match filter)`
56
+ : '- No search filter (show all tokens)';
57
+
58
+ return [
59
+ {
60
+ role: 'user',
61
+ content: {
62
+ type: 'text',
63
+ text: `Show me all Launchpad tokens I'm currently holding:
64
+
65
+ Use ${MCP_TOOLS.FETCH_TOKENS_HELD} with:
66
+ ${searchFilter}
67
+ - limit: ${limit}
68
+
69
+ For each token, display:
70
+ - Token name
71
+ - Balance (formatted with decimals)
72
+ - Whether I created this token (if applicable)
73
+
74
+ Sort by balance (highest to lowest).
75
+
76
+ If I have more tokens than the limit, show pagination info and offer to fetch more.`,
77
+ },
78
+ },
79
+ ];
80
+ },
81
+ };
82
+
83
+ /**
84
+ * Tokens Created - Show tokens created by user
85
+ */
86
+ export const tokensCreatedPrompt: MCPPrompt = {
87
+ name: 'galachain-launchpad:tokens-created',
88
+ description: 'List all Launchpad tokens created by the user with their current status',
89
+ arguments: [
90
+ {
91
+ name: 'search',
92
+ description: 'Optional search filter for token names (fuzzy match)',
93
+ required: false,
94
+ },
95
+ {
96
+ name: 'limit',
97
+ description: 'Number of tokens to show (default: 20)',
98
+ required: false,
99
+ },
100
+ ],
101
+ handler: (args) => {
102
+ // Validate inputs
103
+ if (args.limit) {
104
+ validatePaginationLimit(args.limit, 100);
105
+ }
106
+
107
+ const limit = args.limit || '20';
108
+ const searchFilter = args.search
109
+ ? `- search: "${args.search}" (fuzzy match filter)`
110
+ : '- No search filter (show all tokens)';
111
+
112
+ return [
113
+ {
114
+ role: 'user',
115
+ content: {
116
+ type: 'text',
117
+ text: `Show me all Launchpad tokens I've created:
118
+
119
+ Use ${MCP_TOOLS.FETCH_TOKENS_CREATED} with:
120
+ ${searchFilter}
121
+ - limit: ${limit}
122
+
123
+ For each token, display:
124
+ - Token name and symbol
125
+ - Current status (check using ${MCP_TOOLS.FETCH_POOL_DETAILS}):
126
+ * Pool status (Ongoing/Completed)
127
+ * Current supply
128
+ * Remaining tokens
129
+ * Progress percentage
130
+ - Whether graduated (use ${MCP_TOOLS.IS_TOKEN_GRADUATED})
131
+ - Frontend URL (use ${MCP_TOOLS.GET_URL_BY_TOKEN_NAME})
132
+
133
+ Provide a summary:
134
+ - Total tokens created
135
+ - How many are graduated
136
+ - How many are still in bonding curve phase`,
137
+ },
138
+ },
139
+ ];
140
+ },
141
+ };
142
+
143
+ /**
144
+ * Balance - Check GALA and specific token balances
145
+ */
146
+ export const balancePrompt: MCPPrompt = {
147
+ name: 'galachain-launchpad:balance',
148
+ description: 'Check GALA balance and optionally a specific token balance',
149
+ arguments: [
150
+ {
151
+ name: 'tokenName',
152
+ description: 'Optional token name to check balance for (e.g., anime)',
153
+ required: false,
154
+ },
155
+ ],
156
+ handler: (args) => {
157
+ // Validate inputs
158
+ if (args.tokenName) {
159
+ validateTokenName(args.tokenName);
160
+ }
161
+
162
+ return [
163
+ {
164
+ role: 'user',
165
+ content: {
166
+ type: 'text',
167
+ text: args.tokenName
168
+ ? `Check my balances:
169
+
170
+ 1. GALA balance using ${MCP_TOOLS.FETCH_GALA_BALANCE}
171
+ 2. ${args.tokenName} token balance using ${MCP_TOOLS.FETCH_TOKEN_BALANCE}
172
+ 3. Calculate USD values:
173
+ - GALA USD value using ${MCP_TOOLS.FETCH_GALA_SPOT_PRICE}
174
+ - ${args.tokenName} USD value using ${MCP_TOOLS.FETCH_LAUNCHPAD_TOKEN_SPOT_PRICE}
175
+
176
+ Display:
177
+ - GALA: [amount] ($[USD value])
178
+ - ${args.tokenName}: [amount] ($[USD value])
179
+ - Total value: $[combined USD value]`
180
+ : `Check my GALA balance:
181
+
182
+ Use ${MCP_TOOLS.FETCH_GALA_BALANCE} to get current GALA balance.
183
+ Use ${MCP_TOOLS.FETCH_GALA_SPOT_PRICE} to calculate USD value.
184
+
185
+ Display:
186
+ - GALA: [amount]
187
+ - USD value: $[calculated value]
188
+
189
+ Tip: Add tokenName argument to check a specific token balance.`,
190
+ },
191
+ },
192
+ ];
193
+ },
194
+ };
195
+
196
+ /**
197
+ * Profile - Show user profile information
198
+ */
199
+ export const profilePrompt: MCPPrompt = {
200
+ name: 'galachain-launchpad:profile',
201
+ description: 'Show user profile information and activity summary',
202
+ handler: () => [
203
+ {
204
+ role: 'user',
205
+ content: {
206
+ type: 'text',
207
+ text: `Show my Gala Launchpad profile:
208
+
209
+ 1. Get profile info using ${MCP_TOOLS.FETCH_PROFILE}
210
+ - Full name
211
+ - Profile image URL
212
+ - Wallet address
213
+
214
+ 2. Get activity summary:
215
+ - Tokens held count: ${MCP_TOOLS.FETCH_TOKENS_HELD} (limit: 1) for total
216
+ - Tokens created count: ${MCP_TOOLS.FETCH_TOKENS_CREATED} (limit: 1) for total
217
+
218
+ 3. Get wallet info:
219
+ - GalaChain address format: ${MCP_TOOLS.GET_ADDRESS}
220
+ - Ethereum address format: ${MCP_TOOLS.GET_ETHEREUM_ADDRESS}
221
+ - GALA balance: ${MCP_TOOLS.FETCH_GALA_BALANCE}
222
+
223
+ Display:
224
+ - Profile details
225
+ - Activity metrics
226
+ - Wallet addresses
227
+ - Current balance`,
228
+ },
229
+ },
230
+ ],
231
+ };
232
+
233
+ /**
234
+ * Export all portfolio prompts
235
+ */
236
+ export const portfolioPrompts: MCPPrompt[] = [
237
+ portfolioPrompt,
238
+ tokensHeldPrompt,
239
+ tokensCreatedPrompt,
240
+ balancePrompt,
241
+ profilePrompt,
242
+ ];
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Social Interaction Prompts
3
+ *
4
+ * Slash commands for comments and social interactions
5
+ */
6
+
7
+ import type { MCPPrompt } from '../types/mcp.js';
8
+ import { MCP_TOOLS } from '../constants/mcpToolNames.js';
9
+ import { validateTokenName } from '../utils/validation.js';
10
+
11
+ /**
12
+ * Post Comment - Post comment on token
13
+ */
14
+ export const postCommentPrompt: MCPPrompt = {
15
+ name: 'galachain-launchpad:post-comment',
16
+ description: 'Post a comment on a token pool',
17
+ arguments: [
18
+ {
19
+ name: 'tokenName',
20
+ description: 'Token name (e.g., anime)',
21
+ required: true,
22
+ },
23
+ {
24
+ name: 'message',
25
+ description: 'Comment message (max 500 characters)',
26
+ required: true,
27
+ },
28
+ ],
29
+ handler: (args) => {
30
+ validateTokenName(args.tokenName);
31
+
32
+ return [
33
+ {
34
+ role: 'user',
35
+ content: {
36
+ type: 'text',
37
+ text: `Post comment on token pool.
38
+
39
+ Token: ${args.tokenName}
40
+ Message: ${args.message}
41
+
42
+ Use ${MCP_TOOLS.POST_COMMENT} to post the comment.
43
+
44
+ Display confirmation of successful comment posting.`,
45
+ },
46
+ },
47
+ ];
48
+ },
49
+ };
50
+
51
+ /**
52
+ * Fetch Comments - Get token comments
53
+ */
54
+ export const fetchCommentsPrompt: MCPPrompt = {
55
+ name: 'galachain-launchpad:fetch-comments',
56
+ description: 'Get comments for a token pool',
57
+ arguments: [
58
+ {
59
+ name: 'tokenName',
60
+ description: 'Token name (e.g., anime)',
61
+ required: true,
62
+ },
63
+ {
64
+ name: 'page',
65
+ description: 'Page number (default: 1)',
66
+ required: false,
67
+ },
68
+ {
69
+ name: 'limit',
70
+ description: 'Results per page (default: 20)',
71
+ required: false,
72
+ },
73
+ ],
74
+ handler: (args) => {
75
+ validateTokenName(args.tokenName);
76
+
77
+ return [
78
+ {
79
+ role: 'user',
80
+ content: {
81
+ type: 'text',
82
+ text: `Fetch comments for token pool.
83
+
84
+ Token: ${args.tokenName}
85
+ Page: ${args.page || 1}
86
+ Limit: ${args.limit || 20}
87
+
88
+ Use ${MCP_TOOLS.FETCH_COMMENTS} to retrieve comments.
89
+
90
+ Display the comments with author information and timestamps.`,
91
+ },
92
+ },
93
+ ];
94
+ },
95
+ };
96
+
97
+ export const socialPrompts: MCPPrompt[] = [
98
+ postCommentPrompt,
99
+ fetchCommentsPrompt,
100
+ ];