add label to configItem, use that in UI

This commit is contained in:
Pulkit Sharma
2025-04-09 01:24:23 +05:30
parent cf20fe9142
commit 9c6663c4c2
5 changed files with 25 additions and 12 deletions

View File

@@ -105,8 +105,7 @@ const App = () => {
Object.entries(mergedConfig).forEach(([key, value]) => { Object.entries(mergedConfig).forEach(([key, value]) => {
mergedConfig[key as keyof InspectorConfig] = { mergedConfig[key as keyof InspectorConfig] = {
...value, ...value,
description: label: DEFAULT_INSPECTOR_CONFIG[key as keyof InspectorConfig].label,
DEFAULT_INSPECTOR_CONFIG[key as keyof InspectorConfig].description,
}; };
}); });

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">
{configItem.description} {configItem.label}
</label> </label>
<Tooltip> <Tooltip>
<TooltipTrigger asChild> <TooltipTrigger asChild>

View File

@@ -343,7 +343,8 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Request Timeout", label: "Request Timeout",
description: "Timeout for requests to the MCP server (ms)",
value: 5000, value: 5000,
}, },
}), }),
@@ -366,7 +367,9 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_PROXY_FULL_ADDRESS: { MCP_PROXY_FULL_ADDRESS: {
description: "Inspector Proxy Address", label: "Inspector Proxy Address",
description:
"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",
}, },
}), }),
@@ -389,7 +392,9 @@ 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: "Maximum Total Timeout", label: "Maximum Total Timeout",
description:
"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",
value: 10000, value: 10000,
}, },
}), }),
@@ -410,7 +415,8 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenCalledWith( expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Request Timeout", label: "Request Timeout",
description: "Timeout for requests to the MCP server (ms)",
value: 0, value: 0,
}, },
}), }),
@@ -455,7 +461,8 @@ describe("Sidebar Environment Variables", () => {
expect(setConfig).toHaveBeenLastCalledWith( expect(setConfig).toHaveBeenLastCalledWith(
expect.objectContaining({ expect.objectContaining({
MCP_SERVER_REQUEST_TIMEOUT: { MCP_SERVER_REQUEST_TIMEOUT: {
description: "Request Timeout", label: "Request Timeout",
description: "Timeout for requests to the MCP server (ms)",
value: 3000, value: 3000,
}, },
}), }),

View File

@@ -1,4 +1,5 @@
export type ConfigItem = { export type ConfigItem = {
label: string;
description: string; description: string;
value: string | number | boolean; value: string | number | boolean;
}; };

View File

@@ -22,19 +22,25 @@ 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: "Request Timeout", label: "Request Timeout",
description: "Timeout for requests to the MCP server (ms)",
value: 10000, value: 10000,
}, },
MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS: { MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS: {
description: "Reset Timeout on Progress", label: "Reset Timeout on Progress",
description: "Reset timeout on progress notifications",
value: true, value: true,
}, },
MCP_REQUEST_MAX_TOTAL_TIMEOUT: { MCP_REQUEST_MAX_TOTAL_TIMEOUT: {
description: "Maximum Total Timeout", label: "Maximum Total Timeout",
description:
"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: "Inspector Proxy Address", label: "Inspector Proxy Address",
description:
"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;