fix: add | undefined to transport option callbacks for exactOptionalPropertyTypes (#1855)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Sidak 2026-05-03 18:12:25 -07:00 • committed by GitHub
commit 2c0c481cb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,7 @@
---
'@modelcontextprotocol/server': patch
---
Add `| undefined` to optional callback and function properties on `WebStandardStreamableHTTPServerTransportOptions` (`sessionIdGenerator`, `onsessioninitialized`, `onsessionclosed`) and corresponding private fields.
This fixes TS2430 errors for consumers using `exactOptionalPropertyTypes: true` without `skipLibCheck`, where optional properties with function types need explicit `| undefined` to match their emitted declarations.