first
This commit is contained in:
45
test-http.js
Normal file
45
test-http.js
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Test HTTP server functionality
|
||||
*/
|
||||
|
||||
import { HttpServer } from './http-server.js';
|
||||
|
||||
async function testHttpServer() {
|
||||
console.log('🌐 Testing HTTP Server...\n');
|
||||
|
||||
// Set environment variables
|
||||
process.env.LARAVEL_API_BASE_URL = 'https://example.com';
|
||||
process.env.MCP_SERVER_PORT = '3001'; // Use different port for testing
|
||||
|
||||
const httpServer = new HttpServer();
|
||||
|
||||
try {
|
||||
console.log('1. Initializing HTTP server...');
|
||||
await httpServer.initialize();
|
||||
console.log('✅ HTTP server initialized');
|
||||
|
||||
console.log('2. Starting HTTP server...');
|
||||
await httpServer.start();
|
||||
console.log('✅ HTTP server started');
|
||||
|
||||
console.log('\n🎉 HTTP Server test completed!');
|
||||
console.log('Server should be running on http://0.0.0.0:3001');
|
||||
console.log('\nAvailable endpoints:');
|
||||
console.log('• GET /health - Health check');
|
||||
console.log('• GET /tools - List all tools');
|
||||
console.log('• GET /stats - Server statistics');
|
||||
console.log('• POST /tools/:toolName/execute - Execute tool');
|
||||
|
||||
// Keep server running for testing
|
||||
console.log('\nPress Ctrl+C to stop the server...');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ HTTP server test failed:', error.message);
|
||||
console.error('Stack:', error.stack);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
testHttpServer();
|
Reference in New Issue
Block a user