Skip to content

Commit 2e5bd02

Browse files
committed
update for icons
1 parent 9584012 commit 2e5bd02

File tree

8 files changed

+178
-17
lines changed

8 files changed

+178
-17
lines changed

client/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ const App = () => {
198198
const {
199199
connectionStatus,
200200
serverCapabilities,
201+
serverImplementation,
201202
mcpClient,
202203
requestHistory,
203204
makeRequest,
@@ -818,6 +819,7 @@ const App = () => {
818819
logLevel={logLevel}
819820
sendLogLevelRequest={sendLogLevelRequest}
820821
loggingSupported={!!serverCapabilities?.logging || false}
822+
serverImplementation={serverImplementation}
821823
/>
822824
<div
823825
onMouseDown={handleSidebarDragStart}

client/src/__tests__/App.routing.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const disconnectedConnectionState = {
4848
completionsSupported: false,
4949
connect: jest.fn(),
5050
disconnect: jest.fn(),
51+
serverImplementation: null,
5152
};
5253

5354
// Connected state for tests that need an active connection

client/src/components/IconDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
interface Icon {
33
src: string;
44
mimeType?: string;
5-
sizes?: string;
5+
sizes?: string[];
66
}
77

88
// Helper type for objects that may have icons

client/src/components/PromptsTab.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useEffect, useState } from "react";
1414
import ListPane from "./ListPane";
1515
import { useCompletionState } from "@/lib/hooks/useCompletionState";
1616
import JsonView from "./JsonView";
17+
import IconDisplay from "./IconDisplay";
1718

1819
export type Prompt = {
1920
name: string;
@@ -23,6 +24,7 @@ export type Prompt = {
2324
description?: string;
2425
required?: boolean;
2526
}[];
27+
icons?: { src: string; mimeType?: string; sizes?: string[] }[];
2628
};
2729

2830
const PromptsTab = ({
@@ -101,6 +103,7 @@ const PromptsTab = ({
101103
}}
102104
renderItem={(prompt) => (
103105
<div className="flex flex-col items-start">
106+
<IconDisplay icons={prompt.icons} size="sm" />
104107
<span className="flex-1">{prompt.name}</span>
105108
<span className="text-sm text-gray-500 text-left">
106109
{prompt.description}

client/src/components/Sidebar.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
RefreshCwOff,
1515
Copy,
1616
CheckCheck,
17+
Server,
1718
} from "lucide-react";
1819
import { Button } from "@/components/ui/button";
1920
import { Input } from "@/components/ui/input";
@@ -38,6 +39,7 @@ import {
3839
TooltipContent,
3940
} from "@/components/ui/tooltip";
4041
import { useToast } from "../lib/hooks/useToast";
42+
import IconDisplay, { WithIcons } from "./IconDisplay";
4143

4244
interface SidebarProps {
4345
connectionStatus: ConnectionStatus;
@@ -66,6 +68,9 @@ interface SidebarProps {
6668
loggingSupported: boolean;
6769
config: InspectorConfig;
6870
setConfig: (config: InspectorConfig) => void;
71+
serverImplementation?:
72+
| (WithIcons & { name?: string; version?: string; websiteUrl?: string })
73+
| null;
6974
}
7075

7176
const Sidebar = ({
@@ -95,6 +100,7 @@ const Sidebar = ({
95100
loggingSupported,
96101
config,
97102
setConfig,
103+
serverImplementation,
98104
}: SidebarProps) => {
99105
const [theme, setTheme] = useTheme();
100106
const [showEnvVars, setShowEnvVars] = useState(false);
@@ -729,6 +735,45 @@ const Sidebar = ({
729735
</span>
730736
</div>
731737

738+
{connectionStatus === "connected" && serverImplementation && (
739+
<div className="bg-gray-50 dark:bg-gray-900 p-3 rounded-lg mb-4">
740+
<div className="flex items-center gap-2 mb-1">
741+
{(serverImplementation as WithIcons).icons &&
742+
(serverImplementation as WithIcons).icons!.length > 0 ? (
743+
<IconDisplay
744+
icons={(serverImplementation as WithIcons).icons}
745+
size="sm"
746+
/>
747+
) : (
748+
<Server className="w-4 h-4 text-gray-500" />
749+
)}
750+
{(serverImplementation as { websiteUrl?: string })
751+
.websiteUrl ? (
752+
<a
753+
href={
754+
(serverImplementation as { websiteUrl?: string })
755+
.websiteUrl
756+
}
757+
target="_blank"
758+
rel="noopener noreferrer"
759+
className="text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:underline transition-colors"
760+
>
761+
{serverImplementation.name || "MCP Server"}
762+
</a>
763+
) : (
764+
<span className="text-sm font-medium text-gray-800 dark:text-gray-200">
765+
{serverImplementation.name || "MCP Server"}
766+
</span>
767+
)}
768+
</div>
769+
{serverImplementation.version && (
770+
<div className="text-xs text-gray-500 dark:text-gray-400">
771+
Version: {serverImplementation.version}
772+
</div>
773+
)}
774+
</div>
775+
)}
776+
732777
{loggingSupported && connectionStatus === "connected" && (
733778
<div className="space-y-2">
734779
<label

client/src/components/ToolsTab.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { useEffect, useState } from "react";
2222
import ListPane from "./ListPane";
2323
import JsonView from "./JsonView";
2424
import ToolResults from "./ToolResults";
25+
import IconDisplay, { WithIcons } from "./IconDisplay";
2526

2627
// Type guard to safely detect the optional _meta field without using `any`
2728
const hasMeta = (tool: Tool): tool is Tool & { _meta: unknown } =>
@@ -83,6 +84,7 @@ const ToolsTab = ({
8384
setSelectedItem={setSelectedTool}
8485
renderItem={(tool) => (
8586
<div className="flex flex-col items-start">
87+
<IconDisplay icons={(tool as WithIcons).icons} size="sm" />
8688
<span className="flex-1">{tool.name}</span>
8789
<span className="text-sm text-gray-500 text-left">
8890
{tool.description}
@@ -99,6 +101,17 @@ const ToolsTab = ({
99101
<h3 className="font-semibold">
100102
{selectedTool ? selectedTool.name : "Select a tool"}
101103
</h3>
104+
<div className="flex items-center gap-2">
105+
{selectedTool && (
106+
<IconDisplay
107+
icons={(selectedTool as WithIcons).icons}
108+
size="md"
109+
/>
110+
)}
111+
<h3 className="font-semibold">
112+
{selectedTool ? selectedTool.name : "Select a tool"}
113+
</h3>
114+
</div>
102115
</div>
103116
<div className="p-4">
104117
{selectedTool ? (

client/src/lib/hooks/useConnection.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
Progress,
3131
LoggingLevel,
3232
ElicitRequestSchema,
33+
Implementation,
3334
} from "@modelcontextprotocol/sdk/types.js";
3435
import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
3536
import { useEffect, useState } from "react";
@@ -78,6 +79,7 @@ interface UseConnectionOptions {
7879
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7980
getRoots?: () => any[];
8081
defaultLoggingLevel?: LoggingLevel;
82+
serverImplementation?: Implementation;
8183
}
8284

8385
export function useConnection({
@@ -110,6 +112,8 @@ export function useConnection({
110112
{ request: string; response?: string }[]
111113
>([]);
112114
const [completionsSupported, setCompletionsSupported] = useState(false);
115+
const [serverImplementation, setServerImplementation] =
116+
useState<Implementation | null>(null);
113117

114118
useEffect(() => {
115119
if (!oauthClientId) {
@@ -542,6 +546,8 @@ export function useConnection({
542546
setClientTransport(transport);
543547

544548
capabilities = client.getServerCapabilities();
549+
const serverInfo = client.getServerVersion();
550+
setServerImplementation(serverInfo || null);
545551
const initializeRequest = {
546552
method: "initialize",
547553
};
@@ -651,11 +657,13 @@ export function useConnection({
651657
setConnectionStatus("disconnected");
652658
setCompletionsSupported(false);
653659
setServerCapabilities(null);
660+
setServerImplementation(null);
654661
};
655662

656663
return {
657664
connectionStatus,
658665
serverCapabilities,
666+
serverImplementation,
659667
mcpClient,
660668
requestHistory,
661669
makeRequest,

0 commit comments

Comments
 (0)