Repository navigation
Description
Background
Phases 1-5 of specification/v2_ux_interfaces_plan.md produced contracts for every dumb component under clients/web/src/components/. The component layer is now ready to consume hook output, but the hook layer itself doesn't exist in v2 yet — App.tsx is a 42-line theme shell, and InspectorView accepts hook-output-shaped props that are currently populated by Storybook fixtures only.
v1.5 of this repo (v1.5/main) ships the complete hook surface and the underlying state machinery the hooks subscribe to. The plan calls porting this layer wholesale to v2 as the natural next major effort, with the component contracts produced by Phases 1-5 as its input spec.
Scope
Port the following from v1.5 into v2 under core/:
React hooks (core/react/):
useInspectorClient.ts→{ status, capabilities, serverInfo, instructions, appRendererClient, connect, disconnect }useManagedTools.ts→{ tools: Tool[], refresh }useManagedPrompts.ts→{ prompts: Prompt[], refresh }useManagedResources.ts→{ resources: Resource[], refresh }useManagedResourceTemplates.ts→{ resourceTemplates: ResourceTemplate[], refresh }useManagedRequestorTasks.ts→{ tasks: Task[], refresh }useMessageLog.ts→ JSON-RPCMessageEntry[]bufferuseStderrLog.ts→ stdioStderrLogEntry[]bufferuseFetchRequestLog.ts→ auth/transportFetchRequestEntry[]bufferusePagedTools.ts,usePagedPrompts.ts,usePagedResources.ts,usePagedResourceTemplates.ts,usePagedRequestorTasks.ts— paged siblings of the managed hooks above
State machinery (core/mcp/state/):
managedToolsState.ts,managedPromptsState.ts,managedResourcesState.ts,managedResourceTemplatesState.ts,managedRequestorTasksState.ts—EventTarget-based stores the hooks subscribe to- Paged siblings (
pagedToolsState.ts, etc.)
Inspector client + transport types (core/mcp/):
InspectorClientconstructor types (CreateTransport,CreateTransportOptions,CreateTransportResult,InspectorClientEnvironment,InspectorClientOptions,AppRendererClient) — explicitly skipped in Phase 0.2 of the plan, now in scope- The pending-sampling and pending-elicitation queues (currently coordinated inside v1.5's
InspectorClientvia SDK request handlers)
v2-only additions (no v1.5 analog — flagged as "v2 to introduce" in the audit):
InspectorUrlElicitRequestwrapper incore/mcp/types.ts(unblocksElicitationUrlPanelandInlineElicitationRequestpartials)InspectorPendingRequestwrapper if the pending-queue exposes a list to the dumb componentsInspectorRequestHistoryItemwrapper ifuseMessageLogdoesn't already cover this surface
Acceptance criteria
- All hooks listed above exist under
core/react/, return the documented shape, and import from@modelcontextprotocol/sdk. - All state modules listed exist under
core/mcp/state/with the sameEventTargetsubscription pattern as v1.5. -
InspectorClienttypes are added tocore/mcp/types.ts(or a peer file) per the v1.5 source-of-truth list. - The three v2-only wrapper types listed above are added to
core/mcp/types.ts. - No new component-layer changes — every existing component consumes the hook output unchanged (the contracts produced by Phases 1-5 are the input spec).
- Hook return shapes match what
InspectorViewalready declares as its props (verify by readingInspectorView.tsx:110-122).
Test plan
- Per-hook unit tests (Vitest) covering: initial state, subscription wiring, refresh behavior, cleanup on unmount. See AGENTS.md 90% bar — applies to the hook layer as much as the component layer.
- State module tests covering: event emission, subscriber notification, list mutation semantics.
- Integration smoke test: a fake
InspectorClientdriving a fake transport, exercising one hook end-to-end. -
npm run format && npm run lint && npm run buildclean acrosscore/andclients/web/. - No regressions in existing Storybook stories —
InspectorViewshould still render its fixture-driven demo when run fromnpm run storybook.
Out of scope
- Wiring
App.tsx(separate issue — depends on this one). - Vitest tests for the existing dumb components (separate issue — independent track).
- CLI / TUI clients (separate issue — depends on this one).
- Any change to component prop interfaces.
Unblocks
ElicitationUrlPanelpartial close (InspectorUrlElicitRequestwrapper)InlineElicitationRequestpartial close (URL discriminated union)App.tsxwiring effort- CLI / TUI ports
Related
- v1.5 source: https://github.com/modelcontextprotocol/inspector/tree/v1.5/main/core
- Plan reference:
specification/v2_ux_interfaces_plan.md§ "Out of this plan, but adjacent" (this is the "Building the v2core/hook layer" bullet) - Component contracts (input spec):
specification/v2_ux_interfaces.mdend-to-end
Activity
feat(core): port v1.5 hook layer (#1243) (#1300)
refactor(coverage): address review feedback on #1305
fix(coverage): include core/ files in v8 per-file gate (#1301) (#1305)