Files
mcp-tool/test-http.js
nasir@endelospay.com 8c74b0e23f first
2025-07-11 20:22:12 +05:00

46 lines
1.3 KiB
JavaScript

#!/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();