fix: wrap async handler with void for proper promise handling

This commit is contained in:
2025-12-16 13:40:14 -05:00
parent 0fe118f9e6
commit 9c1c11df5a

View File

@@ -7,7 +7,8 @@ export function setupRoutes(
createErrorResponse: (id: string | number | null, code: number, message: string) => JSONRPCResponse
): void {
// Main MCP endpoint
app.post('/mcp', async (req: Request, res: Response) => {
app.post('/mcp', (req: Request, res: Response) => {
void (async () => {
try {
const request = req.body as JSONRPCRequest;
const response = await handleRequest(request);
@@ -16,6 +17,7 @@ export function setupRoutes(
console.error('MCP request error:', error);
res.status(500).json(createErrorResponse(null, ErrorCodes.InternalError, 'Internal server error'));
}
})();
});
// Health check endpoint