Add auto open disabled environment option to sidebar

This commit is contained in:
KAWAKAMI Moeki
2025-04-13 21:53:42 +09:00
parent d2cb2338a0
commit 52564dd7c5
4 changed files with 53 additions and 4 deletions

View File

@@ -386,7 +386,6 @@ const Sidebar = ({
/> />
) : typeof configItem.value === "boolean" ? ( ) : typeof configItem.value === "boolean" ? (
<Select <Select
data-testid={`${configKey}-select`}
value={configItem.value.toString()} value={configItem.value.toString()}
onValueChange={(val) => { onValueChange={(val) => {
const newConfig = { ...config }; const newConfig = { ...config };
@@ -397,12 +396,25 @@ const Sidebar = ({
setConfig(newConfig); setConfig(newConfig);
}} }}
> >
<SelectTrigger id={`${configKey}-input`}> <SelectTrigger
id={`${configKey}-input`}
data-testid={`${configKey}-input`}
>
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="true">True</SelectItem> <SelectItem
<SelectItem value="false">False</SelectItem> data-testid={`${configKey}-input-true`}
value="true"
>
True
</SelectItem>
<SelectItem
data-testid={`${configKey}-input-false`}
value="false"
>
False
</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
) : ( ) : (

View File

@@ -423,6 +423,33 @@ describe("Sidebar Environment Variables", () => {
); );
}); });
it("should update auto browser open disabled", () => {
const setConfig = jest.fn();
renderSidebar({ config: DEFAULT_INSPECTOR_CONFIG, setConfig });
openConfigSection();
const autoOpenDisabledInput = screen.getByTestId(
"MCP_AUTO_OPEN_DISABLED-input",
);
fireEvent.click(autoOpenDisabledInput);
const trueOption = screen.getByTestId(
"MCP_AUTO_OPEN_DISABLED-input-true",
);
fireEvent.click(trueOption);
expect(setConfig).toHaveBeenCalledWith(
expect.objectContaining({
MCP_AUTO_OPEN_DISABLED: {
label: "Auto Browser Open Disabled",
description:
"Disable automatic browser opening when inspector starts",
value: true,
},
}),
);
});
it("should maintain configuration state after multiple updates", () => { it("should maintain configuration state after multiple updates", () => {
const setConfig = jest.fn(); const setConfig = jest.fn();
const { rerender } = renderSidebar({ const { rerender } = renderSidebar({

View File

@@ -33,4 +33,9 @@ export type InspectorConfig = {
* The full address of the MCP Proxy Server, in case it is running on a non-default address. Example: http://10.1.1.22:5577 * The full address of the MCP Proxy Server, in case it is running on a non-default address. Example: http://10.1.1.22:5577
*/ */
MCP_PROXY_FULL_ADDRESS: ConfigItem; MCP_PROXY_FULL_ADDRESS: ConfigItem;
/**
* Disable automatic browser opening when inspector starts.
*/
MCP_AUTO_OPEN_DISABLED: ConfigItem;
}; };

View File

@@ -43,4 +43,9 @@ export const DEFAULT_INSPECTOR_CONFIG: InspectorConfig = {
"Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577", "Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
value: "", value: "",
}, },
MCP_AUTO_OPEN_DISABLED: {
label: "Auto Browser Open Disabled",
description: "Disable automatic browser opening when inspector starts",
value: false,
},
} as const; } as const;