@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.
- package/CHANGELOG.md +161 -0
- package/README.md +83 -8
- package/dist/constants/mcpToolNames.d.ts +69 -11
- package/dist/constants/mcpToolNames.d.ts.map +1 -1
- package/dist/constants/mcpToolNames.js +47 -9
- 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/balances.d.ts +24 -0
- package/dist/prompts/balances.d.ts.map +1 -0
- package/dist/prompts/balances.js +191 -0
- package/dist/prompts/balances.js.map +1 -0
- package/dist/prompts/creation-utils.d.ts +20 -0
- package/dist/prompts/creation-utils.d.ts.map +1 -0
- package/dist/prompts/creation-utils.js +115 -0
- package/dist/prompts/creation-utils.js.map +1 -0
- package/dist/prompts/index.d.ts +9 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +23 -2
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/pools.d.ts +64 -0
- package/dist/prompts/pools.d.ts.map +1 -0
- package/dist/prompts/pools.js +548 -0
- package/dist/prompts/pools.js.map +1 -0
- package/dist/prompts/social.d.ts +16 -0
- package/dist/prompts/social.d.ts.map +1 -0
- package/dist/prompts/social.js +97 -0
- package/dist/prompts/social.js.map +1 -0
- package/dist/prompts/trading-calculations.d.ts +52 -0
- package/dist/prompts/trading-calculations.d.ts.map +1 -0
- package/dist/prompts/trading-calculations.js +479 -0
- package/dist/prompts/trading-calculations.js.map +1 -0
- package/dist/prompts/transfers.d.ts +16 -0
- package/dist/prompts/transfers.d.ts.map +1 -0
- package/dist/prompts/transfers.js +100 -0
- package/dist/prompts/transfers.js.map +1 -0
- package/dist/prompts/utility-tools.d.ts +56 -0
- package/dist/prompts/utility-tools.d.ts.map +1 -0
- package/dist/prompts/utility-tools.js +338 -0
- package/dist/prompts/utility-tools.js.map +1 -0
- package/dist/prompts/utility.d.ts +8 -0
- package/dist/prompts/utility.d.ts.map +1 -1
- package/dist/prompts/utility.js +49 -2
- package/dist/prompts/utility.js.map +1 -1
- package/dist/server.d.ts +17 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +81 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/index.d.ts +9 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +10 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/utils/getConfig.d.ts +2 -0
- package/dist/tools/utils/getConfig.d.ts.map +1 -1
- package/dist/tools/utils/getConfig.js +12 -3
- package/dist/tools/utils/getConfig.js.map +1 -1
- package/dist/tools/utils/getEnvironment.d.ts +8 -0
- package/dist/tools/utils/getEnvironment.d.ts.map +1 -0
- package/dist/tools/utils/getEnvironment.js +19 -0
- package/dist/tools/utils/getEnvironment.js.map +1 -0
- package/dist/tools/utils/index.d.ts.map +1 -1
- package/dist/tools/utils/index.js +4 -0
- package/dist/tools/utils/index.js.map +1 -1
- package/dist/tools/utils/switchEnvironment.d.ts +8 -0
- package/dist/tools/utils/switchEnvironment.d.ts.map +1 -0
- package/dist/tools/utils/switchEnvironment.js +30 -0
- package/dist/tools/utils/switchEnvironment.js.map +1 -0
- package/dist/types/mcp.d.ts +1 -1
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/utils/tool-factory.d.ts +30 -0
- package/dist/utils/tool-factory.d.ts.map +1 -1
- package/dist/utils/tool-factory.js +31 -0
- package/dist/utils/tool-factory.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 +1 -1
- 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 +256 -0
- package/src/constants/mcpToolNames.ts +181 -0
- package/src/index.ts +19 -0
- package/src/prompts/__tests__/promptStructure.test.ts +137 -0
- package/src/prompts/__tests__/registry.test.ts +359 -0
- package/src/prompts/analysis.ts +429 -0
- package/src/prompts/balances.ts +198 -0
- package/src/prompts/create-token.ts +123 -0
- package/src/prompts/creation-utils.ts +118 -0
- package/src/prompts/dex-trading.ts +86 -0
- package/src/prompts/discover-tokens.ts +86 -0
- package/src/prompts/index.ts +175 -0
- package/src/prompts/liquidity-positions.ts +270 -0
- package/src/prompts/pools.ts +571 -0
- package/src/prompts/portfolio.ts +242 -0
- package/src/prompts/social.ts +100 -0
- package/src/prompts/trading-calculations.ts +499 -0
- package/src/prompts/trading.ts +191 -0
- package/src/prompts/transfers.ts +103 -0
- package/src/prompts/utility-tools.ts +349 -0
- package/src/prompts/utility.ts +92 -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/index.ts +226 -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 +371 -0
- package/tests/wallet-management-integration.test.ts +284 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Tools Prompts
|
|
3
|
+
*
|
|
4
|
+
* Slash commands for utility and system operations
|
|
5
|
+
*/
|
|
6
|
+
import type { MCPPrompt } from '../types/mcp.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create Wallet - Generate new wallet
|
|
9
|
+
*/
|
|
10
|
+
export declare const createWalletPrompt: MCPPrompt;
|
|
11
|
+
/**
|
|
12
|
+
* Get Address - Get GalaChain address
|
|
13
|
+
*/
|
|
14
|
+
export declare const getAddressPrompt: MCPPrompt;
|
|
15
|
+
/**
|
|
16
|
+
* Get Ethereum Address - Get Ethereum address
|
|
17
|
+
*/
|
|
18
|
+
export declare const getEthereumAddressPrompt: MCPPrompt;
|
|
19
|
+
/**
|
|
20
|
+
* Get Config - View SDK configuration
|
|
21
|
+
*/
|
|
22
|
+
export declare const getConfigPrompt: MCPPrompt;
|
|
23
|
+
/**
|
|
24
|
+
* Get URL by Token Name - Generate launchpad URL
|
|
25
|
+
*/
|
|
26
|
+
export declare const getUrlByTokenNamePrompt: MCPPrompt;
|
|
27
|
+
/**
|
|
28
|
+
* Explain SDK Usage - SDK documentation helper
|
|
29
|
+
*/
|
|
30
|
+
export declare const explainSdkUsagePrompt: MCPPrompt;
|
|
31
|
+
/**
|
|
32
|
+
* Get Cache Info - Cache statistics
|
|
33
|
+
*/
|
|
34
|
+
export declare const getCacheInfoPrompt: MCPPrompt;
|
|
35
|
+
/**
|
|
36
|
+
* Clear Cache - Cache management
|
|
37
|
+
*/
|
|
38
|
+
export declare const clearCachePrompt: MCPPrompt;
|
|
39
|
+
/**
|
|
40
|
+
* Has Wallet - Check wallet status
|
|
41
|
+
*/
|
|
42
|
+
export declare const hasWalletPrompt: MCPPrompt;
|
|
43
|
+
/**
|
|
44
|
+
* Get Wallet - Get wallet instance
|
|
45
|
+
*/
|
|
46
|
+
export declare const getWalletPrompt: MCPPrompt;
|
|
47
|
+
/**
|
|
48
|
+
* Set Wallet - Configure wallet
|
|
49
|
+
*/
|
|
50
|
+
export declare const setWalletPrompt: MCPPrompt;
|
|
51
|
+
/**
|
|
52
|
+
* Get Environment - Current environment query
|
|
53
|
+
*/
|
|
54
|
+
export declare const getEnvironmentPrompt: MCPPrompt;
|
|
55
|
+
export declare const utilityToolPrompts: MCPPrompt[];
|
|
56
|
+
//# sourceMappingURL=utility-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-tools.d.ts","sourceRoot":"","sources":["../../src/prompts/utility-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAqBhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAkB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAkBtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SAwB7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,SA2BrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAyBnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAqBhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,SA2B9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SAoB7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SAoB7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SA2B7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAkBlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,EAazC,CAAC"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utility Tools Prompts
|
|
4
|
+
*
|
|
5
|
+
* Slash commands for utility and system operations
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.utilityToolPrompts = exports.getEnvironmentPrompt = exports.setWalletPrompt = exports.getWalletPrompt = exports.hasWalletPrompt = exports.clearCachePrompt = exports.getCacheInfoPrompt = exports.explainSdkUsagePrompt = exports.getUrlByTokenNamePrompt = exports.getConfigPrompt = exports.getEthereumAddressPrompt = exports.getAddressPrompt = exports.createWalletPrompt = void 0;
|
|
9
|
+
const mcpToolNames_js_1 = require("../constants/mcpToolNames.js");
|
|
10
|
+
/**
|
|
11
|
+
* Create Wallet - Generate new wallet
|
|
12
|
+
*/
|
|
13
|
+
exports.createWalletPrompt = {
|
|
14
|
+
name: 'galachain-launchpad:create-wallet',
|
|
15
|
+
description: 'Generate a new wallet with random private key',
|
|
16
|
+
handler: () => {
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
role: 'user',
|
|
20
|
+
content: {
|
|
21
|
+
type: 'text',
|
|
22
|
+
text: `Create a new wallet with random private key.
|
|
23
|
+
|
|
24
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.CREATE_WALLET} to generate:
|
|
25
|
+
- New wallet address
|
|
26
|
+
- Random private key
|
|
27
|
+
- Wallet credentials for authentication
|
|
28
|
+
|
|
29
|
+
Display the wallet details with a security warning about private key storage.`,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Get Address - Get GalaChain address
|
|
37
|
+
*/
|
|
38
|
+
exports.getAddressPrompt = {
|
|
39
|
+
name: 'galachain-launchpad:get-address',
|
|
40
|
+
description: 'Get the GalaChain address format of authenticated wallet',
|
|
41
|
+
handler: () => {
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
role: 'user',
|
|
45
|
+
content: {
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: `Get the GalaChain format address of the authenticated wallet.
|
|
48
|
+
|
|
49
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_ADDRESS} to retrieve the address in GalaChain format (eth|0x...).
|
|
50
|
+
|
|
51
|
+
Display the wallet address.`,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Get Ethereum Address - Get Ethereum address
|
|
59
|
+
*/
|
|
60
|
+
exports.getEthereumAddressPrompt = {
|
|
61
|
+
name: 'galachain-launchpad:get-ethereum-address',
|
|
62
|
+
description: 'Get the standard Ethereum address format of authenticated wallet',
|
|
63
|
+
handler: () => {
|
|
64
|
+
return [
|
|
65
|
+
{
|
|
66
|
+
role: 'user',
|
|
67
|
+
content: {
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: `Get the standard Ethereum format address of the authenticated wallet.
|
|
70
|
+
|
|
71
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_ETHEREUM_ADDRESS} to retrieve the address in Ethereum format (0x...).
|
|
72
|
+
|
|
73
|
+
Display the wallet address.`,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Get Config - View SDK configuration
|
|
81
|
+
*/
|
|
82
|
+
exports.getConfigPrompt = {
|
|
83
|
+
name: 'galachain-launchpad:get-config',
|
|
84
|
+
description: 'View current SDK and MCP server configuration',
|
|
85
|
+
handler: () => {
|
|
86
|
+
return [
|
|
87
|
+
{
|
|
88
|
+
role: 'user',
|
|
89
|
+
content: {
|
|
90
|
+
type: 'text',
|
|
91
|
+
text: `Get the current SDK and MCP server configuration.
|
|
92
|
+
|
|
93
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_CONFIG} to retrieve:
|
|
94
|
+
- Environment (production, development, testing)
|
|
95
|
+
- Base URLs
|
|
96
|
+
- Timeout settings
|
|
97
|
+
- Feature flags
|
|
98
|
+
- Effective slippage tolerance factors
|
|
99
|
+
- Current MCP server environment state
|
|
100
|
+
|
|
101
|
+
Display the configuration in a readable format.`,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Get URL by Token Name - Generate launchpad URL
|
|
109
|
+
*/
|
|
110
|
+
exports.getUrlByTokenNamePrompt = {
|
|
111
|
+
name: 'galachain-launchpad:get-url-by-token-name',
|
|
112
|
+
description: 'Get the launchpad frontend URL for a token',
|
|
113
|
+
arguments: [
|
|
114
|
+
{
|
|
115
|
+
name: 'tokenName',
|
|
116
|
+
description: 'Token name (e.g., anime)',
|
|
117
|
+
required: true,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
handler: (args) => {
|
|
121
|
+
return [
|
|
122
|
+
{
|
|
123
|
+
role: 'user',
|
|
124
|
+
content: {
|
|
125
|
+
type: 'text',
|
|
126
|
+
text: `Get the launchpad frontend URL for a token.
|
|
127
|
+
|
|
128
|
+
Token: ${args.tokenName}
|
|
129
|
+
|
|
130
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_URL_BY_TOKEN_NAME} to generate the URL.
|
|
131
|
+
|
|
132
|
+
Display the complete launchpad URL for viewing/trading the token.`,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Explain SDK Usage - SDK documentation helper
|
|
140
|
+
*/
|
|
141
|
+
exports.explainSdkUsagePrompt = {
|
|
142
|
+
name: 'galachain-launchpad:explain-sdk-usage',
|
|
143
|
+
description: 'Get detailed SDK usage examples for a topic',
|
|
144
|
+
arguments: [
|
|
145
|
+
{
|
|
146
|
+
name: 'topic',
|
|
147
|
+
description: 'Topic: buy-tokens, sell-tokens, pool-graduation, fetch-pools, balances, dex-trading, liquidity-positions, price-history, token-details, token-distribution, token-creation, profile-management, multi-wallet, transfers, error-handling, installation, local-calculations, mcp-to-sdk-mapping',
|
|
148
|
+
required: true,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
handler: (args) => {
|
|
152
|
+
return [
|
|
153
|
+
{
|
|
154
|
+
role: 'user',
|
|
155
|
+
content: {
|
|
156
|
+
type: 'text',
|
|
157
|
+
text: `Get detailed SDK usage examples for topic: ${args.topic}
|
|
158
|
+
|
|
159
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.EXPLAIN_SDK_USAGE} to retrieve complete runnable code examples.
|
|
160
|
+
|
|
161
|
+
Display the examples with explanations for integrating the SDK directly.`,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Get Cache Info - Cache statistics
|
|
169
|
+
*/
|
|
170
|
+
exports.getCacheInfoPrompt = {
|
|
171
|
+
name: 'galachain-launchpad:get-cache-info',
|
|
172
|
+
description: 'Get token metadata cache statistics',
|
|
173
|
+
handler: () => {
|
|
174
|
+
return [
|
|
175
|
+
{
|
|
176
|
+
role: 'user',
|
|
177
|
+
content: {
|
|
178
|
+
type: 'text',
|
|
179
|
+
text: `Get token metadata cache statistics.
|
|
180
|
+
|
|
181
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_CACHE_INFO} to retrieve:
|
|
182
|
+
- Total tokens cached
|
|
183
|
+
- Cache size in bytes
|
|
184
|
+
- Timestamp of oldest entry
|
|
185
|
+
|
|
186
|
+
Display the cache information.`,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Clear Cache - Cache management
|
|
194
|
+
*/
|
|
195
|
+
exports.clearCachePrompt = {
|
|
196
|
+
name: 'galachain-launchpad:clear-cache',
|
|
197
|
+
description: 'Clear token metadata cache',
|
|
198
|
+
arguments: [
|
|
199
|
+
{
|
|
200
|
+
name: 'tokenName',
|
|
201
|
+
description: 'Token name to clear (optional, clears all if not provided)',
|
|
202
|
+
required: false,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
handler: (args) => {
|
|
206
|
+
return [
|
|
207
|
+
{
|
|
208
|
+
role: 'user',
|
|
209
|
+
content: {
|
|
210
|
+
type: 'text',
|
|
211
|
+
text: `Clear token metadata cache.
|
|
212
|
+
|
|
213
|
+
${args.tokenName ? `Token: ${args.tokenName}` : 'Clearing entire cache'}
|
|
214
|
+
|
|
215
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.CLEAR_CACHE} to clear the cache.
|
|
216
|
+
|
|
217
|
+
Display confirmation of cache clearing.`,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Has Wallet - Check wallet status
|
|
225
|
+
*/
|
|
226
|
+
exports.hasWalletPrompt = {
|
|
227
|
+
name: 'galachain-launchpad:has-wallet',
|
|
228
|
+
description: 'Check if a wallet is configured in the MCP server',
|
|
229
|
+
handler: () => {
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
role: 'user',
|
|
233
|
+
content: {
|
|
234
|
+
type: 'text',
|
|
235
|
+
text: `Check wallet configuration status.
|
|
236
|
+
|
|
237
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.HAS_WALLET} to determine:
|
|
238
|
+
- Whether a wallet is configured
|
|
239
|
+
- Whether MCP server is in full-access or read-only mode
|
|
240
|
+
|
|
241
|
+
Display the wallet status clearly.`,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
];
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Get Wallet - Get wallet instance
|
|
249
|
+
*/
|
|
250
|
+
exports.getWalletPrompt = {
|
|
251
|
+
name: 'galachain-launchpad:get-wallet',
|
|
252
|
+
description: 'Get the currently configured wallet instance',
|
|
253
|
+
handler: () => {
|
|
254
|
+
return [
|
|
255
|
+
{
|
|
256
|
+
role: 'user',
|
|
257
|
+
content: {
|
|
258
|
+
type: 'text',
|
|
259
|
+
text: `Get the currently configured wallet instance.
|
|
260
|
+
|
|
261
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_WALLET} to retrieve:
|
|
262
|
+
- Wallet object if available
|
|
263
|
+
- Null if in read-only mode
|
|
264
|
+
|
|
265
|
+
Display the wallet information.`,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
];
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Set Wallet - Configure wallet
|
|
273
|
+
*/
|
|
274
|
+
exports.setWalletPrompt = {
|
|
275
|
+
name: 'galachain-launchpad:set-wallet',
|
|
276
|
+
description: 'Configure a wallet for signing operations',
|
|
277
|
+
arguments: [
|
|
278
|
+
{
|
|
279
|
+
name: 'privateKey',
|
|
280
|
+
description: 'Private key in hex format (0x + 64 hex characters)',
|
|
281
|
+
required: true,
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
handler: (args) => {
|
|
285
|
+
return [
|
|
286
|
+
{
|
|
287
|
+
role: 'user',
|
|
288
|
+
content: {
|
|
289
|
+
type: 'text',
|
|
290
|
+
text: `Configure wallet for signing operations.
|
|
291
|
+
|
|
292
|
+
Private Key: ${args.privateKey.substring(0, 10)}...${args.privateKey.substring(60)}
|
|
293
|
+
|
|
294
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.SET_WALLET} to configure the wallet.
|
|
295
|
+
|
|
296
|
+
Display confirmation that wallet is configured for full-access mode.`,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
];
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Get Environment - Current environment query
|
|
304
|
+
*/
|
|
305
|
+
exports.getEnvironmentPrompt = {
|
|
306
|
+
name: 'galachain-launchpad:get-environment',
|
|
307
|
+
description: 'Get the current MCP server environment',
|
|
308
|
+
handler: () => {
|
|
309
|
+
return [
|
|
310
|
+
{
|
|
311
|
+
role: 'user',
|
|
312
|
+
content: {
|
|
313
|
+
type: 'text',
|
|
314
|
+
text: `Get the current MCP server environment.
|
|
315
|
+
|
|
316
|
+
Use ${mcpToolNames_js_1.MCP_TOOLS.GET_ENVIRONMENT} to retrieve the active environment.
|
|
317
|
+
|
|
318
|
+
Display the current environment (production, development, or testing).`,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
];
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
exports.utilityToolPrompts = [
|
|
325
|
+
exports.createWalletPrompt,
|
|
326
|
+
exports.getAddressPrompt,
|
|
327
|
+
exports.getEthereumAddressPrompt,
|
|
328
|
+
exports.getConfigPrompt,
|
|
329
|
+
exports.getUrlByTokenNamePrompt,
|
|
330
|
+
exports.explainSdkUsagePrompt,
|
|
331
|
+
exports.getCacheInfoPrompt,
|
|
332
|
+
exports.clearCachePrompt,
|
|
333
|
+
exports.hasWalletPrompt,
|
|
334
|
+
exports.getWalletPrompt,
|
|
335
|
+
exports.setWalletPrompt,
|
|
336
|
+
exports.getEnvironmentPrompt,
|
|
337
|
+
];
|
|
338
|
+
//# sourceMappingURL=utility-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-tools.js","sourceRoot":"","sources":["../../src/prompts/utility-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,kEAAyD;AAEzD;;GAEG;AACU,QAAA,kBAAkB,GAAc;IAC3C,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,+CAA+C;IAC5D,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;MAEV,2BAAS,CAAC,aAAa;;;;;8EAKiD;iBACrE;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,gBAAgB,GAAc;IACzC,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,0DAA0D;IACvE,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;MAEV,2BAAS,CAAC,WAAW;;4BAEC;iBACnB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,wBAAwB,GAAc;IACjD,IAAI,EAAE,0CAA0C;IAChD,WAAW,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AC,eAAe;;uEAEwC;iBAC9D;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEW,QAAA,kBAAkB,GAAgB;IAC7C,0BAAkB;IAClB,wBAAgB;IAChB,gCAAwB;IACxB,uBAAe;IACf,+BAAuB;IACvB,6BAAqB;IACrB,0BAAkB;IAClB,wBAAgB;IAChB,uBAAe;IACf,uBAAe;IACf,uBAAe;IACf,4BAAoB;CACrB,CAAC"}
|
|
@@ -11,6 +11,14 @@ import type { MCPPrompt } from '../types/mcp.js';
|
|
|
11
11
|
* useful for debugging version mismatch issues or verifying installed versions.
|
|
12
12
|
*/
|
|
13
13
|
export declare const getVersionPrompt: MCPPrompt;
|
|
14
|
+
/**
|
|
15
|
+
* Switch Environment - Dynamically change the MCP server environment
|
|
16
|
+
*
|
|
17
|
+
* Allows switching between production, development, and testing environments
|
|
18
|
+
* while preserving wallet configuration. Useful for testing against different
|
|
19
|
+
* backends or performing administrative operations.
|
|
20
|
+
*/
|
|
21
|
+
export declare const switchEnvironmentPrompt: MCPPrompt;
|
|
14
22
|
/**
|
|
15
23
|
* All utility prompts
|
|
16
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/prompts/utility.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAuB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/prompts/utility.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAuB9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAwCrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,EAAgD,CAAC"}
|
package/dist/prompts/utility.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Slash commands for utility and information operations on Gala Launchpad
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.utilityPrompts = exports.getVersionPrompt = void 0;
|
|
8
|
+
exports.utilityPrompts = exports.switchEnvironmentPrompt = exports.getVersionPrompt = void 0;
|
|
9
9
|
/**
|
|
10
10
|
* Get Version - Display SDK and MCP server version information
|
|
11
11
|
*
|
|
@@ -36,8 +36,55 @@ This is helpful for debugging version compatibility issues or confirming install
|
|
|
36
36
|
];
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Switch Environment - Dynamically change the MCP server environment
|
|
41
|
+
*
|
|
42
|
+
* Allows switching between production, development, and testing environments
|
|
43
|
+
* while preserving wallet configuration. Useful for testing against different
|
|
44
|
+
* backends or performing administrative operations.
|
|
45
|
+
*/
|
|
46
|
+
exports.switchEnvironmentPrompt = {
|
|
47
|
+
name: 'galachain-launchpad:switch-environment',
|
|
48
|
+
description: 'Switch the MCP server to a different environment (production, development, or testing)',
|
|
49
|
+
arguments: [
|
|
50
|
+
{
|
|
51
|
+
name: 'environment',
|
|
52
|
+
description: 'Target environment: production, development, or testing',
|
|
53
|
+
required: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
handler: (args) => {
|
|
57
|
+
const targetEnv = args.environment?.toLowerCase() || '';
|
|
58
|
+
const validEnvs = ['production', 'development', 'testing'];
|
|
59
|
+
const isValidEnv = validEnvs.includes(targetEnv);
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
role: 'user',
|
|
63
|
+
content: {
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: `Switch the Gala Launchpad MCP server to a different environment.
|
|
66
|
+
|
|
67
|
+
Current task: Switch to the ${isValidEnv ? targetEnv : 'specified'} environment
|
|
68
|
+
|
|
69
|
+
Steps:
|
|
70
|
+
1. First, get the current environment using the gala_launchpad_get_environment tool to see what we're currently on
|
|
71
|
+
2. If switching is needed, use the gala_launchpad_switch_environment tool with environment="${targetEnv || 'production'}"
|
|
72
|
+
3. After switching, verify the change by calling gala_launchpad_get_environment again
|
|
73
|
+
4. Confirm the environment switch was successful and display the results
|
|
74
|
+
|
|
75
|
+
Available environments:
|
|
76
|
+
- production: Production environment (default)
|
|
77
|
+
- development: Development environment for testing features
|
|
78
|
+
- testing: Testing environment for local/staging tests
|
|
79
|
+
|
|
80
|
+
Wallet Preservation: The wallet configuration will be preserved during the switch, maintaining your current signing capabilities if configured.`,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
},
|
|
85
|
+
};
|
|
39
86
|
/**
|
|
40
87
|
* All utility prompts
|
|
41
88
|
*/
|
|
42
|
-
exports.utilityPrompts = [exports.getVersionPrompt];
|
|
89
|
+
exports.utilityPrompts = [exports.getVersionPrompt, exports.switchEnvironmentPrompt];
|
|
43
90
|
//# sourceMappingURL=utility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../src/prompts/utility.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH;;;;;GAKG;AACU,QAAA,gBAAgB,GAAc;IACzC,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,4CAA4C;IACzD,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;6FAS6E;iBACpF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,cAAc,GAAgB,CAAC,wBAAgB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../src/prompts/utility.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH;;;;;GAKG;AACU,QAAA,gBAAgB,GAAc;IACzC,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,4CAA4C;IACzD,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;6FAS6E;iBACpF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAc;IAChD,IAAI,EAAE,wCAAwC;IAC9C,WAAW,EAAE,wFAAwF;IACrG,SAAS,EAAE;QACT;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QACxD,MAAM,SAAS,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAC3D,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAEjD,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;8BAEc,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;;;;8FAI4B,SAAS,IAAI,YAAY;;;;;;;;;gJASyB;iBACvI;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,cAAc,GAAgB,CAAC,wBAAgB,EAAE,+BAAuB,CAAC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare class LaunchpadMCPServer {
|
|
|
7
7
|
private server;
|
|
8
8
|
private sdk;
|
|
9
9
|
private debug;
|
|
10
|
+
private currentEnvironment;
|
|
11
|
+
private currentPrivateKey;
|
|
10
12
|
constructor();
|
|
11
13
|
/**
|
|
12
14
|
* Initialize SDK with AgentConfig
|
|
@@ -35,6 +37,21 @@ export declare class LaunchpadMCPServer {
|
|
|
35
37
|
* Start the MCP server
|
|
36
38
|
*/
|
|
37
39
|
start(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Switch to a different environment dynamically
|
|
42
|
+
* Creates a new SDK instance with the new environment while preserving the wallet
|
|
43
|
+
*
|
|
44
|
+
* Strategy: Create new SDK BEFORE destroying old one to avoid broken state on error
|
|
45
|
+
*/
|
|
46
|
+
switchEnvironment(newEnvironment: 'production' | 'development' | 'testing'): Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
previousEnvironment: "production" | "development" | "testing";
|
|
49
|
+
newEnvironment: "production" | "development" | "testing";
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Get current environment
|
|
53
|
+
*/
|
|
54
|
+
getEnvironment(): 'production' | 'development' | 'testing';
|
|
38
55
|
/**
|
|
39
56
|
* Cleanup resources
|
|
40
57
|
*/
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAA6B;IACxC,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,kBAAkB,CAA0D;IACpF,OAAO,CAAC,iBAAiB,CAAqB;;IAyB9C;;;;;;;;;OASG;IACG,UAAU;IAoEhB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAmDzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiD3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsB1B;;OAEG;IACG,KAAK;IAaX;;;;;OAKG;IACG,iBAAiB,CAAC,cAAc,EAAE,YAAY,GAAG,aAAa,GAAG,SAAS;;;;;IAoEhF;;OAEG;IACH,cAAc,IAAI,YAAY,GAAG,aAAa,GAAG,SAAS;IAI1D;;OAEG;IACH,OAAO;CAQR"}
|
package/dist/server.js
CHANGED
|
@@ -12,15 +12,18 @@ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
|
12
12
|
const launchpad_sdk_1 = require("@gala-chain/launchpad-sdk");
|
|
13
13
|
const index_js_2 = require("./tools/index.js");
|
|
14
14
|
const index_js_3 = require("./prompts/index.js");
|
|
15
|
+
const version_js_1 = require("./generated/version.js");
|
|
15
16
|
class LaunchpadMCPServer {
|
|
16
17
|
server;
|
|
17
18
|
sdk = null;
|
|
18
19
|
debug;
|
|
20
|
+
currentEnvironment = 'production';
|
|
21
|
+
currentPrivateKey;
|
|
19
22
|
constructor() {
|
|
20
23
|
this.debug = process.env.DEBUG === 'true';
|
|
21
24
|
this.server = new index_js_1.Server({
|
|
22
25
|
name: '@gala-chain/launchpad-mcp-server',
|
|
23
|
-
version:
|
|
26
|
+
version: version_js_1.MCP_SERVER_VERSION,
|
|
24
27
|
}, {
|
|
25
28
|
capabilities: {
|
|
26
29
|
tools: {},
|
|
@@ -49,8 +52,13 @@ class LaunchpadMCPServer {
|
|
|
49
52
|
console.error('[MCP Server] Initializing SDK...');
|
|
50
53
|
}
|
|
51
54
|
const hasPrivateKey = Boolean(process.env.PRIVATE_KEY && process.env.PRIVATE_KEY.trim());
|
|
52
|
-
const environment = process.env.ENVIRONMENT || 'production';
|
|
55
|
+
const environment = (process.env.ENVIRONMENT || 'production');
|
|
53
56
|
const timeout = parseInt(process.env.TIMEOUT || '30000', 10);
|
|
57
|
+
// Store environment and private key for dynamic switching
|
|
58
|
+
this.currentEnvironment = environment;
|
|
59
|
+
if (hasPrivateKey) {
|
|
60
|
+
this.currentPrivateKey = process.env.PRIVATE_KEY;
|
|
61
|
+
}
|
|
54
62
|
if (hasPrivateKey) {
|
|
55
63
|
// Full-access mode: use quickSetup() to enable signing operations
|
|
56
64
|
if (this.debug) {
|
|
@@ -130,7 +138,7 @@ class LaunchpadMCPServer {
|
|
|
130
138
|
throw new Error('SDK not initialized. Failed during startup - check logs for details.');
|
|
131
139
|
}
|
|
132
140
|
try {
|
|
133
|
-
const result = await tool.handler(this.sdk, args);
|
|
141
|
+
const result = await tool.handler(this.sdk, args, this);
|
|
134
142
|
if (this.debug) {
|
|
135
143
|
console.error(`[MCP Server] Tool execution successful: ${toolName}`);
|
|
136
144
|
}
|
|
@@ -221,6 +229,76 @@ class LaunchpadMCPServer {
|
|
|
221
229
|
console.error(`[MCP Server] Registered ${index_js_3.prompts.length} prompts (slash commands)`);
|
|
222
230
|
}
|
|
223
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Switch to a different environment dynamically
|
|
234
|
+
* Creates a new SDK instance with the new environment while preserving the wallet
|
|
235
|
+
*
|
|
236
|
+
* Strategy: Create new SDK BEFORE destroying old one to avoid broken state on error
|
|
237
|
+
*/
|
|
238
|
+
async switchEnvironment(newEnvironment) {
|
|
239
|
+
try {
|
|
240
|
+
if (this.debug) {
|
|
241
|
+
console.error(`[MCP Server] Switching environment: ${this.currentEnvironment} → ${newEnvironment}`);
|
|
242
|
+
}
|
|
243
|
+
const previousEnvironment = this.currentEnvironment;
|
|
244
|
+
const previousSdk = this.sdk;
|
|
245
|
+
const timeout = parseInt(process.env.TIMEOUT || '30000', 10);
|
|
246
|
+
// Create new SDK BEFORE destroying old one (prevents broken state on error)
|
|
247
|
+
let newSdk;
|
|
248
|
+
if (this.currentPrivateKey) {
|
|
249
|
+
// Preserve wallet in full-access mode
|
|
250
|
+
if (this.debug) {
|
|
251
|
+
console.error('[MCP Server] Switching with wallet preservation (full-access mode)');
|
|
252
|
+
}
|
|
253
|
+
const { sdk } = await launchpad_sdk_1.AgentConfig.quickSetup({
|
|
254
|
+
environment: newEnvironment,
|
|
255
|
+
privateKey: this.currentPrivateKey,
|
|
256
|
+
timeout,
|
|
257
|
+
debug: this.debug,
|
|
258
|
+
autoValidate: false,
|
|
259
|
+
});
|
|
260
|
+
newSdk = sdk;
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
// Switch in read-only mode
|
|
264
|
+
if (this.debug) {
|
|
265
|
+
console.error('[MCP Server] Switching in read-only mode');
|
|
266
|
+
}
|
|
267
|
+
const { sdk } = await launchpad_sdk_1.AgentConfig.readOnlySetup({
|
|
268
|
+
environment: newEnvironment,
|
|
269
|
+
timeout,
|
|
270
|
+
debug: this.debug,
|
|
271
|
+
});
|
|
272
|
+
newSdk = sdk;
|
|
273
|
+
}
|
|
274
|
+
// Only cleanup old SDK after new one is successfully created and ready
|
|
275
|
+
if (previousSdk) {
|
|
276
|
+
previousSdk.cleanup();
|
|
277
|
+
}
|
|
278
|
+
// Now safe to update SDK instance and environment
|
|
279
|
+
this.sdk = newSdk;
|
|
280
|
+
this.currentEnvironment = newEnvironment;
|
|
281
|
+
if (this.debug) {
|
|
282
|
+
console.error(`[MCP Server] Environment switched successfully: ${previousEnvironment} → ${newEnvironment}`);
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
success: true,
|
|
286
|
+
previousEnvironment,
|
|
287
|
+
newEnvironment,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
console.error('[MCP Server] Failed to switch environment:', error);
|
|
292
|
+
// Old SDK remains intact if switch fails
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get current environment
|
|
298
|
+
*/
|
|
299
|
+
getEnvironment() {
|
|
300
|
+
return this.currentEnvironment;
|
|
301
|
+
}
|
|
224
302
|
/**
|
|
225
303
|
* Cleanup resources
|
|
226
304
|
*/
|