Skip to content

Conversation

@seedlord
Copy link
Contributor

@seedlord seedlord commented May 20, 2025

Related GitHub Issue

Closes: #3676

Description

This pull request introduces new functionality for managing MCP servers, primarily through the addition of two new buttons in the UI: "Reload All MCP Servers" and "Toggle All MCP Servers Enabled/Disabled".

Key changes include:

  • New UI Buttons: Two new buttons are added to the MCP view:
    • "Reload All MCP Servers": Triggers a restart of all currently active MCP servers.
    • "Toggle All MCP Servers Enabled/Disabled": Allows users to globally enable or disable all MCP servers. When servers are re-enabled, their configurations are reloaded.
  • Command Implementation: New VS Code commands (extension.reloadAllMcpServers and extension.toggleAllMcpServersDisabled) are implemented to handle the actions triggered by these buttons.
  • MCP Hub Logic: The McpHub service now includes toggleAllServersDisabled and restartAllMcpServers methods, which manage the state and reloading/restarting of MCP servers.
  • Webview Communication: The webview message handler and schema are updated to support the execution of VS Code commands from the webview, enabling the new button functionality.
  • Internationalization: Translations for the new button texts are added for both German and English.
  • Testing: Comprehensive unit tests have been added for the new MCP server management logic, specifically for toggleAllServersDisabled and restartAllMcpServers methods.

Test Procedure

All relevant unit tests, especially those covering McpHub.test.ts, pass successfully.
New tests explicitly verify the behavior of toggleAllServersDisabled (including the configuration reload when enabling servers) and restartAllMcpServers.
Manual testing confirms that after globally enabling/disabling MCP servers, configuration and servers are correctly reloaded, and that all active servers can be restarted as expected.

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

Screenshots / Videos

(Not applicable, as there are no UI changes)

Documentation Updates

  • No documentation updates are required.

Additional Notes

No further notes.


Important

Adds UI buttons and backend logic for reloading and toggling all MCP servers, with supporting commands and tests.

  • UI Changes:
    • Adds "Reload All MCP Servers" and "Toggle All MCP Servers Enabled/Disabled" buttons to McpView.tsx.
    • Updates translations in mcp.json for German and English.
  • Command Implementation:
    • Implements extension.reloadAllMcpServers and extension.toggleAllMcpServersDisabled in registerCommands.ts.
  • McpHub Logic:
    • Adds toggleAllServersDisabled and restartAllMcpServers methods to McpHub.ts.
  • Webview Communication:
    • Updates webviewMessageHandler.ts to handle executeVSCodeCommand messages.
  • Testing:
    • Adds unit tests for toggleAllServersDisabled and restartAllMcpServers in McpHub.test.ts.

This description was created by Ellipsis for cc278a6. You can customize this summary. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented May 20, 2025

⚠️ No Changeset found

Latest commit: 783cbc6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels May 20, 2025
seedlord and others added 3 commits May 20, 2025 03:46
@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap May 20, 2025
@seedlord seedlord force-pushed the feat/3676-mcp-reload-on-enable branch from 26009d2 to 03d96ab Compare May 21, 2025 01:54
@seedlord
Copy link
Contributor Author

seedlord commented May 21, 2025

reworked it to toggle by buttons instead of setting the checkbox.
grafik

initial description needs update

@seedlord seedlord changed the title feat: add toggle functionality for enabling/disabling all global MCP servers with configuration reload + Tests feat: add toggle functionality for enabling/disabling all MCP servers May 21, 2025
@seedlord seedlord changed the title feat: add toggle functionality for enabling/disabling all MCP servers feat: add toggle functionality for enabling/disabling/reloading all MCP servers May 21, 2025
@seedlord seedlord marked this pull request as draft May 21, 2025 23:13
@seedlord
Copy link
Contributor Author

Description updated. I think its ready for review

@seedlord seedlord marked this pull request as ready for review May 21, 2025 23:38
@hannesrudolph hannesrudolph moved this from PR [Needs Review] to TEMP in Roo Code Roadmap May 26, 2025
@daniel-lxs daniel-lxs moved this from TEMP to PR [Needs Review] in Roo Code Roadmap May 27, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Hey @seedlord, Thank you for the contribution, I left some questions and suggestions.

After you check that can you also review the merge conflicts?

Let me know if you have any questions, hopefully we can review this PR soon.

const allServers = this.getAllServers()

// Set the Disabled flag for all servers
for (const server of allServers) {
Copy link
Member

Choose a reason for hiding this comment

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

As also noted by a previous comment, updating server configurations sequentially in this loop:
for (const server of allServers) { await this.updateServerConfig(...); ... }
could be slow if there are many servers.

It might be a good idea to use Promise.all for the updateServerConfig calls to perform these updates concurrently, which could improve performance.

}),
)

await mcpHub.toggleAllServersDisabled(true)
Copy link
Member

Choose a reason for hiding this comment

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

In the test case it("should disable all servers when passed true", ...), the call to await mcpHub.toggleAllServersDisabled(true) and its subsequent assertions for fs.writeFile appear to be duplicated.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Draft / In Progress] in Roo Code Roadmap Jun 4, 2025
@daniel-lxs daniel-lxs marked this pull request as draft June 4, 2025 19:03
@seedlord
Copy link
Contributor Author

seedlord commented Jun 7, 2025

I am abroad. Gonna check next week when im home 👍

@seedlord
Copy link
Contributor Author

closed redundant pr #4267

@seedlord seedlord closed this Jun 11, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Jun 11, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 11, 2025
@seedlord seedlord deleted the feat/3676-mcp-reload-on-enable branch June 18, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Draft / In Progress size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Load changes to mcp_settings.json and mcp.json when toggling MCP on and off in Roo-code. Currently requires restarting extension.

2 participants