feat(admin): apply MCP allowlist to extensions & gemini mcp list command#18442
feat(admin): apply MCP allowlist to extensions & gemini mcp list command#18442
Conversation
|
Hi there! Thank you for your contribution to Gemini CLI. To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md. This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding How to link an issue: Thank you for your understanding and for being a part of our community! |
|
Hi @skeshive, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
Summary of ChangesHello @skeshive, 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 introduces robust administrative control over Model Context Protocol (MCP) server configurations within the Gemini CLI. By implementing a centralized allowlisting mechanism, it ensures that only explicitly approved MCP servers can be configured and used, both directly by the CLI and through extensions. This significantly enhances the security posture and compliance of the tool by preventing unauthorized server connections and providing clear feedback to users when servers are blocked by policy. 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 introduces a robust administrative allowlist mechanism for MCP servers, centralizing the filtering and merging logic within applyAdminAllowlist. While the overall design aims to improve security by allowing administrators to restrict and override MCP server configurations, a critical vulnerability was identified in the merging logic of the applyAdminAllowlist utility. Specifically, the function fails to sanitize several sensitive fields from the local configuration, which could allow users to bypass admin-defined authentication and connection policies for allowlisted servers. Additionally, the review highlights the need for consistent case-insensitive matching for server IDs across configurations and suggests removing outdated comments for improved code clarity. The utility is integrated across the CLI's configuration loader, extension manager, and the mcp list command, ensuring only approved servers are active, and includes necessary updates to deferred.ts along with comprehensive unit tests.
|
Size Change: +2.71 kB (+0.01%) Total Size: 23.8 MB
ℹ️ View Unchanged
|
abhipatel12
left a comment
There was a problem hiding this comment.
LGTM with a couple nits about the date
| @@ -0,0 +1,67 @@ | |||
| /** | |||
| * @license | |||
| * Copyright 2025 Google LLC | |||
| @@ -0,0 +1,113 @@ | |||
| /** | |||
| * @license | |||
| * Copyright 2025 Google LLC | |||
TLDR
applyAdminAllowlistutility in@google/gemini-cli-corecentralizes the filtering and merging of local MCP server configurations with admin-defined allowlist rules. It removes local connection details (command, args, env, cwd) when an admin configuration is present.packages/cli/src/config/config.ts) now applies this allowlist during startup.ExtensionManageralso uses the allowlist to filter MCP servers provided by extensions.mcp listcommand (packages/cli/src/commands/mcp/list.ts) is updated to show only allowed servers and provide user-friendly warnings for any servers blocked by policy.getAdminBlockedMcpServersMessageprovides consistent messaging for users when servers are blocked.deferred.tsutility is updated to pass the fully merged settings object to deferred command handlers, ensuring that commands likemcp listcan access the admin-filtered settings.