don't show full config keys

This commit is contained in:
Pulkit Sharma
2025-04-09 01:12:02 +05:30
parent 779ca20568
commit 48917ca4e5
4 changed files with 23 additions and 15 deletions

View File

@@ -95,10 +95,22 @@ const App = () => {
const [config, setConfig] = useState<InspectorConfig>(() => { const [config, setConfig] = useState<InspectorConfig>(() => {
const savedConfig = localStorage.getItem(CONFIG_LOCAL_STORAGE_KEY); const savedConfig = localStorage.getItem(CONFIG_LOCAL_STORAGE_KEY);
if (savedConfig) { if (savedConfig) {
return { // merge default config with saved config
const mergedConfig = {
...DEFAULT_INSPECTOR_CONFIG, ...DEFAULT_INSPECTOR_CONFIG,
...JSON.parse(savedConfig), ...JSON.parse(savedConfig),
} as InspectorConfig; } 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; return DEFAULT_INSPECTOR_CONFIG;
}); });

View File

@@ -326,7 +326,7 @@ const Sidebar = ({
<div key={key} className="space-y-2"> <div key={key} className="space-y-2">
<div className="flex items-center gap-1"> <div className="flex items-center gap-1">
<label className="text-sm font-medium text-green-600 break-all"> <label className="text-sm font-medium text-green-600 break-all">
{configKey} {configItem.description}
</label> </label>
<Tooltip> <Tooltip>
<TooltipTrigger asChild> <TooltipTrigger asChild>

View File

@@ -343,7 +343,7 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Timeout for requests to the MCP server (ms)", description: "Request Timeout",
value: 5000, value: 5000,
}, },
}), }),
@@ -366,8 +366,7 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_PROXY_FULL_ADDRESS: { MCP_PROXY_FULL_ADDRESS: {
description: description: "Inspector Proxy Address",
"Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
value: "http://localhost:8080", value: "http://localhost:8080",
}, },
}), }),
@@ -390,8 +389,7 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_REQUEST_MAX_TOTAL_TIMEOUT: { MCP_REQUEST_MAX_TOTAL_TIMEOUT: {
description: description: "Maximum Total Timeout",
"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",
value: 10000, value: 10000,
}, },
}), }),
@@ -412,7 +410,7 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Timeout for requests to the MCP server (ms)", description: "Request Timeout",
value: 0, value: 0,
}, },
}), }),
@@ -457,7 +455,7 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenLastCalledWith( expect(setConfig).toHaveBeenLastCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Timeout for requests to the MCP server (ms)", description: "Request Timeout",
value: 3000, value: 3000,
}, },
}), }),

View File

@@ -22,21 +22,19 @@ export const DEFAULT_MCP_PROXY_LISTEN_PORT = "6277";
**/ **/
export const DEFAULT_INSPECTOR_CONFIG: InspectorConfig = { export const DEFAULT_INSPECTOR_CONFIG: InspectorConfig = {
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Timeout for requests to the MCP server (ms)", description: "Request Timeout",
value: 10000, value: 10000,
}, },
MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS: { MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS: {
description: "Reset timeout on progress notifications", description: "Reset Timeout on Progress",
value: true, value: true,
}, },
MCP_REQUEST_MAX_TOTAL_TIMEOUT: { MCP_REQUEST_MAX_TOTAL_TIMEOUT: {
description: description: "Maximum Total Timeout",
"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",
value: 60000, value: 60000,
}, },
MCP_PROXY_FULL_ADDRESS: { MCP_PROXY_FULL_ADDRESS: {
description: description: "Inspector Proxy Address",
"Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
value: "", value: "",
}, },
} as const; } as const;