Phase 2: Refactor Server/Settings/ViewShell cluster to MCP SDK types#1221
Phase 2: Refactor Server/Settings/ViewShell cluster to MCP SDK types#1221
Conversation
ServerCard: Replace flat scalar props (name, version, transport, status, error) with grouped objects (config: MCPServerConfig, info?: Implementation, connection: ConnectionState). Remove auto-connect useEffect — dumb components must not self-dispatch side effects. Derive transport and command/url from config. ServerInfoContent: Replace flat props with initializeResult: InitializeResult and clientCapabilities: ClientCapabilities from MCP SDK. Derive capability lists by iterating the ServerCapabilities record. ServerSettingsForm: Collapse flat setting props (connectionMode, headers, metadata, timeouts, oauth*) into settings: InspectorServerSettings. Add InspectorServerSettings type to core/mcp/types.ts. ImportServerJsonPanel: Replace scattered scalar props (jsonContent, selectedPackageIndex, serverName) with draft: InspectorServerJsonDraft. ViewHeader: Replace serverName: string with serverInfo: Implementation. Use ConnectionStatus from core types. ConnectedView: Update to pass serverInfo: Implementation instead of serverName. Use ConnectionStatus type. Update all stories for ServerCard, ServerInfoContent, ServerSettingsForm, ImportServerJsonPanel, ViewHeader, ServerListScreen, ConnectedView, and UnconnectedView. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 3m 14s —— View job Code Review: Phase 2 — Server/Settings/ViewShell RefactorTasks
Overall this is a clean refactor: props are properly grouped into structured objects, the Issues1.
|
- Fix getCapabilityEntries to iterate fixed key sets so unsupported capabilities render red X (was only showing present/supported ones) - Merge duplicate @mantine/core import in ViewHeader - Move ConnectionState from ServerCard to core/mcp/types.ts - Narrow onConnectionModeChange to "proxy" | "direct" instead of string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Addressed the review feedback in cc9be5e: 1. 2. 3. Duplicate 4. 5. 6. |
Move expandedSections/onExpandedSectionsChange from props to internal useState. The accordion open/close is local display logic, not parent state. Add optional defaultExpandedSections prop for initial state. Simplify UnconnectedView WithSettingsModal story — no longer needs external state management for accordion sections. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert ServerSettingsForm to a controlled component with expandedSections/onExpandedSectionsChange props. The form is a dumb component — accordion state belongs to its container. Create ServerSettingsModal group that manages: - Accordion expand/collapse state with ListToggle expand-all button - Add/remove/edit header pairs - Add/remove/edit metadata pairs - Connection mode, timeout, and OAuth changes - All changes flow through a single onSettingsChange callback Update ServerSettingsForm stories with useState render functions so accordion sections are interactive. Update UnconnectedView WithSettingsModal story to use the new ServerSettingsModal component. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wrap modal stories in AppShell to provide a page background behind the modal overlay. Add fullscreen layout parameter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace fn() stubs with useState handlers so add/remove/edit for headers, metadata, connection mode, timeouts, and OAuth all work interactively in Storybook. The InteractiveForm wrapper manages settings state the same way ServerSettingsModal does. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each handler now both updates local state (so the UI reacts) and calls a Storybook fn() spy (so the Actions panel logs every callback with its arguments). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Storybook config has no addon-actions/addon-essentials, so fn() calls never produce visible output. The stories are fully interactive via useState — add/remove/edit headers, metadata, timeouts, OAuth, and connection mode all work visually in the UI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Storybook's useArgs hook from storybook/preview-api to update args from within the render function. This wires fn() callbacks to the Actions panel AND updates the UI state through Storybook's args system. All form interactions (add/remove/edit headers/metadata, accordion open/close, connection mode, timeouts, OAuth) now both update the UI and log to the Actions panel. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace onOAuthChange(field, value) with onOAuthChange(oauth) where
oauth is { clientId, clientSecret, scopes }. Each keystroke now
reports the full OAuth state, not just the single field that changed.
This lets the consumer see the complete picture on every change.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use args + useArgs pattern so onSettingsChange and onClose fire through Storybook's args system. Every form interaction now logs to the Actions panel with the full updated settings object. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of all changes on this PRInitial refactor (771a67e)ServerCard: Replaced flat scalar props ( ServerInfoContent: Replaced flat props with ServerSettingsForm: Collapsed flat setting props ( ImportServerJsonPanel: Replaced scattered scalar props ( ViewHeader: Replaced ConnectedView: Updated to pass ServerAddMenu, ServerListControls: No changes needed (spec says "Unchanged"). All stories updated across ServerCard, ServerInfoContent, ServerSettingsForm, ImportServerJsonPanel, ViewHeader, ServerListScreen, ConnectedView, and UnconnectedView. Code review feedback (cc9be5e)
ServerSettingsModal creation (a6fc900)Created a new
Reverted Storybook action logging fix (e04befa, 29ce552)Fixed OAuth callback improvement (d27018b)Changed Minor fixes
|
|
@claude review |
|
Claude finished @cliffhall's task in 1m 33s —— View job Code Review: Phase 2 — Server/Settings/ViewShell RefactorTasks
This is a well-structured follow-on to the first round — the previous feedback was addressed cleanly, and the new Issues1. Inline style on
|
Summary
config: MCPServerConfig,info?: Implementation,connection: ConnectionState). Remove auto-connectuseEffect(dumb component violation). Derive transport and command/url from config.initializeResult: InitializeResultandclientCapabilities: ClientCapabilities. Derive capability lists by iteratingServerCapabilitiesrecord.settings: InspectorServerSettings. AddInspectorServerSettingstype tocore/mcp/types.ts.draft: InspectorServerJsonDraft.serverName: stringwithserverInfo: Implementation. UseConnectionStatusfrom core types.serverInfoinstead ofserverName. UseConnectionStatustype.Local types deleted/replaced
ServerCardProps.name/version/transport/status/error(flat)config: MCPServerConfig+info?: Implementation+connection: ConnectionStateServerInfoContentProps.name/version/protocolVersion/serverCapabilities[]initializeResult: InitializeResult(SDK)ServerInfoContentProps.clientCapabilities: CapabilityItemProps[]clientCapabilities: ClientCapabilities(SDK)ServerSettingsFormPropsflat setting propssettings: InspectorServerSettings(new core type)ImportServerJsonPanelPropsflat draft propsdraft: InspectorServerJsonDraft(existing core type)ViewHeaderProps.serverName: stringserverInfo: Implementation(SDK)ServerCardauto-connectuseEffectNew core type
InspectorServerSettingsadded tocore/mcp/types.tsTest plan
npm run buildpasses (typecheck + Vite build)npm run lintpasses🤖 Generated with Claude Code