From 31b4c76a6b0e52c9d748f51a1766bec19552adf5 Mon Sep 17 00:00:00 2001 From: Jack Wotherspoon Date: Fri, 15 Aug 2025 15:36:38 -0400 Subject: fix: improve robustness of `gemini mcp add` command (#6332) --- packages/cli/src/commands/mcp/add.test.ts | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'packages/cli/src/commands/mcp/add.test.ts') diff --git a/packages/cli/src/commands/mcp/add.test.ts b/packages/cli/src/commands/mcp/add.test.ts index 1d431c48..fc1ffb64 100644 --- a/packages/cli/src/commands/mcp/add.test.ts +++ b/packages/cli/src/commands/mcp/add.test.ts @@ -85,4 +85,38 @@ describe('mcp add command', () => { }, ); }); + + it('should handle MCP server args with -- separator', async () => { + await parser.parseAsync( + 'add my-server npx -- -y http://example.com/some-package', + ); + + expect(mockSetValue).toHaveBeenCalledWith( + SettingScope.Workspace, + 'mcpServers', + { + 'my-server': { + command: 'npx', + args: ['-y', 'http://example.com/some-package'], + }, + }, + ); + }); + + it('should handle unknown options as MCP server args', async () => { + await parser.parseAsync( + 'add test-server npx -y http://example.com/some-package', + ); + + expect(mockSetValue).toHaveBeenCalledWith( + SettingScope.Workspace, + 'mcpServers', + { + 'test-server': { + command: 'npx', + args: ['-y', 'http://example.com/some-package'], + }, + }, + ); + }); }); -- cgit v1.2.3