mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-28 14:04:41 -07:00
feat(mcp): add --type alias for --transport flag in gemini mcp add (#14503)
This commit is contained in:
@@ -131,6 +131,38 @@ describe('mcp add command', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should add an sse server using --type alias', async () => {
|
||||||
|
await parser.parseAsync(
|
||||||
|
'add --type sse --scope user -H "X-API-Key: your-key" sse-server https://example.com/sse',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockSetValue).toHaveBeenCalledWith(SettingScope.User, 'mcpServers', {
|
||||||
|
'sse-server': {
|
||||||
|
url: 'https://example.com/sse',
|
||||||
|
type: 'sse',
|
||||||
|
headers: { 'X-API-Key': 'your-key' },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add an http server using --type alias', async () => {
|
||||||
|
await parser.parseAsync(
|
||||||
|
'add --type http -H "Authorization: Bearer your-token" http-server https://example.com/mcp',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockSetValue).toHaveBeenCalledWith(
|
||||||
|
SettingScope.Workspace,
|
||||||
|
'mcpServers',
|
||||||
|
{
|
||||||
|
'http-server': {
|
||||||
|
url: 'https://example.com/mcp',
|
||||||
|
type: 'http',
|
||||||
|
headers: { Authorization: 'Bearer your-token' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should handle MCP server args with -- separator', async () => {
|
it('should handle MCP server args with -- separator', async () => {
|
||||||
await parser.parseAsync(
|
await parser.parseAsync(
|
||||||
'add my-server npx -- -y http://example.com/some-package',
|
'add my-server npx -- -y http://example.com/some-package',
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ export const addCommand: CommandModule = {
|
|||||||
choices: ['user', 'project'],
|
choices: ['user', 'project'],
|
||||||
})
|
})
|
||||||
.option('transport', {
|
.option('transport', {
|
||||||
alias: 't',
|
alias: ['t', 'type'],
|
||||||
describe: 'Transport type (stdio, sse, http)',
|
describe: 'Transport type (stdio, sse, http)',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'stdio',
|
default: 'stdio',
|
||||||
|
|||||||
Reference in New Issue
Block a user