-
Notifications
You must be signed in to change notification settings - Fork 2.7k
enhancement: Add mode-specific MCP server profiles #10423
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
base: main
Are you sure you want to change the base?
enhancement: Add mode-specific MCP server profiles #10423
Conversation
Implement mode-specific MCP server profiles enabling users to assign different MCP servers to different modes through a multiselect UI in the Modes tab. Added modeToProfile mapping to MCP configuration with server filtering based on active mode. Includes backend filtering logic in McpHub, UI components in ModesView, message handlers for state management, comprehensive tests (41 new tests), and documentation. Backward compatible - modes without profiles use all servers.
Reviewed the latest changes (1e18199). This commit restores three test describe blocks that were accidentally removed. No new issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| // Update MCP Hub with the new active mode | ||
| const mcpHub = this.getMcpHub() | ||
| if (mcpHub) { | ||
| await mcpHub.setActiveMode(newMode) |
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.
This correctly sets the active mode when the user explicitly switches modes, but the same call is missing in createTaskWithHistoryItem(). When a task is resumed from history, the mode is restored via updateGlobalState("mode", historyItem.mode) around line 880, but mcpHub.setActiveMode() is never called. This means MCP server filtering won't work for resumed tasks because activeMode remains undefined in McpHub. Consider adding similar logic after the mode restoration in createTaskWithHistoryItem().
Fix it with Roo Code or mention @roomote and request a fix.
…nt variables in test
Implement mode-specific MCP server profiles enabling users to assign different MCP servers to different modes through a multiselect UI in the Modes tab. Added modeToProfile mapping to MCP configuration with server filtering based on active mode. Includes backend filtering logic in McpHub, UI components in ModesView, message handlers for state management, comprehensive tests (41 new tests), and documentation. Backward compatible - modes without profiles use all servers.
Related GitHub Issue
Closes: #9014
Description
Implemented mode-specific MCP server profiles through a
modeToProfilemapping in MCP configuration. Key implementation details:McpHubwithsetActiveMode(),getModeToProfileMapping(), andupdateModeToProfileMapping()methods. ThegetServers()method now filters servers based on the active mode's profile. Config loading merges global and project mappings (project takes precedence).ModesViewfor assigning servers to modes. Shows "All servers available" when no servers selected (backward compatible behavior).webviewMessageHandlerand integrated mode switching with MCP filtering inClineProvider.Reviewers: Pay attention to the server filtering logic in
McpHub.getServers()and ensure the backward compatibility path (modes without profiles use all servers) works correctly.Test Procedure
Automated Testing:
cd src && npx vitest run services/mcp/__tests__/McpHub.spec.ts(24 new tests)cd webview-ui && npx vitest run src/components/modes/__tests__/ModesView.spec.tsx(18 new tests)cd src && npx tsc --noEmitandcd webview-ui && npx tsc --noEmitManual Testing:
~/.roo-code/settings/mcp_settings.jsonor.roo/mcp.json) to verifymodeToProfilemapping is persistedBackward Compatibility:
modeToProfileshould work unchanged (all servers available to all modes)Pre-Submission Checklist
Screenshots / Videos
This is the UI, a multi-select searchable dropdown would be more favourable, but this is fine for a first iteration to be released.
Video demo-ing the feature, showing that it can have different mcps available in different modes.
https://github.com/user-attachments/assets/5137cbca-207c-489c-9b7e-919829949491
Documentation Updates
Does this PR necessitate updates to user-facing documentation?
Docs will need to updated for the custom modes here.
Get in Touch
Important
Introduces mode-specific MCP server profiles with UI and backend support for assigning servers to modes, ensuring backward compatibility and comprehensive testing.
modeToProfilemapping inMcpHubto assign MCP servers to modes.getServers()inMcpHubfilters servers based on active mode.ModesView.tsxfor server selection per mode.McpHubmethodssetActiveMode(),getModeToProfileMapping(),updateModeToProfileMapping()handle mode-specific server logic.ModesView.tsxincludes multiselect UI for server assignment.ExtensionMessage.tsandWebviewMessage.tsto support new message types for mode-to-profile mapping.This description was created by
for 7f7bf4d. You can customize this summary. It will automatically update as commits are pushed.