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

76 lines
2.0 KiB
JavaScript

#!/usr/bin/env node
/**
* Simple HTTP server starter with console output
*/
import express from 'express';
import cors from 'cors';
const app = express();
const port = process.env.MCP_SERVER_PORT || 3000;
const host = process.env.MCP_SERVER_HOST || '0.0.0.0';
// Basic middleware
app.use(cors());
app.use(express.json());
// Simple health endpoint
app.get('/health', (req, res) => {
res.json({
status: 'healthy',
timestamp: new Date().toISOString(),
server: 'Laravel Healthcare MCP Server',
port: port
});
});
// Simple tools endpoint
app.get('/tools', (req, res) => {
res.json({
message: 'Laravel Healthcare MCP Server Tools',
total: 26,
note: 'Use the full server for complete tool functionality'
});
});
// Start server
const server = app.listen(port, host, () => {
const serverUrl = `http://${host === '0.0.0.0' ? 'localhost' : host}:${port}`;
// Startup banner
console.log('\n' + '='.repeat(60));
console.log('🚀 LARAVEL HEALTHCARE MCP SERVER - HTTP MODE');
console.log('='.repeat(60));
console.log(`📡 Server URL: ${serverUrl}`);
console.log(`🌐 Host: ${host}`);
console.log(`🔌 Port: ${port}`);
console.log('='.repeat(60));
console.log('📋 Available Endpoints:');
console.log(` • Health Check: ${serverUrl}/health`);
console.log(` • Tools List: ${serverUrl}/tools`);
console.log('='.repeat(60));
console.log('📊 Server Status: READY');
console.log(`⏰ Started at: ${new Date().toLocaleString()}`);
console.log('='.repeat(60));
console.log('💡 Press Ctrl+C to stop the server');
console.log('');
});
// Graceful shutdown
process.on('SIGINT', () => {
console.log('\n🛑 Shutting down HTTP server...');
server.close(() => {
console.log('✅ HTTP server stopped');
process.exit(0);
});
});
process.on('SIGTERM', () => {
console.log('\n🛑 Shutting down HTTP server...');
server.close(() => {
console.log('✅ HTTP server stopped');
process.exit(0);
});
});