mcp-cve-intelligence-server-lite-test
Version:
Lite Model Context Protocol server for comprehensive CVE intelligence gathering with multi-source exploit discovery, designed for security professionals and cybersecurity researchers - Alpha Release
59 lines • 2.42 kB
JavaScript
/* eslint-disable no-console */
import { CVEIntelligenceServer } from '../index.js';
import { createContextLogger } from '../utils/logger.js';
import { getAppConfiguration } from '../config/index.js';
const logger = createContextLogger('ServerLauncher');
export async function startServer(transport) {
// Always check configuration first, then parameter, then default
if (!transport) {
const config = getAppConfiguration();
transport = config.transport.type;
}
const server = new CVEIntelligenceServer();
// Handle graceful shutdown
const shutdown = async () => {
logger.info('Received shutdown signal');
try {
await server.shutdown();
process.exit(0);
}
catch (error) {
logger.error('Error during shutdown:', error instanceof Error ? error : new Error(String(error)));
process.exit(1);
}
};
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
process.on('SIGQUIT', shutdown);
// Show startup banner for NPX users
const config = getAppConfiguration();
if (transport === 'http' || config.transport.type === 'http') {
console.log('');
console.log('MCP CVE Intelligence Server Lite');
console.log('=================================');
console.log('');
console.log('Server Configuration:');
console.log(' Transport Type: HTTP');
console.log(` Host Address: ${config.transport.http.host}`);
console.log(` Port Number: ${config.transport.http.port}`);
console.log('');
console.log('Available Endpoints:');
console.log(` Health Check: http://localhost:${config.transport.http.port}/health`);
console.log(` MCP Interface: http://localhost:${config.transport.http.port}/mcp`);
console.log('');
console.log('Status: Server is ready and accepting MCP client connections');
console.log('');
console.log('For setup instructions, please refer to MCP_QUICK_REFERENCE.md');
console.log('');
}
// Start the server
try {
await server.initialize();
await server.run(transport);
}
catch (error) {
logger.error('Failed to start server:', error instanceof Error ? error : new Error(String(error)));
process.exit(1);
}
}
//# sourceMappingURL=server-launcher.js.map