Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ const App = () => {
const {
connectionStatus,
serverCapabilities,
mcpProtocolVersion,
serverImplementation,
mcpClient,
requestHistory,
Expand Down Expand Up @@ -1342,6 +1343,7 @@ const App = () => {
connectionType={connectionType}
setConnectionType={setConnectionType}
serverImplementation={serverImplementation}
mcpProtocolVersion={mcpProtocolVersion}
/>
<div
onMouseDown={handleSidebarDragStart}
Expand Down
7 changes: 7 additions & 0 deletions client/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ interface SidebarProps {
serverImplementation?:
| (WithIcons & { name?: string; version?: string; websiteUrl?: string })
| null;
mcpProtocolVersion?: string | null;
}

const Sidebar = ({
Expand Down Expand Up @@ -110,6 +111,7 @@ const Sidebar = ({
connectionType,
setConnectionType,
serverImplementation,
mcpProtocolVersion,
}: SidebarProps) => {
const [theme, setTheme] = useTheme();
const [showEnvVars, setShowEnvVars] = useState(false);
Expand Down Expand Up @@ -847,6 +849,11 @@ const Sidebar = ({
Version: {serverImplementation.version}
</div>
)}
{mcpProtocolVersion && (
<div className="text-xs text-gray-500 dark:text-gray-400">
Protocol: {mcpProtocolVersion}
</div>
)}
</div>
);
})()}
Expand Down
28 changes: 28 additions & 0 deletions client/src/lib/hooks/__tests__/useConnection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,34 @@ describe("useConnection", () => {
mockStreamableHTTPTransport.options?.requestInit?.headers,
).toHaveProperty("X-MCP-Proxy-Auth", "Bearer test-proxy-token");
});

test("exposes negotiated protocol version from response headers", async () => {
const response = {
headers: {
get: jest.fn((name: string) =>
name === "mcp-protocol-version" ? "2025-06-18" : null,
),
},
} as unknown as Response;
(global.fetch as jest.Mock).mockResolvedValueOnce(response);

const { result } = renderHook(() =>
useConnection({
...defaultProps,
connectionType: "direct",
}),
);

await act(async () => {
await result.current.connect();
});

await act(async () => {
await mockSSETransport.options?.fetch?.("http://localhost:8080");
});

expect(result.current.mcpProtocolVersion).toBe("2025-06-18");
});
});

describe("Custom Headers", () => {
Expand Down
1 change: 1 addition & 0 deletions client/src/lib/hooks/useConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,7 @@ export function useConnection({
return {
connectionStatus,
serverCapabilities,
mcpProtocolVersion,
serverImplementation,
mcpClient,
requestHistory,
Expand Down