Address PR #1221 code review feedback
- Fix getCapabilityEntries to iterate fixed key sets so unsupported capabilities render red X (was only showing present/supported ones) - Merge duplicate @mantine/core import in ViewHeader - Move ConnectionState from ServerCard to core/mcp/types.ts - Narrow onConnectionModeChange to "proxy" | "direct" instead of string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
771a67ee20
commit
cc9be5e930
1 changed files with 44 additions and 17 deletions
|
|
@ -39,12 +39,30 @@ function formatScopes(scopes: string[]): string {
|
|||
return scopes.join(", ");
|
||||
}
|
||||
|
||||
const SERVER_CAPABILITY_KEYS: CapabilityKey[] = [
|
||||
"tools",
|
||||
"resources",
|
||||
"prompts",
|
||||
"logging",
|
||||
"completions",
|
||||
"tasks",
|
||||
"experimental",
|
||||
];
|
||||
|
||||
const CLIENT_CAPABILITY_KEYS: CapabilityKey[] = [
|
||||
"roots",
|
||||
"sampling",
|
||||
"elicitation",
|
||||
"experimental",
|
||||
];
|
||||
|
||||
function getCapabilityEntries(
|
||||
capabilities: Record<string, unknown>,
|
||||
knownKeys: CapabilityKey[],
|
||||
): { capability: CapabilityKey; supported: boolean }[] {
|
||||
return Object.entries(capabilities).map(([key, value]) => ({
|
||||
capability: key as CapabilityKey,
|
||||
supported: value != null,
|
||||
return knownKeys.map((key) => ({
|
||||
capability: key,
|
||||
supported: key in capabilities && capabilities[key] != null,
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +75,11 @@ export function ServerInfoContent({
|
|||
const { serverInfo, protocolVersion, capabilities, instructions } =
|
||||
initializeResult;
|
||||
|
||||
const serverCaps = getCapabilityEntries(capabilities);
|
||||
const clientCaps = getCapabilityEntries(clientCapabilities);
|
||||
const serverCaps = getCapabilityEntries(capabilities, SERVER_CAPABILITY_KEYS);
|
||||
const clientCaps = getCapabilityEntries(
|
||||
clientCapabilities,
|
||||
CLIENT_CAPABILITY_KEYS,
|
||||
);
|
||||
|
||||
return (
|
||||
<Stack gap="md">
|
||||
|
|
|
|||
Loading…
Reference in a new issue