feat(extensions) - Add local/remote for mcp servers (#8355)

Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
shishu314
2025-09-15 11:11:14 -04:00
committed by GitHub
parent c1de070a5e
commit 7470133a13
2 changed files with 44 additions and 2 deletions
+39
View File
@@ -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,