test-server.js•1.66 kB
/**
* Simple test script to verify the HTTP server works
*/
async function runTests() {
const BASE_URL = 'http://localhost:3000';
console.log('=== Testing Sequential Thinking Server ===\n');
// Wait for server to be ready
await new Promise(resolve => setTimeout(resolve, 2000));
try {
// Test 1: Health check
console.log('Test 1: Health Check');
const healthResponse = await fetch(`${BASE_URL}/health`);
const health = await healthResponse.json();
console.log('✓ Health check passed:', health);
// Test 2: Server info
console.log('\nTest 2: Server Info');
const infoResponse = await fetch(`${BASE_URL}/info`);
const info = await infoResponse.json();
console.log('✓ Server info retrieved:', info.name);
// Test 3: Add a thought
console.log('\nTest 3: Add Thought');
const thoughtResponse = await fetch(`${BASE_URL}/sse`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'sequential_thinking',
arguments: {
thought: 'Test thought',
nextThoughtNeeded: false,
thoughtNumber: 1,
totalThoughts: 1
}
},
id: 1
})
});
if (thoughtResponse.ok) {
console.log('✓ Thought added successfully');
} else {
console.log('✗ Failed to add thought');
}
console.log('\n=== All Tests Completed ===\n');
process.exit(0);
} catch (error) {
console.error('✗ Test failed:', error.message);
process.exit(1);
}
}
runTests();