* feat(web): show negotiated MCP protocol version on ServerCard (#1324) Add optional protocolVersion to ConnectionState and render it as a dimmed "MCP <version>" label at the end of the transport-badge/ description row on ServerCard, shown only when connected. The value is plumbed through useInspectorClient as part of #1324. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(core,web): surface negotiated protocolVersion end-to-end (#1324) Plumb the MCP protocol version negotiated during initialize from the InspectorClient through to the ServerCard so the active connected card displays "MCP <version>". The SDK Client doesn't expose protocolVersion; it stamps it onto the transport via setProtocolVersion. MessageTrackingTransport now captures it (and forwards to the base transport when present), so it works for stdio too — whose base transport has no setProtocolVersion. - core: MessageTrackingTransport captures + exposes protocolVersion; InspectorClient stores it, exposes getProtocolVersion(), dispatches a protocolVersionChange event, and clears it on disconnect. - core: useInspectorClient subscribes and returns protocolVersion. - web: App reads it from the hook (drops the hard-coded "2025-06-18") and InspectorView splices it onto the active server's connection. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(web): decouple initializeResult from protocolVersion (#1324 review) Gate the initializeResult memo on serverInfo only, not protocolVersion. initializeResult also drives the connected ViewHeader and Connection Info modal, so requiring the version risked hiding the whole connected surface in the edge case where it's absent. protocolVersion now flows through as the optional field it already is everywhere downstream ('' reads as unknown; the ServerCard label and modal value both tolerate it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(web): drop redundant connected-check in InspectorView splice (#1324 review) initializeResult is derived from connectionStatus in App's memo, so a truthy initializeResult.protocolVersion already implies a live connection — the extra connectionStatus === 'connected' guard in the splice was redundant. ServerCard keeps its own status guard (dumb- component robustness). No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
121f875a0e
commit
9b558afee1
1 changed files with 273 additions and 12 deletions
|
|
@ -600,6 +600,7 @@ function App() {
|
|||
clientCapabilities,
|
||||
serverInfo,
|
||||
instructions,
|
||||
protocolVersion,
|
||||
} = useInspectorClient(inspectorClient);
|
||||
const { tools, refresh: refreshTools } = useManagedTools(
|
||||
inspectorClient,
|
||||
|
|
@ -880,19 +881,30 @@ function App() {
|
|||
};
|
||||
}, [inspectorClient]);
|
||||
|
||||
// Build the InitializeResult the connected ViewHeader expects from the
|
||||
// hook's split fields. `protocolVersion` is hard-coded for now — the
|
||||
// useInspectorClient hook doesn't expose it. TODO(#1324): consume the
|
||||
// negotiated value once the hook surfaces it.
|
||||
// Build the InitializeResult the connected ViewHeader / Connection Info
|
||||
// modal expect from the hook's split fields. `protocolVersion` is the value
|
||||
// the InspectorClient negotiated during initialize (#1324); it's dispatched
|
||||
// alongside serverInfo, so in practice it's present whenever we're connected.
|
||||
// We deliberately gate only on serverInfo (not protocolVersion): this object
|
||||
// also drives the connected header and Connection Info modal, so a
|
||||
// missing/edge-case version must not hide those. It flows through as the
|
||||
// optional field it is everywhere downstream (the ServerCard label and the
|
||||
// modal value both tolerate an empty string), so "" reads as "unknown".
|
||||
const initializeResult = useMemo<InitializeResult | undefined>(() => {
|
||||
if (connectionStatus !== "connected" || !serverInfo) return undefined;
|
||||
return {
|
||||
protocolVersion: "2025-06-18",
|
||||
protocolVersion: protocolVersion ?? "",
|
||||
capabilities: capabilities ?? {},
|
||||
serverInfo,
|
||||
...(instructions ? { instructions } : {}),
|
||||
};
|
||||
}, [connectionStatus, capabilities, serverInfo, instructions]);
|
||||
}, [
|
||||
connectionStatus,
|
||||
capabilities,
|
||||
serverInfo,
|
||||
instructions,
|
||||
protocolVersion,
|
||||
]);
|
||||
|
||||
// The Server Info modal needs the active server's transport and (optional)
|
||||
// OAuth details — both are co-located here so the modal opens against the
|
||||
|
|
|
|||
Loading…
Reference in a new issue