test.mjs•1.3 kB
#!/usr/bin/env node
/**
* Simple test script to verify the Ember MCP server works
*/
import { spawn } from 'child_process';
import path from 'path';
const serverPath = path.join(process.cwd(), 'dist', 'index.js');
console.log('Testing Ember MCP Server...');
console.log('Server path:', serverPath);
// Test 1: Check if server starts without errors
console.log('\n1. Testing server startup...');
const server = spawn('node', [serverPath], {
stdio: ['pipe', 'pipe', 'pipe']
});
// Send a simple initialization request
const initRequest = {
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: {
name: 'test-client',
version: '1.0.0'
}
}
};
setTimeout(() => {
console.log('Sending initialization request...');
server.stdin.write(JSON.stringify(initRequest) + '\n');
}, 100);
server.stdout.on('data', (data) => {
console.log('Server output:', data.toString());
});
server.stderr.on('data', (data) => {
console.log('Server stderr:', data.toString());
});
server.on('close', (code) => {
console.log(`Server process exited with code ${code}`);
});
// Cleanup after 5 seconds
setTimeout(() => {
console.log('Terminating test...');
server.kill();
process.exit(0);
}, 5000);