Skip to content

Add an error event to InspectorClientEventMap so mid-session transport failures surface #1323

Closed

Description

@cliffhall

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

Activity

  1. added 2 commits that reference this issue on May 19, 2026
  2. self-assigned this
    on May 31, 2026
  3. added a commit that references this issue on Jun 15, 2026
    b4716a1
  4. added this to the v2.0.0 milestone on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions