Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: prevent add custom server button from being shrunk by flex header (#429)

Hiep Le301273dae1a2
diff --git a/__tests__/routes/mcp-page.test.tsx b/__tests__/routes/mcp-page.test.tsx
index 311b5146d9..df4085e0e3 100644
--- a/__tests__/routes/mcp-page.test.tsx
+++ b/__tests__/routes/mcp-page.test.tsx
@@ -265,4 +265,17 @@ describe("MCPPage", () => {
slack_1: { env: { SLACK_BOT_TOKEN: "xoxb-new", SLACK_TEAM_ID: "T02" } },
});
});
+
+ it("opens the custom server editor when the header 'Add custom server' button is clicked", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());
+
+ renderPage();
+
+ const addCustomBtn = await screen.findByTestId("mcp-add-custom-server");
+ fireEvent.click(addCustomBtn);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("mcp-custom-editor")).toBeInTheDocument();
+ });
+ });
});
diff --git a/src/routes/mcp.tsx b/src/routes/mcp.tsx
index 10ab763c30..06d96d79f2 100644
--- a/src/routes/mcp.tsx
+++ b/src/routes/mcp.tsx
@@ -152,6 +152,7 @@ export default function MCPPage() {
type="button"
variant="secondary"
testId="mcp-add-custom-server"
+ className="flex-shrink-0 whitespace-nowrap"
onClick={() => setEditingServer({ id: "", type: "sse" })}
>
{t(I18nKey.MCP$ADD_CUSTOM)}