You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(mcp-server): Add defensive patches for StreamableHTTPServerTransport edge cases
This patch adds defensive handling for edge cases in MCP server instrumentation
when working with StreamableHTTPServerTransport and similar transport implementations.
Changes:
- Add transport constructor null checks in getTransportTypes()
- Graceful sessionId undefined handling in buildTransportAttributes()
- WeakMap correlation fallback system for invalid transport objects
- Type validation for WeakMap operations in correlation.ts
The patches prevent runtime errors during MCP initialization and session establishment
while maintaining backward compatibility and proper instrumentation functionality.
Includes comprehensive test coverage for all edge cases and transport scenarios.
Fixes edge cases where:
- Transport objects have undefined/null constructors
- sessionId is undefined during initialization phases
- Transport objects cannot be used as WeakMap keys
- Invalid transport objects are passed to correlation functions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
0 commit comments