v0.4.1
Bug Fixes
-
Session expiry reconnection (#1): MCP Streamable HTTP sessions that expire (HTTP 404 "Session not found") now trigger automatic reconnection. The dead client is evicted from the connection cache, a fresh transport is created, and the failed tool call is retried exactly once. Previously, expired sessions caused the sentinel to fail permanently with no recovery path.
Per the MCP Streamable HTTP spec § Session Management, clients MUST re-initialize when receiving HTTP 404 with a session ID. The
@modelcontextprotocol/sdkthrowsStreamableHTTPErroron 404 but does not auto-reconnect — this plugin now fulfills that obligation.
Features
- Resilient reconnection:
callToolhandles transient network errors (ECONNREFUSED, ECONNRESET, ETIMEDOUT,fetch failed) and server faults (5xx) by reconnecting and retrying once. - Concurrency safety:
getOrCreateClientuses promise-sharing to deduplicate concurrent connection attempts. AWeakMapfallback prevents the second concurrent poll from failing when another poll already evicted the dead client — critical for multi-session environments. - Mock server HTTP mode:
tests/mock-mcp-server.ts --transport=httpsupports Streamable HTTP with configurable session expiry for integration testing.
Internal
- Full TSDoc/JSDoc comments on all 9 source modules
- 84 tests, typecheck + build green
Full Changelog: v0.4.0...v0.4.1