Skip to content

Commit 715936d

Browse files
committed
run prettier
1 parent d973f58 commit 715936d

File tree

8 files changed

+118
-59
lines changed

8 files changed

+118
-59
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
packages
22
server/build
3+
CODE_OF_CONDUCT.md
4+
SECURITY.md

client/src/App.tsx

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
ResourceTemplate,
1717
Root,
1818
ServerNotification,
19-
Tool
19+
Tool,
2020
} from "@modelcontextprotocol/sdk/types.js";
2121
import { useEffect, useRef, useState } from "react";
2222

@@ -124,10 +124,7 @@ const App = () => {
124124
const [nextToolCursor, setNextToolCursor] = useState<string | undefined>();
125125
const progressTokenRef = useRef(0);
126126

127-
const {
128-
height: historyPaneHeight,
129-
handleDragStart
130-
} = useDraggablePane(300);
127+
const { height: historyPaneHeight, handleDragStart } = useDraggablePane(300);
131128

132129
const {
133130
connectionStatus,
@@ -136,7 +133,7 @@ const App = () => {
136133
requestHistory,
137134
makeRequest: makeConnectionRequest,
138135
sendNotification,
139-
connect: connectMcpServer
136+
connect: connectMcpServer,
140137
} = useConnection({
141138
transportType,
142139
command,
@@ -145,18 +142,21 @@ const App = () => {
145142
env,
146143
proxyServerUrl: PROXY_SERVER_URL,
147144
onNotification: (notification) => {
148-
setNotifications(prev => [...prev, notification as ServerNotification]);
145+
setNotifications((prev) => [...prev, notification as ServerNotification]);
149146
},
150147
onStdErrNotification: (notification) => {
151-
setStdErrNotifications(prev => [...prev, notification as StdErrNotification]);
148+
setStdErrNotifications((prev) => [
149+
...prev,
150+
notification as StdErrNotification,
151+
]);
152152
},
153153
onPendingRequest: (request, resolve, reject) => {
154-
setPendingSampleRequests(prev => [
154+
setPendingSampleRequests((prev) => [
155155
...prev,
156-
{ id: nextRequestId.current++, request, resolve, reject }
156+
{ id: nextRequestId.current++, request, resolve, reject },
157157
]);
158158
},
159-
getRoots: () => rootsRef.current
159+
getRoots: () => rootsRef.current,
160160
});
161161

162162
const makeRequest = async <T extends z.ZodType>(
@@ -345,26 +345,40 @@ const App = () => {
345345
{mcpClient ? (
346346
<Tabs
347347
defaultValue={
348-
Object.keys(serverCapabilities ?? {}).includes(window.location.hash.slice(1)) ?
349-
window.location.hash.slice(1) :
350-
serverCapabilities?.resources ? "resources" :
351-
serverCapabilities?.prompts ? "prompts" :
352-
serverCapabilities?.tools ? "tools" :
353-
"ping"
348+
Object.keys(serverCapabilities ?? {}).includes(
349+
window.location.hash.slice(1),
350+
)
351+
? window.location.hash.slice(1)
352+
: serverCapabilities?.resources
353+
? "resources"
354+
: serverCapabilities?.prompts
355+
? "prompts"
356+
: serverCapabilities?.tools
357+
? "tools"
358+
: "ping"
354359
}
355360
className="w-full p-4"
356361
onValueChange={(value) => (window.location.hash = value)}
357362
>
358363
<TabsList className="mb-4 p-0">
359-
<TabsTrigger value="resources" disabled={!serverCapabilities?.resources}>
364+
<TabsTrigger
365+
value="resources"
366+
disabled={!serverCapabilities?.resources}
367+
>
360368
<Files className="w-4 h-4 mr-2" />
361369
Resources
362370
</TabsTrigger>
363-
<TabsTrigger value="prompts" disabled={!serverCapabilities?.prompts}>
371+
<TabsTrigger
372+
value="prompts"
373+
disabled={!serverCapabilities?.prompts}
374+
>
364375
<MessageSquare className="w-4 h-4 mr-2" />
365376
Prompts
366377
</TabsTrigger>
367-
<TabsTrigger value="tools" disabled={!serverCapabilities?.tools}>
378+
<TabsTrigger
379+
value="tools"
380+
disabled={!serverCapabilities?.tools}
381+
>
368382
<Hammer className="w-4 h-4 mr-2" />
369383
Tools
370384
</TabsTrigger>
@@ -388,7 +402,9 @@ const App = () => {
388402
</TabsList>
389403

390404
<div className="w-full">
391-
{!serverCapabilities?.resources && !serverCapabilities?.prompts && !serverCapabilities?.tools ? (
405+
{!serverCapabilities?.resources &&
406+
!serverCapabilities?.prompts &&
407+
!serverCapabilities?.tools ? (
392408
<div className="flex items-center justify-center p-4">
393409
<p className="text-lg text-gray-500">
394410
The connected server does not support any MCP capabilities

client/src/components/Sidebar.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { useState } from "react";
2-
import { Play, ChevronDown, ChevronRight, CircleHelp, Bug, Github } from "lucide-react";
2+
import {
3+
Play,
4+
ChevronDown,
5+
ChevronRight,
6+
CircleHelp,
7+
Bug,
8+
Github,
9+
} from "lucide-react";
310
import { Button } from "@/components/ui/button";
411
import { Input } from "@/components/ui/input";
512
import {
@@ -243,18 +250,33 @@ const Sidebar = ({
243250
</Select>
244251

245252
<div className="flex items-center space-x-2">
246-
<a href="https://modelcontextprotocol.io/docs/tools/inspector" target="_blank" rel="noopener noreferrer">
253+
<a
254+
href="https://modelcontextprotocol.io/docs/tools/inspector"
255+
target="_blank"
256+
rel="noopener noreferrer"
257+
>
247258
<Button variant="ghost" title="Inspector Documentation">
248259
<CircleHelp className="w-4 h-4 text-gray-800" />
249260
</Button>
250261
</a>
251-
<a href="https://modelcontextprotocol.io/docs/tools/debugging" target="_blank" rel="noopener noreferrer">
262+
<a
263+
href="https://modelcontextprotocol.io/docs/tools/debugging"
264+
target="_blank"
265+
rel="noopener noreferrer"
266+
>
252267
<Button variant="ghost" title="Debugging Guide">
253268
<Bug className="w-4 h-4 text-gray-800" />
254269
</Button>
255270
</a>
256-
<a href="https://github.com/modelcontextprotocol/inspector" target="_blank" rel="noopener noreferrer">
257-
<Button variant="ghost" title="Report bugs or contribute on GitHub">
271+
<a
272+
href="https://github.com/modelcontextprotocol/inspector"
273+
target="_blank"
274+
rel="noopener noreferrer"
275+
>
276+
<Button
277+
variant="ghost"
278+
title="Report bugs or contribute on GitHub"
279+
>
258280
<Github className="w-4 h-4 text-gray-800" />
259281
</Button>
260282
</a>

client/src/components/ToolsTab.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ const ToolsTab = ({
174174
}
175175
className="mt-1"
176176
/>
177-
) :
178-
/* @ts-expect-error value type is currently unknown */
177+
) : /* @ts-expect-error value type is currently unknown */
179178
value.type === "object" ? (
180179
<Textarea
181180
id={key}

client/src/lib/hooks/useConnection.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@ export function useConnection({
4444
onPendingRequest,
4545
getRoots,
4646
}: UseConnectionOptions) {
47-
const [connectionStatus, setConnectionStatus] = useState<"disconnected" | "connected" | "error">("disconnected");
48-
const [serverCapabilities, setServerCapabilities] = useState<ServerCapabilities | null>(null);
47+
const [connectionStatus, setConnectionStatus] = useState<
48+
"disconnected" | "connected" | "error"
49+
>("disconnected");
50+
const [serverCapabilities, setServerCapabilities] =
51+
useState<ServerCapabilities | null>(null);
4952
const [mcpClient, setMcpClient] = useState<Client | null>(null);
50-
const [requestHistory, setRequestHistory] = useState<{ request: string; response?: string }[]>([]);
53+
const [requestHistory, setRequestHistory] = useState<
54+
{ request: string; response?: string }[]
55+
>([]);
5156

5257
const pushHistory = (request: object, response?: object) => {
5358
setRequestHistory((prev) => [
@@ -61,7 +66,7 @@ export function useConnection({
6166

6267
const makeRequest = async <T extends z.ZodType>(
6368
request: ClientRequest,
64-
schema: T
69+
schema: T,
6570
) => {
6671
if (!mcpClient) {
6772
throw new Error("MCP client not connected");
@@ -80,14 +85,14 @@ export function useConnection({
8085
});
8186
pushHistory(request, response);
8287
} catch (error) {
83-
const errorMessage = error instanceof Error ? error.message : String(error);
88+
const errorMessage =
89+
error instanceof Error ? error.message : String(error);
8490
pushHistory(request, { error: errorMessage });
8591
throw error;
8692
} finally {
8793
clearTimeout(timeoutId);
8894
}
8995

90-
9196
return response;
9297
} catch (e: unknown) {
9398
const errorString = (e as Error).message ?? String(e);
@@ -140,13 +145,19 @@ export function useConnection({
140145
}
141146

142147
const clientTransport = new SSEClientTransport(backendUrl);
143-
148+
144149
if (onNotification) {
145-
client.setNotificationHandler(ProgressNotificationSchema, onNotification);
150+
client.setNotificationHandler(
151+
ProgressNotificationSchema,
152+
onNotification,
153+
);
146154
}
147155

148156
if (onStdErrNotification) {
149-
client.setNotificationHandler(StdErrNotificationSchema, onStdErrNotification);
157+
client.setNotificationHandler(
158+
StdErrNotificationSchema,
159+
onStdErrNotification,
160+
);
150161
}
151162

152163
await client.connect(clientTransport);
@@ -183,6 +194,6 @@ export function useConnection({
183194
requestHistory,
184195
makeRequest,
185196
sendNotification,
186-
connect
197+
connect,
187198
};
188-
}
199+
}

client/src/lib/hooks/useDraggablePane.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@ export function useDraggablePane(initialHeight: number) {
66
const dragStartY = useRef<number>(0);
77
const dragStartHeight = useRef<number>(0);
88

9-
const handleDragStart = useCallback((e: React.MouseEvent) => {
10-
setIsDragging(true);
11-
dragStartY.current = e.clientY;
12-
dragStartHeight.current = height;
13-
document.body.style.userSelect = "none";
14-
}, [height]);
9+
const handleDragStart = useCallback(
10+
(e: React.MouseEvent) => {
11+
setIsDragging(true);
12+
dragStartY.current = e.clientY;
13+
dragStartHeight.current = height;
14+
document.body.style.userSelect = "none";
15+
},
16+
[height],
17+
);
1518

16-
const handleDragMove = useCallback((e: MouseEvent) => {
17-
if (!isDragging) return;
18-
const deltaY = dragStartY.current - e.clientY;
19-
const newHeight = Math.max(100, Math.min(800, dragStartHeight.current + deltaY));
20-
setHeight(newHeight);
21-
}, [isDragging]);
19+
const handleDragMove = useCallback(
20+
(e: MouseEvent) => {
21+
if (!isDragging) return;
22+
const deltaY = dragStartY.current - e.clientY;
23+
const newHeight = Math.max(
24+
100,
25+
Math.min(800, dragStartHeight.current + deltaY),
26+
);
27+
setHeight(newHeight);
28+
},
29+
[isDragging],
30+
);
2231

2332
const handleDragEnd = useCallback(() => {
2433
setIsDragging(false);
@@ -39,6 +48,6 @@ export function useDraggablePane(initialHeight: number) {
3948
return {
4049
height,
4150
isDragging,
42-
handleDragStart
51+
handleDragStart,
4352
};
44-
}
53+
}

client/src/main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { StrictMode } from "react";
22
import { createRoot } from "react-dom/client";
3-
import { ToastContainer } from 'react-toastify';
4-
import 'react-toastify/dist/ReactToastify.css';
3+
import { ToastContainer } from "react-toastify";
4+
import "react-toastify/dist/ReactToastify.css";
55
import App from "./App.tsx";
66
import "./index.css";
77

client/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default defineConfig({
1414
minify: false,
1515
rollupOptions: {
1616
output: {
17-
manualChunks: undefined
18-
}
19-
}
20-
}
17+
manualChunks: undefined,
18+
},
19+
},
20+
},
2121
});

0 commit comments

Comments
 (0)