fix(cli): improve mcp list UX in untrusted folders#26457
fix(cli): improve mcp list UX in untrusted folders#26457
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 enhances the user experience for the MCP server listing command by providing better visibility into configured servers when working in untrusted directories. By allowing the CLI to peek at project-scoped settings, it ensures that users are aware of all configured servers while maintaining security by explicitly marking them as disabled and providing clear guidance on the current trust state. Highlights
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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the mcp list command to improve visibility when working in untrusted folders. It now displays all configured MCP servers, including project-scoped ones, as 'Disabled' with a warning message, rather than suppressing them. A security-related feedback suggests using activeSettings instead of allSettings when determining server status to ensure that untrusted workspace configurations cannot override global security policies in the list output.
|
Size Change: +919 B (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the mcp list command to display configured MCP servers as 'Disabled' in untrusted folders, accompanied by a warning message, rather than showing them as 'Disconnected'. It introduces a getMergedSettingsAsIfTrusted method in the settings configuration to allow the CLI to retrieve configured servers for informational purposes without compromising security. I have no feedback to provide.
|
From Thanks for the PR! The UX improvements look solid and you've safely handled the untrusted folder constraints. I just have one minor code quality observation regarding testing: Defensive check for test mocks const allSettings =
!loadedSettings.isTrusted && loadedSettings.getMergedSettingsAsIfTrusted
? loadedSettings.getMergedSettingsAsIfTrusted()
: activeSettings;Since Instead of polluting the production code with a defensive check for tests, please remove Otherwise, everything looks great! |
…ve defensive check
Summary
This PR improves the UX of the
gemini mcp listcommand when run in untrusted folders. It ensures that all configured MCP servers (including project-scoped ones) are visible and explicitly marked asDisabled, accompanied by a clear warning message explaining why they are not active.Details
getMergedSettingsAsIfTrusted()topackages/cli/src/config/settings.ts. This allows the CLI to peek into project-scoped settings even when folder trust is not yet established, purely for informational commands likelist.packages/cli/src/commands/mcp/list.tsto use the "as-if-trusted" settings to identify configured servers. It now prints a warning when in an untrusted folder and forces the status of all servers toDisabledwithout attempting connection.listcommand's output consistent with the actual execution environment's restrictions.Related Issues
Fixes #24258
How to Validate
gemini mcp add -t http -s project test-remote https://example.com/mcpgemini mcp list.test-remoteis listed as○ test-remote: https://example.com/mcp (http) - Disabled.gemini trust(or follow the prompt in the shell).gemini mcp listagain.test-remoteshows its actual connection status (e.g.,✓ Connected).Pre-Merge Checklist