@expertvagabond/solana-mcp-server
Version:
Solana MCP server for wallet management, transaction handling, and program interactions on Solana blockchain
156 lines (144 loc) โข 3.36 kB
JavaScript
#!/usr/bin/env node
import { spawn } from 'child_process';
console.log('๐ Testing Comprehensive Solana MCP Server - 50+ Commands\n');
const server = spawn('node', ['dist/index.js'], {
stdio: ['pipe', 'pipe', 'pipe']
});
let testCount = 0;
let passedTests = 0;
let commandCount = 0;
server.stdout.on('data', (data) => {
const response = JSON.parse(data.toString());
testCount++;
if (response.result) {
console.log(`โ
Test ${testCount} passed`);
passedTests++;
} else if (response.error) {
console.log(`โ Test ${testCount} failed:`, response.error.message);
}
});
server.stderr.on('data', (data) => {
// Ignore server startup messages
});
server.on('close', (code) => {
console.log(`\n๐ Comprehensive Test Results:`);
console.log(`- Total tests: ${testCount}`);
console.log(`- Passed tests: ${passedTests}`);
console.log(`- Available commands: ${commandCount}`);
console.log(`- Exit code: ${code}`);
if (passedTests === testCount) {
console.log('๐ All tests passed! Comprehensive Solana MCP Server is working!');
}
process.exit(0);
});
// Test commands for comprehensive functionality
const tests = [
// Test 1: List all available tools
{
jsonrpc: "2.0",
id: 1,
method: "tools/list",
params: {}
},
// Test 2: Create wallet
{
jsonrpc: "2.0",
id: 2,
method: "tools/call",
params: {
name: "create_wallet",
arguments: { name: "comprehensive-test" }
}
},
// Test 3: Get network info
{
jsonrpc: "2.0",
id: 3,
method: "tools/call",
params: {
name: "get_network_info",
arguments: {}
}
},
// Test 4: Get validators
{
jsonrpc: "2.0",
id: 4,
method: "tools/call",
params: {
name: "get_validators",
arguments: {}
}
},
// Test 5: Validate address
{
jsonrpc: "2.0",
id: 5,
method: "tools/call",
params: {
name: "validate_address",
arguments: { address: "11111111111111111111111111111112" }
}
},
// Test 6: Convert lamports to SOL
{
jsonrpc: "2.0",
id: 6,
method: "tools/call",
params: {
name: "convert_lamports_to_sol",
arguments: { lamports: 1000000000 }
}
},
// Test 7: Convert SOL to lamports
{
jsonrpc: "2.0",
id: 7,
method: "tools/call",
params: {
name: "convert_sol_to_lamports",
arguments: { sol: 1.5 }
}
},
// Test 8: Get balance
{
jsonrpc: "2.0",
id: 8,
method: "tools/call",
params: {
name: "get_balance",
arguments: { walletName: "comprehensive-test" }
}
},
// Test 9: Airdrop SOL
{
jsonrpc: "2.0",
id: 9,
method: "tools/call",
params: {
name: "airdrop_sol",
arguments: { walletName: "comprehensive-test", amount: 2 }
}
},
// Test 10: Create token
{
jsonrpc: "2.0",
id: 10,
method: "tools/call",
params: {
name: "create_token",
arguments: { walletName: "comprehensive-test", decimals: 6, initialSupply: 1000000 }
}
}
];
// Send tests with delays
tests.forEach((test, index) => {
setTimeout(() => {
console.log(`๐งช Running test ${index + 1}...`);
server.stdin.write(JSON.stringify(test) + '\n');
}, index * 1000);
});
// Close after all tests
setTimeout(() => {
server.kill();
}, tests.length * 1000 + 2000);