Add ondelete hook to StreamableHTTPServerTransport

Adds optional ondelete callback that fires when DELETE request is received, providing the sessionId for cleanup handling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jerome 2025-07-07 14:44:35 +01:00
commit afb8971569
No known key found for this signature in database

View file

@ -133,6 +133,7 @@ export class StreamableHTTPServerTransport implements Transport {
sessionId?: string;
onclose?: () => void;
ondelete?: (sessionId: string) => void;
onerror?: (error: Error) => void;
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
@ -538,6 +539,7 @@ export class StreamableHTTPServerTransport implements Transport {
if (!this.validateProtocolVersion(req, res)) {
return;
}
this.ondelete?.(this.sessionId!);
await this.close();
res.writeHead(200).end();
}