Phase 0 foundations for component interfaces refactor
Stands up the type-only prerequisites for the v2 UX component
interfaces refactor per specification/v2_ux_interfaces_plan.md.
Phase 0.1 — MCP SDK dependency:
- Add @modelcontextprotocol/sdk ^1.29.0 and zod ^4.3.6 to both the
root package.json and clients/web/package.json so component files
can import Tool / Prompt / Resource / Task / LoggingLevel / etc.
directly from the SDK.
Phase 0.2 — Inspector wrapper-types module:
- Create core/mcp/types.ts mirroring the type-only subset of v1.5's
core/mcp/types.ts: MCPServerConfig (discriminated union), ServerType,
MCPConfig, ConnectionStatus, StderrLogEntry, MessageEntry (Date
timestamps, not ISO strings), FetchRequestEntry(+Base), ServerState,
and the *Invocation types. Adds v2-only wrappers
InspectorResourceSubscription and InspectorServerJsonDraft.
- Add core/mcp/taskNotificationSchemas.ts for the Inspector-owned
notifications/tasks/list_changed signal (not in the SDK).
- Add core/mcp/elicitationCreateMessage.ts re-exporting ElicitRequest
and ElicitResult plus an InspectorPendingElicitation interface for
typing the pending-queue.
- Add core/json/jsonUtils.ts for the shared JsonValue / JsonObject
types used inside core/mcp/types.ts.
- Copy v1.5's clients/web/src/utils/jsonUtils.ts (JsonSchemaType) and
schemaUtils.ts (AJV-backed validators) verbatim so SchemaForm can
switch off its local JsonSchema type.
- Copy v1.5's clients/web/src/lib/types/customHeaders.ts verbatim for
ServerSettingsForm and the experimental panel.
- Add clients/web/src/types/navigation.ts with InspectorTab (UI-routing
concept, lives with the web client rather than in core/).
- Wire tsconfig.app.json + vite.config.ts with the @inspector/core/*
path alias so component files can import from core/ without
relative-path hell.
Phase 0.3 — Vet (likely) hedges in v2_ux_interfaces.md:
- Follow-up sweep on commit 2ef257da. Replaces the remaining
useMcpClient references with useInspectorClient, ties pending
elicitation / sampling callbacks to the in-InspectorClient queue
rather than a non-existent useElicitation / useSampling hook,
corrects Task references to the SDK type (not an InspectorTask
wrapper), corrects log hook wiring to useMessageLog, and strikes
all remaining v2-only hooks with explicit "no v1.5 analog"
annotations. grep "likely" specification/v2_ux_interfaces.md now
returns zero results.
Phase 0.4 — Local-redeclaration inventory:
- specification/v2_ux_interfaces_phase_0_4_inventory.md enumerates
every ad hoc local type (JsonSchema, LogLevel, TaskStatus,
PromptItem, ResourceItem, ToolListItemProps, RootEntry, KeyValuePair,
inline ConnectionStatus / transport unions) that will be replaced
in Phases 1–4, including the file it lives in, every site that
re-imports it, and the SDK / wrapper type that replaces it. Intended
for the Phase 0 PR description and as a running checklist during
the refactor.
Build state: npm run build / lint / format:check all pass in
clients/web.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6abbe4eb1f
commit
8edff4ea77
16 changed files with 3192 additions and 82 deletions
1023
clients/web/package-lock.json
generated
1023
clients/web/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -19,9 +19,11 @@
|
|||
"@mantine/form": "^8.3.17",
|
||||
"@mantine/hooks": "^8.3.17",
|
||||
"@mantine/notifications": "^8.3.17",
|
||||
"@modelcontextprotocol/sdk": "^1.29.0",
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-icons": "^5.6.0"
|
||||
"react-icons": "^5.6.0",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@chromatic-com/storybook": "^5.0.1",
|
||||
|
|
|
|||
64
clients/web/src/lib/types/customHeaders.ts
Normal file
64
clients/web/src/lib/types/customHeaders.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
export interface CustomHeader {
|
||||
name: string;
|
||||
value: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export type CustomHeaders = CustomHeader[];
|
||||
|
||||
export const createEmptyHeader = (): CustomHeader => ({
|
||||
name: "",
|
||||
value: "",
|
||||
enabled: true,
|
||||
});
|
||||
|
||||
export const createHeaderFromBearerToken = (
|
||||
bearerToken: string,
|
||||
headerName?: string,
|
||||
): CustomHeader => ({
|
||||
name: headerName || "Authorization",
|
||||
value:
|
||||
headerName?.toLowerCase() === "authorization" || !headerName
|
||||
? `Bearer ${bearerToken}`
|
||||
: bearerToken,
|
||||
enabled: true,
|
||||
});
|
||||
|
||||
export const getEnabledHeaders = (headers: CustomHeaders): CustomHeaders => {
|
||||
return headers.filter(
|
||||
(header) => header.enabled && header.name.trim() && header.value.trim(),
|
||||
);
|
||||
};
|
||||
|
||||
export const headersToRecord = (
|
||||
headers: CustomHeaders,
|
||||
): Record<string, string> => {
|
||||
const enabledHeaders = getEnabledHeaders(headers);
|
||||
const record: Record<string, string> = {};
|
||||
|
||||
enabledHeaders.forEach((header) => {
|
||||
record[header.name.trim()] = header.value.trim();
|
||||
});
|
||||
|
||||
return record;
|
||||
};
|
||||
|
||||
export const recordToHeaders = (
|
||||
record: Record<string, string>,
|
||||
): CustomHeaders => {
|
||||
return Object.entries(record).map(([name, value]) => ({
|
||||
name,
|
||||
value,
|
||||
enabled: true,
|
||||
}));
|
||||
};
|
||||
|
||||
// Migration helper for backward compatibility
|
||||
export const migrateFromLegacyAuth = (
|
||||
bearerToken?: string,
|
||||
headerName?: string,
|
||||
): CustomHeaders => {
|
||||
return bearerToken
|
||||
? [createHeaderFromBearerToken(bearerToken, headerName)]
|
||||
: [];
|
||||
};
|
||||
7
clients/web/src/types/navigation.ts
Normal file
7
clients/web/src/types/navigation.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export type InspectorTab =
|
||||
| "tools"
|
||||
| "prompts"
|
||||
| "resources"
|
||||
| "logs"
|
||||
| "tasks"
|
||||
| "history";
|
||||
252
clients/web/src/utils/jsonUtils.ts
Normal file
252
clients/web/src/utils/jsonUtils.ts
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
export type JsonValue =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| undefined
|
||||
| JsonValue[]
|
||||
| { [key: string]: JsonValue };
|
||||
|
||||
export type JsonSchemaConst = {
|
||||
const: JsonValue;
|
||||
title?: string;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export type JsonSchemaType = {
|
||||
type?:
|
||||
| "string"
|
||||
| "number"
|
||||
| "integer"
|
||||
| "boolean"
|
||||
| "array"
|
||||
| "object"
|
||||
| "null"
|
||||
| (
|
||||
| "string"
|
||||
| "number"
|
||||
| "integer"
|
||||
| "boolean"
|
||||
| "array"
|
||||
| "object"
|
||||
| "null"
|
||||
)[];
|
||||
title?: string;
|
||||
description?: string;
|
||||
required?: string[];
|
||||
default?: JsonValue;
|
||||
properties?: Record<string, JsonSchemaType>;
|
||||
items?: JsonSchemaType;
|
||||
// Array validation constraints
|
||||
minItems?: number;
|
||||
maxItems?: number;
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
minLength?: number;
|
||||
maxLength?: number;
|
||||
nullable?: boolean;
|
||||
pattern?: string;
|
||||
format?: string;
|
||||
enum?: string[];
|
||||
// Non-standard legacy support: titles for enum values
|
||||
enumNames?: string[];
|
||||
const?: JsonValue;
|
||||
oneOf?: (JsonSchemaType | JsonSchemaConst)[];
|
||||
anyOf?: (JsonSchemaType | JsonSchemaConst)[];
|
||||
$ref?: string;
|
||||
};
|
||||
|
||||
export type JsonObject = { [key: string]: JsonValue };
|
||||
|
||||
export type DataType =
|
||||
| "string"
|
||||
| "number"
|
||||
| "bigint"
|
||||
| "boolean"
|
||||
| "symbol"
|
||||
| "undefined"
|
||||
| "object"
|
||||
| "function"
|
||||
| "array"
|
||||
| "null";
|
||||
|
||||
/**
|
||||
* Determines the specific data type of a JSON value
|
||||
* @param value The JSON value to analyze
|
||||
* @returns The specific data type including "array" and "null" as distinct types
|
||||
*/
|
||||
export function getDataType(value: JsonValue): DataType {
|
||||
if (Array.isArray(value)) return "array";
|
||||
if (value === null) return "null";
|
||||
return typeof value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to parse a string as JSON, only for objects and arrays
|
||||
* @param str The string to parse
|
||||
* @returns Object with success boolean and either parsed data or original string
|
||||
*/
|
||||
export function tryParseJson(str: string): {
|
||||
success: boolean;
|
||||
data: JsonValue;
|
||||
} {
|
||||
const trimmed = str?.trim();
|
||||
if (
|
||||
trimmed &&
|
||||
!(trimmed.startsWith("{") && trimmed.endsWith("}")) &&
|
||||
!(trimmed.startsWith("[") && trimmed.endsWith("]"))
|
||||
) {
|
||||
return { success: false, data: str };
|
||||
}
|
||||
try {
|
||||
return { success: true, data: JSON.parse(str) };
|
||||
} catch {
|
||||
return { success: false, data: str };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a value at a specific path in a nested JSON structure
|
||||
* @param obj The original JSON value
|
||||
* @param path Array of keys/indices representing the path to the value
|
||||
* @param value The new value to set
|
||||
* @returns A new JSON value with the updated path
|
||||
*/
|
||||
export function updateValueAtPath(
|
||||
obj: JsonValue,
|
||||
path: string[],
|
||||
value: JsonValue,
|
||||
): JsonValue {
|
||||
if (path.length === 0) return value;
|
||||
|
||||
if (obj === null || obj === undefined) {
|
||||
obj = !isNaN(Number(path[0])) ? [] : {};
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return updateArray(obj, path, value);
|
||||
} else if (typeof obj === "object" && obj !== null) {
|
||||
return updateObject(obj as JsonObject, path, value);
|
||||
} else {
|
||||
console.error(
|
||||
`Cannot update path ${path.join(".")} in non-object/array value:`,
|
||||
obj,
|
||||
);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an array at a specific path
|
||||
*/
|
||||
function updateArray(
|
||||
array: JsonValue[],
|
||||
path: string[],
|
||||
value: JsonValue,
|
||||
): JsonValue[] {
|
||||
const [index, ...restPath] = path;
|
||||
const arrayIndex = Number(index);
|
||||
|
||||
if (isNaN(arrayIndex)) {
|
||||
console.error(`Invalid array index: ${index}`);
|
||||
return array;
|
||||
}
|
||||
|
||||
if (arrayIndex < 0) {
|
||||
console.error(`Array index out of bounds: ${arrayIndex} < 0`);
|
||||
return array;
|
||||
}
|
||||
|
||||
let newArray: JsonValue[] = [];
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
newArray[i] = i in array ? array[i] : null;
|
||||
}
|
||||
|
||||
if (arrayIndex >= newArray.length) {
|
||||
const extendedArray: JsonValue[] = new Array(arrayIndex).fill(null);
|
||||
// Copy over the existing elements (now guaranteed to be dense)
|
||||
for (let i = 0; i < newArray.length; i++) {
|
||||
extendedArray[i] = newArray[i];
|
||||
}
|
||||
newArray = extendedArray;
|
||||
}
|
||||
|
||||
if (restPath.length === 0) {
|
||||
newArray[arrayIndex] = value;
|
||||
} else {
|
||||
newArray[arrayIndex] = updateValueAtPath(
|
||||
newArray[arrayIndex],
|
||||
restPath,
|
||||
value,
|
||||
);
|
||||
}
|
||||
return newArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an object at a specific path
|
||||
*/
|
||||
function updateObject(
|
||||
obj: JsonObject,
|
||||
path: string[],
|
||||
value: JsonValue,
|
||||
): JsonObject {
|
||||
const [key, ...restPath] = path;
|
||||
|
||||
// Validate object key
|
||||
if (typeof key !== "string") {
|
||||
console.error(`Invalid object key: ${key}`);
|
||||
return obj;
|
||||
}
|
||||
|
||||
const newObj = { ...obj };
|
||||
|
||||
if (restPath.length === 0) {
|
||||
newObj[key] = value;
|
||||
} else {
|
||||
// Ensure key exists
|
||||
if (!(key in newObj)) {
|
||||
newObj[key] = {};
|
||||
}
|
||||
newObj[key] = updateValueAtPath(newObj[key], restPath, value);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value at a specific path in a nested JSON structure
|
||||
* @param obj The JSON value to traverse
|
||||
* @param path Array of keys/indices representing the path to the value
|
||||
* @param defaultValue Value to return if path doesn't exist
|
||||
* @returns The value at the path, or defaultValue if not found
|
||||
*/
|
||||
export function getValueAtPath(
|
||||
obj: JsonValue,
|
||||
path: string[],
|
||||
defaultValue: JsonValue = null,
|
||||
): JsonValue {
|
||||
if (path.length === 0) return obj;
|
||||
|
||||
const [first, ...rest] = path;
|
||||
|
||||
if (obj === null || obj === undefined) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
const index = Number(first);
|
||||
if (isNaN(index) || index < 0 || index >= obj.length) {
|
||||
return defaultValue;
|
||||
}
|
||||
return getValueAtPath(obj[index], rest, defaultValue);
|
||||
}
|
||||
|
||||
if (typeof obj === "object" && obj !== null) {
|
||||
if (!(first in obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return getValueAtPath((obj as JsonObject)[first], rest, defaultValue);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
349
clients/web/src/utils/schemaUtils.ts
Normal file
349
clients/web/src/utils/schemaUtils.ts
Normal file
|
|
@ -0,0 +1,349 @@
|
|||
import type { JsonValue, JsonSchemaType, JsonObject } from "./jsonUtils";
|
||||
import Ajv from "ajv";
|
||||
import type { ValidateFunction } from "ajv";
|
||||
import type { Tool, JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { isJSONRPCRequest } from "@modelcontextprotocol/sdk/types.js";
|
||||
|
||||
const ajv = new Ajv();
|
||||
|
||||
// Cache for compiled validators
|
||||
const toolOutputValidators = new Map<string, ValidateFunction>();
|
||||
|
||||
/**
|
||||
* Compiles and caches output schema validators for a list of tools
|
||||
* Following the same pattern as SDK's Client.cacheToolOutputSchemas
|
||||
* @param tools Array of tools that may have output schemas
|
||||
*/
|
||||
export function cacheToolOutputSchemas(tools: Tool[]): void {
|
||||
toolOutputValidators.clear();
|
||||
for (const tool of tools) {
|
||||
if (tool.outputSchema) {
|
||||
try {
|
||||
const validator = ajv.compile(tool.outputSchema);
|
||||
toolOutputValidators.set(tool.name, validator);
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`Failed to compile output schema for tool ${tool.name}:`,
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cached output schema validator for a tool
|
||||
* Following the same pattern as SDK's Client.getToolOutputValidator
|
||||
* @param toolName Name of the tool
|
||||
* @returns The compiled validator function, or undefined if not found
|
||||
*/
|
||||
export function getToolOutputValidator(
|
||||
toolName: string,
|
||||
): ValidateFunction | undefined {
|
||||
return toolOutputValidators.get(toolName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates structured content against a tool's output schema
|
||||
* Returns validation result with detailed error messages
|
||||
* @param toolName Name of the tool
|
||||
* @param structuredContent The structured content to validate
|
||||
* @returns An object with isValid boolean and optional error message
|
||||
*/
|
||||
export function validateToolOutput(
|
||||
toolName: string,
|
||||
structuredContent: unknown,
|
||||
): { isValid: boolean; error?: string } {
|
||||
const validator = getToolOutputValidator(toolName);
|
||||
if (!validator) {
|
||||
return { isValid: true }; // No validator means no schema to validate against
|
||||
}
|
||||
|
||||
const isValid = validator(structuredContent);
|
||||
if (!isValid) {
|
||||
return {
|
||||
isValid: false,
|
||||
error: ajv.errorsText(validator.errors),
|
||||
};
|
||||
}
|
||||
|
||||
return { isValid: true };
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a tool has an output schema
|
||||
* @param toolName Name of the tool
|
||||
* @returns true if the tool has an output schema
|
||||
*/
|
||||
export function hasOutputSchema(toolName: string): boolean {
|
||||
return toolOutputValidators.has(toolName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a default value based on a JSON schema type
|
||||
* @param schema The JSON schema definition
|
||||
* @param propertyName Optional property name for checking if it's required in parent schema
|
||||
* @param parentSchema Optional parent schema to check required array
|
||||
* @returns A default value matching the schema type
|
||||
*/
|
||||
export function generateDefaultValue(
|
||||
schema: JsonSchemaType,
|
||||
propertyName?: string,
|
||||
parentSchema?: JsonSchemaType,
|
||||
): JsonValue {
|
||||
if ("default" in schema && schema.default !== undefined) {
|
||||
return schema.default;
|
||||
}
|
||||
|
||||
// Check if this property is required in the parent schema
|
||||
const isRequired =
|
||||
propertyName && parentSchema
|
||||
? isPropertyRequired(propertyName, parentSchema)
|
||||
: false;
|
||||
const isRootSchema = propertyName === undefined && parentSchema === undefined;
|
||||
|
||||
switch (schema.type) {
|
||||
case "string":
|
||||
return isRequired ? "" : undefined;
|
||||
case "number":
|
||||
case "integer":
|
||||
return isRequired ? 0 : undefined;
|
||||
case "boolean":
|
||||
return isRequired ? false : undefined;
|
||||
case "array":
|
||||
return isRequired ? [] : undefined;
|
||||
case "object": {
|
||||
if (!schema.properties) {
|
||||
return isRequired || isRootSchema ? {} : undefined;
|
||||
}
|
||||
|
||||
const obj: JsonObject = {};
|
||||
// Include required properties OR optional properties that declare a default
|
||||
Object.entries(schema.properties).forEach(([key, prop]) => {
|
||||
const hasExplicitDefault =
|
||||
"default" in prop && (prop as JsonSchemaType).default !== undefined;
|
||||
if (isPropertyRequired(key, schema) || hasExplicitDefault) {
|
||||
const value = generateDefaultValue(prop, key, schema);
|
||||
if (value !== undefined) {
|
||||
obj[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Object.keys(obj).length === 0) {
|
||||
return isRequired || isRootSchema ? {} : undefined;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
case "null":
|
||||
return null;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to check if a property is required in a schema
|
||||
* @param propertyName The name of the property to check
|
||||
* @param schema The parent schema containing the required array
|
||||
* @returns true if the property is required, false otherwise
|
||||
*/
|
||||
export function isPropertyRequired(
|
||||
propertyName: string,
|
||||
schema: JsonSchemaType,
|
||||
): boolean {
|
||||
return schema.required?.includes(propertyName) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves $ref references in JSON schema
|
||||
* @param schema The schema that may contain $ref
|
||||
* @param rootSchema The root schema to resolve references against
|
||||
* @returns The resolved schema without $ref
|
||||
*/
|
||||
export function resolveRef(
|
||||
schema: JsonSchemaType,
|
||||
rootSchema: JsonSchemaType,
|
||||
): JsonSchemaType {
|
||||
if (!("$ref" in schema) || !schema.$ref) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
const ref = schema.$ref;
|
||||
|
||||
// Handle simple #/properties/name references
|
||||
if (ref.startsWith("#/")) {
|
||||
const path = ref.substring(2).split("/");
|
||||
let current: unknown = rootSchema;
|
||||
|
||||
for (const segment of path) {
|
||||
if (
|
||||
current &&
|
||||
typeof current === "object" &&
|
||||
current !== null &&
|
||||
segment in current
|
||||
) {
|
||||
current = (current as Record<string, unknown>)[segment];
|
||||
} else {
|
||||
// If reference cannot be resolved, return the original schema
|
||||
console.warn(`Could not resolve $ref: ${ref}`);
|
||||
return schema;
|
||||
}
|
||||
}
|
||||
|
||||
return current as JsonSchemaType;
|
||||
}
|
||||
|
||||
// For other types of references, return the original schema
|
||||
console.warn(`Unsupported $ref format: ${ref}`);
|
||||
return schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes union types (like string|null from FastMCP) to simple types for form rendering
|
||||
* @param schema The JSON schema to normalize
|
||||
* @returns A normalized schema or the original schema
|
||||
*/
|
||||
export function normalizeUnionType(schema: JsonSchemaType): JsonSchemaType {
|
||||
// Handle anyOf with exactly string and null (FastMCP pattern)
|
||||
if (
|
||||
schema.anyOf &&
|
||||
schema.anyOf.length === 2 &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "string") &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "null")
|
||||
) {
|
||||
return { ...schema, type: "string", anyOf: undefined, nullable: true };
|
||||
}
|
||||
|
||||
// Handle anyOf with exactly boolean and null (FastMCP pattern)
|
||||
if (
|
||||
schema.anyOf &&
|
||||
schema.anyOf.length === 2 &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "boolean") &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "null")
|
||||
) {
|
||||
return { ...schema, type: "boolean", anyOf: undefined, nullable: true };
|
||||
}
|
||||
|
||||
// Handle anyOf with exactly number and null (FastMCP pattern)
|
||||
if (
|
||||
schema.anyOf &&
|
||||
schema.anyOf.length === 2 &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "number") &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "null")
|
||||
) {
|
||||
return { ...schema, type: "number", anyOf: undefined, nullable: true };
|
||||
}
|
||||
|
||||
// Handle anyOf with exactly integer and null (FastMCP pattern)
|
||||
if (
|
||||
schema.anyOf &&
|
||||
schema.anyOf.length === 2 &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "integer") &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "null")
|
||||
) {
|
||||
return { ...schema, type: "integer", anyOf: undefined, nullable: true };
|
||||
}
|
||||
|
||||
// Handle anyOf with exactly array and null (FastMCP pattern)
|
||||
if (
|
||||
schema.anyOf &&
|
||||
schema.anyOf.length === 2 &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "array") &&
|
||||
schema.anyOf.some((t) => (t as JsonSchemaType).type === "null")
|
||||
) {
|
||||
return { ...schema, type: "array", anyOf: undefined, nullable: true };
|
||||
}
|
||||
|
||||
// Handle array type with exactly string and null
|
||||
if (
|
||||
Array.isArray(schema.type) &&
|
||||
schema.type.length === 2 &&
|
||||
schema.type.includes("string") &&
|
||||
schema.type.includes("null")
|
||||
) {
|
||||
return { ...schema, type: "string", nullable: true };
|
||||
}
|
||||
|
||||
// Handle array type with exactly boolean and null
|
||||
if (
|
||||
Array.isArray(schema.type) &&
|
||||
schema.type.length === 2 &&
|
||||
schema.type.includes("boolean") &&
|
||||
schema.type.includes("null")
|
||||
) {
|
||||
return { ...schema, type: "boolean", nullable: true };
|
||||
}
|
||||
|
||||
// Handle array type with exactly number and null
|
||||
if (
|
||||
Array.isArray(schema.type) &&
|
||||
schema.type.length === 2 &&
|
||||
schema.type.includes("number") &&
|
||||
schema.type.includes("null")
|
||||
) {
|
||||
return { ...schema, type: "number", nullable: true };
|
||||
}
|
||||
|
||||
// Handle array type with exactly integer and null
|
||||
if (
|
||||
Array.isArray(schema.type) &&
|
||||
schema.type.length === 2 &&
|
||||
schema.type.includes("integer") &&
|
||||
schema.type.includes("null")
|
||||
) {
|
||||
return { ...schema, type: "integer", nullable: true };
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a field key into a human-readable label
|
||||
* @param key The field key to format
|
||||
* @returns A formatted label string
|
||||
*/
|
||||
export function formatFieldLabel(key: string): string {
|
||||
return key
|
||||
.replace(/([A-Z])/g, " $1") // Insert space before capital letters
|
||||
.replace(/_/g, " ") // Replace underscores with spaces
|
||||
.replace(/^\w/, (c) => c.toUpperCase()); // Capitalize first letter
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves `$ref` references in a JSON-RPC "elicitation/create" message's `requestedSchema` field
|
||||
* @param message The JSON-RPC message that may contain $ref references
|
||||
* @returns A new message with resolved $ref references, or the original message if no resolution is needed
|
||||
*/
|
||||
export function resolveRefsInMessage(message: JSONRPCMessage): JSONRPCMessage {
|
||||
if (!isJSONRPCRequest(message) || !message.params?.requestedSchema) {
|
||||
return message;
|
||||
}
|
||||
|
||||
const requestedSchema = message.params.requestedSchema as JsonSchemaType;
|
||||
|
||||
if (!requestedSchema?.properties) {
|
||||
return message;
|
||||
}
|
||||
|
||||
const resolvedMessage = {
|
||||
...message,
|
||||
params: {
|
||||
...message.params,
|
||||
requestedSchema: {
|
||||
...requestedSchema,
|
||||
properties: Object.fromEntries(
|
||||
Object.entries(requestedSchema.properties).map(
|
||||
([key, propSchema]) => {
|
||||
const resolved = resolveRef(propSchema, requestedSchema);
|
||||
const normalized = normalizeUnionType(resolved);
|
||||
return [key, normalized];
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return resolvedMessage;
|
||||
}
|
||||
|
|
@ -22,8 +22,14 @@
|
|||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
"noUncheckedSideEffectImports": true,
|
||||
|
||||
/* Path aliases */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@inspector/core/*": ["../../core/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src"],
|
||||
"include": ["src", "../../core/**/*.ts"],
|
||||
"exclude": ["src/**/*.stories.tsx", "src/**/*.stories.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(file
|
|||
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@inspector/core': path.resolve(dirname, '../../core'),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
projects: [{
|
||||
extends: true,
|
||||
|
|
|
|||
13
core/json/jsonUtils.ts
Normal file
13
core/json/jsonUtils.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* JSON value type used across the inspector project
|
||||
*/
|
||||
export type JsonValue =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| undefined
|
||||
| JsonValue[]
|
||||
| { [key: string]: JsonValue };
|
||||
|
||||
export type JsonObject = { [key: string]: JsonValue };
|
||||
19
core/mcp/elicitationCreateMessage.ts
Normal file
19
core/mcp/elicitationCreateMessage.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import type {
|
||||
ElicitRequest,
|
||||
ElicitResult,
|
||||
} from "@modelcontextprotocol/sdk/types.js";
|
||||
|
||||
export type { ElicitRequest, ElicitResult };
|
||||
|
||||
/**
|
||||
* Shape of a pending elicitation request tracked by the Inspector client.
|
||||
* v1.5 implements this as a class with a resolver/reject closure; v2 will
|
||||
* materialize the runtime when the core hook layer lands. For now we keep the
|
||||
* interface so screens/groups can type the pending-elicitation queue.
|
||||
*/
|
||||
export interface InspectorPendingElicitation {
|
||||
id: string;
|
||||
timestamp: Date;
|
||||
request: ElicitRequest;
|
||||
taskId?: string;
|
||||
}
|
||||
23
core/mcp/taskNotificationSchemas.ts
Normal file
23
core/mcp/taskNotificationSchemas.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Notification schema for notifications/tasks/list_changed (server → client).
|
||||
*
|
||||
* The SDK exports list_changed schemas for resources, prompts, tools, and roots, and
|
||||
* TaskStatusNotificationSchema for notifications/tasks/status, but no schema for
|
||||
* notifications/tasks/list_changed. Mainline (v1) does not register a schema for it
|
||||
* either: they use client.fallbackNotificationHandler so any unmatched notification
|
||||
* (including tasks/list_changed) is passed to onNotification, and App branches on
|
||||
* notification.method === "notifications/tasks/list_changed". We register specific
|
||||
* handlers only (no fallback), so we define this schema to handle the notification.
|
||||
*
|
||||
* List-changed notifications have no defined params (they are signals to refetch);
|
||||
* the SDK uses params: NotificationsParamsSchema.optional() for other list_changed
|
||||
* types (which is private, so we can't import it). We accept optional params only
|
||||
* so the notification parses; we do not use any params in the handler.
|
||||
*/
|
||||
import { NotificationSchema } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const TasksListChangedNotificationSchema = NotificationSchema.extend({
|
||||
method: z.literal("notifications/tasks/list_changed"),
|
||||
params: z.record(z.string(), z.unknown()).optional(),
|
||||
});
|
||||
184
core/mcp/types.ts
Normal file
184
core/mcp/types.ts
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
import type {
|
||||
CallToolResult,
|
||||
GetPromptResult,
|
||||
Implementation,
|
||||
JSONRPCErrorResponse,
|
||||
JSONRPCNotification,
|
||||
JSONRPCRequest,
|
||||
JSONRPCResultResponse,
|
||||
Prompt,
|
||||
ReadResourceResult,
|
||||
Resource,
|
||||
ServerCapabilities,
|
||||
Tool,
|
||||
} from "@modelcontextprotocol/sdk/types.js";
|
||||
import type { JsonValue } from "../json/jsonUtils.js";
|
||||
|
||||
// Stdio transport config
|
||||
export interface StdioServerConfig {
|
||||
type?: "stdio";
|
||||
command: string;
|
||||
args?: string[];
|
||||
env?: Record<string, string>;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
// SSE transport config
|
||||
export interface SseServerConfig {
|
||||
type: "sse";
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
eventSourceInit?: Record<string, unknown>;
|
||||
requestInit?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// StreamableHTTP transport config
|
||||
export interface StreamableHttpServerConfig {
|
||||
type: "streamable-http";
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
requestInit?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export type MCPServerConfig =
|
||||
| StdioServerConfig
|
||||
| SseServerConfig
|
||||
| StreamableHttpServerConfig;
|
||||
|
||||
export type ServerType = "stdio" | "sse" | "streamable-http";
|
||||
|
||||
export interface MCPConfig {
|
||||
mcpServers: Record<string, MCPServerConfig>;
|
||||
}
|
||||
|
||||
export type ConnectionStatus =
|
||||
| "disconnected"
|
||||
| "connecting"
|
||||
| "connected"
|
||||
| "error";
|
||||
|
||||
export interface StderrLogEntry {
|
||||
timestamp: Date;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface MessageEntry {
|
||||
id: string;
|
||||
timestamp: Date;
|
||||
direction: "request" | "response" | "notification";
|
||||
message:
|
||||
| JSONRPCRequest
|
||||
| JSONRPCNotification
|
||||
| JSONRPCResultResponse
|
||||
| JSONRPCErrorResponse;
|
||||
response?: JSONRPCResultResponse | JSONRPCErrorResponse;
|
||||
duration?: number; // Time between request and response in ms
|
||||
}
|
||||
|
||||
export type FetchRequestCategory = "auth" | "transport";
|
||||
|
||||
export interface FetchRequestEntry {
|
||||
id: string;
|
||||
timestamp: Date;
|
||||
method: string;
|
||||
url: string;
|
||||
requestHeaders: Record<string, string>;
|
||||
requestBody?: string;
|
||||
responseStatus?: number;
|
||||
responseStatusText?: string;
|
||||
responseHeaders?: Record<string, string>;
|
||||
responseBody?: string;
|
||||
duration?: number; // Time between request and response in ms
|
||||
error?: string;
|
||||
/** Distinguishes OAuth/auth fetches from MCP transport fetches */
|
||||
category: FetchRequestCategory;
|
||||
}
|
||||
|
||||
/** Entry shape from createFetchTracker before category is added by the caller */
|
||||
export type FetchRequestEntryBase = Omit<FetchRequestEntry, "category">;
|
||||
|
||||
export interface ServerState {
|
||||
status: ConnectionStatus;
|
||||
error: string | null;
|
||||
capabilities?: ServerCapabilities;
|
||||
serverInfo?: Implementation;
|
||||
instructions?: string;
|
||||
resources: Resource[];
|
||||
prompts: Prompt[];
|
||||
tools: Tool[];
|
||||
stderrLogs: StderrLogEntry[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a complete resource read invocation, including request parameters,
|
||||
* response, and metadata.
|
||||
*/
|
||||
export interface ResourceReadInvocation {
|
||||
result: ReadResourceResult;
|
||||
timestamp: Date;
|
||||
uri: string;
|
||||
metadata?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a complete resource template read invocation, including request parameters,
|
||||
* response, and metadata.
|
||||
*/
|
||||
export interface ResourceTemplateReadInvocation {
|
||||
uriTemplate: string;
|
||||
expandedUri: string;
|
||||
result: ReadResourceResult;
|
||||
timestamp: Date;
|
||||
params: Record<string, string>;
|
||||
metadata?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a complete prompt get invocation, including request parameters,
|
||||
* response, and metadata.
|
||||
*/
|
||||
export interface PromptGetInvocation {
|
||||
result: GetPromptResult;
|
||||
timestamp: Date;
|
||||
name: string;
|
||||
params?: Record<string, string>;
|
||||
metadata?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a complete tool call invocation, including request parameters,
|
||||
* response, and metadata.
|
||||
*/
|
||||
export interface ToolCallInvocation {
|
||||
toolName: string;
|
||||
params: Record<string, JsonValue>;
|
||||
result: CallToolResult | null;
|
||||
timestamp: Date;
|
||||
success: boolean;
|
||||
error?: string;
|
||||
metadata?: Record<string, string>;
|
||||
}
|
||||
|
||||
// v2-only wrapper types (no v1.5 equivalent)
|
||||
|
||||
/**
|
||||
* Resource subscription wrapper used by the Resources screen to track
|
||||
* subscribed resources and the time of the last update notification.
|
||||
*/
|
||||
export interface InspectorResourceSubscription {
|
||||
resource: Resource;
|
||||
lastUpdated?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draft state for importing a server from registry JSON. Owned by the
|
||||
* ImportServerJsonPanel wiring layer. `parsed` is typed `unknown` until the
|
||||
* registry schema type is added in a follow-up.
|
||||
*/
|
||||
export interface InspectorServerJsonDraft {
|
||||
rawText: string;
|
||||
parsed?: unknown;
|
||||
selectedPackageIndex?: number;
|
||||
envOverrides: Record<string, string>;
|
||||
nameOverride?: string;
|
||||
}
|
||||
1127
package-lock.json
generated
1127
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -20,5 +20,9 @@
|
|||
"main": "./build/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.29.0",
|
||||
"zod": "^4.3.6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ persistence is owned by the **Inspector core system**. The core lives in this
|
|||
repo under `core/` and is modeled after the v1.5 architecture — specifically the
|
||||
React hooks published on the
|
||||
[v1.5/main branch of modelcontextprotocol/inspector](https://github.com/modelcontextprotocol/inspector/tree/v1.5/main).
|
||||
Those hooks (`useConnection`, `useMcpClient`, `useServerCapabilities`, etc.)
|
||||
Those hooks (`useConnection`, `useInspectorClient`, `useServerCapabilities`, etc.)
|
||||
produce the exact data and callbacks that the upper-layer screen/view
|
||||
components will destructure and pass down into the component tree as props.
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ For each component, the plan records:
|
|||
- **Current props** — `name: string`; `supported: boolean`; `count?: number`.
|
||||
- **MCP schema touch points** — `ServerCapabilities` (keys `tools`, `resources`, `prompts`, `logging`, `completions`, `experimental`) plus the paginated `ListToolsResult` / `ListResourcesResult` / `ListPromptsResult` for the count.
|
||||
- **Target props** — Shape stays similar, but semantics pin `name` to a `keyof ServerCapabilities` and `count` to the length of the corresponding list result. Proposed: `capability: keyof ServerCapabilities`; `supported: boolean`; `count?: number`.
|
||||
- **Callbacks → core hook** — None. `supported` is derived from `useServerCapabilities` in the wiring layer; `count` from `useMcpClient` list results.
|
||||
- **Callbacks → core hook** — None. `supported` is derived from `useServerCapabilities` in the wiring layer; `count` from `useInspectorClient` list results.
|
||||
- **Internal refactors** — Map `capability` key to its display label inside the component (`tools → "Tools"`, etc.).
|
||||
|
||||
### ConnectionToggle
|
||||
|
|
@ -169,7 +169,7 @@ For each component, the plan records:
|
|||
- **Current props** — `visible: boolean`; `onRefresh: () => void`.
|
||||
- **MCP schema touch points** — `ToolListChangedNotification`, `ResourceListChangedNotification`, `PromptListChangedNotification`, `RootsListChangedNotification` — all parameterless notifications; the component only needs a boolean "one or more are pending" signal.
|
||||
- **Target props** — Unchanged: `visible: boolean`; `onRefresh: () => void`.
|
||||
- **Callbacks → core hook** — `onRefresh` → `useMcpClient` (re-invokes `listTools` / `listResources` / `listPrompts` / `listRoots` depending on the screen). `visible` comes from core notification-tracking state.
|
||||
- **Callbacks → core hook** — `onRefresh` → `useInspectorClient` (re-invokes `listTools` / `listResources` / `listPrompts` / `listRoots` depending on the screen). `visible` comes from core notification-tracking state.
|
||||
- **Internal refactors** — None.
|
||||
|
||||
### ListToggle
|
||||
|
|
@ -188,7 +188,7 @@ For each component, the plan records:
|
|||
- **Purpose** — Single row in the log stream: timestamp, level badge, optional logger name, message.
|
||||
- **Current props** — `timestamp: string`; `level: LogLevel`; `message: string`; `logger?: string`.
|
||||
- **MCP schema touch points** — `LoggingMessageNotification.params` (`level: LoggingLevel`, `logger?: string`, `data: unknown`). Timestamp is not part of the MCP notification — it is recorded by core when the notification arrives.
|
||||
- **Target props** — `entry: { receivedAt: string; params: LoggingMessageNotification["params"] }` — a core-owned wrapper type that embeds the MCP params verbatim and adds the client-side receive time.
|
||||
- **Target props** — `entry: { receivedAt: Date; params: LoggingMessageNotification["params"] }` — a core-owned wrapper type that embeds the MCP params verbatim and adds the client-side receive time (`Date`, matching v1.5's `MessageEntry`/`StderrLogEntry` convention).
|
||||
- **Callbacks → core hook** — None. Log buffer is owned by core (`useLoggingNotifications` or equivalent) and entries are passed down as props.
|
||||
- **Internal refactors** — Accept `params.data` (`unknown`) and render it via a string coercion / JSON stringify instead of a pre-formatted `message`. Pull `level` and `logger` off `params`. Remove the local `LogLevel` alias in favor of the schema's `LoggingLevel`.
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ For each component, the plan records:
|
|||
- **Current props** — `progress: number` (0–100); `description?: string`; `elapsed?: string`.
|
||||
- **MCP schema touch points** — `ProgressNotification.params` (`progressToken`, `progress: number`, `total?: number`, `message?: string`).
|
||||
- **Target props** — `params: ProgressNotification["params"]`; `elapsed?: string` (client-computed from the time the request was issued).
|
||||
- **Callbacks → core hook** — None. Progress state is aggregated by core (`useMcpClient` / request tracker) keyed by `progressToken`.
|
||||
- **Callbacks → core hook** — None. Progress state is aggregated by core (`useInspectorClient` / request tracker) keyed by `progressToken`.
|
||||
- **Internal refactors** — Compute the displayed percentage from `progress`/`total` (fall back to raw `progress` if `total` is missing). Read caption text from `message` instead of `description`.
|
||||
|
||||
### ServerStatusIndicator
|
||||
|
|
@ -239,7 +239,7 @@ For each component, the plan records:
|
|||
- **Current props** — `subscribed: boolean`; `onToggle: () => void`.
|
||||
- **MCP schema touch points** — `SubscribeRequest.params.uri` and `UnsubscribeRequest.params.uri` — but the URI is held by the parent row; the button itself only needs the current subscription boolean.
|
||||
- **Target props** — `subscribed: boolean`; `onSubscribe: () => void`; `onUnsubscribe: () => void` (split for parity with `ConnectionToggle`). Alternatively keep a single `onToggle` if the wiring layer prefers that.
|
||||
- **Callbacks → core hook** — `onSubscribe` / `onUnsubscribe` → `useMcpClient` (wraps `client.subscribeResource` / `client.unsubscribeResource`); `subscribed` derived from a core-owned subscription set.
|
||||
- **Callbacks → core hook** — `onSubscribe` / `onUnsubscribe` → `useInspectorClient` (wraps `client.subscribeResource` / `client.unsubscribeResource`); `subscribed` derived from a core-owned subscription set.
|
||||
- **Internal refactors** — Optional split of `onToggle` into the two explicit callbacks; otherwise none.
|
||||
|
||||
### TaskStatusBadge
|
||||
|
|
@ -281,7 +281,7 @@ For each component, the plan records:
|
|||
- **Current props**: `message`, `schema: JsonSchema`, `values`, `serverName`, `onChange`, `onSubmit`, `onCancel`.
|
||||
- **MCP schema touch points**: `ElicitRequest.params` (`message`, `requestedSchema`), `PrimitiveSchemaDefinition`, `ElicitResult` (`action`, `content`).
|
||||
- **Target props**: `request: ElicitRequest` (or `{ message; requestedSchema }`), `serverName: string`, `values: Record<string, PrimitiveValue>`, `onChange`, `onSubmit(result: ElicitResult)`, `onCancel()`.
|
||||
- **Callbacks → core hook**: `onSubmit`/`onCancel` from likely `useElicitation` (pending `ElicitRequest` queue).
|
||||
- **Callbacks → core hook**: `onSubmit`/`onCancel` from the pending-elicitation queue (handled inside `InspectorClient`; v2 pending-queue hook TBD) (pending `ElicitRequest` queue).
|
||||
- **Internal refactors**: Constrain to `PrimitiveSchemaDefinition` record instead of freeform `JsonSchema`; emit `{action:'accept'|'decline'|'cancel', content}`.
|
||||
|
||||
### ElicitationUrlPanel
|
||||
|
|
@ -291,7 +291,7 @@ For each component, the plan records:
|
|||
- **Current props**: `message`, `url`, `elicitationId`, `isWaiting`, `onCopyUrl`, `onOpenInBrowser`, `onCancel`.
|
||||
- **MCP schema touch points**: URL-mode elicitation is NOT in MCP 2025-11-25 — Inspector-owned extension of `ElicitRequest`.
|
||||
- **Target props**: `request: InspectorUrlElicitRequest` (`requestId`, `message`, `url`), `isWaiting`, `onCopyUrl`, `onOpenInBrowser`, `onCancel`.
|
||||
- **Callbacks → core hook**: likely `useElicitation` (URL variant).
|
||||
- **Callbacks → core hook**: the pending-elicitation queue (handled inside `InspectorClient`; v2 pending-queue hook TBD) (URL variant).
|
||||
- **Internal refactors**: Replace scalar props with wrapper object.
|
||||
|
||||
### ExperimentalFeaturesPanel
|
||||
|
|
@ -301,7 +301,7 @@ For each component, the plan records:
|
|||
- **Current props**: `serverCapabilities`, `clientCapabilities`, `requestJson`, `responseJson`, `customHeaders`, `requestHistory`, many handlers.
|
||||
- **MCP schema touch points**: `ServerCapabilities.experimental`, `ClientCapabilities.experimental` (freeform `{[k]: object}`); `JSONRPCRequest`/`JSONRPCResponse`/`JSONRPCError`. `RequestHistoryItem` is Inspector-owned.
|
||||
- **Target props**: `serverExperimental: ServerCapabilities['experimental']`, `clientExperimental: ClientCapabilities['experimental']`, `requestDraft: string`, `response?: JSONRPCResponse | JSONRPCError`, `customHeaders: HeaderPair[]`, `history: InspectorRequestHistoryItem[]`, handlers unchanged.
|
||||
- **Callbacks → core hook**: `onSendRequest`/`onTestCapability` from likely `useMcpClient`; `onToggleClientCapability` from likely `useClientCapabilities`; history from `useHistory`.
|
||||
- **Callbacks → core hook**: `onSendRequest`/`onTestCapability` from `useInspectorClient`; `onToggleClientCapability` from `useClientCapabilities` (v2-only — no v1.5 analog); history from `useHistory`.
|
||||
- **Internal refactors**: Iterate over the freeform capability record rather than an inferred `{name,description,methods}` list.
|
||||
|
||||
### HistoryControls
|
||||
|
|
@ -311,7 +311,7 @@ For each component, the plan records:
|
|||
- **Current props**: `searchText`, `methodFilter`, `onSearchChange`, `onMethodFilterChange`.
|
||||
- **MCP schema touch points**: Method filter values are MCP `Request.method` literals.
|
||||
- **Target props**: `searchText`, `methodFilter?: RequestMethod`, `availableMethods: RequestMethod[]`, `onSearchChange`, `onMethodFilterChange`.
|
||||
- **Callbacks → core hook**: likely `useHistory`.
|
||||
- **Callbacks → core hook**: `useMessageLog`.
|
||||
- **Internal refactors**: Type the method filter as a union of MCP method strings.
|
||||
|
||||
### HistoryEntry
|
||||
|
|
@ -321,7 +321,7 @@ For each component, the plan records:
|
|||
- **Current props**: `timestamp`, `method`, `target?`, `status`, `durationMs`, `parameters`, `response`, `childEntries`, `isPinned`, `isListExpanded`, `onReplay`, `onTogglePin`.
|
||||
- **MCP schema touch points**: Wraps an MCP `Request`/`Result` pair; parameters → `Request.params`, response → `Result | JSONRPCError`. Child entries are nested server→client calls (sampling/elicitation/roots).
|
||||
- **Target props**: `entry: InspectorHistoryEntry` (embeds `request: JSONRPCRequest`, `response?: JSONRPCResponse | JSONRPCError`, `startedAt`, `durationMs`, `childEntries`, `isPinned`), `isListExpanded`, `onReplay`, `onTogglePin`.
|
||||
- **Callbacks → core hook**: likely `useHistory`.
|
||||
- **Callbacks → core hook**: `useMessageLog`.
|
||||
- **Internal refactors**: Derive `method`/`target`/`status` from the embedded JSON-RPC objects rather than flat scalars.
|
||||
|
||||
### HistoryListPanel
|
||||
|
|
@ -331,7 +331,7 @@ For each component, the plan records:
|
|||
- **Current props**: `entries`, `pinnedEntries`, `searchText`, `methodFilter?`, `onClearAll`, `onExport`.
|
||||
- **MCP schema touch points**: Same `InspectorHistoryEntry` wrapper as above.
|
||||
- **Target props**: `entries: InspectorHistoryEntry[]`, `pinnedEntries: InspectorHistoryEntry[]`, `searchText`, `methodFilter?`, `onClearAll`, `onExport`, `onReplay(entryId)`, `onTogglePin(entryId)`.
|
||||
- **Callbacks → core hook**: likely `useHistory`.
|
||||
- **Callbacks → core hook**: `useMessageLog`.
|
||||
- **Internal refactors**: Pass entry id + handlers down instead of pre-bound callbacks on each entry.
|
||||
|
||||
### ImportServerJsonPanel
|
||||
|
|
@ -341,7 +341,7 @@ For each component, the plan records:
|
|||
- **Current props**: `jsonContent`, `validationResults`, `packages?`, `selectedPackageIndex`, `envVars`, `serverName`, handlers.
|
||||
- **MCP schema touch points**: `server.json` is MCP **registry** spec, not the runtime schema — Inspector/registry-owned.
|
||||
- **Target props**: `draft: InspectorServerJsonDraft` (raw text + parsed `RegistryServerJson` + `selectedPackageIndex` + env overrides + name override), `validation: ValidationResult[]`, handlers unchanged.
|
||||
- **Callbacks → core hook**: likely `useServerRegistry` / `useServers`.
|
||||
- **Callbacks → core hook**: `useServerRegistry` (v2-only — no v1.5 analog) / `useServers`.
|
||||
- **Internal refactors**: Collapse scattered scalar props into a single draft object.
|
||||
|
||||
### InlineElicitationRequest
|
||||
|
|
@ -351,7 +351,7 @@ For each component, the plan records:
|
|||
- **Current props**: `mode`, `message`, `queuePosition`, `schema?`, `values?`, `url?`, `isWaiting?`, handlers.
|
||||
- **MCP schema touch points**: `ElicitRequest` (form); URL variant is Inspector-owned.
|
||||
- **Target props**: `request: ElicitRequest | InspectorUrlElicitRequest`, `queuePosition`, `values?`, `isWaiting?`, handlers.
|
||||
- **Callbacks → core hook**: likely `useElicitation`.
|
||||
- **Callbacks → core hook**: the pending-elicitation queue (handled inside `InspectorClient`; v2 pending-queue hook TBD).
|
||||
- **Internal refactors**: Discriminate on `request` shape rather than a separate `mode` prop.
|
||||
|
||||
### InlineSamplingRequest
|
||||
|
|
@ -361,7 +361,7 @@ For each component, the plan records:
|
|||
- **Current props**: `queuePosition`, `modelHints?`, `messagePreview`, `responseText`, `onAutoRespond`, `onEditAndSend`, `onReject`, `onViewDetails`.
|
||||
- **MCP schema touch points**: `CreateMessageRequest` (`messages`, `modelPreferences.hints[].name`, etc.), `CreateMessageResult`.
|
||||
- **Target props**: `request: CreateMessageRequest`, `queuePosition`, `draftResult?: CreateMessageResult`, handlers.
|
||||
- **Callbacks → core hook**: likely `useSampling`.
|
||||
- **Callbacks → core hook**: the pending-sampling queue (handled inside `InspectorClient`; v2 pending-queue hook TBD).
|
||||
- **Internal refactors**: Derive `modelHints` and `messagePreview` from the embedded request.
|
||||
|
||||
### LogControls
|
||||
|
|
@ -371,7 +371,7 @@ For each component, the plan records:
|
|||
- **Current props**: `currentLevel`, `filterText`, `visibleLevels`, `onSetLevel`, `onFilterChange`, `onToggleLevel`, `onToggleAllLevels`.
|
||||
- **MCP schema touch points**: `LoggingLevel` union, `SetLevelRequest.params.level`.
|
||||
- **Target props**: `currentLevel: LoggingLevel`, `filterText`, `visibleLevels: Record<LoggingLevel, boolean>`, handlers typed with `LoggingLevel`.
|
||||
- **Callbacks → core hook**: `onSetLevel` from likely `useLogs` (issues `logging/setLevel`); visibility is client state from `useLogs` or screen.
|
||||
- **Callbacks → core hook**: `onSetLevel` from `useMessageLog` (issues `logging/setLevel`); visibility is client state from `useLogs` or screen.
|
||||
- **Internal refactors**: Replace string-typed levels with `LoggingLevel` throughout.
|
||||
|
||||
### LogStreamPanel
|
||||
|
|
@ -381,7 +381,7 @@ For each component, the plan records:
|
|||
- **Current props**: `entries: LogEntryProps[]`, `filterText`, `visibleLevels`, `autoScroll`, handlers.
|
||||
- **MCP schema touch points**: `LoggingMessageNotification.params` (`level`, `logger?`, `data`).
|
||||
- **Target props**: `entries: InspectorLogEntry[]` (wraps `LoggingMessageNotification['params']` + timestamp), `filterText`, `visibleLevels: Record<LoggingLevel, boolean>`, `autoScroll`, handlers.
|
||||
- **Callbacks → core hook**: likely `useLogs` (buffers `notifications/message`).
|
||||
- **Callbacks → core hook**: `useMessageLog` (buffers `notifications/message`).
|
||||
- **Internal refactors**: Adapt `LogEntry` to render `LoggingMessageNotification.params` directly.
|
||||
|
||||
### PendingClientRequests
|
||||
|
|
@ -401,7 +401,7 @@ For each component, the plan records:
|
|||
- **Current props**: `name`, `description?`, `arguments`, `argumentValues`, `onArgumentChange`, `onGetPrompt`.
|
||||
- **MCP schema touch points**: `Prompt`, `PromptArgument` (`name`, `description`, `required`), `GetPromptRequest.params`.
|
||||
- **Target props**: `prompt: Prompt`, `argumentValues: Record<string, string>`, `onArgumentChange`, `onGetPrompt(args: GetPromptRequest['params']['arguments'])`.
|
||||
- **Callbacks → core hook**: `onGetPrompt` from likely `usePrompts`.
|
||||
- **Callbacks → core hook**: `onGetPrompt` from `useManagedPrompts`.
|
||||
- **Internal refactors**: Read `prompt.arguments` directly; display `prompt.title ?? prompt.name`.
|
||||
|
||||
### PromptControls
|
||||
|
|
@ -411,7 +411,7 @@ For each component, the plan records:
|
|||
- **Current props**: `prompts: PromptItem[]`, `listChanged`, `onRefreshList`, `onSelectPrompt`.
|
||||
- **MCP schema touch points**: `Prompt`, `ListPromptsResult`, `PromptListChangedNotification`.
|
||||
- **Target props**: `prompts: Prompt[]`, `selectedName?: string`, `listChanged`, `onRefreshList()`, `onSelectPrompt(name)`.
|
||||
- **Callbacks → core hook**: likely `usePrompts`.
|
||||
- **Callbacks → core hook**: `useManagedPrompts`.
|
||||
- **Internal refactors**: Replace local `PromptItem` with schema `Prompt`; lift `selected` out of item.
|
||||
|
||||
### PromptListItem
|
||||
|
|
@ -441,7 +441,7 @@ For each component, the plan records:
|
|||
- **Current props**: `resources`, `templates`, `subscriptions`, `listChanged`, `onRefreshList`, `onSelectUri`, `onSelectTemplate`, `onUnsubscribeResource`.
|
||||
- **MCP schema touch points**: `Resource`, `ResourceTemplate`, `ListResourcesResult`, `ListResourceTemplatesResult`, `ResourceListChangedNotification`, `ResourceUpdatedNotification`.
|
||||
- **Target props**: `resources: Resource[]`, `templates: ResourceTemplate[]`, `subscriptions: InspectorResourceSubscription[]`, `selectedUri?`, `selectedTemplate?`, `listChanged`, handlers.
|
||||
- **Callbacks → core hook**: likely `useResources`.
|
||||
- **Callbacks → core hook**: `useManagedResources`.
|
||||
- **Internal refactors**: Replace inferred item types with schema types; lift `selected` out.
|
||||
|
||||
### ResourceListItem
|
||||
|
|
@ -461,7 +461,7 @@ For each component, the plan records:
|
|||
- **Current props**: `uri`, `mimeType`, `annotations?`, `content: string`, `lastUpdated?`, `isSubscribed`, `onRefresh`, `onSubscribe`, `onUnsubscribe`.
|
||||
- **MCP schema touch points**: `ReadResourceResult.contents[]` (`TextResourceContents | BlobResourceContents`), parent `Resource`.
|
||||
- **Target props**: `resource: Resource`, `contents: (TextResourceContents | BlobResourceContents)[]`, `lastUpdated?`, `isSubscribed`, handlers.
|
||||
- **Callbacks → core hook**: likely `useResources`.
|
||||
- **Callbacks → core hook**: `useManagedResources`.
|
||||
- **Internal refactors**: Handle blob vs text and iterate over `contents[]` instead of a single string.
|
||||
|
||||
### ResourceSubscribedItem
|
||||
|
|
@ -471,7 +471,7 @@ For each component, the plan records:
|
|||
- **Current props**: `name`, `lastUpdated?`, `onUnsubscribe`.
|
||||
- **MCP schema touch points**: `Resource` + Inspector subscription state (`lastUpdated` from `notifications/resources/updated`).
|
||||
- **Target props**: `subscription: InspectorResourceSubscription` (`{ resource: Resource; lastUpdated? }`), `onUnsubscribe(uri)`.
|
||||
- **Callbacks → core hook**: likely `useResources`.
|
||||
- **Callbacks → core hook**: `useManagedResources`.
|
||||
- **Internal refactors**: Take the wrapper, not flat scalars.
|
||||
|
||||
### ResourceTemplatePanel
|
||||
|
|
@ -481,7 +481,7 @@ For each component, the plan records:
|
|||
- **Current props**: `name`, `title?`, `uriTemplate`, `description?`, `annotations?`, `onReadResource`.
|
||||
- **MCP schema touch points**: `ResourceTemplate` (`uriTemplate`, `name`, `title`, `description`, `mimeType`, `annotations`).
|
||||
- **Target props**: `template: ResourceTemplate`, `onReadResource(uri)`.
|
||||
- **Callbacks → core hook**: likely `useResources`.
|
||||
- **Callbacks → core hook**: `useManagedResources`.
|
||||
- **Internal refactors**: Destructure a single schema object; keep local variable-values state.
|
||||
|
||||
### RootsTable
|
||||
|
|
@ -491,7 +491,7 @@ For each component, the plan records:
|
|||
- **Current props**: `roots: RootEntry[]`, `newRootName`, `newRootPath`, handlers.
|
||||
- **MCP schema touch points**: `Root` (`uri: string (file://...)`, `name?`), `ListRootsResult`, `RootsListChangedNotification`.
|
||||
- **Target props**: `roots: Root[]`, `newRootDraft: { name: string; uri: string }`, handlers.
|
||||
- **Callbacks → core hook**: likely `useRoots`.
|
||||
- **Callbacks → core hook**: `useRoots` (v2-only — no v1.5 analog).
|
||||
- **Internal refactors**: Use schema `Root`; replace `path` field with `uri`.
|
||||
|
||||
### SamplingRequestPanel
|
||||
|
|
@ -501,7 +501,7 @@ For each component, the plan records:
|
|||
- **Current props**: `messages`, `modelHints?`, `cost/speed/intelligencePriority?`, `maxTokens?`, `stopSequences?`, `temperature?`, `includeContext?`, `tools?`, `toolChoice?`, `responseText`, `modelUsed`, `stopReason`, handlers.
|
||||
- **MCP schema touch points**: `CreateMessageRequest.params` (`messages: SamplingMessage[]`, `modelPreferences: ModelPreferences`, `systemPrompt`, `includeContext`, `temperature`, `maxTokens`, `stopSequences`, `metadata`), `CreateMessageResult` (`role`, `content`, `model`, `stopReason`). `tools`/`toolChoice` are NOT in 2025-11-25 `CreateMessageRequest` — Inspector extension or drop.
|
||||
- **Target props**: `request: CreateMessageRequest`, `draftResult: CreateMessageResult`, `onResultChange`, `onAutoRespond`, `onSend`, `onReject`.
|
||||
- **Callbacks → core hook**: likely `useSampling`.
|
||||
- **Callbacks → core hook**: the pending-sampling queue (handled inside `InspectorClient`; v2 pending-queue hook TBD).
|
||||
- **Internal refactors**: Destructure all preferences/parameters from the embedded request; drop or fence off non-schema `tools`/`toolChoice`.
|
||||
|
||||
### SchemaForm
|
||||
|
|
@ -521,7 +521,7 @@ For each component, the plan records:
|
|||
- **Current props**: `onAddManually`, `onImportConfig`, `onImportServerJson`.
|
||||
- **MCP schema touch points**: None — Inspector-core-owned.
|
||||
- **Target props**: Unchanged.
|
||||
- **Callbacks → core hook**: likely `useServers` (and `useServerRegistry` for import).
|
||||
- **Callbacks → core hook**: `useServers` (v2-only — no v1.5 analog) (and `useServerRegistry` for import).
|
||||
- **Internal refactors**: None.
|
||||
|
||||
### ServerCard
|
||||
|
|
@ -531,7 +531,7 @@ For each component, the plan records:
|
|||
- **Current props**: `name`, `version?`, `transport`, `connectionMode`, `command`, `status`, `retryCount?`, `error?`, `canTestClientFeatures`, `activeServer?`, many handlers.
|
||||
- **MCP schema touch points**: `Implementation` (server `name`, `version`) from `InitializeResult.serverInfo`. Transport/command/mode/status are Inspector-core-owned (connection lifecycle).
|
||||
- **Target props**: `config: InspectorServerConfig`, `info?: Implementation`, `connection: InspectorConnectionState` (`status`, `retryCount`, `error`), `canTestClientFeatures`, `activeServer?`, handlers unchanged.
|
||||
- **Callbacks → core hook**: `onToggleConnection`/`onSetActiveServer` from likely `useConnection`; `onEdit`/`onClone`/`onRemove` from `useServers`; test handlers from `useSampling`/`useElicitation`/`useRoots`.
|
||||
- **Callbacks → core hook**: `onToggleConnection`/`onSetActiveServer` from `useConnection`; `onEdit`/`onClone`/`onRemove` from `useServers`; test handlers from `useSampling`/`useElicitation`/`useRoots`.
|
||||
- **Internal refactors**: Replace flat scalar props with grouped objects; **move the auto-connect `useEffect` out** — dumb components must not self-dispatch side effects.
|
||||
|
||||
### ServerInfoContent
|
||||
|
|
@ -541,7 +541,7 @@ For each component, the plan records:
|
|||
- **Current props**: `name`, `version`, `protocolVersion`, `transport`, `serverCapabilities`, `clientCapabilities`, `instructions?`, `oauthDetails?`.
|
||||
- **MCP schema touch points**: `InitializeResult` (`serverInfo: Implementation`, `protocolVersion`, `capabilities: ServerCapabilities`, `instructions?`), `ClientCapabilities`.
|
||||
- **Target props**: `initializeResult: InitializeResult`, `clientCapabilities: ClientCapabilities`, `transport: InspectorTransportType`, `oauth?: InspectorOAuthDetails`.
|
||||
- **Callbacks → core hook**: read-only; data from likely `useConnection` / `useServerCapabilities`.
|
||||
- **Callbacks → core hook**: read-only; data from `useConnection` / `useServerCapabilities`.
|
||||
- **Internal refactors**: Derive capability list by iterating the `ServerCapabilities` record rather than a pre-built `CapabilityInfo[]`.
|
||||
|
||||
### ServerListControls
|
||||
|
|
@ -551,7 +551,7 @@ For each component, the plan records:
|
|||
- **Current props**: `compact`, `serverCount`, `onToggleList`, plus `AddServerMenuProps`.
|
||||
- **MCP schema touch points**: None (Inspector-core-owned).
|
||||
- **Target props**: Unchanged.
|
||||
- **Callbacks → core hook**: likely `useServers` (+ `useServerRegistry`).
|
||||
- **Callbacks → core hook**: `useServers` (v2-only — no v1.5 analog) (+ `useServerRegistry`).
|
||||
- **Internal refactors**: None.
|
||||
|
||||
### ServerSettingsForm
|
||||
|
|
@ -561,7 +561,7 @@ For each component, the plan records:
|
|||
- **Current props**: `connectionMode`, `headers`, `metadata`, `connectionTimeout`, `requestTimeout`, `oauthClient*`, many handlers.
|
||||
- **MCP schema touch points**: `Request._meta` passthrough is the only schema-level tie-in; the rest is Inspector-core-owned.
|
||||
- **Target props**: `settings: InspectorServerSettings`, `onSettingsChange(settings)` (or keep granular setters).
|
||||
- **Callbacks → core hook**: likely `useServers`.
|
||||
- **Callbacks → core hook**: `useServers` (v2-only — no v1.5 analog).
|
||||
- **Internal refactors**: Collapse props into a settings object; keep internal `KeyValueRows`.
|
||||
|
||||
### TaskCard
|
||||
|
|
@ -569,9 +569,9 @@ For each component, the plan records:
|
|||
- **Location**: `groups/TaskCard/`
|
||||
- **Purpose**: Expandable card for a long-running task with progress and cancel.
|
||||
- **Current props**: `taskId`, `status`, `method`, `target?`, `progress?`, `progressDescription?`, `startedAt?`, `completedAt?`, `lastUpdated?`, `elapsed?`, `ttl?`, `error?`, `isListExpanded`, `onCancel`.
|
||||
- **MCP schema touch points**: `ProgressNotification.params` (`progressToken`, `progress`, `total`, `message`); formal `tasks/*` types are NOT in MCP 2025-11-25 base schema — treat the task envelope as Inspector-owned wrapping a `progressToken`-tracked MCP request.
|
||||
- **Target props**: `task: InspectorTask` (embeds originating `Request`, latest `ProgressNotification`, `status`, timestamps, `ttl`), `isListExpanded`, `onCancel(taskId)`.
|
||||
- **Callbacks → core hook**: likely `useTasks` (issues `notifications/cancelled`).
|
||||
- **MCP schema touch points**: `Task` (from `@modelcontextprotocol/sdk/types.js`) plus `ProgressNotification.params` (`progressToken`, `progress`, `total`, `message`) and `CancelledNotification.params`. The `notifications/tasks/list_changed` signal is an Inspector extension (no SDK schema) — see `core/mcp/taskNotificationSchemas.ts`.
|
||||
- **Target props**: `task: Task` (SDK type), `isListExpanded`, `onCancel(taskId)`.
|
||||
- **Callbacks → core hook**: `useManagedRequestorTasks` (issues `notifications/cancelled`).
|
||||
- **Internal refactors**: Replace flat scalars with the wrapper; derive display fields.
|
||||
|
||||
### TaskControls
|
||||
|
|
@ -579,9 +579,9 @@ For each component, the plan records:
|
|||
- **Location**: `groups/TaskControls/`
|
||||
- **Purpose**: Sidebar search + status filter + refresh/clear for tasks.
|
||||
- **Current props**: `searchText`, `statusFilter?`, handlers.
|
||||
- **MCP schema touch points**: Statuses Inspector-owned.
|
||||
- **Target props**: Unchanged; statuses typed as `InspectorTaskStatus`.
|
||||
- **Callbacks → core hook**: likely `useTasks`.
|
||||
- **MCP schema touch points**: `Task` (from `@modelcontextprotocol/sdk/types.js`) — the `status` field lives on the SDK `Task` type.
|
||||
- **Target props**: Unchanged; status filter typed as `Task["status"]`.
|
||||
- **Callbacks → core hook**: `useManagedRequestorTasks`.
|
||||
- **Internal refactors**: None beyond typing.
|
||||
|
||||
### TaskListPanel
|
||||
|
|
@ -589,9 +589,9 @@ For each component, the plan records:
|
|||
- **Location**: `groups/TaskListPanel/`
|
||||
- **Purpose**: List of active and completed tasks.
|
||||
- **Current props**: `tasks: TaskCardProps[]`, `searchText`, `statusFilter?`.
|
||||
- **MCP schema touch points**: Same `InspectorTask` wrapper as TaskCard.
|
||||
- **Target props**: `tasks: InspectorTask[]`, `searchText`, `statusFilter?`, `onCancel(taskId)`.
|
||||
- **Callbacks → core hook**: likely `useTasks`.
|
||||
- **MCP schema touch points**: Same SDK `Task` type as TaskCard.
|
||||
- **Target props**: `tasks: Task[]`, `searchText`, `statusFilter?`, `onCancel(taskId)`.
|
||||
- **Callbacks → core hook**: `useManagedRequestorTasks`.
|
||||
- **Internal refactors**: Pass `onCancel` through to each `TaskCard`; stop spreading prop objects.
|
||||
|
||||
### ToolControls
|
||||
|
|
@ -601,7 +601,7 @@ For each component, the plan records:
|
|||
- **Current props**: `tools: ToolListItemProps[]`, `listChanged`, `onRefreshList`, `onSelectTool`.
|
||||
- **MCP schema touch points**: `Tool`, `ListToolsResult`, `ToolListChangedNotification`.
|
||||
- **Target props**: `tools: Tool[]`, `selectedName?`, `listChanged`, `onRefreshList`, `onSelectTool`.
|
||||
- **Callbacks → core hook**: likely `useTools`.
|
||||
- **Callbacks → core hook**: `useManagedTools`.
|
||||
- **Internal refactors**: Consume schema `Tool[]` directly.
|
||||
|
||||
### ToolDetailPanel
|
||||
|
|
@ -611,7 +611,7 @@ For each component, the plan records:
|
|||
- **Current props**: `name`, `title?`, `description?`, `annotations?`, `schema: JsonSchema`, `formValues`, `isExecuting`, `progress?`, handlers.
|
||||
- **MCP schema touch points**: `Tool` (`name`, `title`, `description`, `inputSchema`, `annotations: ToolAnnotations`), `ToolAnnotations` (`title`, `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`), `CallToolRequest`, `ProgressNotification`.
|
||||
- **Target props**: `tool: Tool`, `formValues: Record<string, unknown>`, `isExecuting`, `progress?: ProgressNotification['params']`, `onFormChange`, `onExecute(args)`, `onCancel()`.
|
||||
- **Callbacks → core hook**: likely `useTools` (wraps `tools/call` with progress token).
|
||||
- **Callbacks → core hook**: `useManagedTools` (wraps `tools/call` with progress token).
|
||||
- **Internal refactors**: Rename local annotation flags to schema `*Hint` names; read `inputSchema` from `tool`.
|
||||
|
||||
### ToolListItem
|
||||
|
|
@ -641,7 +641,7 @@ For each component, the plan records:
|
|||
- **Current props**: discriminated union on `connected`: `serverName`, `status`, `latencyMs`, tabs, handlers.
|
||||
- **MCP schema touch points**: `Implementation.name` for `serverName`; status/latency are Inspector connection state.
|
||||
- **Target props**: Connected: `serverInfo: Implementation`, `connection: InspectorConnectionState`, `activeTab`, `availableTabs`, `onTabChange`, `onDisconnect`, `onToggleTheme`. Unconnected: unchanged.
|
||||
- **Callbacks → core hook**: `onDisconnect` from likely `useConnection`; `onTabChange` from screen/view router; `onToggleTheme` from UI theme store.
|
||||
- **Callbacks → core hook**: `onDisconnect` from `useConnection`; `onTabChange` from screen/view router; `onToggleTheme` from UI theme store.
|
||||
- **Internal refactors**: Replace flat header scalars with grouped objects.
|
||||
|
||||
<!-- /AGENT:GROUPS -->
|
||||
|
|
@ -674,7 +674,7 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- `callState?: { status: 'idle' | 'pending' | 'ok' | 'error'; request?: CallToolRequest['params']; result?: CallToolResult; error?: string }`.
|
||||
- `listChanged: boolean` — driven by `notifications/tools/list_changed`.
|
||||
- `onRefreshList: () => void`, `onSelectTool: (name: string) => void`, `onCallTool: (name: string, args: Record<string, unknown>) => void`.
|
||||
- **Callbacks → core hook**: `useTools` (likely) provides `tools`, `listChanged`, `refreshTools`, `callTool`, `lastCallResult`; backed by `useMcpClient` for the underlying `client.request`.
|
||||
- **Callbacks → core hook**: `useManagedTools` provides `tools`, `listChanged`, `refreshTools`, `callTool`, `lastCallResult`; backed by `useInspectorClient` for the underlying `client.request`.
|
||||
- **Internal refactors**:
|
||||
- Stop flattening `Tool` into `ToolListItemProps` at the screen boundary — pass `Tool` down and let `ToolListItem` project fields.
|
||||
- Derive the selected tool from `tools.find(t => t.name === selectedToolName)` instead of receiving a pre-built `ToolDetailPanelProps`.
|
||||
|
|
@ -693,7 +693,7 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- `getPromptState?: { status: 'idle' | 'pending' | 'ok' | 'error'; result?: GetPromptResult; error?: string }` — replaces the bare `messages` prop.
|
||||
- `listChanged: boolean`.
|
||||
- `onRefreshList`, `onSelectPrompt(name)`, `onArgumentChange(name, value)`, `onGetPrompt()`.
|
||||
- **Callbacks → core hook**: `usePrompts` (likely) provides `prompts`, `listChanged`, `refreshPrompts`, `getPrompt`, `lastGetPromptResult`; backed by `useMcpClient`.
|
||||
- **Callbacks → core hook**: `useManagedPrompts` provides `prompts`, `listChanged`, `refreshPrompts`, `getPrompt`, `lastGetPromptResult`; backed by `useInspectorClient`.
|
||||
- **Internal refactors**:
|
||||
- Drop `PromptItem`/`SelectedPrompt` wrapper types; consume `Prompt` directly.
|
||||
- `PromptMessage[]` flows into `PromptMessagesDisplay` from `GetPromptResult.messages` verbatim.
|
||||
|
|
@ -711,7 +711,7 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- `readState?: { status; uri: string; result?: ReadResourceResult; error?: string }`.
|
||||
- `listChanged: boolean`.
|
||||
- `onRefreshList`, `onSelectUri(uri)`, `onSelectTemplate(uriTemplate)`, `onReadResource(uri)`, `onSubscribeResource(uri)`, `onUnsubscribeResource(uri)`.
|
||||
- **Callbacks → core hook**: `useResources` (likely) owns `resources`, `resourceTemplates`, `readResource`, `subscribe`/`unsubscribe`, `subscriptions`, and forwards `notifications/resources/updated` + `list_changed`.
|
||||
- **Callbacks → core hook**: `useManagedResources` owns `resources`, `resourceTemplates`, `readResource`, `subscribe`/`unsubscribe`, `subscriptions`, and forwards `notifications/resources/updated` + `list_changed`.
|
||||
- **Internal refactors**:
|
||||
- Replace the ad-hoc `SelectedResource` (with inlined `content: string`) with `ReadResourceResult` whose `contents` is a union of `TextResourceContents | BlobResourceContents` — preview panel must branch on type.
|
||||
- Pass `Annotations` through unmodified rather than the reduced `{ audience?: string; priority?: number }`.
|
||||
|
|
@ -723,10 +723,10 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- **Current props**: `entries: HistoryEntryProps[]`, `pinnedEntries: HistoryEntryProps[]`, `onClearAll`, `onExport`.
|
||||
- **MCP schema touch points**: `JSONRPCRequest`, `JSONRPCResponse`, `JSONRPCNotification`, `JSONRPCError`, `RequestId` — entries wrap these, not transform them.
|
||||
- **Target props**:
|
||||
- `entries: HistoryEntry[]` where `HistoryEntry = { id: string; timestamp: string; direction: 'outgoing' | 'incoming'; message: JSONRPCRequest | JSONRPCResponse | JSONRPCNotification | JSONRPCError; pinned: boolean; durationMs?: number }`.
|
||||
- `entries: MessageEntry[]` from `core/mcp/types.ts` (v1.5's `MessageEntry` with `timestamp: Date`, plus a local `pinned: boolean` overlay held in screen state).
|
||||
- `onClearAll`, `onExport`, `onTogglePin(id)`, `onCopy(id)`.
|
||||
- Local state `searchText` / `methodFilter` stays in screen.
|
||||
- **Callbacks → core hook**: `useHistory` (likely) — buffers every message seen by `useMcpClient`'s transport and exposes `entries`, `clear`, `export`, `togglePin`.
|
||||
- **Callbacks → core hook**: `useMessageLog` — buffers every message seen by `useInspectorClient`'s transport and exposes `entries`, `clear`, `export`, `togglePin`.
|
||||
- **Internal refactors**: collapse `entries` + `pinnedEntries` into one list with a `pinned` flag; `HistoryListPanel` handles grouping.
|
||||
|
||||
### LoggingScreen
|
||||
|
|
@ -736,11 +736,11 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- **Current props**: `entries: LogEntryProps[]`, `currentLevel: string`, `onSetLevel`, `onClear`, `onExport`, `autoScroll`, `onToggleAutoScroll`, `onCopyAll`.
|
||||
- **MCP schema touch points**: `LoggingMessageNotification.params` (`LoggingLevel`, `logger?`, `data: unknown`), `SetLevelRequest.params.level`.
|
||||
- **Target props**:
|
||||
- `entries: Array<LoggingMessageNotification['params'] & { id: string; timestamp: string }>`.
|
||||
- `entries: Array<{ receivedAt: Date; params: LoggingMessageNotification['params'] }>` (the core-owned wrapper from `LogEntry`'s target shape; `receivedAt: Date` matches v1.5's convention).
|
||||
- `currentLevel: LoggingLevel`.
|
||||
- `onSetLevel(level: LoggingLevel)`, `onClear`, `onExport`, `onCopyAll`, `autoScroll`, `onToggleAutoScroll`.
|
||||
- `filterText` and `visibleLevels` stay screen-local.
|
||||
- **Callbacks → core hook**: `useLogs` (likely) — subscribes to `notifications/message`, buffers entries, exposes `entries`, `currentLevel`, `setLevel` (wraps `logging/setLevel`).
|
||||
- **Callbacks → core hook**: `useMessageLog` — subscribes to `notifications/message`, buffers entries, exposes `entries`, `currentLevel`, `setLevel` (wraps `logging/setLevel`).
|
||||
|
||||
### TasksScreen
|
||||
|
||||
|
|
@ -752,7 +752,7 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- `tasks: Task[]` where `Task = { id: RequestId; progressToken?: ProgressToken; method: string; params: unknown; status: 'pending' | 'progress' | 'done' | 'error' | 'cancelled'; progress?: ProgressNotification['params']; result?: unknown; error?: JSONRPCError['error']; startedAt: string; endedAt?: string }`.
|
||||
- `onRefresh`, `onClearHistory`, `onCancel(id: RequestId)`.
|
||||
- Local state `searchText` / `statusFilter` stays in screen.
|
||||
- **Callbacks → core hook**: `useTasks` (likely, new in v2) — correlates outbound requests with `notifications/progress`, `notifications/cancelled`, and terminal responses via the transport owned by `useMcpClient`.
|
||||
- **Callbacks → core hook**: `useManagedRequestorTasks` — correlates outbound requests with `notifications/progress`, `notifications/cancelled`, and terminal responses via the transport owned by `useInspectorClient`.
|
||||
|
||||
### ServerListScreen
|
||||
|
||||
|
|
@ -764,7 +764,7 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- `servers: ServerEntry[]` where `ServerEntry = { id: string; config: ServerTransportConfig; connection: { status: 'disconnected' | 'connecting' | 'connected' | 'error'; error?: string; initializeResult?: InitializeResult } }`.
|
||||
- `activeServerId?: string` — may be lifted to core if it drives routing; currently screen-local.
|
||||
- `onAddManually`, `onImportConfig`, `onImportServerJson`, `onConnect(id)`, `onDisconnect(id)`, `onSetActiveServer(id)`, `onEditServer(id)`, `onRemoveServer(id)`.
|
||||
- **Callbacks → core hook**: `useServers` (likely) owns the persisted config list; `useConnection` (v1.5, `client/src/lib/hooks/useConnection.ts`) owns per-server transport lifecycle and exposes `connectionStatus`, `serverCapabilities`, `connect`, `disconnect`. `ServerListScreen` composes both via a parent view.
|
||||
- **Callbacks → core hook**: `useServers` (v2-only — no v1.5 analog) owns the persisted config list; `useConnection` (v1.5, `core/react/useConnection.ts`) owns per-server transport lifecycle and exposes `connectionStatus`, `serverCapabilities`, `connect`, `disconnect`. `ServerListScreen` composes both via a parent view.
|
||||
- **Internal refactors**:
|
||||
- Stop flattening each server into a loose `ServerCardProps`; pass `ServerEntry` and let `ServerCard` read `config` / `connection` fields.
|
||||
- `activeServer` state may migrate to `useServers` once it gates which screen renders; until then, keep `useState` local.
|
||||
|
|
@ -811,9 +811,9 @@ themselves — every callback passed down must originate in a core hook.
|
|||
- `children: ReactNode`
|
||||
- **Callbacks → core hook**:
|
||||
- `onDisconnect` → `useConnection` (disconnect action).
|
||||
- `onTabChange` → local UI state in the wiring layer (not an MCP call); likely `useInspectorNavigation` or screen-level state.
|
||||
- `onTabChange` → local UI state in the wiring layer (not an MCP call); wiring-layer `useState` (no dedicated hook yet) or screen-level state.
|
||||
- `onToggleTheme` → app-level theme store, not a core hook.
|
||||
- `connectionStatus`, `latencyMs`, `serverInfo`, `capabilities` → likely `useConnection` / `useMcpClient` / `useServerCapabilities`.
|
||||
- `connectionStatus`, `latencyMs`, `serverInfo`, `capabilities` → `useConnection` / `useInspectorClient` / `useServerCapabilities`.
|
||||
- **Internal refactors**:
|
||||
- Replace flat `serverName` with `serverInfo.name` lookup; forward full `serverInfo` to `ViewHeader` once that group is updated.
|
||||
- Compute/validate `availableTabs` against `capabilities` rather than accepting an arbitrary string list; narrow `activeTab`/`availableTabs` to an `InspectorTab` union.
|
||||
|
|
@ -851,22 +851,35 @@ components that consume hook output directly.
|
|||
|
||||
<!-- AGENT:HOOKS -->
|
||||
|
||||
Authoritative source: [`modelcontextprotocol/inspector` v1.5/main, `client/src/lib/hooks`](https://github.com/modelcontextprotocol/inspector/tree/main/client/src/lib/hooks) (v1.5 monorepo bundles most primitive-specific logic inside `client/src/App.tsx`; hooks marked "likely" will be extracted cleanly in v2 core).
|
||||
Authoritative source: [`modelcontextprotocol/inspector` v1.5/main, `core/react/`](https://github.com/modelcontextprotocol/inspector/tree/v1.5/main/core/react). v1.5 already has the full core hook surface extracted under `core/react/*.ts`; the v2 wiring layer adopts each hook by name and adapts only where v2 introduces new application state (servers list, registry, client capabilities, navigation).
|
||||
|
||||
- **`useConnection`** — confirmed in v1.5 at `client/src/lib/hooks/useConnection.ts`. Owns MCP transport lifecycle (stdio / SSE / streamable HTTP), performs `initialize`, tracks `connectionStatus`, exposes `makeRequest`, `handleCompletion`, `sendNotification`, and surfaces `serverCapabilities`. Produces: `InitializeResult`, `ServerCapabilities`, `Implementation`, `JSONRPCRequest`/`JSONRPCResponse` flow.
|
||||
- **`useMcpClient`** (likely) — thin wrapper over the MCP SDK `Client` that returns the underlying client, `request`, and `notification` handles. Produces: every `ClientRequest` / `ServerRequest` / `ServerNotification` union member.
|
||||
- **`useServerCapabilities`** (likely) — memoized accessor over `InitializeResult.capabilities`; drives which tabs/screens render. Produces: `ServerCapabilities`.
|
||||
- **`useTools`** (likely) — lists tools, listens for `notifications/tools/list_changed`, calls tools. Produces: `Tool[]`, `ListToolsResult`, `CallToolResult`.
|
||||
- **`usePrompts`** (likely) — lists prompts, listens for `notifications/prompts/list_changed`, gets prompts. Produces: `Prompt[]`, `ListPromptsResult`, `GetPromptResult`, `PromptMessage[]`.
|
||||
- **`useResources`** (likely) — lists resources + templates, reads resources, manages subscriptions, listens for `notifications/resources/updated` and `list_changed`. Produces: `Resource[]`, `ResourceTemplate[]`, `ReadResourceResult`, `TextResourceContents | BlobResourceContents`, subscription set.
|
||||
- **`useLogs`** (likely) — subscribes to `notifications/message`, buffers entries, wraps `logging/setLevel`. Produces: `LoggingMessageNotification['params'][]`, `LoggingLevel`.
|
||||
- **`useHistory`** (likely) — transport-level buffer of every inbound/outbound JSON-RPC frame. Produces: `JSONRPCRequest | JSONRPCResponse | JSONRPCNotification | JSONRPCError` entries with direction and timestamp.
|
||||
- **`useTasks`** (likely, new in v2) — correlates outbound requests with `notifications/progress` and `notifications/cancelled` to model long-running operations. Produces: task records keyed by `RequestId` / `ProgressToken`, wrapping `ProgressNotification.params` and terminal result/error.
|
||||
- **`useServers`** (likely, v2-only) — persisted list of configured server entries (transport config + last-known identity) independent of any live connection. Produces: `ServerEntry[]` (app state; not MCP schema).
|
||||
- **`useCompletionState`** — confirmed in v1.5 at `client/src/lib/hooks/useCompletionState.ts`. Manages argument-completion dropdown state against `completion/complete`. Produces: `CompleteResult` fragments.
|
||||
- **`useElicitation`** (likely) — handles incoming `elicitation/create` server→client requests and exposes pending prompts + `respond` callback. Produces: `ElicitRequest.params`, `ElicitResult`.
|
||||
- **`useSampling`** (likely) — handles incoming `sampling/createMessage` server→client requests and exposes pending prompts + `approve`/`reject`. Produces: `CreateMessageRequest.params`, `CreateMessageResult`.
|
||||
- **`useRoots`** (likely) — client-side roots registry answering `roots/list` requests from the server. Produces: `Root[]`.
|
||||
v1.5 core hooks (confirmed in `core/react/`):
|
||||
|
||||
- **`useInspectorClient`** — `core/react/useInspectorClient.ts`. Central hook returning `{ status, capabilities, serverInfo, instructions, appRendererClient, connect, disconnect }`. `capabilities: ServerCapabilities` is a field on this hook — there is no separate `useServerCapabilities`.
|
||||
- **`useManagedTools`** — `core/react/useManagedTools.ts`. Produces `{ tools: Tool[]; refresh }` and subscribes to `notifications/tools/list_changed`.
|
||||
- **`useManagedPrompts`** — `core/react/useManagedPrompts.ts`. Produces `{ prompts: Prompt[]; refresh }` and subscribes to `notifications/prompts/list_changed`.
|
||||
- **`useManagedResources`** — `core/react/useManagedResources.ts`. Produces `{ resources: Resource[]; refresh }` and subscribes to `notifications/resources/list_changed` + `notifications/resources/updated`.
|
||||
- **`useManagedResourceTemplates`** — `core/react/useManagedResourceTemplates.ts`. Produces `{ resourceTemplates: ResourceTemplate[]; refresh }`.
|
||||
- **`useManagedRequestorTasks`** — `core/react/useManagedRequestorTasks.ts`. Produces `{ tasks: Task[]; refresh }` where `Task` is the SDK type from `@modelcontextprotocol/sdk/types.js`. Correlates outbound requests with `notifications/progress`, `notifications/cancelled`, and `notifications/tasks/list_changed` (an Inspector-owned extension defined in `core/mcp/taskNotificationSchemas.ts`).
|
||||
- **`useMessageLog`** — `core/react/useMessageLog.ts`. JSON-RPC message buffer (`MessageEntry[]`). Serves *both* the History screen (replaces the speculative `useHistory`) *and* the Logging screen's wire view.
|
||||
- **`useStderrLog`** — `core/react/useStderrLog.ts`. Stdio stderr buffer (`StderrLogEntry[]`). Used by server-detail panels showing stderr output.
|
||||
- **`useFetchRequestLog`** — `core/react/useFetchRequestLog.ts`. Auth/transport HTTP fetch buffer (`FetchRequestEntry[]`). Used by OAuth/debug panels.
|
||||
- **`usePagedTools`, `usePagedPrompts`, `usePagedResources`, `usePagedResourceTemplates`, `usePagedRequestorTasks`** — `core/react/usePaged*.ts`. Paged siblings of the managed hooks above; use when the caller needs explicit cursor control.
|
||||
- **`useCompletionState`** — `core/react/useCompletionState.ts`. Manages argument-completion dropdown state against `completion/complete`. Produces `CompleteResult` fragments.
|
||||
- **`useConnection`** — legacy name retained in some call sites. v2 routes per-server connection lifecycle through `useInspectorClient`'s `connect` / `disconnect` plus its `status` field. Where `useConnection` is referenced in this document for per-server actions, read it as "the connection slice of `useInspectorClient`".
|
||||
|
||||
Server→client request handling (elicitation, sampling, roots) — no discrete v1.5 hook:
|
||||
|
||||
- **Elicitation** (`elicitation/create`) — handled inside `InspectorClient` (`core/mcp/elicitationCreateMessage.ts`) via SDK request handlers; see `core/mcp/inspectorClient.ts`. v2 will need a small UI-state hook for the pending-elicitation queue, but it doesn't exist yet — for now, screens hold the pending queue in local state lifted to the wiring layer.
|
||||
- **Sampling** (`sampling/createMessage`) — handled inside `InspectorClient` (`core/mcp/samplingCreateMessage.ts`) via SDK request handlers. Same treatment as elicitation: v2 wiring layer holds the pending queue.
|
||||
- **Roots** (`roots/list`) — configured via `InspectorClientOptions.roots: Root[]` at construction time and answered by an SDK request handler inside `InspectorClient`. No React hook exists. v2 may introduce one; until then, roots flow through client options.
|
||||
|
||||
v2-only hooks (no v1.5 analog — to be introduced alongside the wiring layer):
|
||||
|
||||
- **`useServers`** — persisted list of configured server entries (transport config + last-known identity) independent of any live connection. v2-only.
|
||||
- **`useServerRegistry`** — registry browser / import-from-`server.json` flow. v2-only.
|
||||
- **`useClientCapabilities`** — advertises/toggles client-side capabilities (sampling, elicitation form/URL, roots, receiver-tasks) that `InspectorClient` reports during `initialize`. v2-only.
|
||||
- **`useInspectorNavigation`** — tab/screen routing state. v2 may not introduce a dedicated hook; tab state can be `useState` in the wiring layer if screen count stays small.
|
||||
|
||||
Non-MCP utility hooks present in v1.5 (`useToast`, `useCopy`, `useTheme`, `useDraggablePane`) are orthogonal to the schema contract and will be adopted as-is or replaced by Mantine equivalents.
|
||||
|
||||
|
|
|
|||
35
specification/v2_ux_interfaces_phase_0_4_inventory.md
Normal file
35
specification/v2_ux_interfaces_phase_0_4_inventory.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Phase 0.4 — Inventory of local re-declarations to delete
|
||||
|
||||
This checklist enumerates every ad hoc local type in `clients/web/src/` that
|
||||
will be replaced during Phases 1–4 with a schema type from
|
||||
`@modelcontextprotocol/sdk/types.js` or a wrapper type from
|
||||
`core/mcp/types.ts`. Generated at the close of Phase 0; intended for the
|
||||
Phase 0 PR description and as a running checklist during the refactor.
|
||||
|
||||
**Definition of done for each row**: the listed declaration is gone from
|
||||
`clients/web/src/` and every import site references the replacement type.
|
||||
|
||||
## Local types → replacement
|
||||
|
||||
| Local type | Declared in | Also imported by | Replace with |
|
||||
| --- | --- | --- | --- |
|
||||
| `JsonSchema` | `groups/SchemaForm/SchemaForm.tsx` | `groups/InlineElicitationRequest/InlineElicitationRequest.tsx`, `groups/ElicitationFormPanel/ElicitationFormPanel.tsx`, `groups/ToolDetailPanel/ToolDetailPanel.tsx` | `JsonSchemaType` from `clients/web/src/utils/jsonUtils.ts` |
|
||||
| `LogLevel` | `elements/LogEntry/LogEntry.tsx` | `elements/LogLevelBadge/LogLevelBadge.tsx`, `groups/LogStreamPanel/LogStreamPanel.stories.tsx`, `screens/LoggingScreen/LoggingScreen.stories.tsx`, `views/ConnectedView/ConnectedView.stories.tsx` | SDK `LoggingLevel` |
|
||||
| `TaskStatus` | `groups/TaskCard/TaskCard.tsx` | `elements/TaskStatusBadge/TaskStatusBadge.tsx`, `groups/TaskControls/TaskControls.tsx` | `Task["status"]` from SDK |
|
||||
| `PromptItem`, `SelectedPrompt` | `screens/PromptsScreen/PromptsScreen.tsx` | `groups/PromptControls/PromptControls.tsx`, `screens/PromptsScreen/PromptsScreen.stories.tsx` | SDK `Prompt` (plus `GetPromptResult` for `SelectedPrompt`) |
|
||||
| `ResourceItem`, `TemplateListItem`, `SubscriptionItem` | `screens/ResourcesScreen/ResourcesScreen.tsx` | `groups/ResourceControls/ResourceControls.tsx`, `screens/ResourcesScreen/ResourcesScreen.stories.tsx` | SDK `Resource`, `ResourceTemplate`, wrapper `InspectorResourceSubscription` from `core/mcp/types.ts` |
|
||||
| `ToolListItemProps` (as a data shape) | `groups/ToolListItem/ToolListItem.tsx` | `groups/ToolControls/ToolControls.tsx`, `screens/ToolsScreen/ToolsScreen.tsx`, `screens/ToolsScreen/ToolsScreen.stories.tsx` | SDK `Tool` |
|
||||
| `RootEntry` | `groups/RootsTable/RootsTable.tsx` | — | SDK `Root` |
|
||||
| `KeyValuePair` | `groups/ServerSettingsForm/ServerSettingsForm.tsx`, `groups/ExperimentalFeaturesPanel/ExperimentalFeaturesPanel.tsx` | — | `CustomHeader` from `clients/web/src/lib/types/customHeaders.ts` when the form edits headers specifically; keep a local `KeyValuePair` only for generic key/value lists (e.g. metadata) |
|
||||
| inline `"connected" \| "connecting" \| "disconnected" \| "failed"` | `elements/ServerStatusIndicator/ServerStatusIndicator.tsx:4`, `groups/ServerCard/ServerCard.tsx:15`, `views/ConnectedView/ConnectedView.tsx:7` | — | `ConnectionStatus` from `core/mcp/types.ts`. **Note**: reconcile `"failed"` → `"error"` (v1.5's canonical spelling) |
|
||||
| inline `"stdio" \| "http"` transport union | `elements/TransportBadge/TransportBadge.tsx:4`, `groups/ServerCard/ServerCard.tsx:12` plus story fixtures | — | `ServerType` (`"stdio" \| "sse" \| "streamable-http"`) from `core/mcp/types.ts` |
|
||||
|
||||
## Validation
|
||||
|
||||
After Phase 1 + Phase 2 complete, this must return zero matches:
|
||||
|
||||
```sh
|
||||
git grep -nE '\b(JsonSchema|LogLevel|TaskStatus|PromptItem|SelectedPrompt|ResourceItem|TemplateListItem|SubscriptionItem|ToolListItemProps|RootEntry)\b' clients/web/src
|
||||
```
|
||||
|
||||
And the inline unions above must no longer appear in the listed files.
|
||||
Loading…
Reference in a new issue