Skip to content

Plan: V2 component interfaces refactor#1185

Draft
cliffhall wants to merge 2 commits intov2/mainfrom
v2/component-interfaces-refactor
Draft

Plan: V2 component interfaces refactor#1185
cliffhall wants to merge 2 commits intov2/mainfrom
v2/component-interfaces-refactor

Conversation

@cliffhall
Copy link
Copy Markdown
Member

Summary

Adds the implementation plan for the work scoped in specification/v2_ux_interfaces.md: refactoring every dumb component under clients/web/src/components/ so its props consume MCP SDK schema types or Inspector-owned wrapper types, instead of the ad hoc shapes invented during the visual-design phase.

This PR is plan-only. No component code changes. Subsequent PRs against this branch will execute the plan in phases.

Source-of-truth decisions

The plan establishes two authoritative sources:

  1. MCP schema types@modelcontextprotocol/sdk pinned at the latest 1.x line (^1.29.0).

  2. Inspector-owned wrapper types — the v1.5/main branch of this repo, specifically core/mcp/types.ts (416 lines, fully defined). v1.5 already has every wrapper this refactor needs:

    • MCPServerConfig discriminated union (StdioServerConfig / SseServerConfig / StreamableHttpServerConfig)
    • ServerType, MCPConfig, ConnectionStatus
    • MessageEntry (history wrapper, timestamp: Date)
    • FetchRequestEntry / FetchRequestEntryBase / FetchRequestCategory
    • StderrLogEntry, ServerState
    • ResourceReadInvocation, ResourceTemplateReadInvocation, PromptGetInvocation, ToolCallInvocation

    Plus the JSON Schema typing helpers at clients/web/src/utils/{jsonUtils,schemaUtils}.ts and clients/web/src/lib/types/customHeaders.ts.

The plan includes a name-mapping table that translates every Inspector* placeholder in v2_ux_interfaces.md to its v1.5 actual name. Notably:

  • InspectorServerConfigMCPServerConfig
  • InspectorHistoryEntryMessageEntry
  • InspectorTransportTypeServerType
  • InspectorTask / InspectorTaskStatusdropped. Task is exported by the MCP SDK 1.x at @modelcontextprotocol/sdk/types.js, and v1.5's useManagedRequestorTasks already returns Task[] raw. The interfaces doc's claim that "MCP 2025-11-25 doesn't have a task primitive" is stale and needs a follow-up correction.

Phase structure

  • Phase 0 — Foundations: add SDK dependency, create core/mcp/types.ts in v2 by copying the types-only subset from v1.5, copy the JSON Schema helpers, inventory local re-declarations to delete.
  • Phase 1 — Elements (16 components), ordered: pure presentational → schema-typed primitives → wrapper-consumers → composite-input.
  • Phase 2 + 3 — Groups + Screens, folded into 9 feature clusters (Tools, Prompts, Resources, Logs, Tasks, History, Sampling/Elicitation, Roots/Schema/Experimental, Server/Settings/View-shell). Group cluster + corresponding screen are refactored in the same PR to keep npm run build green at every commit and avoid adapter shims.
  • Phase 4 — Views (ConnectedView, UnconnectedView).
  • Phase 5 — Cleanup sweep: grep for JsonSchema, LogLevel, TaskStatus, RootEntry, PromptItem, ResourceItem, etc., and confirm zero matches.

In-place fixes flagged for execution

  • ServerCard auto-connect useEffect — violates the dumb-component principle. Fixed in the same commit as the server cluster refactor, not deferred.
  • UnconnectedView's HomeLayoutProps — renamed to UnconnectedViewProps for consistency with the component name.

Out of scope

  • Building the v2 core/ hook layer (useInspectorClient, useManaged*, useMessageLog, etc.). v1.5 has the full surface (core/react/* + core/mcp/state/managed*State.ts); porting it wholesale to v2 is a separate effort that consumes the contracts produced here as input.
  • Wiring App.tsx to the v2 core hook layer (currently a 42-line theme-toggle shell).
  • CLI / TUI clients (don't exist yet in v2).
  • Vitest unit tests for refactored components (90% per AGENTS.md) — separate pass after the dust settles.

Test plan

  • Phase 0 lands: npm run format && npm run lint && npm run build clean in clients/web, with core/mcp/types.ts populated and @modelcontextprotocol/sdk@^1.29.0 resolving.
  • Each phase / cluster PR runs format/lint/build clean before merge.
  • Storybook visually unchanged for refactored components, except for newly-rendered fields explicitly called out in the interfaces doc (e.g. ResourceListItem annotations).
  • Final sweep: zero matches for the dead local types listed in Phase 0.3.

🤖 Generated with Claude Code

cliffhall and others added 2 commits April 11, 2026 11:24
Adds specification/v2_ux_interfaces_plan.md, the implementation plan
for the component interface refactor scoped in v2_ux_interfaces.md.

Uses the v1.5/main branch of this repo as the source of truth for
Inspector-owned wrapper types (MCPServerConfig, ConnectionStatus,
MessageEntry, FetchRequestEntry, StderrLogEntry, ServerState, the
*Invocation cache types) and pins @modelcontextprotocol/sdk at the
latest 1.x line (^1.29.0). Includes a name-mapping table that
translates the Inspector* placeholders in v2_ux_interfaces.md to
v1.5's actual type names.

Plan organizes the work into phases: foundations (SDK + wrapper
types), elements, group+screen feature clusters (folded together to
keep the build green at every commit), views, and a cleanup sweep.
Calls out the discovered ServerCard auto-connect useEffect violation
to fix in-place during the server cluster, and flags that Task is
already exported by the SDK 1.x so the InspectorTask wrapper framing
in v2_ux_interfaces.md is stale and needs a follow-up correction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The interfaces doc was produced by parallel research subagents that
were instructed to prefix uncertain hook names with (likely) rather
than fail to fill in a section. The result is 52 instances of "likely"
in v2_ux_interfaces.md, almost all attached to hook names that were
never cross-checked against v1.5/main. Several are actively wrong:

- useTools / usePrompts / useResources do not exist in v1.5; the
  actual hooks are useManagedTools / useManagedPrompts /
  useManagedResources.
- useTasks does not exist; v1.5 has useManagedRequestorTasks (and
  Task itself is a raw SDK 1.x type, not an Inspector wrapper).
- useMcpClient does not exist; v1.5 has useInspectorClient.
- useLogs conflates three v1.5 hooks: useMessageLog, useStderrLog,
  useFetchRequestLog.
- useHistory does not exist; v1.5 uses useMessageLog as the history.
- useElicitation / useSampling / useRoots do not exist as discrete
  React hooks in v1.5; those flows are handled inside InspectorClient
  via SDK request handlers.
- useServerCapabilities is not a separate hook; capabilities live on
  useInspectorClient's result.
- Appendix A's "v1.5 bundles primitive logic in App.tsx" claim is
  wrong about v1.5 in this repo; that's true of upstream
  modelcontextprotocol/inspector v1.x mainline, not v1.5/main here,
  which has the full core/react/* split.

Adds Phase 0.3 to walk every (likely) instance and either resolve it
against v1.5 source or strike it, with a confirmed rename table and
explicit definition-of-done (zero "likely" matches in
v2_ux_interfaces.md after the pass). Adds Risk #11 capturing the
underlying rule: hedging words next to type/hook/file claims must be
vetted before a planning doc ships.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant