Skip to content

ui: refine MCP Server tab layout and alignment#12957

Draft
rodrigosnader wants to merge 2 commits intomainfrom
ui/mcp-server-tab-layout
Draft

ui: refine MCP Server tab layout and alignment#12957
rodrigosnader wants to merge 2 commits intomainfrom
ui/mcp-server-tab-layout

Conversation

@rodrigosnader
Copy link
Copy Markdown
Contributor

@rodrigosnader rodrigosnader commented May 2, 2026

Summary

Refines the MCP Server tab layout in the home page so the two halves are visually aligned and the install content area is delimited:

  • Wraps the install/JSON content in a dashed bordered container (mirrors the empty-state pattern used elsewhere)
  • Moves the Edit Tools button next to the Flows/Tools label
  • Aligns the first chip row vertically with the Auto install / JSON tabs
  • Centers the Auth row vertically
  • Drops a redundant mt-4 in McpAutoInstallContent that was making the dashed box's top padding visually larger than its bottom padding

ToolsComponent change

To let McpFlowsSection render its own Edit Tools button (next to the section label) while still triggering the same modal, ToolsComponent now accepts:

  • hideButton?: boolean — skips rendering its internal absolute-positioned Edit button
  • open?: boolean / setOpen?: (open: boolean) => void — optional controlled modal state

When the new props are omitted, behavior is unchanged. The node parameter renderer (the other consumer) is untouched.

Screenshots

Before:
Screenshot 2026-05-01 at 21 11 18

After:
Screenshot 2026-05-01 at 21 10 08

Test plan

  • Jest suites: McpFlowsSection, McpServerTab, ToolsComponent, McpAuthSection, McpAutoInstallContent — 29 tests passing
  • No new TypeScript or biome errors introduced (only pre-existing ones in the same files)
  • Manual visual check of the MCP Server tab (light + dark themes, narrow + wide viewports)
  • Verify the Edit Tools modal still opens/closes correctly from the new external button
  • Verify the tools parameter renderer in nodes still looks the same (other consumer of ToolsComponent)

- Wrap install/JSON content in dashed bordered container
- Lift Edit Tools modal state to McpFlowsSection so the button can sit
  next to the Flows/Tools label
- Align first chip row with Auto install/JSON tabs
- Center Auth row vertically
- Drop redundant top margin in McpAutoInstallContent

ToolsComponent gains optional hideButton, open and setOpen props for
external trigger control.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Walkthrough

This PR refactors modal state management for MCP tool editing by introducing controlled/uncontrolled prop patterns to ToolsComponent, enabling parent components like McpFlowsSection to manage modal visibility. Additional layout refinements improve spacing and styling across the MCP server configuration interface.

Changes

MCP Tools Modal State & Layout Refinement

Layer / File(s) Summary
Type Definitions
src/frontend/src/components/core/parameterRenderComponent/types.ts
ToolsComponentType gains optional properties: hideButton, open, and setOpen for controlled modal state and button visibility control.
Core Component Implementation
src/frontend/src/components/core/parameterRenderComponent/components/ToolsComponent/index.tsx
ToolsComponent now supports controlled modal visibility via open/setOpen props, falling back to internal state when uncontrolled. hideButton prop suppresses the edit actions button. Padding adjusted conditionally based on button visibility.
Modal Integration & Wiring
src/frontend/src/pages/MainPage/pages/homePage/components/McpFlowsSection.tsx
McpFlowsSection introduces isModalOpen state and an "Edit Tools" button (with conditional styling via ENABLE_MCP_COMPOSER) that drives the modal. Controlled props open/setOpen and hideButton are passed to ToolsComponent to centralize modal management.
Layout & Styling Updates
src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx, src/frontend/src/pages/MainPage/pages/homePage/components/McpAuthSection.tsx, src/frontend/src/pages/MainPage/pages/homePage/components/McpAutoInstallContent.tsx
McpServerTab container gains rounded border and dashed styling (rounded-md border border-dashed border-border p-4). McpAuthSection adds vertical centering (items-center). McpAutoInstallContent removes top margin (mt-4).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 4 warnings)

Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error The PR lacks adequate test coverage for new ToolsComponent props (hideButton, open, setOpen) and their integration with McpFlowsSection. Add tests for controlled/uncontrolled modal behavior, prop passing, button rendering, and type safety to prevent runtime issues.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning No Jest test files found for the modified components despite claiming 29 passing tests in PR objectives. Provide test files for ToolsComponent, McpFlowsSection, McpServerTab, McpAuthSection, and McpAutoInstallContent or correct the PR objectives claim.
Test File Naming And Structure ⚠️ Warning Test files do not adequately cover new ToolsComponent functionality, modal state management, and prop constraints. Create comprehensive ToolsComponent test suite and expand McpFlowsSection tests to verify modal behavior, prop passing, and type system enforcement.
Excessive Mock Usage Warning ⚠️ Warning PR introduces controlled modal state and new props but tests use excessive mocks that prevent validation of new behavior and component integration. Add integration tests verifying controlled modal functionality, hideButton prop behavior, and state management without mocking ToolsComponent or McpFlowsSection.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary focus of the changeset: refining the MCP Server tab layout and alignment through CSS adjustments, container styling, and modal state management.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ui/mcp-server-tab-layout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

❌ Patch coverage is 79.51807% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.90%. Comparing base (b09d942) to head (c3bd0d6).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
...enderComponent/components/ToolsComponent/index.tsx 36.36% 14 Missing ⚠️
.../components/core/parameterRenderComponent/types.ts 0.00% 3 Missing ⚠️

❌ Your project check has failed because the head coverage (50.21%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12957      +/-   ##
==========================================
- Coverage   52.99%   52.90%   -0.09%     
==========================================
  Files        2030     2031       +1     
  Lines      183826   184013     +187     
  Branches    26169    26231      +62     
==========================================
- Hits        97415    97359      -56     
- Misses      85312    85546     +234     
- Partials     1099     1108       +9     
Flag Coverage Δ
backend 56.19% <ø> (-0.01%) ⬇️
frontend 52.78% <79.51%> (-0.18%) ⬇️
lfx 50.21% <ø> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nPage/pages/homePage/components/McpAuthSection.tsx 93.75% <100.00%> (ø)
...ages/homePage/components/McpAutoInstallContent.tsx 96.03% <100.00%> (ø)
...Page/pages/homePage/components/McpFlowsSection.tsx 95.40% <100.00%> (+3.73%) ⬆️
...ainPage/pages/homePage/components/McpServerTab.tsx 96.53% <100.00%> (ø)
.../components/core/parameterRenderComponent/types.ts 0.00% <0.00%> (ø)
...enderComponent/components/ToolsComponent/index.tsx 33.50% <36.36%> (+2.78%) ⬆️

... and 190 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/frontend/src/pages/MainPage/pages/homePage/components/McpFlowsSection.tsx (1)

55-68: 💤 Low value

button_description="Edit Tools" is dead code when hideButton is true.

ToolsComponent only uses button_description inside the !hideButton && (...) block. Since hideButton is always true here, this prop is never read.

🧹 Proposed cleanup
 <ToolsComponent
   value={flowsMCPData}
   title="MCP Server Tools"
   description="Select tools to add to this server"
   handleOnNewValue={handleOnNewValue}
   id="mcp-server-tools"
-  button_description="Edit Tools"
   editNode={false}
   isAction
   disabled={false}
   hideButton
   open={isModalOpen}
   setOpen={setIsModalOpen}
 />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/frontend/src/pages/MainPage/pages/homePage/components/McpFlowsSection.tsx`
around lines 55 - 68, ToolsComponent is being passed button_description="Edit
Tools" while hideButton={true}, so that prop is dead; remove the unused prop
from the ToolsComponent invocation in McpFlowsSection (i.e., delete the
button_description="Edit Tools" attribute) to clean up dead code, or
alternatively make hideButton configurable if you actually need the button;
ensure changes reference the ToolsComponent props (button_description,
hideButton) and update any related prop typings if necessary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/frontend/src/components/core/parameterRenderComponent/types.ts`:
- Around line 62-64: The open/setOpen pair must be required together or not at
all; update the prop type that currently declares hideButton?: boolean; open?:
boolean; setOpen?: (open: boolean) => void to a discriminated union so consumers
cannot pass only one of open or setOpen. Replace the separate optional fields
with a combined type such as hideButton?: boolean plus a union for controlled vs
uncontrolled (controlled branch requires both open and setOpen, uncontrolled
branch forbids both), referencing the existing symbols open and setOpen in the
union so the compiler enforces they come as a pair.

---

Nitpick comments:
In
`@src/frontend/src/pages/MainPage/pages/homePage/components/McpFlowsSection.tsx`:
- Around line 55-68: ToolsComponent is being passed button_description="Edit
Tools" while hideButton={true}, so that prop is dead; remove the unused prop
from the ToolsComponent invocation in McpFlowsSection (i.e., delete the
button_description="Edit Tools" attribute) to clean up dead code, or
alternatively make hideButton configurable if you actually need the button;
ensure changes reference the ToolsComponent props (button_description,
hideButton) and update any related prop typings if necessary.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 61dbd3e5-cd43-4b5c-a4b9-b6fd2edad633

📥 Commits

Reviewing files that changed from the base of the PR and between 2c021ac and fa481e9.

📒 Files selected for processing (6)
  • src/frontend/src/components/core/parameterRenderComponent/components/ToolsComponent/index.tsx
  • src/frontend/src/components/core/parameterRenderComponent/types.ts
  • src/frontend/src/pages/MainPage/pages/homePage/components/McpAuthSection.tsx
  • src/frontend/src/pages/MainPage/pages/homePage/components/McpAutoInstallContent.tsx
  • src/frontend/src/pages/MainPage/pages/homePage/components/McpFlowsSection.tsx
  • src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx

Comment on lines +62 to +64
hideButton?: boolean;
open?: boolean;
setOpen?: (open: boolean) => void;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

open and setOpen are independently optional — partial usage silently breaks the modal.

Because these two props are separate ?: fields, TypeScript permits passing only open or only setOpen. Both partial cases silently malfunction at runtime:

  • open provided, setOpen omitted → setIsModalOpen = setInternalOpen; closing the modal updates internalOpen but isModalOpen = open ?? internalOpen always returns the external open value, so the modal is permanently stuck open.
  • setOpen provided, open omitted → isModalOpen = internalOpen; every call to setIsModalOpen goes to the external setter but never updates internalOpen, so the modal never opens or closes from the component's perspective.

Constrain the type so both must be present together or absent together:

🛡️ Proposed fix — enforce controlled/uncontrolled as a unit
 export type ToolsComponentType = {
   description: string;
   title: string;
   icon?: string;
   button_description?: string;
   isAction?: boolean;
   template?: APITemplateType;
   hideButton?: boolean;
-  open?: boolean;
-  setOpen?: (open: boolean) => void;
-};
+} & (
+  | { open?: never; setOpen?: never }
+  | { open: boolean; setOpen: (open: boolean) => void }
+);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/frontend/src/components/core/parameterRenderComponent/types.ts` around
lines 62 - 64, The open/setOpen pair must be required together or not at all;
update the prop type that currently declares hideButton?: boolean; open?:
boolean; setOpen?: (open: boolean) => void to a discriminated union so consumers
cannot pass only one of open or setOpen. Replace the separate optional fields
with a combined type such as hideButton?: boolean plus a union for controlled vs
uncontrolled (controlled branch requires both open and setOpen, uncontrolled
branch forbids both), referencing the existing symbols open and setOpen in the
union so the compiler enforces they come as a pair.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 35%
35.27% (40453/114671) 68.06% (5580/8198) 35.86% (940/2621)

Unit Test Results

Tests Skipped Failures Errors Time
4007 0 💤 0 ❌ 0 🔥 7m 55s ⏱️

When the consumer renders its own trigger button (hideButton=true), the
empty state now shows just a subtle left-aligned message instead of the
dashed bordered box with a redundant Add button.

Renames the empty-state copy from "actions" to "tools" to match the
MCP Server tab terminology.
@rodrigosnader rodrigosnader marked this pull request as draft May 2, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant