first
This commit is contained in:
75
start-http.js
Normal file
75
start-http.js
Normal file
@@ -0,0 +1,75 @@
|
||||
#!/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);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user