From 925d11a91dc7fd61c95d45006a2226ee59497788 Mon Sep 17 00:00:00 2001 From: oleina Date: Fri, 11 Jul 2025 11:18:01 -0700 Subject: [PATCH 01/24] initalize logging for UI --- client/src/App.tsx | 1 + client/src/lib/hooks/useConnection.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/client/src/App.tsx b/client/src/App.tsx index cff51b4f..bef4ec4e 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -204,6 +204,7 @@ const App = () => { ]); }, getRoots: () => rootsRef.current, + defaultLoggingLevel: "debug" }); useEffect(() => { diff --git a/client/src/lib/hooks/useConnection.ts b/client/src/lib/hooks/useConnection.ts index 9009e698..1ef55154 100644 --- a/client/src/lib/hooks/useConnection.ts +++ b/client/src/lib/hooks/useConnection.ts @@ -28,6 +28,7 @@ import { ToolListChangedNotificationSchema, PromptListChangedNotificationSchema, Progress, + LoggingLevel, } from "@modelcontextprotocol/sdk/types.js"; import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js"; import { useState } from "react"; @@ -63,6 +64,7 @@ interface UseConnectionOptions { onPendingRequest?: (request: any, resolve: any, reject: any) => void; // eslint-disable-next-line @typescript-eslint/no-explicit-any getRoots?: () => any[]; + defaultLoggingLevel?: LoggingLevel, } export function useConnection({ @@ -78,6 +80,7 @@ export function useConnection({ onStdErrNotification, onPendingRequest, getRoots, + defaultLoggingLevel, }: UseConnectionOptions) { const [connectionStatus, setConnectionStatus] = useState("disconnected"); @@ -521,6 +524,10 @@ export function useConnection({ }); } + if (capabilities?.logging && defaultLoggingLevel) { + await client.setLoggingLevel(defaultLoggingLevel); + } + setMcpClient(client); setConnectionStatus("connected"); } catch (e) { From f4d9bf6d5ee9cb00fa4a04f12a6e48230b7dc58f Mon Sep 17 00:00:00 2001 From: oleina Date: Fri, 11 Jul 2025 11:18:01 -0700 Subject: [PATCH 02/24] initalize logging for cli mode --- cli/src/client/connection.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli/src/client/connection.ts b/cli/src/client/connection.ts index 931f803d..dcbe8e51 100644 --- a/cli/src/client/connection.ts +++ b/cli/src/client/connection.ts @@ -18,6 +18,12 @@ export async function connect( ): Promise { try { await client.connect(transport); + + if (client.getServerCapabilities()?.logging) { + // default logging level is undefined in the spec, but the user of the + // inspector most likely wants debug. + await client.setLoggingLevel("debug"); + } } catch (error) { throw new Error( `Failed to connect to MCP server: ${error instanceof Error ? error.message : String(error)}`, From 1c8bf36ea2b35ee4d76472e4c883fbf31c522cb2 Mon Sep 17 00:00:00 2001 From: Konstantin Konstantinov Date: Sun, 13 Jul 2025 08:42:46 +0300 Subject: [PATCH 03/24] generate random state parameter in oauth state machine --- client/src/lib/oauth-state-machine.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/lib/oauth-state-machine.ts b/client/src/lib/oauth-state-machine.ts index d87b3ecd..b3307af9 100644 --- a/client/src/lib/oauth-state-machine.ts +++ b/client/src/lib/oauth-state-machine.ts @@ -113,6 +113,13 @@ export const oauthTransitions: Record = { scope = metadata.scopes_supported.join(" "); } + // Generate a random state + const array = new Uint8Array(32); + crypto.getRandomValues(array); + const state = Array.from(array, (byte) => + byte.toString(16).padStart(2, '0'), + ).join(''); + const { authorizationUrl, codeVerifier } = await startAuthorization( context.serverUrl, { @@ -120,6 +127,7 @@ export const oauthTransitions: Record = { clientInformation, redirectUrl: context.provider.redirectUrl, scope, + state: state, resource: context.state.resource ?? undefined, }, ); From 4ef85f744c5ee96ddefb97620f36ddc79d1de640 Mon Sep 17 00:00:00 2001 From: Konstantin Konstantinov Date: Sun, 13 Jul 2025 08:44:57 +0300 Subject: [PATCH 04/24] generate random state parameter in oauth state machine --- client/src/lib/oauth-state-machine.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/lib/oauth-state-machine.ts b/client/src/lib/oauth-state-machine.ts index b3307af9..5078cfe4 100644 --- a/client/src/lib/oauth-state-machine.ts +++ b/client/src/lib/oauth-state-machine.ts @@ -117,8 +117,8 @@ export const oauthTransitions: Record = { const array = new Uint8Array(32); crypto.getRandomValues(array); const state = Array.from(array, (byte) => - byte.toString(16).padStart(2, '0'), - ).join(''); + byte.toString(16).padStart(2, "0"), + ).join(""); const { authorizationUrl, codeVerifier } = await startAuthorization( context.serverUrl, From 5dd661513bbc641422a491646ccf0d1210336287 Mon Sep 17 00:00:00 2001 From: Eric Horacek Date: Sun, 13 Jul 2025 14:33:39 -0700 Subject: [PATCH 05/24] feat: Add _meta field support to tool UI Shows [_meta](https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta) fields if present when listing and calling tools --- client/src/components/ToolResults.tsx | 8 ++ client/src/components/ToolsTab.tsx | 33 ++++++++ .../components/__tests__/ToolsTab.test.tsx | 81 +++++++++++++++++++ 3 files changed, 122 insertions(+) diff --git a/client/src/components/ToolResults.tsx b/client/src/components/ToolResults.tsx index a3cecf55..6479b5fb 100644 --- a/client/src/components/ToolResults.tsx +++ b/client/src/components/ToolResults.tsx @@ -154,6 +154,14 @@ const ToolResults = ({ )} + {structuredResult._meta && ( +
+
Meta:
+
+ +
+
+ )} {!structuredResult.structuredContent && validationResult && !validationResult.isValid && ( diff --git a/client/src/components/ToolsTab.tsx b/client/src/components/ToolsTab.tsx index 3c7db84e..fcd3ffbd 100644 --- a/client/src/components/ToolsTab.tsx +++ b/client/src/components/ToolsTab.tsx @@ -46,6 +46,7 @@ const ToolsTab = ({ const [params, setParams] = useState>({}); const [isToolRunning, setIsToolRunning] = useState(false); const [isOutputSchemaExpanded, setIsOutputSchemaExpanded] = useState(false); + const [isMetaExpanded, setIsMetaExpanded] = useState(false); useEffect(() => { const params = Object.entries( @@ -245,6 +246,38 @@ const ToolsTab = ({ )} + {selectedTool && (selectedTool as any)._meta && ( +
+
+

Meta:

+ +
+
+ +
+
+ )} + +
- {isMetaExpanded ? ( - <> - - Collapse - - ) : ( - <> - - Expand - - )} - + +
-
- -
- - )} + )}