docs: add error handling when it fails to start HTTP server

This commit is contained in:
Jun Han 2025-04-20 17:51:46 +08:00 • committed by GitHub
commit 4cd5e73a11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -367,7 +367,11 @@ app.delete('/mcp', async (req: Request, res: Response) => {
// Start the server
const PORT = 3000;
setupServer().then(() => {
app.listen(PORT, () => {
app.listen(PORT, (error) => {
if (error) {
console.error('Failed to start server:', error);
process.exit(1);
}
console.log(`MCP Streamable HTTP Server listening on port ${PORT}`);
});
}).catch(error => {