fix(core): merge user settings with extension-provided MCP servers#22484
fix(core): merge user settings with extension-provided MCP servers#22484abhipatel12 merged 4 commits intomainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical bug where user-defined settings for MCP servers, such as Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to fix a bug where user-defined MCP server settings were being ignored for servers provided by extensions. While no high or critical security vulnerabilities were directly introduced by these changes, the current implementation uses a shallow merge for configuration, which could lead to array properties like excludeTools being replaced instead of combined. This might cause unintended behavior, such as overriding security-related tool exclusions. It is recommended to address this shallow merge issue and add a test case to cover the array-merging logic.
|
Size Change: +1.45 kB (+0.01%) Total Size: 26.1 MB
ℹ️ View Unchanged
|
27b9ee8 to
70c223c
Compare
70c223c to
d00903c
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request aims to fix a bug where user-defined MCP server settings were ignored for servers provided by extensions, by merging user configurations with extension settings. While the changes in mcp-client-manager.ts correctly handle merging logic, including the unioning of tool lists, and are supported by thorough tests and updated documentation, this PR introduces two high-severity security issues. Specifically, the union of tool allowlists weakens user-defined security restrictions, and a race condition during initialization can lead to the wipeout of extension-defined security controls and the creation of zombie processes. These critical security concerns must be addressed.
d00903c to
09b6f70
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue where user settings for extension-provided MCP servers were being ignored. The new mergeMcpConfigs function and the updated logic in maybeDiscoverMcpServer enable proper merging of user and extension configurations. The accompanying documentation and tests are thorough. However, I've identified a critical issue in the new merge logic that could cause user overrides for specific connection properties to be ignored. Please see my detailed comment.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a bug where user-defined MCP server settings were being ignored for servers provided by extensions. The new implementation introduces a robust merging logic that correctly prioritizes user configurations over extension defaults for scalar properties and environment variables, while securely merging tool inclusion/exclusion lists. The changes are well-tested, covering different loading orders and edge cases, and the accompanying documentation update clearly explains the new override behavior to users. The implementation is clean and effective.
Summary
Fixes a bug where user-defined MCP server settings (like
excludeTools) insettings.jsonwere ignored for MCP servers provided by extensions.Details
When an extension contributes an MCP server, the
McpClientManagerwas previously using the extension's configuration as-is. This PR modifiesstartExtensionto merge the extension's configuration with any matching local user overrides.It also updates
maybeDiscoverMcpServerto allow extensions to "enrich" existing server configurations that were initially registered without an extension ID (which is the case for user-provided overrides).Related Issues
Fixes the reported issue where
excludeToolsfor thegoogle-workspaceextension (and others) were not being respected.How to Validate
google-workspaceextension.settings.json, add:/mcp list.mcp_google-workspace_gmail.sendis NOT in the list.Pre-Merge Checklist