Phase 1: Refactor all 16 element component interfaces to use MCP SDK types

Replace ad-hoc local type definitions in element components with real
MCP SDK types and Inspector wrapper types from core/mcp/types.ts:

Schema-typed primitives:
- LogLevelBadge: LogLevel → LoggingLevel (SDK)
- TransportBadge: "stdio"|"http" → ServerType (core), add sse/streamable-http
- TaskStatusBadge: local TaskStatus → SDK TaskStatus (working/input_required/...)
- ServerStatusIndicator: inline union → ConnectionStatus (core), "failed"→"error"

MCP wrapper consumers:
- AnnotationBadge: label+variant → facet+value with SDK Role type
- CapabilityItem: name:string → capability:keyof ServerCapabilities|ClientCapabilities
- LogEntry: flat props → entry:{receivedAt:Date, params:LoggingMessageNotification["params"]}
- MessageBubble: flat props → message:SamplingMessage|PromptMessage
- ProgressDisplay: flat props → params:ProgressNotification["params"]

Composite-input elements:
- ContentViewer: type+content+mimeType → block:ContentBlock (SDK discriminated union)
- InlineError: message+details → error:{message,data?}
- ConnectionToggle: checked+loading+onChange → status:ConnectionStatus+onConnect/onDisconnect

Also updates all group/screen/view consumers to keep the build green,
and renames CSS variable --inspector-status-failed → --inspector-status-error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-04-16 22:25:23 -04:00
commit 2d4fca4fa6
2 changed files with 905 additions and 648 deletions

View file

@ -66,7 +66,7 @@ export const Failed: Story = {
transport: "stdio",
connectionMode: "Subprocess",
command: "npx -y @modelcontextprotocol/server-everything",
status: "failed",
status: "error",
retryCount: 3,
error: {
message: "Connection refused",
@ -106,7 +106,7 @@ export const HttpDirect: Story = {
args: {
name: "Remote API Server",
version: "2.0.0",
transport: "http",
transport: "streamable-http",
connectionMode: "Direct",
command: "https://api.example.com/mcp",
status: "connected",

View file

@ -9,10 +9,10 @@ import { InlineError } from "../../elements/InlineError/InlineError";
export interface ServerCardProps {
name: string;
version?: string;
transport: "stdio" | "http";
transport: "stdio" | "sse" | "streamable-http";
connectionMode: string;
command: string;
status: "connected" | "connecting" | "disconnected" | "failed";
status: "connected" | "connecting" | "disconnected" | "error";
retryCount?: number;
error?: { message: string; details?: string };
canTestClientFeatures: boolean;
@ -90,8 +90,6 @@ export function ServerCard({
}: ServerCardProps) {
const isThisConnecting = activeServer === name;
const isDimmed = activeServer !== undefined && activeServer !== name;
const isConnected = status === "connected";
const isConnecting = status === "connecting" || isThisConnecting;
const displayStatus = isThisConnecting ? "connecting" : status;
useEffect(() => {
@ -128,10 +126,10 @@ export function ServerCard({
retryCount={retryCount}
/>
<ConnectionToggle
checked={isConnected}
loading={isConnecting}
status={displayStatus}
disabled={isDimmed}
onChange={handleToggle}
onConnect={() => handleToggle(true)}
onDisconnect={() => handleToggle(false)}
/>
</HeaderRight>
</Group>
@ -166,12 +164,14 @@ export function ServerCard({
)}
</Group>
<ContentViewer type="text" content={command} copyable />
<ContentViewer block={{ type: "text", text: command }} copyable />
{error && (
<InlineError
message={error.message}
details={error.details}
error={{
message: error.message,
data: error.details,
}}
retryCount={retryCount}
/>
)}