fix: add error handling for server startup failures (#236)

Previously, if app.listen() failed (e.g., port already in use), the
server would fail silently. This adds proper error handling to log
the error and exit with a non-zero status code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Olivier Chafik 2026-01-11 16:52:55 +00:00 • committed by GitHub
commit 081dad83c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,7 +54,11 @@ export async function startServer(
}
});
const httpServer = app.listen(port, () => {
const httpServer = app.listen(port, (err) => {
if (err) {
console.error("Failed to start server:", err);
process.exit(1);
}
console.log(`${name} listening on http://localhost:${port}/mcp`);
});