Skip to content

Commit 52564dd

Browse files
committed
Add auto open disabled environment option to sidebar
1 parent d2cb233 commit 52564dd

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

client/src/components/Sidebar.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ const Sidebar = ({
386386
/>
387387
) : typeof configItem.value === "boolean" ? (
388388
<Select
389-
data-testid={`${configKey}-select`}
390389
value={configItem.value.toString()}
391390
onValueChange={(val) => {
392391
const newConfig = { ...config };
@@ -397,12 +396,25 @@ const Sidebar = ({
397396
setConfig(newConfig);
398397
}}
399398
>
400-
<SelectTrigger id={`${configKey}-input`}>
399+
<SelectTrigger
400+
id={`${configKey}-input`}
401+
data-testid={`${configKey}-input`}
402+
>
401403
<SelectValue />
402404
</SelectTrigger>
403405
<SelectContent>
404-
<SelectItem value="true">True</SelectItem>
405-
<SelectItem value="false">False</SelectItem>
406+
<SelectItem
407+
data-testid={`${configKey}-input-true`}
408+
value="true"
409+
>
410+
True
411+
</SelectItem>
412+
<SelectItem
413+
data-testid={`${configKey}-input-false`}
414+
value="false"
415+
>
416+
False
417+
</SelectItem>
406418
</SelectContent>
407419
</Select>
408420
) : (

client/src/components/__tests__/Sidebar.test.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,33 @@ describe("Sidebar Environment Variables", () => {
423423
);
424424
});
425425

426+
it("should update auto browser open disabled", () => {
427+
const setConfig = jest.fn();
428+
renderSidebar({ config: DEFAULT_INSPECTOR_CONFIG, setConfig });
429+
430+
openConfigSection();
431+
432+
const autoOpenDisabledInput = screen.getByTestId(
433+
"MCP_AUTO_OPEN_DISABLED-input",
434+
);
435+
fireEvent.click(autoOpenDisabledInput);
436+
const trueOption = screen.getByTestId(
437+
"MCP_AUTO_OPEN_DISABLED-input-true",
438+
);
439+
fireEvent.click(trueOption);
440+
441+
expect(setConfig).toHaveBeenCalledWith(
442+
expect.objectContaining({
443+
MCP_AUTO_OPEN_DISABLED: {
444+
label: "Auto Browser Open Disabled",
445+
description:
446+
"Disable automatic browser opening when inspector starts",
447+
value: true,
448+
},
449+
}),
450+
);
451+
});
452+
426453
it("should maintain configuration state after multiple updates", () => {
427454
const setConfig = jest.fn();
428455
const { rerender } = renderSidebar({

client/src/lib/configurationTypes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,9 @@ export type InspectorConfig = {
3333
* 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
3434
*/
3535
MCP_PROXY_FULL_ADDRESS: ConfigItem;
36+
37+
/**
38+
* Disable automatic browser opening when inspector starts.
39+
*/
40+
MCP_AUTO_OPEN_DISABLED: ConfigItem;
3641
};

client/src/lib/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,9 @@ export const DEFAULT_INSPECTOR_CONFIG: InspectorConfig = {
4343
"Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
4444
value: "",
4545
},
46+
MCP_AUTO_OPEN_DISABLED: {
47+
label: "Auto Browser Open Disabled",
48+
description: "Disable automatic browser opening when inspector starts",
49+
value: false,
50+
},
4651
} as const;

0 commit comments

Comments
 (0)