Skip to content

Commit debb003

Browse files
Merge branch 'main' into add_proxy_config
2 parents 0dcd10c + f9cb2c1 commit debb003

File tree

10 files changed

+83
-39
lines changed

10 files changed

+83
-39
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-client",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "Client-side application for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

client/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ const App = () => {
152152
handleCompletion,
153153
completionsSupported,
154154
connect: connectMcpServer,
155+
disconnect: disconnectMcpServer,
155156
} = useConnection({
156157
transportType,
157158
command,
@@ -466,6 +467,7 @@ const App = () => {
466467
bearerToken={bearerToken}
467468
setBearerToken={setBearerToken}
468469
onConnect={connectMcpServer}
470+
onDisconnect={disconnectMcpServer}
469471
stdErrNotifications={stdErrNotifications}
470472
logLevel={logLevel}
471473
sendLogLevelRequest={sendLogLevelRequest}

client/src/components/Sidebar.tsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
RotateCcw,
1212
Settings,
1313
HelpCircle,
14+
RefreshCwOff,
1415
} from "lucide-react";
1516
import { Button } from "@/components/ui/button";
1617
import { Input } from "@/components/ui/input";
@@ -51,6 +52,7 @@ interface SidebarProps {
5152
bearerToken: string;
5253
setBearerToken: (token: string) => void;
5354
onConnect: () => void;
55+
onDisconnect: () => void;
5456
stdErrNotifications: StdErrNotification[];
5557
logLevel: LoggingLevel;
5658
sendLogLevelRequest: (level: LoggingLevel) => void;
@@ -74,6 +76,7 @@ const Sidebar = ({
7476
bearerToken,
7577
setBearerToken,
7678
onConnect,
79+
onDisconnect,
7780
stdErrNotifications,
7881
logLevel,
7982
sendLogLevelRequest,
@@ -393,23 +396,24 @@ const Sidebar = ({
393396
</div>
394397

395398
<div className="space-y-2">
396-
<Button
397-
data-testid="connect-button"
398-
className="w-full"
399-
onClick={onConnect}
400-
>
401-
{connectionStatus === "connected" ? (
402-
<>
399+
{connectionStatus === "connected" && (
400+
<div className="grid grid-cols-2 gap-4">
401+
<Button data-testid="connect-button" onClick={onConnect}>
403402
<RotateCcw className="w-4 h-4 mr-2" />
404403
{transportType === "stdio" ? "Restart" : "Reconnect"}
405-
</>
406-
) : (
407-
<>
408-
<Play className="w-4 h-4 mr-2" />
409-
Connect
410-
</>
411-
)}
412-
</Button>
404+
</Button>
405+
<Button onClick={onDisconnect}>
406+
<RefreshCwOff className="w-4 h-4 mr-2" />
407+
Disconnect
408+
</Button>
409+
</div>
410+
)}
411+
{connectionStatus !== "connected" && (
412+
<Button className="w-full" onClick={onConnect}>
413+
<Play className="w-4 h-4 mr-2" />
414+
Connect
415+
</Button>
416+
)}
413417

414418
<div className="flex items-center justify-center space-x-2 mb-4">
415419
<div

client/src/components/ToolsTab.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
1+
import { Alert, AlertDescription } from "@/components/ui/alert";
22
import { Button } from "@/components/ui/button";
33
import { Checkbox } from "@/components/ui/checkbox";
44
import { Input } from "@/components/ui/input";
@@ -13,7 +13,7 @@ import {
1313
ListToolsResult,
1414
Tool,
1515
} from "@modelcontextprotocol/sdk/types.js";
16-
import { AlertCircle, Send } from "lucide-react";
16+
import { Send } from "lucide-react";
1717
import { useEffect, useState } from "react";
1818
import ListPane from "./ListPane";
1919
import JsonView from "./JsonView";
@@ -27,7 +27,6 @@ const ToolsTab = ({
2727
setSelectedTool,
2828
toolResult,
2929
nextCursor,
30-
error,
3130
}: {
3231
tools: Tool[];
3332
listTools: () => void;
@@ -147,13 +146,7 @@ const ToolsTab = ({
147146
</h3>
148147
</div>
149148
<div className="p-4">
150-
{error ? (
151-
<Alert variant="destructive">
152-
<AlertCircle className="h-4 w-4" />
153-
<AlertTitle>Error</AlertTitle>
154-
<AlertDescription>{error}</AlertDescription>
155-
</Alert>
156-
) : selectedTool ? (
149+
{selectedTool ? (
157150
<div className="space-y-4">
158151
<p className="text-sm text-gray-600">
159152
{selectedTool.description}
@@ -226,7 +219,11 @@ const ToolsTab = ({
226219
</div>
227220
) : (
228221
<Input
229-
type={prop.type === "number" ? "number" : "text"}
222+
type={
223+
prop.type === "number" || prop.type === "integer"
224+
? "number"
225+
: "text"
226+
}
230227
id={key}
231228
name={key}
232229
placeholder={prop.description}
@@ -235,7 +232,8 @@ const ToolsTab = ({
235232
setParams({
236233
...params,
237234
[key]:
238-
prop.type === "number"
235+
prop.type === "number" ||
236+
prop.type === "integer"
239237
? Number(e.target.value)
240238
: e.target.value,
241239
})

client/src/components/__tests__/Sidebar.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe("Sidebar Environment Variables", () => {
2727
bearerToken: "",
2828
setBearerToken: jest.fn(),
2929
onConnect: jest.fn(),
30+
onDisconnect: jest.fn(),
3031
stdErrNotifications: [],
3132
logLevel: "info" as const,
3233
sendLogLevelRequest: jest.fn(),

client/src/components/__tests__/ToolsTab.test.tsx

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { render, screen, fireEvent } from "@testing-library/react";
22
import { describe, it, expect, jest } from "@jest/globals";
3+
import "@testing-library/jest-dom";
34
import ToolsTab from "../ToolsTab";
45
import { Tool } from "@modelcontextprotocol/sdk/types.js";
56
import { Tabs } from "@/components/ui/tabs";
@@ -16,6 +17,16 @@ describe("ToolsTab", () => {
1617
},
1718
},
1819
},
20+
{
21+
name: "tool3",
22+
description: "Integer tool",
23+
inputSchema: {
24+
type: "object" as const,
25+
properties: {
26+
count: { type: "integer" as const },
27+
},
28+
},
29+
},
1930
{
2031
name: "tool2",
2132
description: "Second tool",
@@ -61,12 +72,31 @@ describe("ToolsTab", () => {
6172
// Switch to second tool
6273
rerender(
6374
<Tabs defaultValue="tools">
64-
<ToolsTab {...defaultProps} selectedTool={mockTools[1]} />
75+
<ToolsTab {...defaultProps} selectedTool={mockTools[2]} />
6576
</Tabs>,
6677
);
6778

6879
// Verify input is reset
6980
const newInput = screen.getByRole("spinbutton") as HTMLInputElement;
7081
expect(newInput.value).toBe("");
7182
});
83+
it("should handle integer type inputs", () => {
84+
renderToolsTab({
85+
selectedTool: mockTools[1], // Use the tool with integer type
86+
});
87+
88+
const input = screen.getByRole("spinbutton", {
89+
name: /count/i,
90+
}) as HTMLInputElement;
91+
expect(input).toHaveProperty("type", "number");
92+
fireEvent.change(input, { target: { value: "42" } });
93+
expect(input.value).toBe("42");
94+
95+
const submitButton = screen.getByRole("button", { name: /run tool/i });
96+
fireEvent.click(submitButton);
97+
98+
expect(defaultProps.callTool).toHaveBeenCalledWith(mockTools[1].name, {
99+
count: 42,
100+
});
101+
});
72102
});

client/src/lib/hooks/useConnection.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,14 @@ export function useConnection({
342342
}
343343
};
344344

345+
const disconnect = async () => {
346+
await mcpClient?.close();
347+
setMcpClient(null);
348+
setConnectionStatus("disconnected");
349+
setCompletionsSupported(false);
350+
setServerCapabilities(null);
351+
};
352+
345353
return {
346354
connectionStatus,
347355
serverCapabilities,
@@ -352,5 +360,6 @@ export function useConnection({
352360
handleCompletion,
353361
completionsSupported,
354362
connect,
363+
disconnect,
355364
};
356365
}

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -36,8 +36,8 @@
3636
"publish-all": "npm publish --workspaces --access public && npm publish --access public"
3737
},
3838
"dependencies": {
39-
"@modelcontextprotocol/inspector-client": "^0.7.0",
40-
"@modelcontextprotocol/inspector-server": "^0.7.0",
39+
"@modelcontextprotocol/inspector-client": "^0.8.0",
40+
"@modelcontextprotocol/inspector-server": "^0.8.0",
4141
"concurrently": "^9.0.1",
4242
"shell-quote": "^1.8.2",
4343
"spawn-rx": "^5.1.2",

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-server",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "Server-side application for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

0 commit comments

Comments
 (0)