mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
feat(extensions) - Add local/remote for mcp servers (#8355)
Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
@@ -585,6 +585,45 @@ describe('installExtension', () => {
|
||||
expect(logger?.logExtensionInstallEvent).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should show users information on their mcp server when installing', async () => {
|
||||
const consoleInfoSpy = vi.spyOn(console, 'info');
|
||||
const sourceExtDir = createExtension({
|
||||
extensionsDir: tempHomeDir,
|
||||
name: 'my-local-extension',
|
||||
version: '1.0.0',
|
||||
mcpServers: {
|
||||
'test-server': {
|
||||
command: 'node',
|
||||
args: ['server.js'],
|
||||
description: 'a local mcp server',
|
||||
},
|
||||
'test-server-2': {
|
||||
description: 'a remote mcp server',
|
||||
httpUrl: 'https://google.com',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
mockQuestion.mockImplementation((_query, callback) => callback('y'));
|
||||
|
||||
await expect(
|
||||
installExtension({ source: sourceExtDir, type: 'local' }),
|
||||
).resolves.toBe('my-local-extension');
|
||||
|
||||
expect(consoleInfoSpy).toHaveBeenCalledWith(
|
||||
'This extension will run the following MCP servers: ',
|
||||
);
|
||||
expect(consoleInfoSpy).toHaveBeenCalledWith(
|
||||
' * test-server (local): a local mcp server',
|
||||
);
|
||||
expect(consoleInfoSpy).toHaveBeenCalledWith(
|
||||
' * test-server-2 (remote): a remote mcp server',
|
||||
);
|
||||
expect(consoleInfoSpy).toHaveBeenCalledWith(
|
||||
'The extension will append info to your gemini.md context',
|
||||
);
|
||||
});
|
||||
|
||||
it('should continue installation if user accepts prompt for local extension with mcp servers', async () => {
|
||||
const sourceExtDir = createExtension({
|
||||
extensionsDir: tempHomeDir,
|
||||
|
||||
@@ -481,8 +481,11 @@ export async function installExtension(
|
||||
);
|
||||
if (mcpServerEntries.length) {
|
||||
console.info('This extension will run the following MCP servers: ');
|
||||
for (const [key, value] of mcpServerEntries) {
|
||||
console.info(` * ${key}: ${value.description}`);
|
||||
for (const [key, mcpServer] of mcpServerEntries) {
|
||||
const isLocal = !!mcpServer.command;
|
||||
console.info(
|
||||
` * ${key} (${isLocal ? 'local' : 'remote'}): ${mcpServer.description}`,
|
||||
);
|
||||
}
|
||||
console.info(
|
||||
'The extension will append info to your gemini.md context',
|
||||
|
||||
Reference in New Issue
Block a user