-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add Refresh MCP Servers capability, fix state changes in MCP server management UI view #4267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update contributors list
Revert "Update contributors list"
src/services/mcp/McpHub.ts
Outdated
| t("common:info.mcp_servers_active", { | ||
| mcpServers: `Global: ${globalServerNames.join(", ") || "none"}`, | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nitpicks on the internationalization that I can help out with later:
- I think this would probably be better in another namespace - is there something better suited than
common? - Ideally we can also translate "Global", "Project", and "none". I think maybe I would have a
global_mcp_servers_activeandproject_mcp_servers_activestrings in case the order is different in any languages. "none" can probably live under common .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ the i18n is always a little different project to project, figured there would be a little bit of a learning curve. Happy to expand any coverage as needed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mrubens, just circling back here to clean these up - should have some time after work tonight. I'm thinking todo items are:
- add
global_mcp_servers_activeandproject_mcp_servers_activein place of the generalmcp_servers_activewhere applicable - refac mcp related i18n strings from common.json into mcp.json (clarifying question below)
The pattern I was following was where the existing mcp server related information messages lived ie "common:info.mcp_server_connected" based on #3865582 but I see there's also the mcp.json in each locale so I'm thinking that is probably the right home? Let me know if that's the correct landing spot more than happy to handle the refac. I can move all the mcp related ones into mcp.json unless you'd prefer otherwise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added global and project level + i18n in current location and pushed up, will hold off until I hear otherwise as far as moving them into a different locale file. Looking at the structure, it appears you've got two different approaches:
- /src/i18n/locales/{locale}/ with
common.json&tools.jsonas the only options - /webview-ui/src/i18n/locales/{locale} with
account.jsonchat.jsoncommon.jsonmcp.jsonetc
The existing i18n in McpHub all pull from the former source so if approved I will refac to place all of those in mcp.json in their relevant webview-ui locale
|
Failing test doesn't appear related to this change so I won't touch it here to avoid complexity |
- Add flexWrap to button container to allow wrapping on smaller screens - Change buttons from fixed flex:1 to flex: 1 1 auto with minWidth - Ensures buttons maintain minimum readable width of 120px - Prevents button text from being truncated on narrow viewports
- Added createTextEditorDecorationType to vscode mock in McpHub.test.ts - Created execa mock to handle ESM module import issues - Fixes test failure that was exposed by PR RooCodeInc#4267's module loading changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @taylorwilsdon!
Looks good to me, it seems that the changes made to McpHub.ts exposed some issues with jest, but the changes were completely unrelated.
I solved the problems with the test to prevent this PR from causing issues when merged.
I also moved the translations and made the MCP buttons responsive since they were overflowing.
Awesome, appreciate you! I think this will be a popular one |
|
Made some additional changes to solve #4431 |
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Related GitHub Issue
Closes: #4265
Closes: #4431
Description
This PR introduces MCP server refresh (button & on save) while introducing reliable deletion for MCP server connections in the Roo Code extension. Wasn't sure if the i18n generation is something I should trigger myself or if it runs as a github action / workflow @mrubens sorry just getting up to speed here but if there's manual action there lmk (edit - did fail on missing i18n, went ahead and had gemini take a run at it - alas I only speak enough french and spanish to verify those particular ones 😂 )
Debugging why the refresh wasn't taking in the actual VSCode panel view stumped Opus and spent like $15 before I gave it up and figured it out the old fashioned way. While I don't usually like to mix feat and bugfix, this is a requirement for this to work (and any other UI updates after initialization of the widget, this actually fixes other stuff that would have reflected without restarting the extension now too)
Key points
refreshAllMcpServerscommand & UIWeb-view “Refresh MCP Servers” button (
McpView.tsx) sends a new"refreshAllMcpServers"message.webviewMessageHandlerroutes the message toMcpHub.refreshAllConnections(), whichisConnecting,mcp_settings.json,Deletion view update fix
notifyWebviewOfServerChanges()now chooses the correctClineProviderinstance before posting, ensuring that the list re-renders immediately after a delete.Supporting infrastructure
updateServerConnections()gainsmanageConnectingStateso internal calls (e.g., during refresh) do not erroneously block the UI.common.json,mcp.json).react-useuseEventwith nativewindow.addEventListenerto avoid double listeners during hot reloads.Reviewer focus
isConnectingflag.notifyWebviewOfServerChanges()(fallback logic).Test Procedure
Manual – refresh path
mcp_settings.json(global or project).Manual – delete path
Regression – existing flows
Type of Change
Pre-Submission Checklist
Screenshots / Videos
roo_mcp_after.mov
roo_mcp_before.mov
Documentation Updates
Additional Notes
The PR purposefully keeps
refreshAllConnections()self-contained to minimise surface area; future enhancements (e.g., per-server ping) can layer on top without altering UI contracts.Get in Touch
Discord: @taylorwilsdon
Important
Introduces MCP server refresh functionality and fixes deletion view update, with infrastructure improvements and i18n updates.
refreshAllMcpServerscommand inwebviewMessageHandler.tsto refresh MCP servers.refreshAllConnections()inMcpHub.tsto reload server configurations and notify UI.McpView.tsxto include "Refresh MCP Servers" button.notifyWebviewOfServerChanges()to select correctClineProviderinstance for immediate list re-render.manageConnectingStatetoupdateServerConnections()inMcpHub.tsto prevent UI blocking during refresh.useEventwithwindow.addEventListenerinExtensionStateContext.tsxfor message handling.common.jsonandmcp.jsonfor new messages and UI elements.This description was created by
for aeac9e4. You can customize this summary. It will automatically update as commits are pushed.