inspector/core
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Cliff Hall 440b194f64
fix(state): dispatch connect event after capabilities are populated (#1405)
* fix(state): dispatch connect event after capabilities are populated

The list-state managers (tools/prompts/resources/templates) refresh on the
"connect" event and, since #1395, gate their list RPC on getCapabilities().
But connect() dispatched "connect" before fetchServerInfo() populated
this.capabilities, and refresh() runs synchronously up to its first await —
so the capability gate executed during the synchronous dispatch, read
undefined capabilities (reset to undefined on every disconnect), tripped,
and wiped every list to empty on connect. Tools, prompts, resources, and
resource templates all vanished against any server.

Move the "connect" dispatch to after the awaited fetchServerInfo() so
capabilities are in place before any manager refreshes. The unit tests
missed this because their FakeInspectorClient has capabilities populated
from construction; added an integration regression test wiring a real
ManagedToolsState on connect and asserting the tool list is non-empty
(fails without the fix).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(integration): harden connect-race regression test per review

Address the two non-blocking suggestions from the PR review:
- Replace the 100ms settle sleep with waitForEvent() on the managers'
  change events, so the test is deterministic against slow CI instead of
  racing a fixed timeout.
- Assert a second affected primitive (ManagedResourcesState alongside
  ManagedToolsState). The fix is a single shared line, but covering two
  distinct capabilities guards against a future change gating one
  primitive differently.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 11:10:07 -04:00
..
auth fix(auth): persist OAuth pre-redirect Network log across the redirect (#1384) (#1385) 2026-05-30 20:39:25 -04:00
json feat(core): port v1.5 InspectorClient + transports + auth subsystem (#1302) (#1306) 2026-05-15 15:36:17 -04:00
logging feat(core): port v1.5 InspectorClient + transports + auth subsystem (#1302) (#1306) 2026-05-15 15:36:17 -04:00
mcp fix(state): dispatch connect event after capabilities are populated (#1405) 2026-06-01 11:10:07 -04:00
react feat(connection-info): wire Connection Info modal to the connection handshake (#1377) 2026-05-30 16:42:37 -04:00
storage feat(servers): persist server list to ~/.mcp-inspector/mcp.json (#1343) (#1349) 2026-05-23 14:26:23 -04:00