summaryrefslogtreecommitdiff
path: root/packages/cli/src/commands/mcp/add.test.ts
diff options
context:
space:
mode:
authorJack Wotherspoon <[email protected]>2025-08-15 15:36:38 -0400
committerGitHub <[email protected]>2025-08-15 19:36:38 +0000
commit31b4c76a6b0e52c9d748f51a1766bec19552adf5 (patch)
tree0cec8d3dc52e9294e81af17752615b84376bac24 /packages/cli/src/commands/mcp/add.test.ts
parentf5a5cdd9738ae8925d5336f060201d908500c7ef (diff)
fix: improve robustness of `gemini mcp add` command (#6332)
Diffstat (limited to 'packages/cli/src/commands/mcp/add.test.ts')
-rw-r--r--packages/cli/src/commands/mcp/add.test.ts34
1 files changed, 34 insertions, 0 deletions
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'],
+ },
+ },
+ );
+ });
});