Skip to content

Server is crashing if the client aborts the request before response is sent #128

@utkarsh-dixit

Description

@utkarsh-dixit

Issue

Server is crashing if the client aborts the request before a complete response with mcp-server-handler is sent, with the following stack trace:

Unhandled rejection

Error: aborted
    at abortIncoming (node:_http_server:809:17)
    at socketOnClose (node:_http_server:803:3)
    at Socket.emit (node:events:530:35)
    at Socket.emit (node:domain:489:12)
    at TCP.<anonymous> (node:net:351:12)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)

Expected Result

mcp-handler should handle socket close gracefully and not crash the server

Version info

Node:  v22.14.0
mcp-handler: 1.0.2
NextJs: 15.2.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions