@gala-chain/launchpad-mcp-server 1.24.1 → 1.25.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 +30 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +3 -3
- package/dist/tools/pools/index.d.ts.map +1 -1
- package/dist/tools/pools/index.js +4 -0
- package/dist/tools/pools/index.js.map +1 -1
- package/dist/tools/pools/onDexPoolCreation.d.ts +6 -0
- package/dist/tools/pools/onDexPoolCreation.d.ts.map +1 -0
- package/dist/tools/pools/onDexPoolCreation.js +60 -0
- package/dist/tools/pools/onDexPoolCreation.js.map +1 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts +6 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts.map +1 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.js +54 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.js.map +1 -0
- package/package.json +2 -2
- package/docs/AI-AGENT-PATTERNS.md +0 -555
- package/docs/CONSTRAINTS-REFERENCE.md +0 -454
- package/docs/PROMPT-TOOL-MAPPING.md +0 -352
- package/docs/examples/default-values-pattern.md +0 -240
- package/docs/examples/tool-factory-pattern.md +0 -217
- package/jest.config.js +0 -94
- package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
- package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
- package/src/__tests__/server.test.ts +0 -255
- package/src/constants/mcpToolNames.ts +0 -183
- package/src/index.ts +0 -19
- package/src/prompts/__tests__/promptStructure.test.ts +0 -187
- package/src/prompts/__tests__/registry.test.ts +0 -349
- package/src/prompts/analysis.ts +0 -380
- package/src/prompts/balances.ts +0 -182
- package/src/prompts/create-token.ts +0 -123
- package/src/prompts/creation-utils.ts +0 -103
- package/src/prompts/dex-trading.ts +0 -86
- package/src/prompts/discover-tokens.ts +0 -86
- package/src/prompts/explore-dex-pools.ts +0 -138
- package/src/prompts/index.ts +0 -178
- package/src/prompts/liquidity-positions.ts +0 -237
- package/src/prompts/pools.ts +0 -496
- package/src/prompts/portfolio.ts +0 -208
- package/src/prompts/social.ts +0 -94
- package/src/prompts/trading-calculations.ts +0 -414
- package/src/prompts/trading.ts +0 -160
- package/src/prompts/transfers.ts +0 -97
- package/src/prompts/utility-tools.ts +0 -266
- package/src/prompts/utility.ts +0 -77
- package/src/prompts/utils/handlerHelpers.ts +0 -55
- package/src/prompts/utils/textTemplates.ts +0 -73
- package/src/prompts/utils/workflowTemplates.ts +0 -511
- package/src/schemas/common-schemas.ts +0 -393
- package/src/scripts/test-all-prompts.ts +0 -184
- package/src/server.ts +0 -367
- package/src/tools/__tests__/dex-tools.test.ts +0 -562
- package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
- package/src/tools/balance/index.ts +0 -174
- package/src/tools/creation/index.ts +0 -182
- package/src/tools/dex/fetchAllDexPools.ts +0 -45
- package/src/tools/dex/fetchDexPools.ts +0 -58
- package/src/tools/dex/index.ts +0 -231
- package/src/tools/dex/liquidity-positions.ts +0 -547
- package/src/tools/index.ts +0 -94
- package/src/tools/pools/fetchAllPools.ts +0 -47
- package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
- package/src/tools/pools/fetchPoolDetails.ts +0 -27
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
- package/src/tools/pools/fetchPools.ts +0 -47
- package/src/tools/pools/fetchPriceHistory.ts +0 -124
- package/src/tools/pools/fetchTokenDetails.ts +0 -77
- package/src/tools/pools/index.ts +0 -284
- package/src/tools/social/index.ts +0 -64
- package/src/tools/trading/index.ts +0 -605
- package/src/tools/transfers/index.ts +0 -75
- package/src/tools/utils/clearCache.ts +0 -36
- package/src/tools/utils/createWallet.ts +0 -19
- package/src/tools/utils/explainSdkUsage.ts +0 -1446
- package/src/tools/utils/getAddress.ts +0 -12
- package/src/tools/utils/getCacheInfo.ts +0 -14
- package/src/tools/utils/getConfig.ts +0 -21
- package/src/tools/utils/getEnvironment.ts +0 -17
- package/src/tools/utils/getEthereumAddress.ts +0 -12
- package/src/tools/utils/getUrlByTokenName.ts +0 -12
- package/src/tools/utils/getVersion.ts +0 -25
- package/src/tools/utils/getWallet.ts +0 -25
- package/src/tools/utils/hasWallet.ts +0 -15
- package/src/tools/utils/index.ts +0 -37
- package/src/tools/utils/isTokenGraduated.ts +0 -16
- package/src/tools/utils/setWallet.ts +0 -41
- package/src/tools/utils/switchEnvironment.ts +0 -28
- package/src/types/mcp.ts +0 -72
- package/src/utils/__tests__/validation.test.ts +0 -147
- package/src/utils/constraints.ts +0 -155
- package/src/utils/default-values.ts +0 -208
- package/src/utils/error-handler.ts +0 -69
- package/src/utils/error-templates.ts +0 -273
- package/src/utils/response-formatter.ts +0 -51
- package/src/utils/tool-factory.ts +0 -303
- package/src/utils/tool-registry.ts +0 -296
- package/src/utils/validation.ts +0 -429
- package/tests/wallet-management-integration.test.ts +0 -284
- package/tsconfig.json +0 -23
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Tests for Pool Tools
|
|
3
|
-
*
|
|
4
|
-
* These tests use real SDK instances and make actual API calls.
|
|
5
|
-
* Requires valid PRIVATE_KEY environment variable.
|
|
6
|
-
*
|
|
7
|
-
* Run with: npm run test:integration
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { AgentConfig } from '@gala-chain/launchpad-sdk';
|
|
11
|
-
import { fetchPoolsTool, fetchPoolDetailsTool } from '../../tools/pools/index.js';
|
|
12
|
-
|
|
13
|
-
describe('Pool Tools Integration', () => {
|
|
14
|
-
let sdk: any;
|
|
15
|
-
|
|
16
|
-
beforeAll(async () => {
|
|
17
|
-
// Skip tests if no private key available
|
|
18
|
-
if (!process.env.PRIVATE_KEY) {
|
|
19
|
-
console.warn('⚠️ Skipping integration tests: PRIVATE_KEY environment variable not set');
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Initialize SDK with AgentConfig
|
|
24
|
-
const { sdk: initializedSdk } = await AgentConfig.quickSetup({
|
|
25
|
-
environment: (process.env.ENVIRONMENT as any) || 'development',
|
|
26
|
-
privateKey: process.env.PRIVATE_KEY,
|
|
27
|
-
timeout: 30000,
|
|
28
|
-
debug: false,
|
|
29
|
-
autoValidate: false,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
sdk = initializedSdk;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
afterAll(() => {
|
|
36
|
-
if (sdk) {
|
|
37
|
-
sdk.cleanup();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('fetchPoolsTool', () => {
|
|
42
|
-
it('should fetch recent pools successfully', async () => {
|
|
43
|
-
if (!sdk) {
|
|
44
|
-
return; // Skip if SDK not initialized
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const result = await fetchPoolsTool.handler(sdk, {
|
|
48
|
-
type: 'recent',
|
|
49
|
-
limit: 5,
|
|
50
|
-
page: 1,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
expect(result).toBeDefined();
|
|
54
|
-
expect(result.content).toBeDefined();
|
|
55
|
-
expect(Array.isArray(result.content)).toBe(true);
|
|
56
|
-
expect(result.content.length).toBeGreaterThan(0);
|
|
57
|
-
|
|
58
|
-
const response = JSON.parse(result.content[0].text!);
|
|
59
|
-
expect(response).toHaveProperty('pools');
|
|
60
|
-
expect(Array.isArray(response.pools)).toBe(true);
|
|
61
|
-
expect(response.pools.length).toBeLessThanOrEqual(5);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should fetch popular pools successfully', async () => {
|
|
65
|
-
if (!sdk) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const result = await fetchPoolsTool.handler(sdk, {
|
|
70
|
-
type: 'popular',
|
|
71
|
-
limit: 3,
|
|
72
|
-
page: 1,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
expect(result).toBeDefined();
|
|
76
|
-
const response = JSON.parse(result.content[0].text!);
|
|
77
|
-
expect(response).toHaveProperty('pools');
|
|
78
|
-
expect(response.pools.length).toBeLessThanOrEqual(3);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should handle pagination correctly', async () => {
|
|
82
|
-
if (!sdk) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const page1 = await fetchPoolsTool.handler(sdk, {
|
|
87
|
-
type: 'recent',
|
|
88
|
-
limit: 2,
|
|
89
|
-
page: 1,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const page2 = await fetchPoolsTool.handler(sdk, {
|
|
93
|
-
type: 'recent',
|
|
94
|
-
limit: 2,
|
|
95
|
-
page: 2,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const response1 = JSON.parse(page1.content[0].text!);
|
|
99
|
-
const response2 = JSON.parse(page2.content[0].text!);
|
|
100
|
-
|
|
101
|
-
expect(response1.page).toBe(1);
|
|
102
|
-
expect(response2.page).toBe(2);
|
|
103
|
-
|
|
104
|
-
// Different pools on different pages
|
|
105
|
-
if (response1.pools.length > 0 && response2.pools.length > 0) {
|
|
106
|
-
expect(response1.pools[0].name).not.toBe(response2.pools[0].name);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('fetchPoolDetailsTool', () => {
|
|
112
|
-
it('should fetch pool details for a known token', async () => {
|
|
113
|
-
if (!sdk) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// First get a pool name from recent pools
|
|
118
|
-
const pools = await fetchPoolsTool.handler(sdk, {
|
|
119
|
-
type: 'recent',
|
|
120
|
-
limit: 1,
|
|
121
|
-
page: 1,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
const poolsResponse = JSON.parse(pools.content[0].text!);
|
|
125
|
-
|
|
126
|
-
if (poolsResponse.pools.length === 0) {
|
|
127
|
-
console.warn('⚠️ No pools available for testing');
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const tokenName = poolsResponse.pools[0].name;
|
|
132
|
-
|
|
133
|
-
// Fetch details for that token
|
|
134
|
-
const result = await fetchPoolDetailsTool.handler(sdk, {
|
|
135
|
-
tokenName,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
expect(result).toBeDefined();
|
|
139
|
-
const response = JSON.parse(result.content[0].text!);
|
|
140
|
-
|
|
141
|
-
expect(response).toHaveProperty('name', tokenName);
|
|
142
|
-
expect(response).toHaveProperty('symbol');
|
|
143
|
-
expect(response).toHaveProperty('saleStatus');
|
|
144
|
-
expect(response).toHaveProperty('currentSupply');
|
|
145
|
-
expect(response).toHaveProperty('maxSupply');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should handle non-existent token gracefully', async () => {
|
|
149
|
-
if (!sdk) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const result = await fetchPoolDetailsTool.handler(sdk, {
|
|
154
|
-
tokenName: 'nonexistenttoken123456',
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Should return error response
|
|
158
|
-
expect(result).toBeDefined();
|
|
159
|
-
expect(result.isError).toBe(true);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe('MCP Response Format', () => {
|
|
164
|
-
it('should return valid MCP response structure', async () => {
|
|
165
|
-
if (!sdk) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const result = await fetchPoolsTool.handler(sdk, {
|
|
170
|
-
type: 'recent',
|
|
171
|
-
limit: 1,
|
|
172
|
-
page: 1,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Validate MCP response structure
|
|
176
|
-
expect(result).toHaveProperty('content');
|
|
177
|
-
expect(Array.isArray(result.content)).toBe(true);
|
|
178
|
-
expect(result.content[0]).toHaveProperty('type', 'text');
|
|
179
|
-
expect(result.content[0]).toHaveProperty('text');
|
|
180
|
-
|
|
181
|
-
// Validate JSON parseable
|
|
182
|
-
expect(() => JSON.parse(result.content[0].text!)).not.toThrow();
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Server Tests
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive test suite for LaunchpadMCPServer environment switching,
|
|
5
|
-
* state management, and core server functionality.
|
|
6
|
-
*
|
|
7
|
-
* Note: These tests focus on the public API contract and behavior
|
|
8
|
-
* rather than implementation details to avoid over-mocking dependencies.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
describe('LaunchpadMCPServer', () => {
|
|
12
|
-
/**
|
|
13
|
-
* Environment Switching Contract Tests
|
|
14
|
-
*
|
|
15
|
-
* These tests verify the documented API contract for environment
|
|
16
|
-
* switching without requiring the full MCP SDK setup.
|
|
17
|
-
*
|
|
18
|
-
* The actual functionality is validated through:
|
|
19
|
-
* 1. TypeScript type checking (src/server.ts types)
|
|
20
|
-
* 2. Runtime behavior validation in manual testing
|
|
21
|
-
* 3. Integration tests in CI/CD pipeline
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
describe('switchEnvironment() API Contract', () => {
|
|
25
|
-
it('should accept production as valid environment', () => {
|
|
26
|
-
const validEnv: 'production' | 'development' | 'testing' = 'production';
|
|
27
|
-
expect(validEnv).toBeDefined();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should accept development as valid environment', () => {
|
|
31
|
-
const validEnv: 'production' | 'development' | 'testing' = 'development';
|
|
32
|
-
expect(validEnv).toBeDefined();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should accept testing as valid environment', () => {
|
|
36
|
-
const validEnv: 'production' | 'development' | 'testing' = 'testing';
|
|
37
|
-
expect(validEnv).toBeDefined();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('getEnvironment() API Contract', () => {
|
|
42
|
-
it('should return a string representing the environment', () => {
|
|
43
|
-
const env: 'production' | 'development' | 'testing' = 'production';
|
|
44
|
-
expect(typeof env).toBe('string');
|
|
45
|
-
expect(['production', 'development', 'testing']).toContain(env);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('Server State Management Contract', () => {
|
|
50
|
-
it('should store currentEnvironment with three valid options', () => {
|
|
51
|
-
type Environment = 'production' | 'development' | 'testing';
|
|
52
|
-
const validEnvironments: Environment[] = ['production', 'development', 'testing'];
|
|
53
|
-
|
|
54
|
-
validEnvironments.forEach((env) => {
|
|
55
|
-
expect(['production', 'development', 'testing']).toContain(env);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should store currentPrivateKey as optional string', () => {
|
|
60
|
-
const privateKey: string | undefined = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef';
|
|
61
|
-
expect(typeof privateKey).toBe('string');
|
|
62
|
-
|
|
63
|
-
const noKey: string | undefined = undefined;
|
|
64
|
-
expect(noKey).toBeUndefined();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
describe('Environment Switch Response Contract', () => {
|
|
69
|
-
it('should return success indicator', () => {
|
|
70
|
-
const response = { success: true, previousEnvironment: 'production', newEnvironment: 'development' };
|
|
71
|
-
expect(response.success).toBe(true);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should track both previous and new environments', () => {
|
|
75
|
-
const response = { success: true, previousEnvironment: 'production', newEnvironment: 'development' };
|
|
76
|
-
expect(response.previousEnvironment).toBe('production');
|
|
77
|
-
expect(response.newEnvironment).toBe('development');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should show environment change progression', () => {
|
|
81
|
-
const response1 = { success: true, previousEnvironment: 'production', newEnvironment: 'development' };
|
|
82
|
-
const response2 = { success: true, previousEnvironment: 'development', newEnvironment: 'testing' };
|
|
83
|
-
|
|
84
|
-
expect(response1.newEnvironment).toBe(response2.previousEnvironment);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe('Initialization Mode Contract', () => {
|
|
89
|
-
it('should support full-access mode with private key', () => {
|
|
90
|
-
const hasPrivateKey = Boolean('0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef');
|
|
91
|
-
expect(hasPrivateKey).toBe(true);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('should support read-only mode without private key', () => {
|
|
95
|
-
const hasPrivateKey = Boolean(undefined);
|
|
96
|
-
expect(hasPrivateKey).toBe(false);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe('Wallet Preservation Contract', () => {
|
|
101
|
-
it('should preserve wallet across environment switches', () => {
|
|
102
|
-
const originalWallet = '0xaaaa567890abcdef1234567890abcdef1234567890abcdef1234567890bcdef';
|
|
103
|
-
const preservedWallet = originalWallet; // Simulates internal preservation
|
|
104
|
-
|
|
105
|
-
expect(preservedWallet).toBe(originalWallet);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should maintain same wallet for multiple switches', () => {
|
|
109
|
-
const wallet = '0xbbbb567890abcdef1234567890abcdef1234567890abcdef1234567890bcdef';
|
|
110
|
-
|
|
111
|
-
const switch1 = { wallet }; // prod -> dev
|
|
112
|
-
const switch2 = { wallet }; // dev -> testing
|
|
113
|
-
const switch3 = { wallet }; // testing -> prod
|
|
114
|
-
|
|
115
|
-
expect(switch1.wallet).toBe(switch2.wallet);
|
|
116
|
-
expect(switch2.wallet).toBe(switch3.wallet);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
describe('Error Handling Contract', () => {
|
|
121
|
-
it('should maintain server state on switch failure', () => {
|
|
122
|
-
const originalEnv = 'production';
|
|
123
|
-
|
|
124
|
-
// Simulates switch failure leaving original state intact
|
|
125
|
-
const finalEnv = originalEnv;
|
|
126
|
-
|
|
127
|
-
expect(finalEnv).toBe(originalEnv);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('should preserve SDK when switch fails', () => {
|
|
131
|
-
const hasSdk = true; // Before switch attempt
|
|
132
|
-
const stillHasSdk = true; // After failed switch
|
|
133
|
-
|
|
134
|
-
expect(hasSdk).toBe(stillHasSdk);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
describe('Configuration Retrieval Contract', () => {
|
|
139
|
-
it('should include mcpServerEnvironment in getConfig response', () => {
|
|
140
|
-
const config = {
|
|
141
|
-
baseUrl: 'https://api.example.com',
|
|
142
|
-
environment: 'production',
|
|
143
|
-
mcpServerEnvironment: 'production',
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
expect(config).toHaveProperty('mcpServerEnvironment');
|
|
147
|
-
expect(config.mcpServerEnvironment).toBe('production');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('should reflect current environment in config', () => {
|
|
151
|
-
const currentEnv = 'development';
|
|
152
|
-
const config = { mcpServerEnvironment: currentEnv };
|
|
153
|
-
|
|
154
|
-
expect(config.mcpServerEnvironment).toBe(currentEnv);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
describe('Type Safety Contract', () => {
|
|
159
|
-
it('should enforce environment type at compile time', () => {
|
|
160
|
-
// These would fail TypeScript compilation with wrong values
|
|
161
|
-
const validEnvs: Array<'production' | 'development' | 'testing'> = [
|
|
162
|
-
'production',
|
|
163
|
-
'development',
|
|
164
|
-
'testing',
|
|
165
|
-
];
|
|
166
|
-
|
|
167
|
-
expect(validEnvs).toHaveLength(3);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('should enforce optional private key type', () => {
|
|
171
|
-
// Valid variations
|
|
172
|
-
const fullAccess: string | undefined = '0x1234...';
|
|
173
|
-
const readOnly: string | undefined = undefined;
|
|
174
|
-
|
|
175
|
-
expect(typeof fullAccess).toBe('string');
|
|
176
|
-
expect(readOnly).toBeUndefined();
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
describe('Backward Compatibility Contract', () => {
|
|
181
|
-
it('should accept optional server parameter in tool handlers', () => {
|
|
182
|
-
type ToolHandler = (sdk: any, args: any, server?: any) => Promise<any>;
|
|
183
|
-
|
|
184
|
-
// Handler can work with or without server parameter
|
|
185
|
-
const handlerWithServer: ToolHandler = async (sdk, args, server) => {
|
|
186
|
-
return { result: server?.getEnvironment?.() };
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const handlerWithoutServer: ToolHandler = async (_sdk, _args) => {
|
|
190
|
-
return { result: 'ok' };
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
expect(typeof handlerWithServer).toBe('function');
|
|
194
|
-
expect(typeof handlerWithoutServer).toBe('function');
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
describe('Server-Level Tool Factory Contract', () => {
|
|
199
|
-
it('should enable tools to access server state', () => {
|
|
200
|
-
interface ServerLevelToolConfig {
|
|
201
|
-
name: string;
|
|
202
|
-
description: string;
|
|
203
|
-
handler: (sdk: any, args: any, server: any) => Promise<any>;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const config: ServerLevelToolConfig = {
|
|
207
|
-
name: 'test-tool',
|
|
208
|
-
description: 'Test tool',
|
|
209
|
-
handler: async (sdk, args, server) => {
|
|
210
|
-
return { environment: server.getEnvironment() };
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
expect(config.handler).toBeDefined();
|
|
215
|
-
expect(typeof config.handler).toBe('function');
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
describe('Integration Pattern Validation', () => {
|
|
220
|
-
it('should support switching between all environment pairs', () => {
|
|
221
|
-
const environments: Array<'production' | 'development' | 'testing'> = [
|
|
222
|
-
'production',
|
|
223
|
-
'development',
|
|
224
|
-
'testing',
|
|
225
|
-
];
|
|
226
|
-
|
|
227
|
-
// Validate all possible pairs
|
|
228
|
-
const pairs: Array<[string, string]> = [];
|
|
229
|
-
environments.forEach((from) => {
|
|
230
|
-
environments.forEach((to) => {
|
|
231
|
-
if (from !== to) {
|
|
232
|
-
pairs.push([from, to]);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
expect(pairs).toHaveLength(6); // 3 * 2 non-diagonal transitions
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
it('should handle rapid successive switches', () => {
|
|
241
|
-
const switches = [
|
|
242
|
-
{ from: 'production', to: 'development' },
|
|
243
|
-
{ from: 'development', to: 'testing' },
|
|
244
|
-
{ from: 'testing', to: 'production' },
|
|
245
|
-
];
|
|
246
|
-
|
|
247
|
-
expect(switches).toHaveLength(3);
|
|
248
|
-
switches.forEach((s, i) => {
|
|
249
|
-
if (i > 0) {
|
|
250
|
-
expect(s.from).toBe(switches[i - 1].to);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
});
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool Name Constants
|
|
3
|
-
*
|
|
4
|
-
* Centralized constants for all Gala Launchpad MCP tool names.
|
|
5
|
-
* Use these constants instead of hardcoded strings to prevent typos
|
|
6
|
-
* and enable IDE autocomplete.
|
|
7
|
-
*
|
|
8
|
-
* Total: 74 tools across 9 categories (added 2 new DEX pool discovery tools)
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Pool Management & Pricing Tools (17 tools)
|
|
13
|
-
*/
|
|
14
|
-
export const POOL_TOOLS = {
|
|
15
|
-
FETCH_POOLS: 'gala_launchpad_fetch_pools',
|
|
16
|
-
FETCH_ALL_POOLS: 'gala_launchpad_fetch_all_pools',
|
|
17
|
-
FETCH_POOL_DETAILS: 'gala_launchpad_fetch_pool_details',
|
|
18
|
-
FETCH_POOL_DETAILS_FOR_CALCULATION: 'gala_launchpad_fetch_pool_details_for_calculation',
|
|
19
|
-
FETCH_TOKEN_DETAILS: 'gala_launchpad_fetch_token_details',
|
|
20
|
-
FETCH_TOKEN_DISTRIBUTION: 'gala_launchpad_fetch_token_distribution',
|
|
21
|
-
FETCH_TOKEN_BADGES: 'gala_launchpad_fetch_token_badges',
|
|
22
|
-
FETCH_VOLUME_DATA: 'gala_launchpad_fetch_volume_data',
|
|
23
|
-
FETCH_GALA_SPOT_PRICE: 'gala_launchpad_fetch_gala_spot_price',
|
|
24
|
-
FETCH_TOKEN_SPOT_PRICE: 'gala_launchpad_fetch_token_spot_price',
|
|
25
|
-
FETCH_LAUNCHPAD_TOKEN_SPOT_PRICE: 'gala_launchpad_fetch_launchpad_token_spot_price',
|
|
26
|
-
FETCH_PRICE_HISTORY: 'gala_launchpad_fetch_price_history',
|
|
27
|
-
FETCH_ALL_PRICE_HISTORY: 'gala_launchpad_fetch_all_price_history',
|
|
28
|
-
CHECK_TOKEN_NAME: 'gala_launchpad_check_token_name',
|
|
29
|
-
CHECK_TOKEN_SYMBOL: 'gala_launchpad_check_token_symbol',
|
|
30
|
-
RESOLVE_VAULT_ADDRESS: 'gala_launchpad_resolve_vault_address',
|
|
31
|
-
RESOLVE_TOKEN_CLASS_KEY: 'gala_launchpad_resolve_token_class_key',
|
|
32
|
-
} as const;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Trading Operations Tools (13 tools)
|
|
36
|
-
*/
|
|
37
|
-
export const TRADING_TOOLS = {
|
|
38
|
-
CALCULATE_BUY_AMOUNT: 'gala_launchpad_calculate_buy_amount',
|
|
39
|
-
CALCULATE_BUY_AMOUNT_LOCAL: 'gala_launchpad_calculate_buy_amount_local',
|
|
40
|
-
CALCULATE_BUY_AMOUNT_EXTERNAL: 'gala_launchpad_calculate_buy_amount_external',
|
|
41
|
-
CALCULATE_SELL_AMOUNT: 'gala_launchpad_calculate_sell_amount',
|
|
42
|
-
CALCULATE_SELL_AMOUNT_LOCAL: 'gala_launchpad_calculate_sell_amount_local',
|
|
43
|
-
CALCULATE_SELL_AMOUNT_EXTERNAL: 'gala_launchpad_calculate_sell_amount_external',
|
|
44
|
-
CALCULATE_BUY_AMOUNT_FOR_GRADUATION: 'gala_launchpad_calculate_buy_amount_for_graduation',
|
|
45
|
-
BUY_TOKENS: 'gala_launchpad_buy_tokens',
|
|
46
|
-
SELL_TOKENS: 'gala_launchpad_sell_tokens',
|
|
47
|
-
GRADUATE_TOKEN: 'gala_launchpad_graduate_token',
|
|
48
|
-
FETCH_TRADES: 'gala_launchpad_fetch_trades',
|
|
49
|
-
GET_BUNDLER_TRANSACTION_RESULT: 'gala_launchpad_get_bundler_transaction_result',
|
|
50
|
-
IS_TOKEN_GRADUATED: 'gala_launchpad_is_token_graduated',
|
|
51
|
-
} as const;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Balance & Portfolio Tools (6 tools)
|
|
55
|
-
*/
|
|
56
|
-
export const BALANCE_TOOLS = {
|
|
57
|
-
FETCH_GALA_BALANCE: 'gala_launchpad_fetch_gala_balance',
|
|
58
|
-
FETCH_TOKEN_BALANCE: 'gala_launchpad_fetch_token_balance',
|
|
59
|
-
FETCH_TOKENS_HELD: 'gala_launchpad_fetch_tokens_held',
|
|
60
|
-
FETCH_TOKENS_CREATED: 'gala_launchpad_fetch_tokens_created',
|
|
61
|
-
FETCH_PROFILE: 'gala_launchpad_fetch_profile',
|
|
62
|
-
UPDATE_PROFILE: 'gala_launchpad_update_profile',
|
|
63
|
-
} as const;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Token Creation Tools (5 tools)
|
|
67
|
-
*/
|
|
68
|
-
export const CREATION_TOOLS = {
|
|
69
|
-
LAUNCH_TOKEN: 'gala_launchpad_launch_token',
|
|
70
|
-
UPLOAD_TOKEN_IMAGE: 'gala_launchpad_upload_token_image',
|
|
71
|
-
UPLOAD_PROFILE_IMAGE: 'gala_launchpad_upload_profile_image',
|
|
72
|
-
FETCH_LAUNCH_TOKEN_FEE: 'gala_launchpad_fetch_launch_token_fee',
|
|
73
|
-
CALCULATE_INITIAL_BUY: 'gala_launchpad_calculate_initial_buy',
|
|
74
|
-
} as const;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Social & Comments Tools (2 tools)
|
|
78
|
-
*/
|
|
79
|
-
export const SOCIAL_TOOLS = {
|
|
80
|
-
POST_COMMENT: 'gala_launchpad_post_comment',
|
|
81
|
-
FETCH_COMMENTS: 'gala_launchpad_fetch_comments',
|
|
82
|
-
} as const;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Token Transfer Tools (2 tools)
|
|
86
|
-
*/
|
|
87
|
-
export const TRANSFER_TOOLS = {
|
|
88
|
-
TRANSFER_GALA: 'gala_launchpad_transfer_gala',
|
|
89
|
-
TRANSFER_TOKEN: 'gala_launchpad_transfer_token',
|
|
90
|
-
} as const;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Utility Tools (14 tools)
|
|
94
|
-
*/
|
|
95
|
-
export const UTILITY_TOOLS = {
|
|
96
|
-
CREATE_WALLET: 'gala_launchpad_create_wallet',
|
|
97
|
-
GET_ADDRESS: 'gala_launchpad_get_address',
|
|
98
|
-
GET_ETHEREUM_ADDRESS: 'gala_launchpad_get_ethereum_address',
|
|
99
|
-
GET_CONFIG: 'gala_launchpad_get_config',
|
|
100
|
-
GET_URL_BY_TOKEN_NAME: 'gala_launchpad_get_url_by_token_name',
|
|
101
|
-
EXPLAIN_SDK_USAGE: 'gala_launchpad_explain_sdk_usage',
|
|
102
|
-
GET_CACHE_INFO: 'gala_launchpad_get_cache_info',
|
|
103
|
-
CLEAR_CACHE: 'gala_launchpad_clear_cache',
|
|
104
|
-
HAS_WALLET: 'gala_launchpad_has_wallet',
|
|
105
|
-
GET_WALLET: 'gala_launchpad_get_wallet',
|
|
106
|
-
SET_WALLET: 'gala_launchpad_set_wallet',
|
|
107
|
-
GET_ENVIRONMENT: 'gala_launchpad_get_environment',
|
|
108
|
-
SWITCH_ENVIRONMENT: 'gala_launchpad_switch_environment',
|
|
109
|
-
GET_VERSION: 'gala_launchpad_get_version',
|
|
110
|
-
} as const;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* DEX Trading & Pool Discovery Tools (7 tools)
|
|
114
|
-
*/
|
|
115
|
-
export const DEX_TOOLS = {
|
|
116
|
-
FETCH_DEX_POOLS: 'gala_launchpad_fetch_dex_pools',
|
|
117
|
-
FETCH_ALL_DEX_POOLS: 'gala_launchpad_fetch_all_dex_pools',
|
|
118
|
-
GET_SWAP_QUOTE_EXACT_INPUT: 'gala_launchpad_get_swap_quote_exact_input',
|
|
119
|
-
GET_SWAP_QUOTE_EXACT_OUTPUT: 'gala_launchpad_get_swap_quote_exact_output',
|
|
120
|
-
EXECUTE_SWAP: 'gala_launchpad_execute_swap',
|
|
121
|
-
GET_SWAP_USER_ASSETS: 'gala_launchpad_get_swap_user_assets',
|
|
122
|
-
GET_SWAP_POOL_INFO: 'gala_launchpad_get_swap_pool_info',
|
|
123
|
-
} as const;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Liquidity Position Management Tools (8 tools)
|
|
127
|
-
*/
|
|
128
|
-
export const LIQUIDITY_TOOLS = {
|
|
129
|
-
GET_USER_LIQUIDITY_POSITIONS: 'gala_launchpad_get_user_liquidity_positions',
|
|
130
|
-
GET_LIQUIDITY_POSITION_BY_ID: 'gala_launchpad_get_liquidity_position_by_id',
|
|
131
|
-
GET_LIQUIDITY_POSITION: 'gala_launchpad_get_liquidity_position',
|
|
132
|
-
ESTIMATE_REMOVE_LIQUIDITY: 'gala_launchpad_estimate_remove_liquidity',
|
|
133
|
-
ADD_LIQUIDITY_BY_PRICE: 'gala_launchpad_add_liquidity_by_price',
|
|
134
|
-
ADD_LIQUIDITY_BY_TICKS: 'gala_launchpad_add_liquidity_by_ticks',
|
|
135
|
-
REMOVE_LIQUIDITY: 'gala_launchpad_remove_liquidity',
|
|
136
|
-
COLLECT_POSITION_FEES: 'gala_launchpad_collect_position_fees',
|
|
137
|
-
} as const;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* All MCP Tools - Flat structure for easy access
|
|
141
|
-
*
|
|
142
|
-
* Use specific category constants above for better organization,
|
|
143
|
-
* or use this flat object for backwards compatibility.
|
|
144
|
-
*/
|
|
145
|
-
export const MCP_TOOLS = {
|
|
146
|
-
// Pool Management & Pricing
|
|
147
|
-
...POOL_TOOLS,
|
|
148
|
-
// Trading Operations
|
|
149
|
-
...TRADING_TOOLS,
|
|
150
|
-
// Balance & Portfolio
|
|
151
|
-
...BALANCE_TOOLS,
|
|
152
|
-
// Token Creation
|
|
153
|
-
...CREATION_TOOLS,
|
|
154
|
-
// Social & Comments
|
|
155
|
-
...SOCIAL_TOOLS,
|
|
156
|
-
// Token Transfers
|
|
157
|
-
...TRANSFER_TOOLS,
|
|
158
|
-
// Utilities
|
|
159
|
-
...UTILITY_TOOLS,
|
|
160
|
-
// DEX Trading
|
|
161
|
-
...DEX_TOOLS,
|
|
162
|
-
// Liquidity Positions
|
|
163
|
-
...LIQUIDITY_TOOLS,
|
|
164
|
-
} as const;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Type helper for tool names
|
|
168
|
-
*/
|
|
169
|
-
export type MCPToolName = (typeof MCP_TOOLS)[keyof typeof MCP_TOOLS];
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Get all tool names as an array
|
|
173
|
-
*/
|
|
174
|
-
export function getAllToolNames(): string[] {
|
|
175
|
-
return Object.values(MCP_TOOLS);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Check if a string is a valid MCP tool name
|
|
180
|
-
*/
|
|
181
|
-
export function isValidToolName(name: string): name is MCPToolName {
|
|
182
|
-
return getAllToolNames().includes(name);
|
|
183
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Gala Launchpad MCP Server Entry Point
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { LaunchpadMCPServer } from './server.js';
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
const server = new LaunchpadMCPServer();
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
await server.start();
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error('[MCP Server] Fatal error:', error);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
main();
|