feat(cli): support Open Plugins MCP servers#23630
feat(cli): support Open Plugins MCP servers#23630NTaylorMullen wants to merge 8 commits intontm/gh.1592from
Conversation
🧠 Model Steering GuidanceThis PR modifies files that affect the model's behavior (prompts, tools, or instructions).
This is an automated guidance message triggered by steering logic signatures. |
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 significantly enhances the Gemini CLI's extensibility by integrating support for Open Plugins to define and manage their own Model Context Protocol (MCP) servers. It introduces flexible configuration options for MCP servers within plugin manifests, enables dynamic path resolution for plugin-bundled executables, and establishes a clear namespacing convention to prevent conflicts. These changes allow Open Plugins to seamlessly provide custom tools and services to the CLI environment. 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 introduces support for Open Plugins MCP servers, including discovery of server configurations, variable expansion for plugin paths, and namespacing for tool names. The implementation is well-structured and includes relevant tests. However, I've identified a critical issue with unresolved merge conflict markers that must be fixed. Additionally, there's a potential bug in the tool name parsing logic when server names contain underscores, for which I've suggested an additional test case to ensure robustness.
Note: Security Review did not run due to the size of the PR.
| <<<<<<< HEAD | ||
| ======= | ||
| // Features partially enabled for Open Plugins | ||
| >>>>>>> 559a26635 (feat(cli): support Open Plugins MCP servers) |
| expect(result.serverName).toBe('demo-plugin:demo-server'); | ||
| expect(result.toolName).toBe('demo_tool'); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
The current test cases for parseMcpToolName don't cover scenarios where the server name part of a namespaced tool name contains an underscore. The underlying implementation in mcp-tool.ts appears to split on the first underscore, which will lead to incorrect parsing for names like mcp_my-plugin:my_server_my_tool.
Please add a test case to cover this scenario. This will likely require updating parseMcpToolName to correctly handle underscores in the server name part, for example by splitting on the last underscore.
Suggested test case to add:
it('should correctly parse namespaced MCP tool names with underscores in server name', () => {
const result = parseMcpToolName('mcp_my-plugin:my_server_my_tool');
expect(result.serverName).toBe('my-plugin:my_server');
expect(result.toolName).toBe('my_tool');
});
- Updated skillLoader to support discovery in skills/ subdirectories - Implemented convention-based skill discovery for Open Plugins - Enforced namespacing for plugin skills (plugin:skill-name) - Refactored skill resolution into resolvePluginSkills for better maintainability - Added comprehensive tests for Open Plugin skill discovery Fixes google-gemini/maintainers-gemini-cli#1592
122e64e to
c64c08c
Compare
e6ba2c6 to
19bb7a2
Compare
- Implement discovery of .mcp.json at the plugin root - Support explicit mcpServers path or record in plugin.json - Add variable expansion for PLUGIN_ROOT in command, args, env, and cwd - Align MCP server naming with the pluginName:mcpServerName format - Ensure MCP tool names use standard mcp_ prefix for API compatibility - Enable settings and mcpServers for Open Plugins - Refactor MCP server resolution into dedicated method - Improve type safety in tests and configuration loading Fixes google-gemini/maintainers-gemini-cli#1595
- Remove stray conflict markers in plugin.ts - Add missing MCPServerConfig import and type assertions in plugin.ts - Fix missing sanitizationConfig property in mcp-plugin-expansion.test.ts Part of google-gemini/maintainers-gemini-cli#1595
19bb7a2 to
f741356
Compare
|
|
||
| // 1. Explicit mcpServers in plugin.json | ||
| if (hydratedConfig.mcpServers) { | ||
| if (typeof hydratedConfig.mcpServers === 'string') { |
| // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion | ||
| return result.data.mcpServers as Record<string, MCPServerConfig>; | ||
| } | ||
| } catch (_e) { |
There was a problem hiding this comment.
Should we be swallowing this? Or only on ENOENT?
Summary
Implement support for the Open Plugins MCP Servers specification in Gemini CLI. This allows Open Plugins (
plugin.json) to define one or more MCP servers that are automatically discovered and configured when the plugin is loaded.Details
.mcp.jsonat the plugin root and support formcpServers(as a path string, array of paths, or direct record) inplugin.json.${PLUGIN_ROOT}variable expansion in MCP servercommand,args,env, andcwdfields. This ensures bundled scripts or binaries within a plugin can be correctly referenced regardless of the installation path.pluginName:mcpServerNameformat to ensure proper tool namespacing (e.g.,mcp_pluginName:mcpServerName_toolName).plugin.tsfor better maintainability.mcp_prefix format, avoiding "more than one colon" errors while still providing clear namespacing.ntm/gh.1592to include skill support for Open Plugins.Related Issues
Fixes https://github.com/google-gemini/maintainers-gemini-cli/issues/1595
How to Validate
.mcp.jsonormcpServersfield inplugin.json.${PLUGIN_ROOT}./mcp list.packages/cli/src/config/open-plugin-mcp.test.ts: Discovery from.mcp.jsonand explicit paths.packages/core/src/tools/mcp-plugin-expansion.test.ts:${PLUGIN_ROOT}expansion logic.packages/core/src/tools/mcp-plugin-namespacing.test.ts:pluginName:mcpServerNameformatting.packages/core/src/tools/mcp-plugin-naming.test.ts: API compatibility and tool name parsing.Pre-Merge Checklist