Background
useInspectorClient exposes status driven by the OAuth/XState machine inside InspectorClient. The status can transition connected → error when a transport dies mid-session (stdio subprocess crash, SSE stream drop, HTTP 5xx). Callers see the status flip but don't get the reason.
#1244 wired App.tsx to useInspectorClient and captures errorMessage only from client.connect() Promise rejection (handshake-only). A state-machine transition to "error" after a successful connect bypasses that path and leaves the UI's errorMessage stale (or unset).
Scope
- Add
error: { detail: string; cause?: unknown } (or similar shape) to InspectorClientEventMap in core/mcp/inspectorClientEventTarget.ts.
- Dispatch from every code path inside
core/mcp/inspectorClient.ts that sets status to "error" outside of an awaited promise.
- Expose
lastError?: string on useInspectorClient's return type so consumers can render it without subscribing to the event directly.
- Update App.tsx to consume the new field instead of the
connect() catch (or in addition to, for the handshake case).
Out of scope
- Reconnection UX. This is just about surfacing the reason.
Related
Background
useInspectorClientexposesstatusdriven by the OAuth/XState machine insideInspectorClient. The status can transitionconnected → errorwhen a transport dies mid-session (stdio subprocess crash, SSE stream drop, HTTP 5xx). Callers see thestatusflip but don't get the reason.#1244 wired
App.tsxtouseInspectorClientand captureserrorMessageonly fromclient.connect()Promise rejection (handshake-only). A state-machine transition to"error"after a successful connect bypasses that path and leaves the UI'serrorMessagestale (or unset).Scope
error: { detail: string; cause?: unknown }(or similar shape) toInspectorClientEventMapincore/mcp/inspectorClientEventTarget.ts.core/mcp/inspectorClient.tsthat setsstatusto"error"outside of an awaited promise.lastError?: stringonuseInspectorClient's return type so consumers can render it without subscribing to the event directly.connect()catch (or in addition to, for the handshake case).Out of scope
Related