Skip to content

fix: MCP connection refresh state#12931

Open
erichare wants to merge 8 commits intorelease-1.10.0from
fix/mcp-connection-refresh-state
Open

fix: MCP connection refresh state#12931
erichare wants to merge 8 commits intorelease-1.10.0from
fix/mcp-connection-refresh-state

Conversation

@erichare
Copy link
Copy Markdown
Collaborator

Summary

  • Add an MCP server refresh action on the MCP node parameter control.
  • Force backend MCP tool reloads when refresh is requested, bypassing stale options/cache and surfacing the concrete connection error in the tool placeholder.
  • Clear stale frontend error status after successful MCP template refreshes and show selected server errors directly in the node UI.

Root Cause

MCP server/tool refreshes could reuse existing dropdown options or cache entries, so a node that had previously failed could keep stale frontend error state even after the backend had successfully refreshed the server configuration. Error placeholders also collapsed connection failures into generic text.

Validation

  • uv run pytest src/backend/tests/unit/components/models_and_agents/test_mcp_component_dynamic.py -q
  • npm test -- McpComponent.test.tsx --runInBand
  • npm run lint:types -- src/components/core/parameterRenderComponent/components/mcpComponent/index.tsx src/components/core/parameterRenderComponent/components/mcpComponent/__tests__/McpComponent.test.tsx
  • uv run ruff format src/lfx/src/lfx/components/models_and_agents/mcp_component.py src/backend/tests/unit/components/models_and_agents/test_mcp_component_dynamic.py --check
  • pre-commit hooks via uv run git commit
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fc243afe-8129-429e-af24-2215358bf9ad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mcp-connection-refresh-state

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.

@erichare erichare marked this pull request as ready for review April 29, 2026 17:08
@erichare erichare changed the title [codex] Fix MCP connection refresh state Apr 29, 2026
@github-actions github-actions Bot added the bug Something isn't working label Apr 29, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 95.23810% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.12%. Comparing base (e68e33e) to head (3bdb73d).
⚠️ Report is 1 commits behind head on release-1.10.0.

Files with missing lines Patch % Lines
...rRenderComponent/components/mcpComponent/index.tsx 94.65% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##           release-1.10.0   #12931       +/-   ##
===================================================
+ Coverage           41.71%   54.12%   +12.41%     
===================================================
  Files                1909     2051      +142     
  Lines              175706   188193    +12487     
  Branches            10132    27910    +17778     
===================================================
+ Hits                73297   101864    +28567     
+ Misses             101298    85217    -16081     
- Partials             1111     1112        +1     
Flag Coverage Δ
backend 57.12% <ø> (+1.95%) ⬆️
frontend 54.42% <95.23%> (+18.20%) ⬆️
lfx 49.76% <ø> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...controllers/API/queries/mcp/use-get-mcp-servers.ts 69.90% <100.00%> (+69.90%) ⬆️
...rRenderComponent/components/mcpComponent/index.tsx 86.14% <94.65%> (+86.14%) ⬆️

... and 1176 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.
@erichare erichare force-pushed the fix/mcp-connection-refresh-state branch from e741cdd to 7c2e84e Compare April 29, 2026 17:18
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 36%
36.44% (42454/116484) 67.67% (5819/8598) 36.25% (973/2684)

Unit Test Results

Tests Skipped Failures Errors Time
4097 0 💤 0 ❌ 0 🔥 8m 56s ⏱️
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 29, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 29, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Apr 29, 2026
Copy link
Copy Markdown
Member

@Cristhianzl Cristhianzl left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Apr 29, 2026
@github-actions github-actions Bot removed the bug Something isn't working label Apr 30, 2026
@github-actions github-actions Bot added the bug Something isn't working label Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

2 participants