From 48917ca4e5f3aefd4207f49fb82afa94c91c5c92 Mon Sep 17 00:00:00 2001 From: Pulkit Sharma Date: Wed, 9 Apr 2025 01:12:02 +0530 Subject: [PATCH] don't show full config keys --- client/src/App.tsx | 14 +++++++++++++- client/src/components/Sidebar.tsx | 2 +- client/src/components/__tests__/Sidebar.test.tsx | 12 +++++------- client/src/lib/constants.ts | 10 ++++------ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 68d67a9..e2aab1b 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -95,10 +95,22 @@ const App = () => { const [config, setConfig] = useState(() => { const savedConfig = localStorage.getItem(CONFIG_LOCAL_STORAGE_KEY); if (savedConfig) { - return { + // merge default config with saved config + const mergedConfig = { ...DEFAULT_INSPECTOR_CONFIG, ...JSON.parse(savedConfig), } as InspectorConfig; + + // update description of keys to match the new description (in case of any updates to the default config description) + Object.entries(mergedConfig).forEach(([key, value]) => { + mergedConfig[key as keyof InspectorConfig] = { + ...value, + description: + DEFAULT_INSPECTOR_CONFIG[key as keyof InspectorConfig].description, + }; + }); + + return mergedConfig; } return DEFAULT_INSPECTOR_CONFIG; }); diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 039453e..2ef54b1 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -326,7 +326,7 @@ const Sidebar = ({
diff --git a/client/src/components/__tests__/Sidebar.test.tsx b/client/src/components/__tests__/Sidebar.test.tsx index 4d0e3f1..f373a41 100644 --- a/client/src/components/__tests__/Sidebar.test.tsx +++ b/client/src/components/__tests__/Sidebar.test.tsx @@ -343,7 +343,7 @@ describe("Sidebar Environment Variables", () => { expect(setConfig).toHaveBeenCalledWith( expect.objectContaining({ MCP_SERVER_REQUEST_TIMEOUT: { - description: "Timeout for requests to the MCP server (ms)", + description: "Request Timeout", value: 5000, }, }), @@ -366,8 +366,7 @@ describe("Sidebar Environment Variables", () => { expect(setConfig).toHaveBeenCalledWith( expect.objectContaining({ MCP_PROXY_FULL_ADDRESS: { - description: - "Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577", + description: "Inspector Proxy Address", value: "http://localhost:8080", }, }), @@ -390,8 +389,7 @@ describe("Sidebar Environment Variables", () => { expect(setConfig).toHaveBeenCalledWith( expect.objectContaining({ MCP_REQUEST_MAX_TOTAL_TIMEOUT: { - description: - "Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)", + description: "Maximum Total Timeout", value: 10000, }, }), @@ -412,7 +410,7 @@ describe("Sidebar Environment Variables", () => { expect(setConfig).toHaveBeenCalledWith( expect.objectContaining({ MCP_SERVER_REQUEST_TIMEOUT: { - description: "Timeout for requests to the MCP server (ms)", + description: "Request Timeout", value: 0, }, }), @@ -457,7 +455,7 @@ describe("Sidebar Environment Variables", () => { expect(setConfig).toHaveBeenLastCalledWith( expect.objectContaining({ MCP_SERVER_REQUEST_TIMEOUT: { - description: "Timeout for requests to the MCP server (ms)", + description: "Request Timeout", value: 3000, }, }), diff --git a/client/src/lib/constants.ts b/client/src/lib/constants.ts index f594827..1a772f5 100644 --- a/client/src/lib/constants.ts +++ b/client/src/lib/constants.ts @@ -22,21 +22,19 @@ export const DEFAULT_MCP_PROXY_LISTEN_PORT = "6277"; **/ export const DEFAULT_INSPECTOR_CONFIG: InspectorConfig = { MCP_SERVER_REQUEST_TIMEOUT: { - description: "Timeout for requests to the MCP server (ms)", + description: "Request Timeout", value: 10000, }, MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS: { - description: "Reset timeout on progress notifications", + description: "Reset Timeout on Progress", value: true, }, MCP_REQUEST_MAX_TOTAL_TIMEOUT: { - description: - "Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)", + description: "Maximum Total Timeout", value: 60000, }, MCP_PROXY_FULL_ADDRESS: { - description: - "Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577", + description: "Inspector Proxy Address", value: "", }, } as const;